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

Unified Diff: Source/modules/device_orientation/DeviceOrientationInspectorAgent.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/device_orientation/DeviceOrientationInspectorAgent.cpp
diff --git a/Source/modules/device_orientation/DeviceOrientationInspectorAgent.cpp b/Source/modules/device_orientation/DeviceOrientationInspectorAgent.cpp
index 0769fa0af9a0fa898db75d88dae9b95254a13be0..0c5a9f54af59013434a07e7a304aff54213d5a47 100644
--- a/Source/modules/device_orientation/DeviceOrientationInspectorAgent.cpp
+++ b/Source/modules/device_orientation/DeviceOrientationInspectorAgent.cpp
@@ -15,17 +15,17 @@
namespace WebCore {
-void DeviceOrientationInspectorAgent::provideTo(Page* page)
+void DeviceOrientationInspectorAgent::provideTo(Page& page)
{
OwnPtr<DeviceOrientationInspectorAgent> deviceOrientationAgent(adoptPtr(new DeviceOrientationInspectorAgent(page)));
- page->inspectorController().registerModuleAgent(deviceOrientationAgent.release());
+ page.inspectorController().registerModuleAgent(deviceOrientationAgent.release());
}
DeviceOrientationInspectorAgent::~DeviceOrientationInspectorAgent()
{
}
-DeviceOrientationInspectorAgent::DeviceOrientationInspectorAgent(Page* page)
+DeviceOrientationInspectorAgent::DeviceOrientationInspectorAgent(Page& page)
: InspectorBaseAgent<DeviceOrientationInspectorAgent>("DeviceOrientation")
, m_page(page)
{
@@ -33,12 +33,9 @@ DeviceOrientationInspectorAgent::DeviceOrientationInspectorAgent(Page* page)
void DeviceOrientationInspectorAgent::setDeviceOrientationOverride(ErrorString* error, double alpha, double beta, double gamma)
{
- DeviceOrientationController* controller = DeviceOrientationController::from(m_page->mainFrame()->document());
- if (!controller) {
- *error = "Internal error: unable to override device orientation";
- return;
- }
- controller->didChangeDeviceOrientation(DeviceOrientationData::create(true, alpha, true, beta, true, gamma).get());
+ ASSERT(m_page.mainFrame()->document());
+ DeviceOrientationController& controller = DeviceOrientationController::from(*m_page.mainFrame()->document());
+ controller.didChangeDeviceOrientation(DeviceOrientationData::create(true, alpha, true, beta, true, gamma).get());
}
void DeviceOrientationInspectorAgent::clearDeviceOrientationOverride(ErrorString* error)

Powered by Google App Engine
This is Rietveld 408576698