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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller.h

Issue 151283006: Mac OS X: Show the Translate icon on Omnibox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue-307352-translate-bubble-2
Patch Set: groby's review Created 6 years, 10 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 unified diff | Download patch
OLDNEW
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 PresentationModeController; 43 @class PresentationModeController;
42 class StatusBubbleMac; 44 class StatusBubbleMac;
43 @class TabStripController; 45 @class TabStripController;
44 @class TabStripView; 46 @class TabStripView;
45 @class ToolbarController; 47 @class ToolbarController;
48 @class TranslateBubbleController;
46 49
47 namespace content { 50 namespace content {
48 class WebContents; 51 class WebContents;
49 } 52 }
50 53
51 @interface BrowserWindowController : 54 @interface BrowserWindowController :
52 TabWindowController<NSUserInterfaceValidations, 55 TabWindowController<NSUserInterfaceValidations,
53 BookmarkBarControllerDelegate, 56 BookmarkBarControllerDelegate,
54 BrowserCommandExecutor, 57 BrowserCommandExecutor,
55 ViewResizer, 58 ViewResizer,
(...skipping 23 matching lines...) Expand all
79 // Strong. StatusBubble is a special case of a strong reference that 82 // Strong. StatusBubble is a special case of a strong reference that
80 // we don't wrap in a scoped_ptr because it is acting the same 83 // we don't wrap in a scoped_ptr because it is acting the same
81 // as an NSWindowController in that it wraps a window that must 84 // as an NSWindowController in that it wraps a window that must
82 // be shut down before our destructors are called. 85 // be shut down before our destructors are called.
83 StatusBubbleMac* statusBubble_; 86 StatusBubbleMac* statusBubble_;
84 87
85 BookmarkBubbleController* bookmarkBubbleController_; // Weak. 88 BookmarkBubbleController* bookmarkBubbleController_; // Weak.
86 BOOL initializing_; // YES while we are currently in initWithBrowser: 89 BOOL initializing_; // YES while we are currently in initWithBrowser:
87 BOOL ownsBrowser_; // Only ever NO when testing 90 BOOL ownsBrowser_; // Only ever NO when testing
88 91
92 TranslateBubbleController* translateBubbleController_; // Weak.
93
89 // The total amount by which we've grown the window up or down (to display a 94 // The total amount by which we've grown the window up or down (to display a
90 // bookmark bar and/or download shelf), respectively; reset to 0 when moved 95 // bookmark bar and/or download shelf), respectively; reset to 0 when moved
91 // away from the bottom/top or resized (or zoomed). 96 // away from the bottom/top or resized (or zoomed).
92 CGFloat windowTopGrowth_; 97 CGFloat windowTopGrowth_;
93 CGFloat windowBottomGrowth_; 98 CGFloat windowBottomGrowth_;
94 99
95 // YES only if we're shrinking the window from an apparent zoomed state (which 100 // YES only if we're shrinking the window from an apparent zoomed state (which
96 // we'll only do if we grew it to the zoomed state); needed since we'll then 101 // we'll only do if we grew it to the zoomed state); needed since we'll then
97 // restrict the amount of shrinking by the amounts specified above. Reset to 102 // restrict the amount of shrinking by the amounts specified above. Reset to
98 // NO on growth. 103 // NO on growth.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 - (AvatarBaseController*)avatarButtonController; 234 - (AvatarBaseController*)avatarButtonController;
230 235
231 // Forces the toolbar (and transitively the location bar) to update its current 236 // Forces the toolbar (and transitively the location bar) to update its current
232 // state. If |tab| is non-NULL, we're switching (back?) to this tab and should 237 // state. If |tab| is non-NULL, we're switching (back?) to this tab and should
233 // restore any previous location bar state (such as user editing) as well. 238 // restore any previous location bar state (such as user editing) as well.
234 - (void)updateToolbarWithContents:(content::WebContents*)tab; 239 - (void)updateToolbarWithContents:(content::WebContents*)tab;
235 240
236 // Sets whether or not the current page in the frontmost tab is bookmarked. 241 // Sets whether or not the current page in the frontmost tab is bookmarked.
237 - (void)setStarredState:(BOOL)isStarred; 242 - (void)setStarredState:(BOOL)isStarred;
238 243
244 // Sets whether or not the current page is translated.
245 - (void)setCurrentPageIsTranslated:(BOOL)on;
246
239 // Happens when the zoom level is changed in the active tab, the active tab is 247 // Happens when the zoom level is changed in the active tab, the active tab is
240 // changed, or a new browser window or tab is created. |canShowBubble| denotes 248 // changed, or a new browser window or tab is created. |canShowBubble| denotes
241 // whether it would be appropriate to show a zoom bubble or not. 249 // whether it would be appropriate to show a zoom bubble or not.
242 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble; 250 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble;
243 251
244 // Return the rect, in WebKit coordinates (flipped), of the window's grow box 252 // Return the rect, in WebKit coordinates (flipped), of the window's grow box
245 // in the coordinate system of the content area of the currently selected tab. 253 // in the coordinate system of the content area of the currently selected tab.
246 - (NSRect)selectedTabGrowBoxRect; 254 - (NSRect)selectedTabGrowBoxRect;
247 255
248 // Called to tell the selected tab to update its loading state. 256 // Called to tell the selected tab to update its loading state.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 // an extension command and returns YES if so (NO otherwise). 310 // an extension command and returns YES if so (NO otherwise).
303 - (BOOL)handledByExtensionCommand:(NSEvent*)event; 311 - (BOOL)handledByExtensionCommand:(NSEvent*)event;
304 312
305 // Delegate method for the status bubble to query its base frame. 313 // Delegate method for the status bubble to query its base frame.
306 - (NSRect)statusBubbleBaseFrame; 314 - (NSRect)statusBubbleBaseFrame;
307 315
308 // Show the bookmark bubble (e.g. user just clicked on the STAR) 316 // Show the bookmark bubble (e.g. user just clicked on the STAR)
309 - (void)showBookmarkBubbleForURL:(const GURL&)url 317 - (void)showBookmarkBubbleForURL:(const GURL&)url
310 alreadyBookmarked:(BOOL)alreadyBookmarked; 318 alreadyBookmarked:(BOOL)alreadyBookmarked;
311 319
320 // Show the translate bubble.
321 - (void)showTranslateBubbleForWebContents:(content::WebContents*)contents
322 step:
323 (TranslateTabHelper::TranslateStep)step
324 errorType:(TranslateErrors::Type)errorType;
325
312 // Shows or hides the docked web inspector depending on |contents|'s state. 326 // Shows or hides the docked web inspector depending on |contents|'s state.
313 - (void)updateDevToolsForContents:(content::WebContents*)contents; 327 - (void)updateDevToolsForContents:(content::WebContents*)contents;
314 328
315 // Gets the current theme provider. 329 // Gets the current theme provider.
316 - (ui::ThemeProvider*)themeProvider; 330 - (ui::ThemeProvider*)themeProvider;
317 331
318 // Gets the window style. 332 // Gets the window style.
319 - (ThemedWindowStyle)themedWindowStyle; 333 - (ThemedWindowStyle)themedWindowStyle;
320 334
321 // Returns the position in the coordinates of the root view 335 // Returns the position in the coordinates of the root view
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 // positioned relative to. 514 // positioned relative to.
501 - (NSRect)omniboxPopupAnchorRect; 515 - (NSRect)omniboxPopupAnchorRect;
502 516
503 // Force a layout of info bars. 517 // Force a layout of info bars.
504 - (void)layoutInfoBars; 518 - (void)layoutInfoBars;
505 519
506 @end // @interface BrowserWindowController (TestingAPI) 520 @end // @interface BrowserWindowController (TestingAPI)
507 521
508 522
509 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ 523 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698