Index: chrome/browser/ui/exclusive_access/exclusive_access_manager.h |
diff --git a/content/renderer/geolocation_dispatcher.h b/chrome/browser/ui/exclusive_access/exclusive_access_manager.h |
similarity index 11% |
copy from content/renderer/geolocation_dispatcher.h |
copy to chrome/browser/ui/exclusive_access/exclusive_access_manager.h |
index 391e65d105d264a9d96ab27f620163c545ef6965..0c10fe57cc66231cde8411a202fa508936a8f116 100644 |
--- a/content/renderer/geolocation_dispatcher.h |
+++ b/chrome/browser/ui/exclusive_access/exclusive_access_manager.h |
@@ -1,64 +1,69 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_ |
-#define CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_ |
+#ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_ |
+#define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_ |
#include "base/memory/scoped_ptr.h" |
-#include "content/common/geolocation_service.mojom.h" |
-#include "content/common/permission_service.mojom.h" |
-#include "content/public/renderer/render_frame_observer.h" |
-#include "third_party/WebKit/public/web/WebGeolocationClient.h" |
-#include "third_party/WebKit/public/web/WebGeolocationController.h" |
- |
-namespace blink { |
-class WebGeolocationController; |
-class WebGeolocationPermissionRequest; |
-class WebGeolocationPermissionRequestManager; |
-class WebGeolocationPosition; |
-} |
+#include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h" |
+#include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
+#include "chrome/browser/ui/exclusive_access/mouse_lock_controller.h" |
+ |
+class Browser; |
+class FullscreenController; |
+class GURL; |
+class MouseLockController; |
namespace content { |
-struct Geoposition; |
- |
-// GeolocationDispatcher is a delegate for Geolocation messages used by |
-// WebKit. |
-// It's the complement of GeolocationDispatcherHost. |
-class GeolocationDispatcher |
- : public RenderFrameObserver, |
- public blink::WebGeolocationClient { |
+class WebContents; |
+} |
+ |
+// This class combines the different exclusive access modes (like fullscreen and |
+// mouse lock) which are each handled by respective controller. It also updates |
+// the exit bubble to reflect the combined state. |
+class ExclusiveAccessManager { |
public: |
- explicit GeolocationDispatcher(RenderFrame* render_frame); |
- virtual ~GeolocationDispatcher(); |
+ explicit ExclusiveAccessManager(Browser* browser); |
+ ~ExclusiveAccessManager(); |
+ |
+ FullscreenController* fullscreen_controller() { |
+ return &fullscreen_controller_; |
+ } |
+ |
+ MouseLockController* mouse_lock_controller() { |
+ return &mouse_lock_controller_; |
+ } |
+ |
+ ExclusiveAccessBubbleType GetExclusiveAccessExitBubbleType() const; |
+ void UpdateExclusiveAccessExitBubbleContent(); |
+ |
+ GURL GetExclusiveAccessBubbleURL() const; |
+ |
+ // Callbacks //////////////////////////////////////////////////////////////// |
+ |
+ // Called by Browser::TabDeactivated. |
+ void OnTabDeactivated(content::WebContents* web_contents); |
+ |
+ // Called by Browser::ActiveTabChanged. |
+ void OnTabDetachedFromView(content::WebContents* web_contents); |
+ |
+ // Called by Browser::TabClosingAt. |
+ void OnTabClosing(content::WebContents* web_contents); |
+ |
+ // Called by Browser::PreHandleKeyboardEvent |
+ bool HandleUserPressedEscape(); |
+ |
+ // Called by platform ExclusiveAccessExitBubble. |
+ void OnAcceptExclusiveAccessPermission(); |
+ void OnDenyExclusiveAccessPermission(); |
private: |
- // WebGeolocationClient |
- virtual void startUpdating(); |
- virtual void stopUpdating(); |
- virtual void setEnableHighAccuracy(bool enable_high_accuracy); |
- virtual void setController(blink::WebGeolocationController* controller); |
- virtual bool lastPosition(blink::WebGeolocationPosition& position); |
- virtual void requestPermission( |
- const blink::WebGeolocationPermissionRequest& permissionRequest); |
- virtual void cancelPermissionRequest( |
- const blink::WebGeolocationPermissionRequest& permissionRequest); |
- |
- void QueryNextPosition(); |
- void OnPositionUpdate(MojoGeopositionPtr geoposition); |
- |
- // Permission for using geolocation has been set. |
- void OnPermissionSet(int permission_request_id, PermissionStatus status); |
- |
- scoped_ptr<blink::WebGeolocationController> controller_; |
- |
- scoped_ptr<blink::WebGeolocationPermissionRequestManager> |
- pending_permissions_; |
- GeolocationServicePtr geolocation_service_; |
- bool enable_high_accuracy_; |
- PermissionServicePtr permission_service_; |
-}; |
+ Browser* const browser_; |
+ FullscreenController fullscreen_controller_; |
+ MouseLockController mouse_lock_controller_; |
-} // namespace content |
+ DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessManager); |
+}; |
-#endif // CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_ |
+#endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_ |