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

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

Issue 151593005: Implement permission bubble view for Cocoa. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added a few comments 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 | Annotate | Revision Log
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" 47 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h"
48 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa .h" 48 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa .h"
49 #import "chrome/browser/ui/cocoa/fast_resize_view.h" 49 #import "chrome/browser/ui/cocoa/fast_resize_view.h"
50 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" 50 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h"
51 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" 51 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h"
52 #import "chrome/browser/ui/cocoa/framed_browser_window.h" 52 #import "chrome/browser/ui/cocoa/framed_browser_window.h"
53 #import "chrome/browser/ui/cocoa/fullscreen_window.h" 53 #import "chrome/browser/ui/cocoa/fullscreen_window.h"
54 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" 54 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h"
55 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" 55 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h"
56 #import "chrome/browser/ui/cocoa/nsview_additions.h" 56 #import "chrome/browser/ui/cocoa/nsview_additions.h"
57 #include "chrome/browser/ui/cocoa/permission_bubble_cocoa.h"
57 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" 58 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h"
58 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" 59 #import "chrome/browser/ui/cocoa/status_bubble_mac.h"
59 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" 60 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h"
60 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" 61 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h"
61 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" 62 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h"
62 #import "chrome/browser/ui/cocoa/tabpose_window.h" 63 #import "chrome/browser/ui/cocoa/tabpose_window.h"
63 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" 64 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
64 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" 65 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
65 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" 66 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
66 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 67 #import "chrome/browser/ui/cocoa/toolbar/toolbar_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"
74 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
73 #include "chrome/browser/ui/window_sizer/window_sizer.h" 75 #include "chrome/browser/ui/window_sizer/window_sizer.h"
74 #include "chrome/common/chrome_switches.h" 76 #include "chrome/common/chrome_switches.h"
75 #include "chrome/common/profile_management_switches.h" 77 #include "chrome/common/profile_management_switches.h"
76 #include "chrome/common/url_constants.h" 78 #include "chrome/common/url_constants.h"
77 #include "components/web_modal/web_contents_modal_dialog_manager.h" 79 #include "components/web_modal/web_contents_modal_dialog_manager.h"
78 #include "content/public/browser/render_view_host.h" 80 #include "content/public/browser/render_view_host.h"
79 #include "content/public/browser/render_widget_host_view.h" 81 #include "content/public/browser/render_widget_host_view.h"
80 #include "content/public/browser/web_contents.h" 82 #include "content/public/browser/web_contents.h"
81 #include "content/public/browser/web_contents_view.h" 83 #include "content/public/browser/web_contents_view.h"
82 #include "grit/chromium_strings.h" 84 #include "grit/chromium_strings.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 NSRect frame = [[self window] frame]; 418 NSRect frame = [[self window] frame];
417 frame.size.height += convertedSize.height; 419 frame.size.height += convertedSize.height;
418 frame.origin.y -= convertedSize.height; 420 frame.origin.y -= convertedSize.height;
419 [[self window] setFrame:frame display:NO]; 421 [[self window] setFrame:frame display:NO];
420 } 422 }
421 } 423 }
422 424
423 // Create the bridge for the status bubble. 425 // Create the bridge for the status bubble.
424 statusBubble_ = new StatusBubbleMac([self window], self); 426 statusBubble_ = new StatusBubbleMac([self window], self);
425 427
428 // Create the permissions bubble.
429 permissionBubbleCocoa_.reset(new PermissionBubbleCocoa([self window]));
430
426 // Register for application hide/unhide notifications. 431 // Register for application hide/unhide notifications.
427 [[NSNotificationCenter defaultCenter] 432 [[NSNotificationCenter defaultCenter]
428 addObserver:self 433 addObserver:self
429 selector:@selector(applicationDidHide:) 434 selector:@selector(applicationDidHide:)
430 name:NSApplicationDidHideNotification 435 name:NSApplicationDidHideNotification
431 object:nil]; 436 object:nil];
432 [[NSNotificationCenter defaultCenter] 437 [[NSNotificationCenter defaultCenter]
433 addObserver:self 438 addObserver:self
434 selector:@selector(applicationDidUnhide:) 439 selector:@selector(applicationDidUnhide:)
435 name:NSApplicationDidUnhideNotification 440 name:NSApplicationDidUnhideNotification
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 windowShim_->UpdateTitleBar(); 1590 windowShim_->UpdateTitleBar();
1586 1591
1587 // Update the bookmark bar. 1592 // Update the bookmark bar.
1588 // TODO(viettrungluu): perhaps update to not terminate running animations (if 1593 // TODO(viettrungluu): perhaps update to not terminate running animations (if
1589 // applicable)? 1594 // applicable)?
1590 windowShim_->BookmarkBarStateChanged( 1595 windowShim_->BookmarkBarStateChanged(
1591 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); 1596 BookmarkBar::DONT_ANIMATE_STATE_CHANGE);
1592 1597
1593 [infoBarContainerController_ changeWebContents:contents]; 1598 [infoBarContainerController_ changeWebContents:contents];
1594 1599
1600 // No need to remove previous bubble. It will close itself.
1601 PermissionBubbleManager::FromWebContents(contents)->SetView(
groby-ooo-7-16 2014/01/31 22:31:51 Is it ok for the PBM to not have its view NULLED o
leng 2014/02/03 22:38:04 It would be safer to NULL out view for the previou
groby-ooo-7-16 2014/02/04 02:39:29 Ugh. I missed that we only get the new contents. O
leng 2014/02/04 21:48:22 I filed a bug, and added a comment. We'll see what
1602 permissionBubbleCocoa_.get());
1603
1595 // Must do this after bookmark and infobar updates to avoid 1604 // Must do this after bookmark and infobar updates to avoid
1596 // unnecesary resize in contents. 1605 // unnecesary resize in contents.
1597 [devToolsController_ updateDevToolsForWebContents:contents 1606 [devToolsController_ updateDevToolsForWebContents:contents
1598 withProfile:browser_->profile()]; 1607 withProfile:browser_->profile()];
1599 1608
1600 [self updateAllowOverlappingViews:[self inPresentationMode]]; 1609 [self updateAllowOverlappingViews:[self inPresentationMode]];
1601 } 1610 }
1602 1611
1603 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change 1612 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change
1604 withContents:(WebContents*)contents { 1613 withContents:(WebContents*)contents {
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 2244
2236 - (BOOL)supportsBookmarkBar { 2245 - (BOOL)supportsBookmarkBar {
2237 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2246 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2238 } 2247 }
2239 2248
2240 - (BOOL)isTabbedWindow { 2249 - (BOOL)isTabbedWindow {
2241 return browser_->is_type_tabbed(); 2250 return browser_->is_type_tabbed();
2242 } 2251 }
2243 2252
2244 @end // @implementation BrowserWindowController(WindowType) 2253 @end // @implementation BrowserWindowController(WindowType)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698