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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 | 699 |
699 // |menu| will automatically release itself on close. | 700 // |menu| will automatically release itself on close. |
700 AvatarMenuBubbleController* menu = | 701 AvatarMenuBubbleController* menu = |
701 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ | 702 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ |
702 anchoredAt:point]; | 703 anchoredAt:point]; |
703 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; | 704 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; |
704 [menu showWindow:nil]; | 705 [menu showWindow:nil]; |
705 } | 706 } |
706 | 707 |
707 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton( | 708 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton( |
708 AvatarBubbleMode mode) { | 709 AvatarBubbleMode mode, signin::GAIA_SERVICE_TYPE service_type) { |
709 AvatarBaseController* controller = [controller_ avatarButtonController]; | 710 AvatarBaseController* controller = [controller_ avatarButtonController]; |
710 NSView* anchor = [controller buttonView]; | 711 NSView* anchor = [controller buttonView]; |
711 if ([anchor isHiddenOrHasHiddenAncestor]) | 712 if ([anchor isHiddenOrHasHiddenAncestor]) |
712 anchor = [[controller_ toolbarController] wrenchButton]; | 713 anchor = [[controller_ toolbarController] wrenchButton]; |
| 714 // TODO(mlerman): pass |service_type| to profile_chooser_controller to |
| 715 // implement UMA instrumentation of the menu. |
713 [controller showAvatarBubble:anchor withMode:mode]; | 716 [controller showAvatarBubble:anchor withMode:mode]; |
714 } | 717 } |
715 | 718 |
716 void BrowserWindowCocoa::ShowPasswordGenerationBubble( | 719 void BrowserWindowCocoa::ShowPasswordGenerationBubble( |
717 const gfx::Rect& rect, | 720 const gfx::Rect& rect, |
718 const autofill::PasswordForm& form, | 721 const autofill::PasswordForm& form, |
719 autofill::PasswordGenerator* password_generator) { | 722 autofill::PasswordGenerator* password_generator) { |
720 WebContents* web_contents = | 723 WebContents* web_contents = |
721 browser_->tab_strip_model()->GetActiveWebContents(); | 724 browser_->tab_strip_model()->GetActiveWebContents(); |
722 // We want to point to the middle of the rect instead of the right side. | 725 // We want to point to the middle of the rect instead of the right side. |
(...skipping 28 matching lines...) Expand all Loading... |
751 | 754 |
752 void BrowserWindowCocoa::ShowPageActionPopup( | 755 void BrowserWindowCocoa::ShowPageActionPopup( |
753 const extensions::Extension* extension) { | 756 const extensions::Extension* extension) { |
754 [cocoa_controller() activatePageAction:extension->id()]; | 757 [cocoa_controller() activatePageAction:extension->id()]; |
755 } | 758 } |
756 | 759 |
757 void BrowserWindowCocoa::ShowBrowserActionPopup( | 760 void BrowserWindowCocoa::ShowBrowserActionPopup( |
758 const extensions::Extension* extension) { | 761 const extensions::Extension* extension) { |
759 [cocoa_controller() activateBrowserAction:extension->id()]; | 762 [cocoa_controller() activateBrowserAction:extension->id()]; |
760 } | 763 } |
OLD | NEW |