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

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

Issue 444033002: Fix screen.orientation.lock() rejection and an integration test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 6 years, 4 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 "base/id_map.h" 8 #include "base/id_map.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_observer.h" 10 #include "content/public/browser/web_contents_observer.h"
(...skipping 13 matching lines...) Expand all
24 class CONTENT_EXPORT ScreenOrientationDispatcherHost 24 class CONTENT_EXPORT ScreenOrientationDispatcherHost
25 : public WebContentsObserver { 25 : public WebContentsObserver {
26 public: 26 public:
27 explicit ScreenOrientationDispatcherHost(WebContents* web_contents); 27 explicit ScreenOrientationDispatcherHost(WebContents* web_contents);
28 virtual ~ScreenOrientationDispatcherHost(); 28 virtual ~ScreenOrientationDispatcherHost();
29 29
30 // WebContentsObserver 30 // WebContentsObserver
31 virtual bool OnMessageReceived(const IPC::Message&, 31 virtual bool OnMessageReceived(const IPC::Message&,
32 RenderFrameHost* render_frame_host) OVERRIDE; 32 RenderFrameHost* render_frame_host) OVERRIDE;
33 33
34 // Notifies that the lock with the given |request_id| has succeeded.
35 // The renderer process will be notified that the lock succeeded only if
36 // |request_id| matches the |current_lock_|.
34 void NotifyLockSuccess(int request_id); 37 void NotifyLockSuccess(int request_id);
38
39 // Notifies that the lock with the given |request_id| has failed.
40 // The renderer process will be notified that the lock succeeded only if
41 // |request_id| matches the |current_lock_|.
35 void NotifyLockError(int request_id, blink::WebLockOrientationError error); 42 void NotifyLockError(int request_id, blink::WebLockOrientationError error);
36 43
37 void OnOrientationChange(); 44 void OnOrientationChange();
38 45
39 private: 46 private:
40 void OnLockRequest(RenderFrameHost* render_frame_host, 47 void OnLockRequest(RenderFrameHost* render_frame_host,
41 blink::WebScreenOrientationLockType orientation, 48 blink::WebScreenOrientationLockType orientation,
42 int request_id); 49 int request_id);
43 void OnUnlockRequest(RenderFrameHost* render_frame_host); 50 void OnUnlockRequest(RenderFrameHost* render_frame_host);
44 51
45 // Returns a RenderFrameHost if the request_id is still valid and the 52 // Returns a RenderFrameHost if the request_id is still valid and the
46 // associated RenderFrameHost still exists. Returns NULL otherwise. 53 // associated RenderFrameHost still exists. Returns NULL otherwise.
47 RenderFrameHost* GetRenderFrameHostForRequestID(int request_id); 54 RenderFrameHost* GetRenderFrameHostForRequestID(int request_id);
48 55
49 void ResetCurrentLock(); 56 void ResetCurrentLock();
57 void NotifyLockError(int request_id,
58 RenderFrameHost* render_frame_host,
59 blink::WebLockOrientationError error);
50 60
51 scoped_ptr<ScreenOrientationProvider> provider_; 61 scoped_ptr<ScreenOrientationProvider> provider_;
52 62
53 struct LockInformation { 63 struct LockInformation {
54 LockInformation(int request_id, int process_id, int routing_id); 64 LockInformation(int request_id, int process_id, int routing_id);
55 int request_id; 65 int request_id;
56 int process_id; 66 int process_id;
57 int routing_id; 67 int routing_id;
58 }; 68 };
59 // current_lock_ will be NULL if there are no current lock. 69 // current_lock_ will be NULL if there are no current lock.
60 LockInformation* current_lock_; 70 LockInformation* current_lock_;
61 71
62 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationDispatcherHost); 72 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationDispatcherHost);
63 }; 73 };
64 74
65 } // namespace content 75 } // namespace content
66 76
67 #endif // CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_HOST_ H_ 77 #endif // CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_HOST_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698