Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Unified Diff: content/browser/service_worker/service_worker_version.cc

Issue 1202453002: ServiceWorker: Implement navigate() method in WindowClient (chromium side). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_version.cc
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc
index 55b6a0e5dc2822ab51e846b8525fa0765b1a0f2f..958a948e0a503899ab55bf2e81d35055e0670929 100644
--- a/content/browser/service_worker/service_worker_version.cc
+++ b/content/browser/service_worker/service_worker_version.cc
@@ -1194,6 +1194,7 @@ bool ServiceWorkerVersion::OnMessageReceived(const IPC::Message& message) {
OnPostMessageToClient)
IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_FocusClient,
OnFocusClient)
+ IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_NavigateClient, OnNavigateClient)
IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_SkipWaiting,
OnSkipWaiting)
IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ClaimClients,
@@ -1626,6 +1627,26 @@ void ServiceWorkerVersion::OnFocusClient(int request_id,
client_uuid));
}
+void ServiceWorkerVersion::OnNavigateClient(int request_id,
+ const std::string& client_uuid,
+ const GURL& url) {
+ if (!context_)
+ return;
+ TRACE_EVENT2("ServiceWorker", "ServiceWorkerVersion::OnNavigateClient",
+ "Request id", request_id, "Client id", client_uuid);
+ ServiceWorkerProviderHost* provider_host =
+ context_->GetProviderHostByClientID(client_uuid);
+ if (!provider_host) {
+ // The client may already have been closed, just ignore.
+ return;
+ }
nhiroki 2015/06/23 10:14:37 We need to verify that provider_host's active work
zino 2015/07/07 15:40:36 Maybe done but I'm not sure. Please correct me.
+
nhiroki 2015/06/23 10:14:37 |url| passed from a renderer should be verified be
zino 2015/07/07 15:40:36 Done.
+ provider_host->Navigate(
+ url,
+ base::Bind(&ServiceWorkerVersion::OnNavigateClientFinished,
+ weak_factory_.GetWeakPtr(), request_id, client_uuid, url));
+}
+
void ServiceWorkerVersion::OnFocusClientFinished(
int request_id,
const std::string& client_uuid,
@@ -1642,6 +1663,26 @@ void ServiceWorkerVersion::OnFocusClientFinished(
request_id, client_info));
}
+void ServiceWorkerVersion::OnNavigateClientFinished(
+ int request_id,
+ const std::string& client_uuid,
+ const GURL& url,
+ const ServiceWorkerClientInfo& client) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+ if (running_status() != RUNNING)
+ return;
+
+ ServiceWorkerClientInfo client_info(client);
+ client_info.client_uuid = client_uuid;
+
+ if (url.GetOrigin() != script_url_.GetOrigin()) {
+ client_info = ServiceWorkerClientInfo();
+ }
nhiroki 2015/06/23 10:14:37 nit: you don't have to wrap a single line with {}
zino 2015/07/07 15:40:36 Done.
+ embedded_worker_->SendMessage(
+ ServiceWorkerMsg_NavigateClientResponse(request_id, client_info));
+}
+
void ServiceWorkerVersion::OnSkipWaiting(int request_id) {
skip_waiting_ = true;
if (status_ != INSTALLED)
« no previous file with comments | « content/browser/service_worker/service_worker_version.h ('k') | content/common/service_worker/service_worker_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698