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

Side by Side Diff: third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationInspectorAgent.cpp

Issue 1702673002: DevTools: migrate remote debugging protocol generators to jinja2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/screen_orientation/ScreenOrientationInspectorAgent.h" 5 #include "modules/screen_orientation/ScreenOrientationInspectorAgent.h"
6 6
7 #include "core/frame/LocalFrame.h" 7 #include "core/frame/LocalFrame.h"
8 #include "modules/screen_orientation/ScreenOrientation.h" 8 #include "modules/screen_orientation/ScreenOrientation.h"
9 #include "modules/screen_orientation/ScreenOrientationController.h" 9 #include "modules/screen_orientation/ScreenOrientationController.h"
10 #include "platform/inspector_protocol/TypeBuilder.h" 10 #include "platform/inspector_protocol/TypeBuilder.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 namespace ScreenOrientationInspectorAgentState { 14 namespace ScreenOrientationInspectorAgentState {
15 static const char angle[] = "angle"; 15 static const char angle[] = "angle";
16 static const char type[] = "type"; 16 static const char type[] = "type";
17 static const char overrideEnabled[] = "overrideEnabled"; 17 static const char overrideEnabled[] = "overrideEnabled";
18 } 18 }
19 19
20 namespace { 20 namespace {
21 21
22 WebScreenOrientationType WebScreenOrientationTypeFromString(const String& type) 22 WebScreenOrientationType WebScreenOrientationTypeFromString(const String& type)
23 { 23 {
24 if (type == protocol::TypeBuilder::getEnumConstantValue(protocol::TypeBuilde r::ScreenOrientation::OrientationType::PortraitPrimary)) 24 if (type == protocol::TypeBuilder::ScreenOrientation::OrientationTypeEnum::P ortraitPrimary)
25 return WebScreenOrientationPortraitPrimary; 25 return WebScreenOrientationPortraitPrimary;
26 if (type == protocol::TypeBuilder::getEnumConstantValue(protocol::TypeBuilde r::ScreenOrientation::OrientationType::PortraitSecondary)) 26 if (type == protocol::TypeBuilder::ScreenOrientation::OrientationTypeEnum::P ortraitSecondary)
27 return WebScreenOrientationPortraitSecondary; 27 return WebScreenOrientationPortraitSecondary;
28 if (type == protocol::TypeBuilder::getEnumConstantValue(protocol::TypeBuilde r::ScreenOrientation::OrientationType::LandscapePrimary)) 28 if (type == protocol::TypeBuilder::ScreenOrientation::OrientationTypeEnum::L andscapePrimary)
29 return WebScreenOrientationLandscapePrimary; 29 return WebScreenOrientationLandscapePrimary;
30 if (type == protocol::TypeBuilder::getEnumConstantValue(protocol::TypeBuilde r::ScreenOrientation::OrientationType::LandscapeSecondary)) 30 if (type == protocol::TypeBuilder::ScreenOrientation::OrientationTypeEnum::L andscapeSecondary)
31 return WebScreenOrientationLandscapeSecondary; 31 return WebScreenOrientationLandscapeSecondary;
32 return WebScreenOrientationUndefined; 32 return WebScreenOrientationUndefined;
33 } 33 }
34 34
35 } // namespace 35 } // namespace
36 36
37 // static 37 // static
38 PassOwnPtrWillBeRawPtr<ScreenOrientationInspectorAgent> ScreenOrientationInspect orAgent::create(LocalFrame& frame) 38 PassOwnPtrWillBeRawPtr<ScreenOrientationInspectorAgent> ScreenOrientationInspect orAgent::create(LocalFrame& frame)
39 { 39 {
40 return adoptPtrWillBeNoop(new ScreenOrientationInspectorAgent(frame)); 40 return adoptPtrWillBeNoop(new ScreenOrientationInspectorAgent(frame));
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 m_state->getNumber(ScreenOrientationInspectorAgentState::type, &longType ); 103 m_state->getNumber(ScreenOrientationInspectorAgentState::type, &longType );
104 WebScreenOrientationType type = static_cast<WebScreenOrientationType>(lo ngType); 104 WebScreenOrientationType type = static_cast<WebScreenOrientationType>(lo ngType);
105 int angle = 0; 105 int angle = 0;
106 m_state->getNumber(ScreenOrientationInspectorAgentState::angle, &angle); 106 m_state->getNumber(ScreenOrientationInspectorAgentState::angle, &angle);
107 if (ScreenOrientationController* controller = ScreenOrientationControlle r::from(*m_frame)) 107 if (ScreenOrientationController* controller = ScreenOrientationControlle r::from(*m_frame))
108 controller->setOverride(type, angle); 108 controller->setOverride(type, angle);
109 } 109 }
110 } 110 }
111 111
112 } // namespace blink 112 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698