| 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 18 matching lines...) Expand all Loading... |
| 29 NavigatorInstalledApp* NavigatorInstalledApp::from(Document& document) | 29 NavigatorInstalledApp* NavigatorInstalledApp::from(Document& document) |
| 30 { | 30 { |
| 31 if (!document.frame() || !document.frame()->domWindow()) | 31 if (!document.frame() || !document.frame()->domWindow()) |
| 32 return nullptr; | 32 return nullptr; |
| 33 Navigator& navigator = *document.frame()->domWindow()->navigator(); | 33 Navigator& navigator = *document.frame()->domWindow()->navigator(); |
| 34 return &from(navigator); | 34 return &from(navigator); |
| 35 } | 35 } |
| 36 | 36 |
| 37 NavigatorInstalledApp& NavigatorInstalledApp::from(Navigator& navigator) | 37 NavigatorInstalledApp& NavigatorInstalledApp::from(Navigator& navigator) |
| 38 { | 38 { |
| 39 NavigatorInstalledApp* supplement = static_cast<NavigatorInstalledApp*>(Heap
Supplement<Navigator>::from(navigator, supplementName())); | 39 NavigatorInstalledApp* supplement = static_cast<NavigatorInstalledApp*>(Supp
lement<Navigator>::from(navigator, supplementName())); |
| 40 if (!supplement) { | 40 if (!supplement) { |
| 41 supplement = new NavigatorInstalledApp(navigator.frame()); | 41 supplement = new NavigatorInstalledApp(navigator.frame()); |
| 42 provideTo(navigator, supplementName(), supplement); | 42 provideTo(navigator, supplementName(), supplement); |
| 43 } | 43 } |
| 44 return *supplement; | 44 return *supplement; |
| 45 } | 45 } |
| 46 | 46 |
| 47 ScriptPromise NavigatorInstalledApp::getInstalledRelatedApps(ScriptState* script
State, Navigator& navigator) | 47 ScriptPromise NavigatorInstalledApp::getInstalledRelatedApps(ScriptState* script
State, Navigator& navigator) |
| 48 { | 48 { |
| 49 return NavigatorInstalledApp::from(navigator).getInstalledRelatedApps(script
State); | 49 return NavigatorInstalledApp::from(navigator).getInstalledRelatedApps(script
State); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Supplement<Navigator>::trace(visitor); |
| 103 DOMWindowProperty::trace(visitor); | 103 DOMWindowProperty::trace(visitor); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |