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

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp

Issue 2815313002: Reland of Move ScriptState::GetExecutionContext (Part 5) (Closed)
Patch Set: Created 3 years, 8 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 #include "modules/serviceworkers/NavigatorServiceWorker.h" 5 #include "modules/serviceworkers/NavigatorServiceWorker.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/ExecutionContext.h"
9 #include "core/frame/LocalDOMWindow.h" 10 #include "core/frame/LocalDOMWindow.h"
10 #include "core/frame/LocalFrame.h" 11 #include "core/frame/LocalFrame.h"
11 #include "core/frame/Navigator.h" 12 #include "core/frame/Navigator.h"
12 #include "modules/serviceworkers/ServiceWorkerContainer.h" 13 #include "modules/serviceworkers/ServiceWorkerContainer.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
16 NavigatorServiceWorker::NavigatorServiceWorker(Navigator& navigator) {} 17 NavigatorServiceWorker::NavigatorServiceWorker(Navigator& navigator) {}
17 18
18 NavigatorServiceWorker* NavigatorServiceWorker::From(Document& document) { 19 NavigatorServiceWorker* NavigatorServiceWorker::From(Document& document) {
(...skipping 28 matching lines...) Expand all
47 } 48 }
48 49
49 const char* NavigatorServiceWorker::SupplementName() { 50 const char* NavigatorServiceWorker::SupplementName() {
50 return "NavigatorServiceWorker"; 51 return "NavigatorServiceWorker";
51 } 52 }
52 53
53 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker( 54 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(
54 ScriptState* script_state, 55 ScriptState* script_state,
55 Navigator& navigator, 56 Navigator& navigator,
56 ExceptionState& exception_state) { 57 ExceptionState& exception_state) {
57 ExecutionContext* execution_context = script_state->GetExecutionContext(); 58 ExecutionContext* execution_context = ExecutionContext::From(script_state);
58 DCHECK(!navigator.GetFrame() || 59 DCHECK(!navigator.GetFrame() ||
59 execution_context->GetSecurityOrigin()->CanAccess( 60 execution_context->GetSecurityOrigin()->CanAccess(
60 navigator.GetFrame()->GetSecurityContext()->GetSecurityOrigin())); 61 navigator.GetFrame()->GetSecurityContext()->GetSecurityOrigin()));
61 return NavigatorServiceWorker::From(navigator).serviceWorker( 62 return NavigatorServiceWorker::From(navigator).serviceWorker(
62 navigator.GetFrame(), exception_state); 63 navigator.GetFrame(), exception_state);
63 } 64 }
64 65
65 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker( 66 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(
66 ScriptState* script_state, 67 ScriptState* script_state,
67 Navigator& navigator, 68 Navigator& navigator,
68 String& error_message) { 69 String& error_message) {
69 ExecutionContext* execution_context = script_state->GetExecutionContext(); 70 ExecutionContext* execution_context = ExecutionContext::From(script_state);
70 DCHECK(!navigator.GetFrame() || 71 DCHECK(!navigator.GetFrame() ||
71 execution_context->GetSecurityOrigin()->CanAccess( 72 execution_context->GetSecurityOrigin()->CanAccess(
72 navigator.GetFrame()->GetSecurityContext()->GetSecurityOrigin())); 73 navigator.GetFrame()->GetSecurityContext()->GetSecurityOrigin()));
73 return NavigatorServiceWorker::From(navigator).serviceWorker( 74 return NavigatorServiceWorker::From(navigator).serviceWorker(
74 navigator.GetFrame(), error_message); 75 navigator.GetFrame(), error_message);
75 } 76 }
76 77
77 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker( 78 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(
78 LocalFrame* frame, 79 LocalFrame* frame,
79 ExceptionState& exception_state) { 80 ExceptionState& exception_state) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 void NavigatorServiceWorker::ClearServiceWorker() { 122 void NavigatorServiceWorker::ClearServiceWorker() {
122 service_worker_ = nullptr; 123 service_worker_ = nullptr;
123 } 124 }
124 125
125 DEFINE_TRACE(NavigatorServiceWorker) { 126 DEFINE_TRACE(NavigatorServiceWorker) {
126 visitor->Trace(service_worker_); 127 visitor->Trace(service_worker_);
127 Supplement<Navigator>::Trace(visitor); 128 Supplement<Navigator>::Trace(visitor);
128 } 129 }
129 130
130 } // namespace blink 131 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698