| 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 "base/mac/scoped_nsobject.h" | 15 #include "base/mac/scoped_nsobject.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "chrome/browser/translate/translate_tab_helper.h" |
| 17 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" | 19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" |
| 19 #import "chrome/browser/ui/cocoa/browser_command_executor.h" | 20 #import "chrome/browser/ui/cocoa/browser_command_executor.h" |
| 20 #import "chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h" | 21 #import "chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h" |
| 21 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 22 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 22 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" | 23 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" |
| 23 #import "chrome/browser/ui/cocoa/themed_window.h" | 24 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 24 #import "chrome/browser/ui/cocoa/url_drop_target.h" | 25 #import "chrome/browser/ui/cocoa/url_drop_target.h" |
| 25 #import "chrome/browser/ui/cocoa/view_resizer.h" | 26 #import "chrome/browser/ui/cocoa/view_resizer.h" |
| 27 #include "components/translate/core/common/translate_errors.h" |
| 26 #include "ui/gfx/rect.h" | 28 #include "ui/gfx/rect.h" |
| 27 | 29 |
| 28 @class AvatarBaseController; | 30 @class AvatarBaseController; |
| 29 class Browser; | 31 class Browser; |
| 30 class BrowserWindow; | 32 class BrowserWindow; |
| 31 class BrowserWindowCocoa; | 33 class BrowserWindowCocoa; |
| 32 @class DevToolsController; | 34 @class DevToolsController; |
| 33 @class DownloadShelfController; | 35 @class DownloadShelfController; |
| 34 class ExtensionKeybindingRegistryCocoa; | 36 class ExtensionKeybindingRegistryCocoa; |
| 35 @class FindBarCocoaController; | 37 @class FindBarCocoaController; |
| 36 @class FullscreenModeController; | 38 @class FullscreenModeController; |
| 37 @class FullscreenWindow; | 39 @class FullscreenWindow; |
| 38 @class InfoBarContainerController; | 40 @class InfoBarContainerController; |
| 39 class LocationBarViewMac; | 41 class LocationBarViewMac; |
| 40 @class OverlayableContentsController; | 42 @class OverlayableContentsController; |
| 41 class PermissionBubbleCocoa; | 43 class PermissionBubbleCocoa; |
| 42 @class PresentationModeController; | 44 @class PresentationModeController; |
| 43 class StatusBubbleMac; | 45 class StatusBubbleMac; |
| 44 @class TabStripController; | 46 @class TabStripController; |
| 45 @class TabStripView; | 47 @class TabStripView; |
| 46 @class ToolbarController; | 48 @class ToolbarController; |
| 49 @class TranslateBubbleController; |
| 47 | 50 |
| 48 namespace content { | 51 namespace content { |
| 49 class WebContents; | 52 class WebContents; |
| 50 } | 53 } |
| 51 | 54 |
| 52 namespace extensions { | 55 namespace extensions { |
| 53 class Command; | 56 class Command; |
| 54 } | 57 } |
| 55 | 58 |
| 56 @interface BrowserWindowController : | 59 @interface BrowserWindowController : |
| (...skipping 27 matching lines...) Expand all Loading... |
| 84 // Strong. StatusBubble is a special case of a strong reference that | 87 // Strong. StatusBubble is a special case of a strong reference that |
| 85 // we don't wrap in a scoped_ptr because it is acting the same | 88 // we don't wrap in a scoped_ptr because it is acting the same |
| 86 // as an NSWindowController in that it wraps a window that must | 89 // as an NSWindowController in that it wraps a window that must |
| 87 // be shut down before our destructors are called. | 90 // be shut down before our destructors are called. |
| 88 StatusBubbleMac* statusBubble_; | 91 StatusBubbleMac* statusBubble_; |
| 89 | 92 |
| 90 BookmarkBubbleController* bookmarkBubbleController_; // Weak. | 93 BookmarkBubbleController* bookmarkBubbleController_; // Weak. |
| 91 BOOL initializing_; // YES while we are currently in initWithBrowser: | 94 BOOL initializing_; // YES while we are currently in initWithBrowser: |
| 92 BOOL ownsBrowser_; // Only ever NO when testing | 95 BOOL ownsBrowser_; // Only ever NO when testing |
| 93 | 96 |
| 97 TranslateBubbleController* translateBubbleController_; // Weak. |
| 98 |
| 94 // The total amount by which we've grown the window up or down (to display a | 99 // The total amount by which we've grown the window up or down (to display a |
| 95 // bookmark bar and/or download shelf), respectively; reset to 0 when moved | 100 // bookmark bar and/or download shelf), respectively; reset to 0 when moved |
| 96 // away from the bottom/top or resized (or zoomed). | 101 // away from the bottom/top or resized (or zoomed). |
| 97 CGFloat windowTopGrowth_; | 102 CGFloat windowTopGrowth_; |
| 98 CGFloat windowBottomGrowth_; | 103 CGFloat windowBottomGrowth_; |
| 99 | 104 |
| 100 // YES only if we're shrinking the window from an apparent zoomed state (which | 105 // YES only if we're shrinking the window from an apparent zoomed state (which |
| 101 // we'll only do if we grew it to the zoomed state); needed since we'll then | 106 // we'll only do if we grew it to the zoomed state); needed since we'll then |
| 102 // restrict the amount of shrinking by the amounts specified above. Reset to | 107 // restrict the amount of shrinking by the amounts specified above. Reset to |
| 103 // NO on growth. | 108 // NO on growth. |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 - (AvatarBaseController*)avatarButtonController; | 242 - (AvatarBaseController*)avatarButtonController; |
| 238 | 243 |
| 239 // Forces the toolbar (and transitively the location bar) to update its current | 244 // Forces the toolbar (and transitively the location bar) to update its current |
| 240 // state. If |tab| is non-NULL, we're switching (back?) to this tab and should | 245 // state. If |tab| is non-NULL, we're switching (back?) to this tab and should |
| 241 // restore any previous location bar state (such as user editing) as well. | 246 // restore any previous location bar state (such as user editing) as well. |
| 242 - (void)updateToolbarWithContents:(content::WebContents*)tab; | 247 - (void)updateToolbarWithContents:(content::WebContents*)tab; |
| 243 | 248 |
| 244 // Sets whether or not the current page in the frontmost tab is bookmarked. | 249 // Sets whether or not the current page in the frontmost tab is bookmarked. |
| 245 - (void)setStarredState:(BOOL)isStarred; | 250 - (void)setStarredState:(BOOL)isStarred; |
| 246 | 251 |
| 252 // Sets whether or not the current page is translated. |
| 253 - (void)setCurrentPageIsTranslated:(BOOL)on; |
| 254 |
| 247 // Happens when the zoom level is changed in the active tab, the active tab is | 255 // Happens when the zoom level is changed in the active tab, the active tab is |
| 248 // changed, or a new browser window or tab is created. |canShowBubble| denotes | 256 // changed, or a new browser window or tab is created. |canShowBubble| denotes |
| 249 // whether it would be appropriate to show a zoom bubble or not. | 257 // whether it would be appropriate to show a zoom bubble or not. |
| 250 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble; | 258 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble; |
| 251 | 259 |
| 252 // Return the rect, in WebKit coordinates (flipped), of the window's grow box | 260 // Return the rect, in WebKit coordinates (flipped), of the window's grow box |
| 253 // in the coordinate system of the content area of the currently selected tab. | 261 // in the coordinate system of the content area of the currently selected tab. |
| 254 - (NSRect)selectedTabGrowBoxRect; | 262 - (NSRect)selectedTabGrowBoxRect; |
| 255 | 263 |
| 256 // Called to tell the selected tab to update its loading state. | 264 // Called to tell the selected tab to update its loading state. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 // an extension command and returns YES if so (NO otherwise). | 318 // an extension command and returns YES if so (NO otherwise). |
| 311 - (BOOL)handledByExtensionCommand:(NSEvent*)event; | 319 - (BOOL)handledByExtensionCommand:(NSEvent*)event; |
| 312 | 320 |
| 313 // Delegate method for the status bubble to query its base frame. | 321 // Delegate method for the status bubble to query its base frame. |
| 314 - (NSRect)statusBubbleBaseFrame; | 322 - (NSRect)statusBubbleBaseFrame; |
| 315 | 323 |
| 316 // Show the bookmark bubble (e.g. user just clicked on the STAR) | 324 // Show the bookmark bubble (e.g. user just clicked on the STAR) |
| 317 - (void)showBookmarkBubbleForURL:(const GURL&)url | 325 - (void)showBookmarkBubbleForURL:(const GURL&)url |
| 318 alreadyBookmarked:(BOOL)alreadyBookmarked; | 326 alreadyBookmarked:(BOOL)alreadyBookmarked; |
| 319 | 327 |
| 328 // Show the translate bubble. |
| 329 - (void)showTranslateBubbleForWebContents:(content::WebContents*)contents |
| 330 step: |
| 331 (TranslateTabHelper::TranslateStep)step |
| 332 errorType:(TranslateErrors::Type)errorType; |
| 333 |
| 320 // Shows or hides the docked web inspector depending on |contents|'s state. | 334 // Shows or hides the docked web inspector depending on |contents|'s state. |
| 321 - (void)updateDevToolsForContents:(content::WebContents*)contents; | 335 - (void)updateDevToolsForContents:(content::WebContents*)contents; |
| 322 | 336 |
| 323 // Gets the current theme provider. | 337 // Gets the current theme provider. |
| 324 - (ui::ThemeProvider*)themeProvider; | 338 - (ui::ThemeProvider*)themeProvider; |
| 325 | 339 |
| 326 // Gets the window style. | 340 // Gets the window style. |
| 327 - (ThemedWindowStyle)themedWindowStyle; | 341 - (ThemedWindowStyle)themedWindowStyle; |
| 328 | 342 |
| 329 // Returns the position in the coordinates of the root view | 343 // Returns the position in the coordinates of the root view |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 // positioned relative to. | 532 // positioned relative to. |
| 519 - (NSRect)omniboxPopupAnchorRect; | 533 - (NSRect)omniboxPopupAnchorRect; |
| 520 | 534 |
| 521 // Force a layout of info bars. | 535 // Force a layout of info bars. |
| 522 - (void)layoutInfoBars; | 536 - (void)layoutInfoBars; |
| 523 | 537 |
| 524 @end // @interface BrowserWindowController (TestingAPI) | 538 @end // @interface BrowserWindowController (TestingAPI) |
| 525 | 539 |
| 526 | 540 |
| 527 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ | 541 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ |
| OLD | NEW |