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

Side by Side Diff: content/browser/screen_orientation/screen_orientation_dispatcher_host.h

Issue 327573002: Properly route screen orientation IPC messages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screen_lock_view
Patch Set: review comments Created 6 years, 6 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 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 receives lock and unlock requests from the
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698