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

Unified Diff: third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp

Issue 2627413003: NavigatorContentUtils should be a supplement of Navigator (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
Index: third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
diff --git a/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp b/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
index 54ac3bdb0f80585628e7aac1b6f24def4b9cc368..47065387c0b23338db5d3b374d96dffe9d27da7d 100644
--- a/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
+++ b/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
@@ -128,18 +128,13 @@ static bool verifyCustomHandlerScheme(const String& scheme,
return false;
}
-NavigatorContentUtils* NavigatorContentUtils::from(LocalFrame& frame) {
+NavigatorContentUtils* NavigatorContentUtils::from(Navigator& navigator) {
return static_cast<NavigatorContentUtils*>(
- Supplement<LocalFrame>::from(frame, supplementName()));
+ Supplement<Navigator>::from(navigator, supplementName()));
}
NavigatorContentUtils::~NavigatorContentUtils() {}
-NavigatorContentUtils* NavigatorContentUtils::create(
- NavigatorContentUtilsClient* client) {
- return new NavigatorContentUtils(client);
-}
-
void NavigatorContentUtils::registerProtocolHandler(
Navigator& navigator,
const String& scheme,
@@ -164,9 +159,8 @@ void NavigatorContentUtils::registerProtocolHandler(
? UseCounter::RegisterProtocolHandlerSecureOrigin
: UseCounter::RegisterProtocolHandlerInsecureOrigin);
- NavigatorContentUtils::from(*navigator.frame())
- ->client()
- ->registerProtocolHandler(scheme, document->completeURL(url), title);
+ NavigatorContentUtils::from(navigator)->client()->registerProtocolHandler(
+ scheme, document->completeURL(url), title);
}
static String customHandlersStateString(
@@ -210,7 +204,7 @@ String NavigatorContentUtils::isProtocolHandlerRegistered(
return declined;
return customHandlersStateString(
- NavigatorContentUtils::from(*navigator.frame())
+ NavigatorContentUtils::from(navigator)
->client()
->isProtocolHandlerRegistered(scheme, document->completeURL(url)));
}
@@ -232,25 +226,24 @@ void NavigatorContentUtils::unregisterProtocolHandler(
if (!verifyCustomHandlerScheme(scheme, exceptionState))
return;
- NavigatorContentUtils::from(*navigator.frame())
- ->client()
- ->unregisterProtocolHandler(scheme, document->completeURL(url));
+ NavigatorContentUtils::from(navigator)->client()->unregisterProtocolHandler(
+ scheme, document->completeURL(url));
}
DEFINE_TRACE(NavigatorContentUtils) {
visitor->trace(m_client);
- Supplement<LocalFrame>::trace(visitor);
+ Supplement<Navigator>::trace(visitor);
}
const char* NavigatorContentUtils::supplementName() {
return "NavigatorContentUtils";
}
-void provideNavigatorContentUtilsTo(LocalFrame& frame,
- NavigatorContentUtilsClient* client) {
- NavigatorContentUtils::provideTo(frame,
- NavigatorContentUtils::supplementName(),
- NavigatorContentUtils::create(client));
+void NavigatorContentUtils::provideTo(Navigator& navigator,
+ NavigatorContentUtilsClient* client) {
+ NavigatorContentUtils::provideTo(
sof 2017/01/13 08:13:46 Drop the NavigatorContentUtils:: namespace qualifi
+ navigator, NavigatorContentUtils::supplementName(),
+ new NavigatorContentUtils(navigator, client));
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698