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

Unified Diff: Source/modules/vibration/NavigatorVibration.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/vibration/NavigatorVibration.cpp
diff --git a/Source/modules/vibration/NavigatorVibration.cpp b/Source/modules/vibration/NavigatorVibration.cpp
index 3e2fcff4a6b6fb3f52b862762495166d45b756f7..22b43250c0651626db5d8c8c6955404f5d079936 100644
--- a/Source/modules/vibration/NavigatorVibration.cpp
+++ b/Source/modules/vibration/NavigatorVibration.cpp
@@ -31,8 +31,8 @@ namespace WebCore {
// Maximum number of entries in a vibration pattern.
const unsigned kVibrationPatternLengthMax = 99;
-NavigatorVibration::NavigatorVibration(Page* page)
- : PageLifecycleObserver(page)
+NavigatorVibration::NavigatorVibration(Page& page)
+ : PageLifecycleObserver(&page)
, m_timerStart(this, &NavigatorVibration::timerStartFired)
, m_timerStop(this, &NavigatorVibration::timerStopFired)
, m_isVibrating(false)
@@ -136,33 +136,33 @@ void NavigatorVibration::didCommitLoad(Frame* frame)
cancelVibration();
}
-bool NavigatorVibration::vibrate(Navigator* navigator, unsigned time)
+bool NavigatorVibration::vibrate(Navigator& navigator, unsigned time)
{
VibrationPattern pattern;
pattern.append(time);
return NavigatorVibration::vibrate(navigator, pattern);
}
-bool NavigatorVibration::vibrate(Navigator* navigator, const VibrationPattern& pattern)
+bool NavigatorVibration::vibrate(Navigator& navigator, const VibrationPattern& pattern)
{
- Page* page = navigator->frame()->page();
+ Page* page = navigator.frame()->page();
if (!page)
return false;
if (page->visibilityState() != PageVisibilityStateVisible)
return false;
- return NavigatorVibration::from(page)->vibrate(pattern);
+ return NavigatorVibration::from(*page).vibrate(pattern);
}
-NavigatorVibration* NavigatorVibration::from(Page* page)
+NavigatorVibration& NavigatorVibration::from(Page& page)
{
NavigatorVibration* navigatorVibration = static_cast<NavigatorVibration*>(Supplement<Page>::from(page, supplementName()));
if (!navigatorVibration) {
navigatorVibration = new NavigatorVibration(page);
Supplement<Page>::provideTo(page, supplementName(), adoptPtr(navigatorVibration));
}
- return navigatorVibration;
+ return *navigatorVibration;
}
const char* NavigatorVibration::supplementName()

Powered by Google App Engine
This is Rietveld 408576698