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

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

Issue 1292353006: Mac Changes for BubbleManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mcdb-mac-3.gitbr
Patch Set: Created 5 years, 4 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 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 20 matching lines...) Expand all
31 #include "chrome/browser/themes/theme_service_factory.h" 31 #include "chrome/browser/themes/theme_service_factory.h"
32 #include "chrome/browser/translate/chrome_translate_client.h" 32 #include "chrome/browser/translate/chrome_translate_client.h"
33 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" 33 #include "chrome/browser/ui/bookmarks/bookmark_editor.h"
34 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 34 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
35 #include "chrome/browser/ui/browser.h" 35 #include "chrome/browser/ui/browser.h"
36 #include "chrome/browser/ui/browser_command_controller.h" 36 #include "chrome/browser/ui/browser_command_controller.h"
37 #include "chrome/browser/ui/browser_commands.h" 37 #include "chrome/browser/ui/browser_commands.h"
38 #include "chrome/browser/ui/browser_instant_controller.h" 38 #include "chrome/browser/ui/browser_instant_controller.h"
39 #include "chrome/browser/ui/browser_list.h" 39 #include "chrome/browser/ui/browser_list.h"
40 #include "chrome/browser/ui/browser_window_state.h" 40 #include "chrome/browser/ui/browser_window_state.h"
41 #include "chrome/browser/ui/chrome_bubble_manager.h"
42 #include "chrome/browser/ui/chrome_bubble_manager_factory.h"
41 #import "chrome/browser/ui/cocoa/background_gradient_view.h" 43 #import "chrome/browser/ui/cocoa/background_gradient_view.h"
42 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 44 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
43 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h" 45 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h"
44 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" 46 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h"
45 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" 47 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h"
46 #import "chrome/browser/ui/cocoa/browser_window_layout.h" 48 #import "chrome/browser/ui/cocoa/browser_window_layout.h"
47 #import "chrome/browser/ui/cocoa/browser_window_utils.h" 49 #import "chrome/browser/ui/cocoa/browser_window_utils.h"
48 #import "chrome/browser/ui/cocoa/dev_tools_controller.h" 50 #import "chrome/browser/ui/cocoa/dev_tools_controller.h"
49 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" 51 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h"
50 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa .h" 52 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa .h"
(...skipping 10 matching lines...) Expand all
61 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h" 63 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h"
62 #import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h" 64 #import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h"
63 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" 65 #import "chrome/browser/ui/cocoa/status_bubble_mac.h"
64 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" 66 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h"
65 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" 67 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h"
66 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" 68 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
67 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" 69 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
68 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" 70 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
69 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 71 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
70 #import "chrome/browser/ui/cocoa/translate/translate_bubble_controller.h" 72 #import "chrome/browser/ui/cocoa/translate/translate_bubble_controller.h"
71 #include "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h"
72 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 73 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
73 #include "chrome/browser/ui/location_bar/location_bar.h" 74 #include "chrome/browser/ui/location_bar/location_bar.h"
74 #include "chrome/browser/ui/tabs/tab_strip_model.h" 75 #include "chrome/browser/ui/tabs/tab_strip_model.h"
75 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" 76 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
76 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" 77 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
77 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h" 78 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h"
78 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
79 #include "chrome/browser/ui/window_sizer/window_sizer.h" 79 #include "chrome/browser/ui/window_sizer/window_sizer.h"
80 #include "chrome/common/chrome_switches.h" 80 #include "chrome/common/chrome_switches.h"
81 #include "chrome/common/extensions/command.h" 81 #include "chrome/common/extensions/command.h"
82 #include "chrome/common/url_constants.h" 82 #include "chrome/common/url_constants.h"
83 #include "chrome/grit/generated_resources.h" 83 #include "chrome/grit/generated_resources.h"
84 #include "chrome/grit/locale_settings.h" 84 #include "chrome/grit/locale_settings.h"
85 #include "components/bookmarks/browser/bookmark_model.h" 85 #include "components/bookmarks/browser/bookmark_model.h"
86 #include "components/bookmarks/managed/managed_bookmark_service.h" 86 #include "components/bookmarks/managed/managed_bookmark_service.h"
87 #include "components/signin/core/common/profile_management_switches.h" 87 #include "components/signin/core/common/profile_management_switches.h"
88 #include "components/translate/core/browser/translate_manager.h" 88 #include "components/translate/core/browser/translate_manager.h"
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 - (void)setStarredState:(BOOL)isStarred { 1287 - (void)setStarredState:(BOOL)isStarred {
1288 [toolbarController_ setStarredState:isStarred]; 1288 [toolbarController_ setStarredState:isStarred];
1289 } 1289 }
1290 1290
1291 - (void)setCurrentPageIsTranslated:(BOOL)on { 1291 - (void)setCurrentPageIsTranslated:(BOOL)on {
1292 [toolbarController_ setTranslateIconLit:on]; 1292 [toolbarController_ setTranslateIconLit:on];
1293 } 1293 }
1294 1294
1295 - (void)onActiveTabChanged:(content::WebContents*)oldContents 1295 - (void)onActiveTabChanged:(content::WebContents*)oldContents
1296 to:(content::WebContents*)newContents { 1296 to:(content::WebContents*)newContents {
1297 // No need to remove previous bubble. It will close itself. 1297 ChromeBubbleManager* manager =
1298 PermissionBubbleManager* manager(nullptr); 1298 ChromeBubbleManagerFactory::GetForBrowserContext(browser_->profile());
1299 if (oldContents) { 1299 if (oldContents)
1300 manager = PermissionBubbleManager::FromWebContents(oldContents); 1300 manager->TabBlur(oldContents);
1301 if (manager) 1301 manager->TabFocus(newContents);
groby-ooo-7-16 2015/08/14 18:26:04 I believe we talked about having a manager per bro
hcarmona 2015/08/18 02:22:21 Done. Moved to the browser and no longer part of t
1302 manager->HideBubble();
1303 }
1304
1305 if (newContents) {
1306 manager = PermissionBubbleManager::FromWebContents(newContents);
1307 if (manager)
1308 manager->DisplayPendingRequests(browser_.get());
1309 }
1310 } 1302 }
1311 1303
1312 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble { 1304 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble {
1313 [toolbarController_ zoomChangedForActiveTab:canShowBubble]; 1305 [toolbarController_ zoomChangedForActiveTab:canShowBubble];
1314 } 1306 }
1315 1307
1316 // Return the rect, in WebKit coordinates (flipped), of the window's grow box 1308 // Return the rect, in WebKit coordinates (flipped), of the window's grow box
1317 // in the coordinate system of the content area of the currently selected tab. 1309 // in the coordinate system of the content area of the currently selected tab.
1318 // |windowGrowBox| needs to be in the window's coordinate system. 1310 // |windowGrowBox| needs to be in the window's coordinate system.
1319 - (NSRect)selectedTabGrowBoxRect { 1311 - (NSRect)selectedTabGrowBoxRect {
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1854 webContents:contents]; 1846 webContents:contents];
1855 [translateBubbleController_ showWindow:nil]; 1847 [translateBubbleController_ showWindow:nil];
1856 1848
1857 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; 1849 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
1858 [center addObserver:self 1850 [center addObserver:self
1859 selector:@selector(translateBubbleWindowWillClose:) 1851 selector:@selector(translateBubbleWindowWillClose:)
1860 name:NSWindowWillCloseNotification 1852 name:NSWindowWillCloseNotification
1861 object:[translateBubbleController_ window]]; 1853 object:[translateBubbleController_ window]];
1862 } 1854 }
1863 1855
1864 - (void)dismissPermissionBubble { 1856 - (void)dismissBubble {
1865 PermissionBubbleManager* manager = [self permissionBubbleManager]; 1857 ChromeBubbleManagerFactory::GetForBrowserContext(browser_->profile())
1866 if (manager) 1858 ->UserDismissBubbles([self webContents]);
1867 manager->HideBubble();
1868 } 1859 }
1869 1860
1870 // Nil out the weak translate bubble controller reference. 1861 // Nil out the weak translate bubble controller reference.
1871 - (void)translateBubbleWindowWillClose:(NSNotification*)notification { 1862 - (void)translateBubbleWindowWillClose:(NSNotification*)notification {
1872 DCHECK_EQ([notification object], [translateBubbleController_ window]); 1863 DCHECK_EQ([notification object], [translateBubbleController_ window]);
1873 1864
1874 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; 1865 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
1875 [center removeObserver:self 1866 [center removeObserver:self
1876 name:NSWindowWillCloseNotification 1867 name:NSWindowWillCloseNotification
1877 object:[translateBubbleController_ window]]; 1868 object:[translateBubbleController_ window]];
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
2266 2257
2267 - (BOOL)supportsBookmarkBar { 2258 - (BOOL)supportsBookmarkBar {
2268 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2259 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2269 } 2260 }
2270 2261
2271 - (BOOL)isTabbedWindow { 2262 - (BOOL)isTabbedWindow {
2272 return browser_->is_type_tabbed(); 2263 return browser_->is_type_tabbed();
2273 } 2264 }
2274 2265
2275 @end // @implementation BrowserWindowController(WindowType) 2266 @end // @implementation BrowserWindowController(WindowType)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698