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

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

Issue 2009453002: service worker: Don't control a subframe of an insecure context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: selfreview Created 4 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 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_provider_host.h" 5 #include "content/browser/service_worker/service_worker_provider_host.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // static 47 // static
48 std::unique_ptr<ServiceWorkerProviderHost> 48 std::unique_ptr<ServiceWorkerProviderHost>
49 ServiceWorkerProviderHost::PreCreateNavigationHost( 49 ServiceWorkerProviderHost::PreCreateNavigationHost(
50 base::WeakPtr<ServiceWorkerContextCore> context) { 50 base::WeakPtr<ServiceWorkerContextCore> context) {
51 CHECK(IsBrowserSideNavigationEnabled()); 51 CHECK(IsBrowserSideNavigationEnabled());
52 // Generate a new browser-assigned id for the host. 52 // Generate a new browser-assigned id for the host.
53 int provider_id = g_next_navigation_provider_id--; 53 int provider_id = g_next_navigation_provider_id--;
54 return std::unique_ptr<ServiceWorkerProviderHost>( 54 return std::unique_ptr<ServiceWorkerProviderHost>(
55 new ServiceWorkerProviderHost( 55 new ServiceWorkerProviderHost(
56 ChildProcessHost::kInvalidUniqueID, MSG_ROUTING_NONE, provider_id, 56 ChildProcessHost::kInvalidUniqueID, MSG_ROUTING_NONE, provider_id,
57 SERVICE_WORKER_PROVIDER_FOR_WINDOW, context, nullptr)); 57 SERVICE_WORKER_PROVIDER_FOR_WINDOW, false, context, nullptr));
58 } 58 }
59 59
60 ServiceWorkerProviderHost::ServiceWorkerProviderHost( 60 ServiceWorkerProviderHost::ServiceWorkerProviderHost(
61 int render_process_id, 61 int render_process_id,
62 int route_id, 62 int route_id,
63 int provider_id, 63 int provider_id,
64 ServiceWorkerProviderType provider_type, 64 ServiceWorkerProviderType provider_type,
65 bool is_parent_frame_secure,
65 base::WeakPtr<ServiceWorkerContextCore> context, 66 base::WeakPtr<ServiceWorkerContextCore> context,
66 ServiceWorkerDispatcherHost* dispatcher_host) 67 ServiceWorkerDispatcherHost* dispatcher_host)
67 : client_uuid_(base::GenerateGUID()), 68 : client_uuid_(base::GenerateGUID()),
68 render_process_id_(render_process_id), 69 render_process_id_(render_process_id),
69 route_id_(route_id), 70 route_id_(route_id),
70 render_thread_id_(kDocumentMainThreadId), 71 render_thread_id_(kDocumentMainThreadId),
71 provider_id_(provider_id), 72 provider_id_(provider_id),
72 provider_type_(provider_type), 73 provider_type_(provider_type),
74 is_parent_frame_secure_(is_parent_frame_secure),
73 context_(context), 75 context_(context),
74 dispatcher_host_(dispatcher_host), 76 dispatcher_host_(dispatcher_host),
75 allow_association_(true) { 77 allow_association_(true) {
76 DCHECK_NE(SERVICE_WORKER_PROVIDER_UNKNOWN, provider_type_); 78 DCHECK_NE(SERVICE_WORKER_PROVIDER_UNKNOWN, provider_type_);
77 79
78 // PlzNavigate 80 // PlzNavigate
79 CHECK(render_process_id != ChildProcessHost::kInvalidUniqueID || 81 CHECK(render_process_id != ChildProcessHost::kInvalidUniqueID ||
80 IsBrowserSideNavigationEnabled()); 82 IsBrowserSideNavigationEnabled());
81 83
82 if (provider_type_ == SERVICE_WORKER_PROVIDER_FOR_CONTROLLER) { 84 if (provider_type_ == SERVICE_WORKER_PROVIDER_FOR_CONTROLLER) {
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 Send(new ServiceWorkerMsg_SetControllerServiceWorker( 645 Send(new ServiceWorkerMsg_SetControllerServiceWorker(
644 render_thread_id_, provider_id(), 646 render_thread_id_, provider_id(),
645 GetOrCreateServiceWorkerHandle( 647 GetOrCreateServiceWorkerHandle(
646 associated_registration_->active_version()), 648 associated_registration_->active_version()),
647 false /* shouldNotifyControllerChange */)); 649 false /* shouldNotifyControllerChange */));
648 } 650 }
649 } 651 }
650 } 652 }
651 653
652 } // namespace content 654 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698