Chromium Code Reviews| 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 #ifndef CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_HOST_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/browser_message_filter.h" | 8 #include "content/public/browser/web_contents_observer.h" |
| 9 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" | 9 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" |
| 10 #include "third_party/WebKit/public/platform/WebScreenOrientationType.h" | 10 #include "third_party/WebKit/public/platform/WebScreenOrientationType.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 class RenderFrameHost; | |
| 14 class ScreenOrientationProvider; | 15 class ScreenOrientationProvider; |
| 16 class WebContents; | |
| 15 | 17 |
| 16 // ScreenOrientationDispatcherHost is a browser filter for Screen Orientation | 18 // ScreenOrientationDispatcherHost is receives lock and unlock requests from the |
|
jam
2014/06/11 00:42:49
nit: grammer ("is receives")
mlamouri (slow - plz ping)
2014/06/16 14:11:54
Done.
| |
| 17 // messages and also helps dispatching messages about orientation changes to the | 19 // RenderFrames and dispatch them to the ScreenOrientationProvider. It also |
| 18 // renderers. | 20 // make sure that the right RenderFrame get replied for each lock request. |
| 19 class CONTENT_EXPORT ScreenOrientationDispatcherHost | 21 class CONTENT_EXPORT ScreenOrientationDispatcherHost |
| 20 : public BrowserMessageFilter { | 22 : public WebContentsObserver { |
| 21 public: | 23 public: |
| 22 ScreenOrientationDispatcherHost(); | 24 explicit ScreenOrientationDispatcherHost(WebContents* web_contents); |
| 25 virtual ~ScreenOrientationDispatcherHost(); | |
| 23 | 26 |
| 24 // BrowserMessageFilter | 27 // WebContentsObserver |
| 25 virtual bool OnMessageReceived(const IPC::Message&) OVERRIDE; | 28 virtual bool OnMessageReceived(const IPC::Message&, |
| 29 RenderFrameHost* render_frame_host) OVERRIDE; | |
| 26 | 30 |
| 27 void OnOrientationChange(blink::WebScreenOrientationType orientation); | 31 void OnOrientationChange(blink::WebScreenOrientationType orientation); |
| 28 | 32 |
| 29 void SetProviderForTests(ScreenOrientationProvider* provider); | 33 void SetProviderForTests(ScreenOrientationProvider* provider); |
| 30 | 34 |
| 31 protected: | |
| 32 virtual ~ScreenOrientationDispatcherHost(); | |
| 33 | |
| 34 private: | 35 private: |
| 35 void OnLockRequest(blink::WebScreenOrientationLockType orientation, | 36 void OnLockRequest(RenderFrameHost* render_frame_host, |
| 37 blink::WebScreenOrientationLockType orientation, | |
| 36 int request_id); | 38 int request_id); |
| 37 void OnUnlockRequest(); | 39 void OnUnlockRequest(RenderFrameHost* render_frame_host); |
| 38 | 40 |
| 39 static ScreenOrientationProvider* CreateProvider(); | 41 static ScreenOrientationProvider* CreateProvider(); |
| 40 | 42 |
| 41 scoped_ptr<ScreenOrientationProvider> provider_; | 43 scoped_ptr<ScreenOrientationProvider> provider_; |
| 42 | 44 |
| 43 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationDispatcherHost); | 45 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationDispatcherHost); |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 } // namespace content | 48 } // namespace content |
| 47 | 49 |
| 48 #endif // CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_HOST_ H_ | 50 #endif // CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_HOST_ H_ |
| OLD | NEW |