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

Side by Side Diff: content/browser/service_worker/service_worker_version.cc

Issue 1141813002: ServiceWorker: Introduce ServiceWorkerMessageEvent to replace MessageEvent (2/3). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/service_worker_version.h" 5 #include "content/browser/service_worker/service_worker_version.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 context_->GetProviderHostByClientID(client_uuid); 1424 context_->GetProviderHostByClientID(client_uuid);
1425 if (!provider_host) { 1425 if (!provider_host) {
1426 // The client may already have been closed, just ignore. 1426 // The client may already have been closed, just ignore.
1427 return; 1427 return;
1428 } 1428 }
1429 if (provider_host->document_url().GetOrigin() != script_url_.GetOrigin()) { 1429 if (provider_host->document_url().GetOrigin() != script_url_.GetOrigin()) {
1430 // The client does not belong to the same origin as this ServiceWorker, 1430 // The client does not belong to the same origin as this ServiceWorker,
1431 // possibly due to timing issue or bad message. 1431 // possibly due to timing issue or bad message.
1432 return; 1432 return;
1433 } 1433 }
1434 provider_host->PostMessage(message, sent_message_ports); 1434 provider_host->PostMessage(this, message, sent_message_ports);
1435 } 1435 }
1436 1436
1437 void ServiceWorkerVersion::OnFocusClient(int request_id, 1437 void ServiceWorkerVersion::OnFocusClient(int request_id,
1438 const std::string& client_uuid) { 1438 const std::string& client_uuid) {
1439 if (!context_) 1439 if (!context_)
1440 return; 1440 return;
1441 TRACE_EVENT2("ServiceWorker", 1441 TRACE_EVENT2("ServiceWorker",
1442 "ServiceWorkerVersion::OnFocusClient", 1442 "ServiceWorkerVersion::OnFocusClient",
1443 "Request id", request_id, 1443 "Request id", request_id,
1444 "Client id", client_uuid); 1444 "Client id", client_uuid);
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 return SERVICE_WORKER_ERROR_ABORT; 1878 return SERVICE_WORKER_ERROR_ABORT;
1879 default: 1879 default:
1880 return SERVICE_WORKER_ERROR_NETWORK; 1880 return SERVICE_WORKER_ERROR_NETWORK;
1881 } 1881 }
1882 } 1882 }
1883 1883
1884 return default_code; 1884 return default_code;
1885 } 1885 }
1886 1886
1887 } // namespace content 1887 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698