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

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

Issue 171333003: Pass implementation object to supplemental classes by reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 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: Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
diff --git a/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp b/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
index 09e24dfc2181348ee8fdce49815bca9263820090..59ea1eff712ad3ff6b87126b1786f96d46ac42a1 100644
--- a/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
+++ b/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
@@ -119,7 +119,7 @@ static bool verifyProtocolHandlerScheme(const String& scheme, const String& meth
return false;
}
-NavigatorContentUtils* NavigatorContentUtils::from(Page* page)
+NavigatorContentUtils* NavigatorContentUtils::from(Page& page)
{
return static_cast<NavigatorContentUtils*>(RefCountedSupplement<Page, NavigatorContentUtils>::from(page, NavigatorContentUtils::supplementName()));
}
@@ -133,12 +133,12 @@ PassRefPtr<NavigatorContentUtils> NavigatorContentUtils::create(NavigatorContent
return adoptRef(new NavigatorContentUtils(client));
}
-void NavigatorContentUtils::registerProtocolHandler(Navigator* navigator, const String& scheme, const String& url, const String& title, ExceptionState& exceptionState)
+void NavigatorContentUtils::registerProtocolHandler(Navigator& navigator, const String& scheme, const String& url, const String& title, ExceptionState& exceptionState)
{
- if (!navigator->frame())
+ if (!navigator.frame())
return;
- Document* document = navigator->frame()->document();
+ Document* document = navigator.frame()->document();
if (!document)
return;
@@ -150,7 +150,8 @@ void NavigatorContentUtils::registerProtocolHandler(Navigator* navigator, const
if (!verifyProtocolHandlerScheme(scheme, "registerProtocolHandler", exceptionState))
return;
- NavigatorContentUtils::from(navigator->frame()->page())->client()->registerProtocolHandler(scheme, baseURL, KURL(ParsedURLString, url), title);
+ ASSERT(navigator.frame()->page());
+ NavigatorContentUtils::from(*navigator.frame()->page())->client()->registerProtocolHandler(scheme, baseURL, KURL(ParsedURLString, url), title);
}
static String customHandlersStateString(const NavigatorContentUtilsClient::CustomHandlersState state)
@@ -172,14 +173,14 @@ static String customHandlersStateString(const NavigatorContentUtilsClient::Custo
return String();
}
-String NavigatorContentUtils::isProtocolHandlerRegistered(Navigator* navigator, const String& scheme, const String& url, ExceptionState& exceptionState)
+String NavigatorContentUtils::isProtocolHandlerRegistered(Navigator& navigator, const String& scheme, const String& url, ExceptionState& exceptionState)
{
DEFINE_STATIC_LOCAL(const String, declined, ("declined"));
- if (!navigator->frame())
+ if (!navigator.frame())
return declined;
- Document* document = navigator->frame()->document();
+ Document* document = navigator.frame()->document();
KURL baseURL = document->baseURL();
if (!verifyCustomHandlerURL(baseURL, url, exceptionState))
@@ -188,15 +189,16 @@ String NavigatorContentUtils::isProtocolHandlerRegistered(Navigator* navigator,
if (!verifyProtocolHandlerScheme(scheme, "isProtocolHandlerRegistered", exceptionState))
return declined;
- return customHandlersStateString(NavigatorContentUtils::from(navigator->frame()->page())->client()->isProtocolHandlerRegistered(scheme, baseURL, KURL(ParsedURLString, url)));
+ ASSERT(navigator.frame()->page());
+ return customHandlersStateString(NavigatorContentUtils::from(*navigator.frame()->page())->client()->isProtocolHandlerRegistered(scheme, baseURL, KURL(ParsedURLString, url)));
}
-void NavigatorContentUtils::unregisterProtocolHandler(Navigator* navigator, const String& scheme, const String& url, ExceptionState& exceptionState)
+void NavigatorContentUtils::unregisterProtocolHandler(Navigator& navigator, const String& scheme, const String& url, ExceptionState& exceptionState)
{
- if (!navigator->frame())
+ if (!navigator.frame())
return;
- Document* document = navigator->frame()->document();
+ Document* document = navigator.frame()->document();
KURL baseURL = document->baseURL();
if (!verifyCustomHandlerURL(baseURL, url, exceptionState))
@@ -205,7 +207,8 @@ void NavigatorContentUtils::unregisterProtocolHandler(Navigator* navigator, cons
if (!verifyProtocolHandlerScheme(scheme, "unregisterProtocolHandler", exceptionState))
return;
- NavigatorContentUtils::from(navigator->frame()->page())->client()->unregisterProtocolHandler(scheme, baseURL, KURL(ParsedURLString, url));
+ ASSERT(navigator.frame()->page());
+ NavigatorContentUtils::from(*navigator.frame()->page())->client()->unregisterProtocolHandler(scheme, baseURL, KURL(ParsedURLString, url));
}
const char* NavigatorContentUtils::supplementName()
@@ -213,7 +216,7 @@ const char* NavigatorContentUtils::supplementName()
return "NavigatorContentUtils";
}
-void provideNavigatorContentUtilsTo(Page* page, NavigatorContentUtilsClient* client)
+void provideNavigatorContentUtilsTo(Page& page, NavigatorContentUtilsClient* client)
{
RefCountedSupplement<Page, NavigatorContentUtils>::provideTo(page, NavigatorContentUtils::supplementName(), NavigatorContentUtils::create(client));
}

Powered by Google App Engine
This is Rietveld 408576698