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

Unified Diff: chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.h

Issue 1650483002: Refactor: Untangle Mac's ExclusiveAccessContext from BrowserWindow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self nits, More robust interface, fix other random stuff Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.h
diff --git a/chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.h b/chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.h
new file mode 100644
index 0000000000000000000000000000000000000000..d85b13e9a287f2ab31624d78f38e080d3e6c79ef
--- /dev/null
+++ b/chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.h
@@ -0,0 +1,82 @@
+// Copyright 2016 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 CHROME_BROWSER_UI_COCOA_BROWSER_EXCLUSIVE_ACCESS_CONTROLLER_VIEWS_H_
+#define CHROME_BROWSER_UI_COCOA_BROWSER_EXCLUSIVE_ACCESS_CONTROLLER_VIEWS_H_
+
+// Note this file has a _views suffix so that it may have an optional runtime
+// dependency on toolkit-views UI.
+
+#import <CoreGraphics/CoreGraphics.h>
+
+#import "base/mac/scoped_nsobject.h"
+#include "base/macros.h"
+#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
+
+class Browser;
+class BrowserWindow;
+@class BrowserWindowController;
+@class ExclusiveAccessBubbleWindowController;
+class GURL;
+
+// Component placed into a browser window controller to manage communication
+// with the exclusive access bubble, which appears when entering fullscreen.
+class ExclusiveAccessController : public ExclusiveAccessContext {
+ public:
+ ExclusiveAccessController(BrowserWindowController* controller,
+ Browser* browser);
+ ~ExclusiveAccessController() override;
+
+ const GURL& url() const { return url_; }
+ ExclusiveAccessBubbleType bubble_type() const { return bubble_type_; }
+ ExclusiveAccessBubbleWindowController* cocoa_bubble() {
+ return cocoa_bubble_;
+ }
+
+ // Shows the bubble once the NSWindow has received -windowDidEnterFullScreen:.
+ void Show();
+
+ // Closes any open bubble.
+ void Destroy();
+
+ // If showing, position the bubble at the given y-coordinate.
+ void Layout(CGFloat max_y);
+
+ // ExclusiveAccessContext:
+ Profile* GetProfile() override;
+ bool IsFullscreen() const override;
spqchan 2016/02/01 19:55:04 Can you also move the comments that describe these
tapted 2016/02/02 11:57:06 There weren't any on BrowserWindowController - I t
+ bool SupportsFullscreenWithToolbar() const override;
+ void UpdateFullscreenWithToolbar(bool with_toolbar) override;
+ void ToggleFullscreenToolbar() override;
+ bool IsFullscreenWithToolbar() const override;
+ void EnterFullscreen(const GURL& url,
+ ExclusiveAccessBubbleType type,
+ bool with_toolbar) override;
+ void ExitFullscreen() override;
+ void UpdateExclusiveAccessExitBubbleContent(
+ const GURL& url,
+ ExclusiveAccessBubbleType bubble_type) override;
+ void OnExclusiveAccessUserInput() override;
+ content::WebContents* GetActiveWebContents() override;
+ void UnhideDownloadShelf() override;
+ void HideDownloadShelf() override;
+
+ private:
+ BrowserWindow* GetBrowserWindow() const;
+
+ BrowserWindowController* controller_; // Weak. Owns |this|.
+ Browser* browser_; // Weak. Owned by controller.
+
+ // When going fullscreen for a tab, we need to store the URL and the
+ // fullscreen type, since we can't show the bubble until
+ // -windowDidEnterFullScreen: gets called.
+ GURL url_;
+ ExclusiveAccessBubbleType bubble_type_;
+
+ base::scoped_nsobject<ExclusiveAccessBubbleWindowController> cocoa_bubble_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessController);
+};
+
+#endif // CHROME_BROWSER_UI_COCOA_BROWSER_EXCLUSIVE_ACCESS_CONTROLLER_VIEWS_H_

Powered by Google App Engine
This is Rietveld 408576698