| 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 | 72 |
| 73 InstalledAppController* appController = controller(); | 73 InstalledAppController* appController = controller(); |
| 74 if (!appController) { // If the associated frame is detached | 74 if (!appController) { // If the associated frame is detached |
| 75 DOMException* exception = DOMException::create( | 75 DOMException* exception = DOMException::create( |
| 76 InvalidStateError, "The object is no longer associated to a document."); | 76 InvalidStateError, "The object 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 appController->getInstalledRelatedApps( | 81 appController->getInstalledRelatedApps( |
| 82 scriptState->getExecutionContext()->getSecurityOrigin(), | |
| 83 WTF::wrapUnique( | 82 WTF::wrapUnique( |
| 84 new CallbackPromiseAdapter<RelatedAppArray, void>(resolver))); | 83 new CallbackPromiseAdapter<RelatedAppArray, void>(resolver))); |
| 85 return promise; | 84 return promise; |
| 86 } | 85 } |
| 87 | 86 |
| 88 InstalledAppController* NavigatorInstalledApp::controller() { | 87 InstalledAppController* NavigatorInstalledApp::controller() { |
| 89 if (!supplementable()->frame()) | 88 if (!supplementable()->frame()) |
| 90 return nullptr; | 89 return nullptr; |
| 91 | 90 |
| 92 return InstalledAppController::from(*supplementable()->frame()); | 91 return InstalledAppController::from(*supplementable()->frame()); |
| 93 } | 92 } |
| 94 | 93 |
| 95 const char* NavigatorInstalledApp::supplementName() { | 94 const char* NavigatorInstalledApp::supplementName() { |
| 96 return "NavigatorInstalledApp"; | 95 return "NavigatorInstalledApp"; |
| 97 } | 96 } |
| 98 | 97 |
| 99 DEFINE_TRACE(NavigatorInstalledApp) { | 98 DEFINE_TRACE(NavigatorInstalledApp) { |
| 100 Supplement<Navigator>::trace(visitor); | 99 Supplement<Navigator>::trace(visitor); |
| 101 } | 100 } |
| 102 | 101 |
| 103 } // namespace blink | 102 } // namespace blink |
| OLD | NEW |