Skip to content

Commit

Permalink
[Chromecast] Add localStorage APIs to mojom::CastWebService
Browse files Browse the repository at this point in the history
Exposes these methods so they can be called over IPC.

Bug: b/149041392
Test: Cast CQ
Change-Id: I06b9d292c53d573ea27c851ea06290e35c889953
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3218129
Reviewed-by: Alex Gough <ajgo@chromium.org>
Commit-Queue: Sean Topping <seantopping@chromium.org>
Cr-Commit-Position: refs/heads/main@{#930354}
  • Loading branch information
Sean Topping authored and Chromium LUCI CQ committed Oct 12, 2021
1 parent 6b07763 commit 1c64d3a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion chromecast/browser/cast_web_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void CastWebService::FlushDomLocalStorage() {
}));
}

void CastWebService::ClearLocalStorage(base::OnceClosure callback) {
void CastWebService::ClearLocalStorage(ClearLocalStorageCallback callback) {
browser_context_->ForEachStoragePartition(
base::BindRepeating(
[](base::OnceClosure cb, content::StoragePartition* partition) {
Expand Down
8 changes: 2 additions & 6 deletions chromecast/browser/cast_web_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,15 @@ class CastWebService : public mojom::CastWebService,
return overlay_renderer_cache_.get();
}

void FlushDomLocalStorage();

// |callback| is called when data deletion is done or at least the deletion
// is scheduled.
void ClearLocalStorage(base::OnceClosure callback);

// mojom::CastWebService implementation:
void CreateWebView(
mojom::CastWebViewParamsPtr params,
mojo::PendingReceiver<mojom::CastWebContents> web_contents,
mojo::PendingReceiver<mojom::CastContentWindow> window) override;
void RegisterWebUiClient(mojo::PendingRemote<mojom::WebUiClient> client,
const std::vector<std::string>& hosts) override;
void FlushDomLocalStorage() override;
void ClearLocalStorage(ClearLocalStorageCallback callback) override;

// mojom::BrowserIdentificationSettingsManager implementation:
void CreateSessionWithSubstitutions(
Expand Down
7 changes: 7 additions & 0 deletions chromecast/browser/mojom/cast_web_service.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,12 @@ interface CastWebService {
// for details on how Web UIs are used in the Cast Browser.
RegisterWebUiClient(pending_remote<WebUiClient> client,
array<string> hosts);

// Write all DOM localStorage to disk.
FlushDomLocalStorage();

// Clears all localStorage data from the device. The response callback is
// called when data deletion is done.
ClearLocalStorage() => ();
};

0 comments on commit 1c64d3a

Please sign in to comment.