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

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

Issue 549603003: Create Mojo service for locking/unlocking screen orientation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 6 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_HOST_IM PL_H_
6 #define CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_HOST_IM PL_H_
7
8 #include "content/public/browser/screen_orientation_dispatcher_host.h"
9 #include "content/public/browser/web_contents_observer.h"
10 #include "third_party/WebKit/public/platform/WebLockOrientationError.h"
11 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h"
12
13 namespace content {
14
15 class RenderFrameHost;
16 class ScreenOrientationProvider;
17 class WebContents;
18
19 // ScreenOrientationDispatcherHost receives lock and unlock requests from the
20 // RenderFrames and dispatch them to the ScreenOrientationProvider. It also
21 // make sure that the right RenderFrame get replied for each lock request.
22 class CONTENT_EXPORT ScreenOrientationDispatcherHostImpl
23 : public ScreenOrientationDispatcherHost,
24 public WebContentsObserver {
25 public:
26 explicit ScreenOrientationDispatcherHostImpl(WebContents* web_contents);
27 virtual ~ScreenOrientationDispatcherHostImpl();
28
29 // ScreenOrientationDispatcherHost:
30 virtual void NotifyLockSuccess(int request_id) OVERRIDE;
31 virtual void NotifyLockError(int request_id,
32 blink::WebLockOrientationError error) OVERRIDE;
33 virtual void OnOrientationChange() OVERRIDE;
34
35 // WebContentsObserver:
36 virtual bool OnMessageReceived(const IPC::Message&,
37 RenderFrameHost* render_frame_host) OVERRIDE;
38
39 private:
40 void OnLockRequest(RenderFrameHost* render_frame_host,
41 blink::WebScreenOrientationLockType orientation,
42 int request_id);
43 void OnUnlockRequest(RenderFrameHost* render_frame_host);
44
45 // Returns a RenderFrameHost if the request_id is still valid and the
46 // associated RenderFrameHost still exists. Returns NULL otherwise.
47 RenderFrameHost* GetRenderFrameHostForRequestID(int request_id);
48
49 void ResetCurrentLock();
50 void NotifyLockError(int request_id,
51 RenderFrameHost* render_frame_host,
52 blink::WebLockOrientationError error);
53
54 scoped_ptr<ScreenOrientationProvider> provider_;
55
56 struct LockInformation {
57 LockInformation(int request_id, int process_id, int routing_id);
58 int request_id;
59 int process_id;
60 int routing_id;
61 };
62 // current_lock_ will be NULL if there are no current lock.
63 LockInformation* current_lock_;
64
65 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationDispatcherHostImpl);
66 };
67
68 } // namespace content
69
70 #endif // CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_HOST_ IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698