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

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: Fixed variable name 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 #include "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.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 // TODO(leng): The PermissionBubbleManager for the previous contents should
1602 // have SetView(NULL) called. Fix this when the previous contents are
1603 // available here or move to BrowserWindowCocoa::OnActiveTabChanged().
1604 // crbug.com/340720
1605 PermissionBubbleManager::FromWebContents(contents)->SetView(
1606 permissionBubbleCocoa_.get());
1607
1595 // Must do this after bookmark and infobar updates to avoid 1608 // Must do this after bookmark and infobar updates to avoid
1596 // unnecesary resize in contents. 1609 // unnecesary resize in contents.
1597 [devToolsController_ updateDevToolsForWebContents:contents 1610 [devToolsController_ updateDevToolsForWebContents:contents
1598 withProfile:browser_->profile()]; 1611 withProfile:browser_->profile()];
1599 1612
1600 [self updateAllowOverlappingViews:[self inPresentationMode]]; 1613 [self updateAllowOverlappingViews:[self inPresentationMode]];
1601 } 1614 }
1602 1615
1603 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change 1616 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change
1604 withContents:(WebContents*)contents { 1617 withContents:(WebContents*)contents {
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 2248
2236 - (BOOL)supportsBookmarkBar { 2249 - (BOOL)supportsBookmarkBar {
2237 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2250 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2238 } 2251 }
2239 2252
2240 - (BOOL)isTabbedWindow { 2253 - (BOOL)isTabbedWindow {
2241 return browser_->is_type_tabbed(); 2254 return browser_->is_type_tabbed();
2242 } 2255 }
2243 2256
2244 @end // @implementation BrowserWindowController(WindowType) 2257 @end // @implementation BrowserWindowController(WindowType)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698