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" |
11 #import "base/mac/sdk_forward_declarations.h" | 11 #import "base/mac/sdk_forward_declarations.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
17 #include "chrome/browser/download/download_shelf.h" | 17 #include "chrome/browser/download/download_shelf.h" |
18 #include "chrome/browser/extensions/tab_helper.h" | 18 #include "chrome/browser/extensions/tab_helper.h" |
19 #include "chrome/browser/fullscreen.h" | 19 #include "chrome/browser/fullscreen.h" |
20 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 20 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/shell_integration.h" | 22 #include "chrome/browser/shell_integration.h" |
| 23 #include "chrome/browser/signin/signin_header_helper.h" |
23 #include "chrome/browser/translate/translate_tab_helper.h" | 24 #include "chrome/browser/translate/translate_tab_helper.h" |
24 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
25 #include "chrome/browser/ui/browser_command_controller.h" | 26 #include "chrome/browser/ui/browser_command_controller.h" |
26 #include "chrome/browser/ui/browser_commands_mac.h" | 27 #include "chrome/browser/ui/browser_commands_mac.h" |
27 #include "chrome/browser/ui/browser_list.h" | 28 #include "chrome/browser/ui/browser_list.h" |
28 #include "chrome/browser/ui/browser_window_state.h" | 29 #include "chrome/browser/ui/browser_window_state.h" |
29 #import "chrome/browser/ui/cocoa/browser/edit_search_engine_cocoa_controller.h" | 30 #import "chrome/browser/ui/cocoa/browser/edit_search_engine_cocoa_controller.h" |
30 #import "chrome/browser/ui/cocoa/browser/password_generation_bubble_controller.h
" | 31 #import "chrome/browser/ui/cocoa/browser/password_generation_bubble_controller.h
" |
31 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 32 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
32 #import "chrome/browser/ui/cocoa/browser_window_utils.h" | 33 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 | 698 |
698 // |menu| will automatically release itself on close. | 699 // |menu| will automatically release itself on close. |
699 AvatarMenuBubbleController* menu = | 700 AvatarMenuBubbleController* menu = |
700 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ | 701 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ |
701 anchoredAt:point]; | 702 anchoredAt:point]; |
702 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; | 703 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; |
703 [menu showWindow:nil]; | 704 [menu showWindow:nil]; |
704 } | 705 } |
705 | 706 |
706 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton( | 707 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton( |
707 AvatarBubbleMode mode) { | 708 AvatarBubbleMode mode, signin::GAIAServiceType service_type) { |
708 AvatarBaseController* controller = [controller_ avatarButtonController]; | 709 AvatarBaseController* controller = [controller_ avatarButtonController]; |
709 NSView* anchor = [controller buttonView]; | 710 NSView* anchor = [controller buttonView]; |
710 if ([anchor isHiddenOrHasHiddenAncestor]) | 711 if ([anchor isHiddenOrHasHiddenAncestor]) |
711 anchor = [[controller_ toolbarController] wrenchButton]; | 712 anchor = [[controller_ toolbarController] wrenchButton]; |
| 713 // TODO(mlerman): pass |service_type| to profile_chooser_controller to |
| 714 // implement UMA instrumentation of the menu. |
712 [controller showAvatarBubble:anchor withMode:mode]; | 715 [controller showAvatarBubble:anchor withMode:mode]; |
713 } | 716 } |
714 | 717 |
715 void BrowserWindowCocoa::ShowPasswordGenerationBubble( | 718 void BrowserWindowCocoa::ShowPasswordGenerationBubble( |
716 const gfx::Rect& rect, | 719 const gfx::Rect& rect, |
717 const autofill::PasswordForm& form, | 720 const autofill::PasswordForm& form, |
718 autofill::PasswordGenerator* password_generator) { | 721 autofill::PasswordGenerator* password_generator) { |
719 WebContents* web_contents = | 722 WebContents* web_contents = |
720 browser_->tab_strip_model()->GetActiveWebContents(); | 723 browser_->tab_strip_model()->GetActiveWebContents(); |
721 // We want to point to the middle of the rect instead of the right side. | 724 // We want to point to the middle of the rect instead of the right side. |
(...skipping 28 matching lines...) Expand all Loading... |
750 | 753 |
751 void BrowserWindowCocoa::ShowPageActionPopup( | 754 void BrowserWindowCocoa::ShowPageActionPopup( |
752 const extensions::Extension* extension) { | 755 const extensions::Extension* extension) { |
753 [cocoa_controller() activatePageAction:extension->id()]; | 756 [cocoa_controller() activatePageAction:extension->id()]; |
754 } | 757 } |
755 | 758 |
756 void BrowserWindowCocoa::ShowBrowserActionPopup( | 759 void BrowserWindowCocoa::ShowBrowserActionPopup( |
757 const extensions::Extension* extension) { | 760 const extensions::Extension* extension) { |
758 [cocoa_controller() activateBrowserAction:extension->id()]; | 761 [cocoa_controller() activateBrowserAction:extension->id()]; |
759 } | 762 } |
OLD | NEW |