OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |
7 | 7 |
8 // A class acting as the Objective-C controller for the Browser | 8 // A class acting as the Objective-C controller for the Browser |
9 // object. Handles interactions between Cocoa and the cross-platform | 9 // object. Handles interactions between Cocoa and the cross-platform |
10 // code. Each window has a single toolbar and, by virtue of being a | 10 // code. Each window has a single toolbar and, by virtue of being a |
11 // TabWindowController, a tab strip along the top. | 11 // TabWindowController, a tab strip along the top. |
12 | 12 |
13 #import <Cocoa/Cocoa.h> | 13 #import <Cocoa/Cocoa.h> |
14 | 14 |
| 15 #include <memory> |
| 16 |
15 #include "base/mac/scoped_nsobject.h" | 17 #include "base/mac/scoped_nsobject.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "chrome/browser/extensions/browser_extension_window_controller.h" | 18 #include "chrome/browser/extensions/browser_extension_window_controller.h" |
18 #include "chrome/browser/translate/chrome_translate_client.h" | 19 #include "chrome/browser/translate/chrome_translate_client.h" |
19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" | 21 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" |
21 #import "chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.h" | 22 #import "chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.h" |
22 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 23 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
23 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" | 24 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" |
24 #import "chrome/browser/ui/cocoa/themed_window.h" | 25 #import "chrome/browser/ui/cocoa/themed_window.h" |
25 #import "chrome/browser/ui/cocoa/url_drop_target.h" | 26 #import "chrome/browser/ui/cocoa/url_drop_target.h" |
26 #import "chrome/browser/ui/cocoa/view_resizer.h" | 27 #import "chrome/browser/ui/cocoa/view_resizer.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 65 |
65 @interface BrowserWindowController | 66 @interface BrowserWindowController |
66 : TabWindowController<BookmarkBarControllerDelegate, | 67 : TabWindowController<BookmarkBarControllerDelegate, |
67 ViewResizer, | 68 ViewResizer, |
68 TabStripControllerDelegate> { | 69 TabStripControllerDelegate> { |
69 @private | 70 @private |
70 // The ordering of these members is important as it determines the order in | 71 // The ordering of these members is important as it determines the order in |
71 // which they are destroyed. |browser_| needs to be destroyed last as most of | 72 // which they are destroyed. |browser_| needs to be destroyed last as most of |
72 // the other objects hold weak references to it or things it owns | 73 // the other objects hold weak references to it or things it owns |
73 // (tab/toolbar/bookmark models, profiles, etc). | 74 // (tab/toolbar/bookmark models, profiles, etc). |
74 scoped_ptr<Browser> browser_; | 75 std::unique_ptr<Browser> browser_; |
75 NSWindow* savedRegularWindow_; | 76 NSWindow* savedRegularWindow_; |
76 scoped_ptr<BrowserWindowCocoa> windowShim_; | 77 std::unique_ptr<BrowserWindowCocoa> windowShim_; |
77 base::scoped_nsobject<ToolbarController> toolbarController_; | 78 base::scoped_nsobject<ToolbarController> toolbarController_; |
78 base::scoped_nsobject<TabStripController> tabStripController_; | 79 base::scoped_nsobject<TabStripController> tabStripController_; |
79 base::scoped_nsobject<FindBarCocoaController> findBarCocoaController_; | 80 base::scoped_nsobject<FindBarCocoaController> findBarCocoaController_; |
80 base::scoped_nsobject<InfoBarContainerController> infoBarContainerController_; | 81 base::scoped_nsobject<InfoBarContainerController> infoBarContainerController_; |
81 base::scoped_nsobject<DownloadShelfController> downloadShelfController_; | 82 base::scoped_nsobject<DownloadShelfController> downloadShelfController_; |
82 base::scoped_nsobject<BookmarkBarController> bookmarkBarController_; | 83 base::scoped_nsobject<BookmarkBarController> bookmarkBarController_; |
83 base::scoped_nsobject<DevToolsController> devToolsController_; | 84 base::scoped_nsobject<DevToolsController> devToolsController_; |
84 base::scoped_nsobject<OverlayableContentsController> | 85 base::scoped_nsobject<OverlayableContentsController> |
85 overlayableContentsController_; | 86 overlayableContentsController_; |
86 base::scoped_nsobject<PresentationModeController> presentationModeController_; | 87 base::scoped_nsobject<PresentationModeController> presentationModeController_; |
87 scoped_ptr<ExclusiveAccessController> exclusiveAccessController_; | 88 std::unique_ptr<ExclusiveAccessController> exclusiveAccessController_; |
88 base::scoped_nsobject<BrowserWindowFullscreenTransition> | 89 base::scoped_nsobject<BrowserWindowFullscreenTransition> |
89 fullscreenTransition_; | 90 fullscreenTransition_; |
90 | 91 |
91 // Strong. StatusBubble is a special case of a strong reference that | 92 // Strong. StatusBubble is a special case of a strong reference that |
92 // we don't wrap in a scoped_ptr because it is acting the same | 93 // we don't wrap in a scoped_ptr because it is acting the same |
93 // as an NSWindowController in that it wraps a window that must | 94 // as an NSWindowController in that it wraps a window that must |
94 // be shut down before our destructors are called. | 95 // be shut down before our destructors are called. |
95 StatusBubbleMac* statusBubble_; | 96 StatusBubbleMac* statusBubble_; |
96 | 97 |
97 scoped_ptr<BookmarkBubbleObserverCocoa> bookmarkBubbleObserver_; | 98 std::unique_ptr<BookmarkBubbleObserverCocoa> bookmarkBubbleObserver_; |
98 BookmarkBubbleController* bookmarkBubbleController_; // Weak. | 99 BookmarkBubbleController* bookmarkBubbleController_; // Weak. |
99 BOOL initializing_; // YES while we are currently in initWithBrowser: | 100 BOOL initializing_; // YES while we are currently in initWithBrowser: |
100 BOOL ownsBrowser_; // Only ever NO when testing | 101 BOOL ownsBrowser_; // Only ever NO when testing |
101 | 102 |
102 TranslateBubbleController* translateBubbleController_; // Weak. | 103 TranslateBubbleController* translateBubbleController_; // Weak. |
103 | 104 |
104 // The total amount by which we've grown the window up or down (to display a | 105 // The total amount by which we've grown the window up or down (to display a |
105 // bookmark bar and/or download shelf), respectively; reset to 0 when moved | 106 // bookmark bar and/or download shelf), respectively; reset to 0 when moved |
106 // away from the bottom/top or resized (or zoomed). | 107 // away from the bottom/top or resized (or zoomed). |
107 CGFloat windowTopGrowth_; | 108 CGFloat windowTopGrowth_; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // in visible state when the following is |YES|. | 189 // in visible state when the following is |YES|. |
189 BOOL barVisibilityUpdatesEnabled_; | 190 BOOL barVisibilityUpdatesEnabled_; |
190 | 191 |
191 // If this ivar is set to YES, layoutSubviews calls will be ignored. This is | 192 // If this ivar is set to YES, layoutSubviews calls will be ignored. This is |
192 // used in fullscreen transition to prevent spurious resize messages from | 193 // used in fullscreen transition to prevent spurious resize messages from |
193 // being sent to the renderer, which causes the transition to be janky. | 194 // being sent to the renderer, which causes the transition to be janky. |
194 BOOL blockLayoutSubviews_; | 195 BOOL blockLayoutSubviews_; |
195 | 196 |
196 // The Extension Command Registry used to determine which keyboard events to | 197 // The Extension Command Registry used to determine which keyboard events to |
197 // handle. | 198 // handle. |
198 scoped_ptr<ExtensionKeybindingRegistryCocoa> extension_keybinding_registry_; | 199 std::unique_ptr<ExtensionKeybindingRegistryCocoa> |
| 200 extension_keybinding_registry_; |
199 } | 201 } |
200 | 202 |
201 // A convenience class method which gets the |BrowserWindowController| for a | 203 // A convenience class method which gets the |BrowserWindowController| for a |
202 // given window. This method returns nil if no window in the chain has a BWC. | 204 // given window. This method returns nil if no window in the chain has a BWC. |
203 + (BrowserWindowController*)browserWindowControllerForWindow:(NSWindow*)window; | 205 + (BrowserWindowController*)browserWindowControllerForWindow:(NSWindow*)window; |
204 | 206 |
205 // A convenience class method which gets the |BrowserWindowController| for a | 207 // A convenience class method which gets the |BrowserWindowController| for a |
206 // given view. This is the controller for the window containing |view|, if it | 208 // given view. This is the controller for the window containing |view|, if it |
207 // is a BWC, or the first controller in the parent-window chain that is a | 209 // is a BWC, or the first controller in the parent-window chain that is a |
208 // BWC. This method returns nil if no window in the chain has a BWC. | 210 // BWC. This method returns nil if no window in the chain has a BWC. |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 // Returns the active tab contents controller's |blockFullscreenResize_| flag. | 654 // Returns the active tab contents controller's |blockFullscreenResize_| flag. |
653 - (BOOL)isActiveTabContentsControllerResizeBlocked; | 655 - (BOOL)isActiveTabContentsControllerResizeBlocked; |
654 | 656 |
655 // Returns the presentation mode controller. | 657 // Returns the presentation mode controller. |
656 - (PresentationModeController*)presentationModeController; | 658 - (PresentationModeController*)presentationModeController; |
657 | 659 |
658 @end // @interface BrowserWindowController (TestingAPI) | 660 @end // @interface BrowserWindowController (TestingAPI) |
659 | 661 |
660 | 662 |
661 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 663 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |
OLD | NEW |