OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/installedapp/NavigatorInstalledApp.h" | 5 #include "modules/installedapp/NavigatorInstalledApp.h" |
6 | 6 |
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // Don't crash when called and unattached to document. | 72 // Don't crash when called and unattached to document. |
73 Document* document = m_frame ? m_frame->document() : 0; | 73 Document* document = m_frame ? m_frame->document() : 0; |
74 | 74 |
75 if (!document || !controller()) { | 75 if (!document || !controller()) { |
76 DOMException* exception = DOMException::create(InvalidStateError, "The o
bject is no longer associated to a document."); | 76 DOMException* exception = DOMException::create(InvalidStateError, "The o
bject is no longer associated to a document."); |
77 resolver->reject(exception); | 77 resolver->reject(exception); |
78 return promise; | 78 return promise; |
79 } | 79 } |
80 | 80 |
81 controller()->getInstalledApps( | 81 controller()->getInstalledApps( |
82 WebSecurityOrigin(scriptState->executionContext()->securityOrigin()), | 82 WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin(
)), |
83 adoptWebPtr(new CallbackPromiseAdapter<RelatedAppArray, void>(resolver))
); | 83 adoptWebPtr(new CallbackPromiseAdapter<RelatedAppArray, void>(resolver))
); |
84 return promise; | 84 return promise; |
85 } | 85 } |
86 | 86 |
87 InstalledAppController* NavigatorInstalledApp::controller() | 87 InstalledAppController* NavigatorInstalledApp::controller() |
88 { | 88 { |
89 if (!frame()) | 89 if (!frame()) |
90 return nullptr; | 90 return nullptr; |
91 | 91 |
92 return InstalledAppController::from(*frame()); | 92 return InstalledAppController::from(*frame()); |
93 } | 93 } |
94 | 94 |
95 const char* NavigatorInstalledApp::supplementName() | 95 const char* NavigatorInstalledApp::supplementName() |
96 { | 96 { |
97 return "NavigatorInstalledApp"; | 97 return "NavigatorInstalledApp"; |
98 } | 98 } |
99 | 99 |
100 DEFINE_TRACE(NavigatorInstalledApp) | 100 DEFINE_TRACE(NavigatorInstalledApp) |
101 { | 101 { |
102 HeapSupplement<Navigator>::trace(visitor); | 102 HeapSupplement<Navigator>::trace(visitor); |
103 DOMWindowProperty::trace(visitor); | 103 DOMWindowProperty::trace(visitor); |
104 } | 104 } |
105 | 105 |
106 } // namespace blink | 106 } // namespace blink |
OLD | NEW |