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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 #import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h" | 63 #import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h" |
64 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" | 64 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" |
65 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" | 65 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" |
66 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" | 66 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" |
67 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" | 67 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" |
68 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 68 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
69 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" | 69 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
70 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" | 70 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" |
71 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 71 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
72 #import "chrome/browser/ui/cocoa/translate/translate_bubble_controller.h" | 72 #import "chrome/browser/ui/cocoa/translate/translate_bubble_controller.h" |
73 #include "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h" | |
74 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 73 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
75 #include "chrome/browser/ui/location_bar/location_bar.h" | 74 #include "chrome/browser/ui/location_bar/location_bar.h" |
76 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 75 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
77 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 76 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
78 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" | 77 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" |
79 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h" | 78 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h" |
80 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | |
81 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 79 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
82 #include "chrome/common/chrome_switches.h" | 80 #include "chrome/common/chrome_switches.h" |
83 #include "chrome/common/extensions/command.h" | 81 #include "chrome/common/extensions/command.h" |
84 #include "chrome/common/url_constants.h" | 82 #include "chrome/common/url_constants.h" |
85 #include "chrome/grit/generated_resources.h" | 83 #include "chrome/grit/generated_resources.h" |
86 #include "chrome/grit/locale_settings.h" | 84 #include "chrome/grit/locale_settings.h" |
87 #include "components/bookmarks/browser/bookmark_model.h" | 85 #include "components/bookmarks/browser/bookmark_model.h" |
88 #include "components/signin/core/common/profile_management_switches.h" | 86 #include "components/signin/core/common/profile_management_switches.h" |
89 #include "components/translate/core/browser/translate_manager.h" | 87 #include "components/translate/core/browser/translate_manager.h" |
90 #include "components/translate/core/browser/translate_ui_delegate.h" | 88 #include "components/translate/core/browser/translate_ui_delegate.h" |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 } | 1257 } |
1260 | 1258 |
1261 - (void)setStarredState:(BOOL)isStarred { | 1259 - (void)setStarredState:(BOOL)isStarred { |
1262 [toolbarController_ setStarredState:isStarred]; | 1260 [toolbarController_ setStarredState:isStarred]; |
1263 } | 1261 } |
1264 | 1262 |
1265 - (void)setCurrentPageIsTranslated:(BOOL)on { | 1263 - (void)setCurrentPageIsTranslated:(BOOL)on { |
1266 [toolbarController_ setTranslateIconLit:on]; | 1264 [toolbarController_ setTranslateIconLit:on]; |
1267 } | 1265 } |
1268 | 1266 |
1269 - (void)onActiveTabChanged:(content::WebContents*)oldContents | |
1270 to:(content::WebContents*)newContents { | |
1271 // No need to remove previous bubble. It will close itself. | |
1272 PermissionBubbleManager* manager(nullptr); | |
1273 if (oldContents) { | |
1274 manager = PermissionBubbleManager::FromWebContents(oldContents); | |
1275 if (manager) | |
1276 manager->SetView(nullptr); | |
1277 } | |
1278 | |
1279 if (newContents) { | |
1280 if (!permissionBubbleCocoa_.get()) { | |
1281 DCHECK(browser_.get()); | |
1282 permissionBubbleCocoa_.reset(new PermissionBubbleCocoa(browser_.get())); | |
1283 } | |
1284 manager = PermissionBubbleManager::FromWebContents(newContents); | |
1285 if (manager) | |
1286 manager->SetView(permissionBubbleCocoa_.get()); | |
1287 } | |
1288 } | |
1289 | |
1290 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble { | 1267 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble { |
1291 [toolbarController_ zoomChangedForActiveTab:canShowBubble]; | 1268 [toolbarController_ zoomChangedForActiveTab:canShowBubble]; |
1292 } | 1269 } |
1293 | 1270 |
1294 // Return the rect, in WebKit coordinates (flipped), of the window's grow box | 1271 // Return the rect, in WebKit coordinates (flipped), of the window's grow box |
1295 // in the coordinate system of the content area of the currently selected tab. | 1272 // in the coordinate system of the content area of the currently selected tab. |
1296 // |windowGrowBox| needs to be in the window's coordinate system. | 1273 // |windowGrowBox| needs to be in the window's coordinate system. |
1297 - (NSRect)selectedTabGrowBoxRect { | 1274 - (NSRect)selectedTabGrowBoxRect { |
1298 NSWindow* window = [self window]; | 1275 NSWindow* window = [self window]; |
1299 if (![window respondsToSelector:@selector(_growBoxRect)]) | 1276 if (![window respondsToSelector:@selector(_growBoxRect)]) |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2232 | 2209 |
2233 - (BOOL)supportsBookmarkBar { | 2210 - (BOOL)supportsBookmarkBar { |
2234 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2211 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2235 } | 2212 } |
2236 | 2213 |
2237 - (BOOL)isTabbedWindow { | 2214 - (BOOL)isTabbedWindow { |
2238 return browser_->is_type_tabbed(); | 2215 return browser_->is_type_tabbed(); |
2239 } | 2216 } |
2240 | 2217 |
2241 @end // @implementation BrowserWindowController(WindowType) | 2218 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |