| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <numeric> | 8 #include <numeric> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" | 57 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" |
| 58 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" | 58 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" |
| 59 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" | 59 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" |
| 60 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" | 60 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" |
| 61 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" | 61 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" |
| 62 #import "chrome/browser/ui/cocoa/tabpose_window.h" | 62 #import "chrome/browser/ui/cocoa/tabpose_window.h" |
| 63 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 63 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 64 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" | 64 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
| 65 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" | 65 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" |
| 66 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 66 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 67 #import "chrome/browser/ui/cocoa/translate/translate_bubble_controller.h" |
| 67 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 68 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| 68 #include "chrome/browser/ui/omnibox/location_bar.h" | 69 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 69 #include "chrome/browser/ui/tabs/dock_info.h" | 70 #include "chrome/browser/ui/tabs/dock_info.h" |
| 70 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 71 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 71 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 72 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
| 72 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" | 73 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" |
| 73 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 74 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
| 74 #include "chrome/common/chrome_switches.h" | 75 #include "chrome/common/chrome_switches.h" |
| 75 #include "chrome/common/profile_management_switches.h" | 76 #include "chrome/common/profile_management_switches.h" |
| 76 #include "chrome/common/url_constants.h" | 77 #include "chrome/common/url_constants.h" |
| (...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 } | 1241 } |
| 1241 | 1242 |
| 1242 - (void)updateToolbarWithContents:(WebContents*)tab { | 1243 - (void)updateToolbarWithContents:(WebContents*)tab { |
| 1243 [toolbarController_ updateToolbarWithContents:tab]; | 1244 [toolbarController_ updateToolbarWithContents:tab]; |
| 1244 } | 1245 } |
| 1245 | 1246 |
| 1246 - (void)setStarredState:(BOOL)isStarred { | 1247 - (void)setStarredState:(BOOL)isStarred { |
| 1247 [toolbarController_ setStarredState:isStarred]; | 1248 [toolbarController_ setStarredState:isStarred]; |
| 1248 } | 1249 } |
| 1249 | 1250 |
| 1251 - (void)setCurrentPageIsTranslated:(BOOL)on { |
| 1252 [toolbarController_ setTranslateIconLit:on]; |
| 1253 } |
| 1254 |
| 1250 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble { | 1255 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble { |
| 1251 [toolbarController_ zoomChangedForActiveTab:canShowBubble]; | 1256 [toolbarController_ zoomChangedForActiveTab:canShowBubble]; |
| 1252 } | 1257 } |
| 1253 | 1258 |
| 1254 // Return the rect, in WebKit coordinates (flipped), of the window's grow box | 1259 // Return the rect, in WebKit coordinates (flipped), of the window's grow box |
| 1255 // in the coordinate system of the content area of the currently selected tab. | 1260 // in the coordinate system of the content area of the currently selected tab. |
| 1256 // |windowGrowBox| needs to be in the window's coordinate system. | 1261 // |windowGrowBox| needs to be in the window's coordinate system. |
| 1257 - (NSRect)selectedTabGrowBoxRect { | 1262 - (NSRect)selectedTabGrowBoxRect { |
| 1258 NSWindow* window = [self window]; | 1263 NSWindow* window = [self window]; |
| 1259 if (![window respondsToSelector:@selector(_growBoxRect)]) | 1264 if (![window respondsToSelector:@selector(_growBoxRect)]) |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 alreadyBookmarked:alreadyMarked]; | 1677 alreadyBookmarked:alreadyMarked]; |
| 1673 [bookmarkBubbleController_ showWindow:self]; | 1678 [bookmarkBubbleController_ showWindow:self]; |
| 1674 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 1679 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| 1675 [center addObserver:self | 1680 [center addObserver:self |
| 1676 selector:@selector(bookmarkBubbleWindowWillClose:) | 1681 selector:@selector(bookmarkBubbleWindowWillClose:) |
| 1677 name:NSWindowWillCloseNotification | 1682 name:NSWindowWillCloseNotification |
| 1678 object:[bookmarkBubbleController_ window]]; | 1683 object:[bookmarkBubbleController_ window]]; |
| 1679 } | 1684 } |
| 1680 } | 1685 } |
| 1681 | 1686 |
| 1687 - (void)showTranslateBubbleForWebContents:(content::WebContents*)contents |
| 1688 viewState: |
| 1689 (TranslateBubbleModel::ViewState)viewState |
| 1690 errorType:(TranslateErrors::Type)errorType { |
| 1691 [TranslateBubbleController showBubbleWithBrowserWindowController:self |
| 1692 webContents:contents |
| 1693 viewState:viewState |
| 1694 errorType:errorType]; |
| 1695 } |
| 1696 |
| 1682 // Nil out the weak bookmark bubble controller reference. | 1697 // Nil out the weak bookmark bubble controller reference. |
| 1683 - (void)bookmarkBubbleWindowWillClose:(NSNotification*)notification { | 1698 - (void)bookmarkBubbleWindowWillClose:(NSNotification*)notification { |
| 1684 DCHECK_EQ([notification object], [bookmarkBubbleController_ window]); | 1699 DCHECK_EQ([notification object], [bookmarkBubbleController_ window]); |
| 1685 | 1700 |
| 1686 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 1701 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| 1687 [center removeObserver:self | 1702 [center removeObserver:self |
| 1688 name:NSWindowWillCloseNotification | 1703 name:NSWindowWillCloseNotification |
| 1689 object:[bookmarkBubbleController_ window]]; | 1704 object:[bookmarkBubbleController_ window]]; |
| 1690 bookmarkBubbleController_ = nil; | 1705 bookmarkBubbleController_ = nil; |
| 1691 } | 1706 } |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2235 | 2250 |
| 2236 - (BOOL)supportsBookmarkBar { | 2251 - (BOOL)supportsBookmarkBar { |
| 2237 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2252 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2238 } | 2253 } |
| 2239 | 2254 |
| 2240 - (BOOL)isTabbedWindow { | 2255 - (BOOL)isTabbedWindow { |
| 2241 return browser_->is_type_tabbed(); | 2256 return browser_->is_type_tabbed(); |
| 2242 } | 2257 } |
| 2243 | 2258 |
| 2244 @end // @implementation BrowserWindowController(WindowType) | 2259 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |