OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 AvatarMenuBubbleController* menu = | 699 AvatarMenuBubbleController* menu = |
700 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ | 700 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ |
701 anchoredAt:point]; | 701 anchoredAt:point]; |
702 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; | 702 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; |
703 [menu showWindow:nil]; | 703 [menu showWindow:nil]; |
704 } | 704 } |
705 | 705 |
706 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton( | 706 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton( |
707 AvatarBubbleMode mode) { | 707 AvatarBubbleMode mode) { |
708 AvatarBaseController* controller = [controller_ avatarButtonController]; | 708 AvatarBaseController* controller = [controller_ avatarButtonController]; |
709 [controller showAvatarBubble:[controller buttonView] withMode:mode]; | 709 NSView* anchor = [controller buttonView]; |
| 710 if ([anchor isHiddenOrHasHiddenAncestor]) |
| 711 anchor = [[controller_ toolbarController] wrenchButton]; |
| 712 [controller showAvatarBubble:anchor withMode:mode]; |
710 } | 713 } |
711 | 714 |
712 void BrowserWindowCocoa::ShowPasswordGenerationBubble( | 715 void BrowserWindowCocoa::ShowPasswordGenerationBubble( |
713 const gfx::Rect& rect, | 716 const gfx::Rect& rect, |
714 const autofill::PasswordForm& form, | 717 const autofill::PasswordForm& form, |
715 autofill::PasswordGenerator* password_generator) { | 718 autofill::PasswordGenerator* password_generator) { |
716 WebContents* web_contents = | 719 WebContents* web_contents = |
717 browser_->tab_strip_model()->GetActiveWebContents(); | 720 browser_->tab_strip_model()->GetActiveWebContents(); |
718 // We want to point to the middle of the rect instead of the right side. | 721 // We want to point to the middle of the rect instead of the right side. |
719 NSPoint point = GetPointForBubble(web_contents, | 722 NSPoint point = GetPointForBubble(web_contents, |
(...skipping 27 matching lines...) Expand all Loading... |
747 | 750 |
748 void BrowserWindowCocoa::ShowPageActionPopup( | 751 void BrowserWindowCocoa::ShowPageActionPopup( |
749 const extensions::Extension* extension) { | 752 const extensions::Extension* extension) { |
750 [cocoa_controller() activatePageAction:extension->id()]; | 753 [cocoa_controller() activatePageAction:extension->id()]; |
751 } | 754 } |
752 | 755 |
753 void BrowserWindowCocoa::ShowBrowserActionPopup( | 756 void BrowserWindowCocoa::ShowBrowserActionPopup( |
754 const extensions::Extension* extension) { | 757 const extensions::Extension* extension) { |
755 [cocoa_controller() activateBrowserAction:extension->id()]; | 758 [cocoa_controller() activateBrowserAction:extension->id()]; |
756 } | 759 } |
OLD | NEW |