OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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_RENDERER_GEOLOCATION_DISPATCHER_H_ | 5 #ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_ |
6 #define CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_ | 6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/common/geolocation_service.mojom.h" | 9 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h" |
10 #include "content/common/permission_service.mojom.h" | 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
11 #include "content/public/renderer/render_frame_observer.h" | 11 #include "chrome/browser/ui/exclusive_access/mouse_lock_controller.h" |
12 #include "third_party/WebKit/public/web/WebGeolocationClient.h" | |
13 #include "third_party/WebKit/public/web/WebGeolocationController.h" | |
14 | 12 |
15 namespace blink { | 13 class Browser; |
16 class WebGeolocationController; | 14 class FullscreenController; |
17 class WebGeolocationPermissionRequest; | 15 class GURL; |
18 class WebGeolocationPermissionRequestManager; | 16 class MouseLockController; |
19 class WebGeolocationPosition; | 17 |
18 namespace content { | |
19 class WebContents; | |
20 } | 20 } |
21 | 21 |
22 namespace content { | 22 // This class combines the different exclusive access modes (like fullscreen and |
23 struct Geoposition; | 23 // mouse lock) which are each handled by respective controller. It also update |
scheib
2015/01/22 22:54:04
update -> updates
Sriram
2015/01/23 07:13:43
Done.
| |
24 // the exit bubble to reflect the combined state. | |
25 class ExclusiveAccessManager { | |
26 public: | |
27 explicit ExclusiveAccessManager(Browser* browser); | |
28 ~ExclusiveAccessManager(); | |
24 | 29 |
25 // GeolocationDispatcher is a delegate for Geolocation messages used by | 30 FullscreenController* fullscreen_controller() { |
26 // WebKit. | 31 return &fullscreen_controller_; |
27 // It's the complement of GeolocationDispatcherHost. | 32 } |
28 class GeolocationDispatcher | 33 |
29 : public RenderFrameObserver, | 34 MouseLockController* mouse_lock_controller() { |
30 public blink::WebGeolocationClient { | 35 return &mouse_lock_controller_; |
31 public: | 36 } |
32 explicit GeolocationDispatcher(RenderFrame* render_frame); | 37 |
33 virtual ~GeolocationDispatcher(); | 38 ExclusiveAccessBubbleType GetExclusiveAccessExitBubbleType() const; |
39 void UpdateExclusiveAccessExitBubbleContent(); | |
40 | |
41 GURL GetExclusiveAccessBubbleURL() const; | |
42 | |
43 // Callbacks //////////////////////////////////////////////////////////////// | |
44 | |
45 // Called by Browser::TabDeactivated. | |
46 void OnTabDeactivated(content::WebContents* web_contents); | |
47 | |
48 // Called by Browser::ActiveTabChanged. | |
49 void OnTabDetachedFromView(content::WebContents* web_contents); | |
50 | |
51 // Called by Browser::TabClosingAt. | |
52 void OnTabClosing(content::WebContents* web_contents); | |
53 | |
54 // Called by Browser::PreHandleKeyboardEvent | |
55 bool HandleUserPressedEscape(); | |
56 | |
57 // Called by platform ExclusiveAccessExitBubble. | |
58 void OnAcceptExclusiveAccessPermission(); | |
59 void OnDenyExclusiveAccessPermission(); | |
34 | 60 |
35 private: | 61 private: |
36 // WebGeolocationClient | 62 Browser* const browser_; |
37 virtual void startUpdating(); | 63 FullscreenController fullscreen_controller_; |
38 virtual void stopUpdating(); | 64 MouseLockController mouse_lock_controller_; |
39 virtual void setEnableHighAccuracy(bool enable_high_accuracy); | |
40 virtual void setController(blink::WebGeolocationController* controller); | |
41 virtual bool lastPosition(blink::WebGeolocationPosition& position); | |
42 virtual void requestPermission( | |
43 const blink::WebGeolocationPermissionRequest& permissionRequest); | |
44 virtual void cancelPermissionRequest( | |
45 const blink::WebGeolocationPermissionRequest& permissionRequest); | |
46 | 65 |
47 void QueryNextPosition(); | 66 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessManager); |
48 void OnPositionUpdate(MojoGeopositionPtr geoposition); | |
49 | |
50 // Permission for using geolocation has been set. | |
51 void OnPermissionSet(int permission_request_id, PermissionStatus status); | |
52 | |
53 scoped_ptr<blink::WebGeolocationController> controller_; | |
54 | |
55 scoped_ptr<blink::WebGeolocationPermissionRequestManager> | |
56 pending_permissions_; | |
57 GeolocationServicePtr geolocation_service_; | |
58 bool enable_high_accuracy_; | |
59 PermissionServicePtr permission_service_; | |
60 }; | 67 }; |
61 | 68 |
62 } // namespace content | 69 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_ |
63 | |
64 #endif // CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_ | |
OLD | NEW |