| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 56 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
| 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/tabs/tab_strip_controller.h" | 62 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 63 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" | 63 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
| 64 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" | 64 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" |
| 65 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 65 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 66 #import "chrome/browser/ui/cocoa/translate/translate_bubble_controller.h" |
| 66 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 67 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| 67 #include "chrome/browser/ui/omnibox/location_bar.h" | 68 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 68 #include "chrome/browser/ui/tabs/dock_info.h" | 69 #include "chrome/browser/ui/tabs/dock_info.h" |
| 69 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 70 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 70 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 71 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
| 71 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" | 72 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" |
| 72 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 73 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
| 73 #include "chrome/common/chrome_switches.h" | 74 #include "chrome/common/chrome_switches.h" |
| 74 #include "chrome/common/profile_management_switches.h" | 75 #include "chrome/common/profile_management_switches.h" |
| 75 #include "chrome/common/url_constants.h" | 76 #include "chrome/common/url_constants.h" |
| (...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 } | 1237 } |
| 1237 | 1238 |
| 1238 - (void)updateToolbarWithContents:(WebContents*)tab { | 1239 - (void)updateToolbarWithContents:(WebContents*)tab { |
| 1239 [toolbarController_ updateToolbarWithContents:tab]; | 1240 [toolbarController_ updateToolbarWithContents:tab]; |
| 1240 } | 1241 } |
| 1241 | 1242 |
| 1242 - (void)setStarredState:(BOOL)isStarred { | 1243 - (void)setStarredState:(BOOL)isStarred { |
| 1243 [toolbarController_ setStarredState:isStarred]; | 1244 [toolbarController_ setStarredState:isStarred]; |
| 1244 } | 1245 } |
| 1245 | 1246 |
| 1247 - (void)setCurrentPageIsTranslated:(BOOL)on { |
| 1248 [toolbarController_ setTranslateIconLit:on]; |
| 1249 } |
| 1250 |
| 1246 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble { | 1251 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble { |
| 1247 [toolbarController_ zoomChangedForActiveTab:canShowBubble]; | 1252 [toolbarController_ zoomChangedForActiveTab:canShowBubble]; |
| 1248 } | 1253 } |
| 1249 | 1254 |
| 1250 // Return the rect, in WebKit coordinates (flipped), of the window's grow box | 1255 // Return the rect, in WebKit coordinates (flipped), of the window's grow box |
| 1251 // in the coordinate system of the content area of the currently selected tab. | 1256 // in the coordinate system of the content area of the currently selected tab. |
| 1252 // |windowGrowBox| needs to be in the window's coordinate system. | 1257 // |windowGrowBox| needs to be in the window's coordinate system. |
| 1253 - (NSRect)selectedTabGrowBoxRect { | 1258 - (NSRect)selectedTabGrowBoxRect { |
| 1254 NSWindow* window = [self window]; | 1259 NSWindow* window = [self window]; |
| 1255 if (![window respondsToSelector:@selector(_growBoxRect)]) | 1260 if (![window respondsToSelector:@selector(_growBoxRect)]) |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1668 alreadyBookmarked:alreadyMarked]; | 1673 alreadyBookmarked:alreadyMarked]; |
| 1669 [bookmarkBubbleController_ showWindow:self]; | 1674 [bookmarkBubbleController_ showWindow:self]; |
| 1670 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 1675 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| 1671 [center addObserver:self | 1676 [center addObserver:self |
| 1672 selector:@selector(bookmarkBubbleWindowWillClose:) | 1677 selector:@selector(bookmarkBubbleWindowWillClose:) |
| 1673 name:NSWindowWillCloseNotification | 1678 name:NSWindowWillCloseNotification |
| 1674 object:[bookmarkBubbleController_ window]]; | 1679 object:[bookmarkBubbleController_ window]]; |
| 1675 } | 1680 } |
| 1676 } | 1681 } |
| 1677 | 1682 |
| 1683 - (void)showTranslateBubbleForWebContents:(content::WebContents*)contents |
| 1684 step: |
| 1685 (TranslateTabHelper::TranslateStep)step |
| 1686 errorType:(TranslateErrors::Type)errorType { |
| 1687 [TranslateBubbleController showForParentWindow:self |
| 1688 webContents:contents |
| 1689 step:step |
| 1690 errorType:errorType]; |
| 1691 } |
| 1692 |
| 1678 // Nil out the weak bookmark bubble controller reference. | 1693 // Nil out the weak bookmark bubble controller reference. |
| 1679 - (void)bookmarkBubbleWindowWillClose:(NSNotification*)notification { | 1694 - (void)bookmarkBubbleWindowWillClose:(NSNotification*)notification { |
| 1680 DCHECK_EQ([notification object], [bookmarkBubbleController_ window]); | 1695 DCHECK_EQ([notification object], [bookmarkBubbleController_ window]); |
| 1681 | 1696 |
| 1682 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 1697 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| 1683 [center removeObserver:self | 1698 [center removeObserver:self |
| 1684 name:NSWindowWillCloseNotification | 1699 name:NSWindowWillCloseNotification |
| 1685 object:[bookmarkBubbleController_ window]]; | 1700 object:[bookmarkBubbleController_ window]]; |
| 1686 bookmarkBubbleController_ = nil; | 1701 bookmarkBubbleController_ = nil; |
| 1687 } | 1702 } |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2189 | 2204 |
| 2190 - (BOOL)supportsBookmarkBar { | 2205 - (BOOL)supportsBookmarkBar { |
| 2191 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2206 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2192 } | 2207 } |
| 2193 | 2208 |
| 2194 - (BOOL)isTabbedWindow { | 2209 - (BOOL)isTabbedWindow { |
| 2195 return browser_->is_type_tabbed(); | 2210 return browser_->is_type_tabbed(); |
| 2196 } | 2211 } |
| 2197 | 2212 |
| 2198 @end // @implementation BrowserWindowController(WindowType) | 2213 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |