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

Unified Diff: third_party/WebKit/Source/modules/installedapp/NavigatorInstalledApp.cpp

Issue 2610783004: Remove ContextClient from NavigatorInstalledApp (Closed)
Patch Set: temp Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/installedapp/NavigatorInstalledApp.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/installedapp/NavigatorInstalledApp.cpp
diff --git a/third_party/WebKit/Source/modules/installedapp/NavigatorInstalledApp.cpp b/third_party/WebKit/Source/modules/installedapp/NavigatorInstalledApp.cpp
index 78545b6bea4c6fcca8bbd8d1e13b43fa4e9782ca..4ba29c0b1c00f220061eb22db0e799a2c63ef26e 100644
--- a/third_party/WebKit/Source/modules/installedapp/NavigatorInstalledApp.cpp
+++ b/third_party/WebKit/Source/modules/installedapp/NavigatorInstalledApp.cpp
@@ -22,8 +22,8 @@
namespace blink {
-NavigatorInstalledApp::NavigatorInstalledApp(LocalFrame* frame)
- : ContextClient(frame) {}
+NavigatorInstalledApp::NavigatorInstalledApp(Navigator& navigator)
+ : Supplement<Navigator>(navigator) {}
NavigatorInstalledApp* NavigatorInstalledApp::from(Document& document) {
if (!document.frame() || !document.frame()->domWindow())
@@ -36,7 +36,7 @@ NavigatorInstalledApp& NavigatorInstalledApp::from(Navigator& navigator) {
NavigatorInstalledApp* supplement = static_cast<NavigatorInstalledApp*>(
Supplement<Navigator>::from(navigator, supplementName()));
if (!supplement) {
- supplement = new NavigatorInstalledApp(navigator.frame());
+ supplement = new NavigatorInstalledApp(navigator);
provideTo(navigator, supplementName(), supplement);
}
return *supplement;
@@ -71,17 +71,15 @@ ScriptPromise NavigatorInstalledApp::getInstalledRelatedApps(
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
- // Don't crash when called and unattached to document.
- Document* document = frame() ? frame()->document() : 0;
-
- if (!document || !controller()) {
+ InstalledAppController* appController = controller();
+ if (!appController) { // If the associated frame is detached
DOMException* exception = DOMException::create(
InvalidStateError, "The object is no longer associated to a document.");
resolver->reject(exception);
return promise;
}
- controller()->getInstalledApps(
+ appController->getInstalledApps(
WebSecurityOrigin(
scriptState->getExecutionContext()->getSecurityOrigin()),
WTF::wrapUnique(
@@ -90,10 +88,10 @@ ScriptPromise NavigatorInstalledApp::getInstalledRelatedApps(
}
InstalledAppController* NavigatorInstalledApp::controller() {
- if (!frame())
+ if (!host()->frame())
return nullptr;
- return InstalledAppController::from(*frame());
+ return InstalledAppController::from(*host()->frame());
}
const char* NavigatorInstalledApp::supplementName() {
@@ -102,7 +100,6 @@ const char* NavigatorInstalledApp::supplementName() {
DEFINE_TRACE(NavigatorInstalledApp) {
Supplement<Navigator>::trace(visitor);
- ContextClient::trace(visitor);
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/modules/installedapp/NavigatorInstalledApp.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698