OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/screen_orientation/screen_orientation_dispatcher_host.
h" | 5 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host.
h" |
6 | 6 |
7 #include "content/browser/screen_orientation/screen_orientation_provider.h" | 7 #include "content/browser/screen_orientation/screen_orientation_provider.h" |
8 #include "content/common/screen_orientation_messages.h" | 8 #include "content/common/screen_orientation_messages.h" |
9 #include "content/public/browser/render_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 void ScreenOrientationDispatcherHost::OnLockRequest( | 49 void ScreenOrientationDispatcherHost::OnLockRequest( |
50 RenderFrameHost* render_frame_host, | 50 RenderFrameHost* render_frame_host, |
51 blink::WebScreenOrientationLockType orientation, | 51 blink::WebScreenOrientationLockType orientation, |
52 int request_id) { | 52 int request_id) { |
53 if (!provider_) { | 53 if (!provider_) { |
54 render_frame_host->Send(new ScreenOrientationMsg_LockError( | 54 render_frame_host->Send(new ScreenOrientationMsg_LockError( |
55 render_frame_host->GetRoutingID(), | 55 render_frame_host->GetRoutingID(), |
56 request_id, | 56 request_id, |
57 blink::WebLockOrientationCallback::ErrorTypeNotAvailable)); | 57 blink::WebLockOrientationErrorNotAvailable)); |
58 return; | 58 return; |
59 } | 59 } |
60 | 60 |
61 // TODO(mlamouri): pass real values. | 61 // TODO(mlamouri): pass real values. |
62 render_frame_host->Send(new ScreenOrientationMsg_LockSuccess( | 62 render_frame_host->Send(new ScreenOrientationMsg_LockSuccess( |
63 render_frame_host->GetRoutingID(), | 63 render_frame_host->GetRoutingID(), |
64 request_id, | 64 request_id, |
65 0, | 65 0, |
66 blink::WebScreenOrientationPortraitPrimary)); | 66 blink::WebScreenOrientationPortraitPrimary)); |
67 provider_->LockOrientation(orientation); | 67 provider_->LockOrientation(orientation); |
68 } | 68 } |
69 | 69 |
70 void ScreenOrientationDispatcherHost::OnUnlockRequest( | 70 void ScreenOrientationDispatcherHost::OnUnlockRequest( |
71 RenderFrameHost* render_frame_host) { | 71 RenderFrameHost* render_frame_host) { |
72 if (!provider_.get()) | 72 if (!provider_.get()) |
73 return; | 73 return; |
74 | 74 |
75 provider_->UnlockOrientation(); | 75 provider_->UnlockOrientation(); |
76 } | 76 } |
77 | 77 |
78 #if !defined(OS_ANDROID) | 78 #if !defined(OS_ANDROID) |
79 // static | 79 // static |
80 ScreenOrientationProvider* ScreenOrientationDispatcherHost::CreateProvider() { | 80 ScreenOrientationProvider* ScreenOrientationDispatcherHost::CreateProvider() { |
81 return NULL; | 81 return NULL; |
82 } | 82 } |
83 #endif | 83 #endif |
84 | 84 |
85 } // namespace content | 85 } // namespace content |
OLD | NEW |