Chromium Code Reviews| 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_ |
|
miu
2015/01/16 22:17:39
Your git cl --similarity=X setting might be too lo
Sriram
2015/01/21 01:38:57
I used 10% but tried a few value and even at 11% m
miu
2015/01/22 00:47:15
Not that I know of. Yeah, just prefer retaining 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" | |
| 11 #include "content/public/renderer/render_frame_observer.h" | |
| 12 #include "third_party/WebKit/public/web/WebGeolocationClient.h" | |
| 13 #include "third_party/WebKit/public/web/WebGeolocationController.h" | |
| 14 | 10 |
| 15 namespace blink { | 11 class Browser; |
| 16 class WebGeolocationController; | 12 class BrowserWindow; |
| 17 class WebGeolocationPermissionRequest; | 13 class FullscreenController; |
| 18 class WebGeolocationPermissionRequestManager; | 14 class GURL; |
| 19 class WebGeolocationPosition; | 15 class MouseLockController; |
| 16 | |
| 17 namespace content { | |
| 18 class WebContents; | |
| 20 } | 19 } |
| 21 | 20 |
| 22 namespace content { | 21 // This class combines the different exclusive access modes (like fullscreen and |
| 23 struct Geoposition; | 22 // mouse lock) which are each handled by respective controller. It also update |
| 23 // the exit bubble to reflect the combined state. | |
| 24 class ExclusiveAccessManager { | |
| 25 public: | |
| 26 explicit ExclusiveAccessManager(Browser* browser); | |
| 27 ~ExclusiveAccessManager(); | |
| 24 | 28 |
| 25 // GeolocationDispatcher is a delegate for Geolocation messages used by | 29 FullscreenController* GetFullscreenController(); |
|
miu
2015/01/16 22:17:39
Trivial accessors should be inlined:
Fullscreen
Sriram
2015/01/21 01:38:57
Done.
| |
| 26 // WebKit. | 30 MouseLockController* GetMouseLockController(); |
| 27 // It's the complement of GeolocationDispatcherHost. | 31 |
| 28 class GeolocationDispatcher | 32 ExclusiveAccessBubbleType GetExclusiveAccessExitBubbleType() const; |
| 29 : public RenderFrameObserver, | 33 void UpdateExclusiveAccessExitBubbleContent(); |
| 30 public blink::WebGeolocationClient { | 34 |
| 31 public: | 35 GURL GetExclusiveAccessBubbleURL() const; |
| 32 explicit GeolocationDispatcher(RenderFrame* render_frame); | 36 // Callbacks //////////////////////////////////////////////////////////////// |
|
miu
2015/01/16 22:17:38
nit: Add newline above this line.
Sriram
2015/01/21 01:38:57
Done.
| |
| 33 virtual ~GeolocationDispatcher(); | 37 |
| 38 // Called by Browser::TabDeactivated. | |
| 39 void OnTabDeactivated(content::WebContents* web_contents); | |
| 40 | |
| 41 // Called by Browser::ActiveTabChanged. | |
| 42 void OnTabDetachedFromView(content::WebContents* web_contents); | |
| 43 | |
| 44 // Called by Browser::TabClosingAt. | |
| 45 void OnTabClosing(content::WebContents* web_contents); | |
| 46 | |
| 47 // Called by Browser::PreHandleKeyboardEvent | |
| 48 bool HandleUserPressedEscape(); | |
| 49 | |
| 50 // Called by platform ExclusiveAccessExitBubble. | |
| 51 void OnAcceptExclusiveAccessPermission(); | |
| 52 void OnDenyExclusiveAccessPermission(); | |
| 34 | 53 |
| 35 private: | 54 private: |
| 36 // WebGeolocationClient | 55 Browser* browser_; |
|
miu
2015/01/16 22:17:38
nit: Browser* const browser_;
Sriram
2015/01/21 01:38:57
Done.
| |
| 37 virtual void startUpdating(); | 56 BrowserWindow* window_; |
|
miu
2015/01/16 22:17:38
You can remove this: It is unused. Also, the forw
Sriram
2015/01/21 01:38:57
Done.
| |
| 38 virtual void stopUpdating(); | 57 scoped_ptr<FullscreenController> fullscreen_controller_; |
|
miu
2015/01/16 22:17:38
Remove extra indirection and heap objects:
Full
Sriram
2015/01/21 01:38:57
Done.
| |
| 39 virtual void setEnableHighAccuracy(bool enable_high_accuracy); | 58 scoped_ptr<MouseLockController> mouse_lock_controller_; |
| 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 | 59 |
| 47 void QueryNextPosition(); | 60 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 }; | 61 }; |
| 61 | 62 |
| 62 } // namespace content | 63 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_ |
| 63 | |
| 64 #endif // CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_ | |
| OLD | NEW |