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

Side by Side Diff: content/child/service_worker/service_worker_network_provider.h

Issue 2055433002: Revert of service worker: Don't control a subframe of an insecure context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_H_ 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_H_
6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_H_ 6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/supports_user_data.h" 15 #include "base/supports_user_data.h"
16 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
17 #include "content/common/service_worker/service_worker_types.h" 17 #include "content/common/service_worker/service_worker_types.h"
18 18 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
19 namespace blink {
20 class WebDataSource;
21 class WebLocalFrame;
22 } // namespace blink
23 19
24 namespace content { 20 namespace content {
25 21
26 class ServiceWorkerProviderContext; 22 class ServiceWorkerProviderContext;
27 struct RequestNavigationParams; 23 struct RequestNavigationParams;
28 24
29 // A unique provider_id is generated for each instance. 25 // A unique provider_id is generated for each instance.
30 // Instantiated prior to the main resource load being started and remains 26 // Instantiated prior to the main resource load being started and remains
31 // allocated until after the last subresource load has occurred. 27 // allocated until after the last subresource load has occurred.
32 // This is used to track the lifetime of a Document to create 28 // This is used to track the lifetime of a Document to create
(...skipping 10 matching lines...) Expand all
43 static void AttachToDocumentState( 39 static void AttachToDocumentState(
44 base::SupportsUserData* document_state, 40 base::SupportsUserData* document_state,
45 std::unique_ptr<ServiceWorkerNetworkProvider> network_provider); 41 std::unique_ptr<ServiceWorkerNetworkProvider> network_provider);
46 42
47 static ServiceWorkerNetworkProvider* FromDocumentState( 43 static ServiceWorkerNetworkProvider* FromDocumentState(
48 base::SupportsUserData* document_state); 44 base::SupportsUserData* document_state);
49 45
50 static std::unique_ptr<ServiceWorkerNetworkProvider> CreateForNavigation( 46 static std::unique_ptr<ServiceWorkerNetworkProvider> CreateForNavigation(
51 int route_id, 47 int route_id,
52 const RequestNavigationParams& request_params, 48 const RequestNavigationParams& request_params,
53 blink::WebLocalFrame* frame, 49 blink::WebSandboxFlags sandbox_flags,
54 bool content_initiated); 50 bool content_initiated);
55 51
56 // PlzNavigate 52 // PlzNavigate
57 // The |browser_provider_id| is initialized by the browser for navigations. 53 // The |browser_provider_id| is initialized by the browser for navigations.
58 ServiceWorkerNetworkProvider(int route_id, 54 ServiceWorkerNetworkProvider(int route_id,
59 ServiceWorkerProviderType type, 55 ServiceWorkerProviderType type,
60 int browser_provider_id, 56 int browser_provider_id);
61 bool is_parent_frame_secure); 57 ServiceWorkerNetworkProvider(int route_id, ServiceWorkerProviderType type);
62 ServiceWorkerNetworkProvider(int route_id,
63 ServiceWorkerProviderType type,
64 bool is_parent_frame_secure);
65 ServiceWorkerNetworkProvider(); 58 ServiceWorkerNetworkProvider();
66 ~ServiceWorkerNetworkProvider() override; 59 ~ServiceWorkerNetworkProvider() override;
67 60
68 int provider_id() const { return provider_id_; } 61 int provider_id() const { return provider_id_; }
69 ServiceWorkerProviderContext* context() const { return context_.get(); } 62 ServiceWorkerProviderContext* context() const { return context_.get(); }
70 63
71 // This method is called for a provider that's associated with a 64 // This method is called for a provider that's associated with a
72 // running service worker script. The version_id indicates which 65 // running service worker script. The version_id indicates which
73 // ServiceWorkerVersion should be used. 66 // ServiceWorkerVersion should be used.
74 void SetServiceWorkerVersionId(int64_t version_id); 67 void SetServiceWorkerVersionId(int64_t version_id);
75 68
76 bool IsControlledByServiceWorker() const; 69 bool IsControlledByServiceWorker() const;
77 70
78 private: 71 private:
79 const int provider_id_; 72 const int provider_id_;
80 scoped_refptr<ServiceWorkerProviderContext> context_; 73 scoped_refptr<ServiceWorkerProviderContext> context_;
81 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerNetworkProvider); 74 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerNetworkProvider);
82 }; 75 };
83 76
84 } // namespace content 77 } // namespace content
85 78
86 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_H_ 79 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698