| 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/views/avatar_menu_bubble_view.h" | 5 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/profiles/avatar_menu.h" | 14 #include "chrome/browser/profiles/avatar_menu.h" |
| 15 #include "chrome/browser/profiles/profile_info_cache.h" | 15 #include "chrome/browser/profiles/profile_info_cache.h" |
| 16 #include "chrome/browser/profiles/profile_info_util.h" | 16 #include "chrome/browser/profiles/profile_info_util.h" |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/browser/profiles/profile_window.h" | |
| 19 #include "chrome/browser/signin/signin_manager.h" | 18 #include "chrome/browser/signin/signin_manager.h" |
| 20 #include "chrome/browser/signin/signin_manager_factory.h" | 19 #include "chrome/browser/signin/signin_manager_factory.h" |
| 21 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 22 #include "chrome/browser/ui/browser_commands.h" | 21 #include "chrome/browser/ui/browser_commands.h" |
| 23 #include "chrome/browser/ui/browser_list.h" | 22 #include "chrome/browser/ui/browser_list.h" |
| 24 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
| 25 #include "chrome/browser/ui/chrome_pages.h" | 24 #include "chrome/browser/ui/chrome_pages.h" |
| 26 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 28 #include "content/public/browser/page_navigator.h" | 27 #include "content/public/browser/page_navigator.h" |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 return true; | 651 return true; |
| 653 } | 652 } |
| 654 | 653 |
| 655 void AvatarMenuBubbleView::ButtonPressed(views::Button* sender, | 654 void AvatarMenuBubbleView::ButtonPressed(views::Button* sender, |
| 656 const ui::Event& event) { | 655 const ui::Event& event) { |
| 657 if (sender->tag() == IDS_PROFILES_MANAGE_PROFILES_BUTTON) { | 656 if (sender->tag() == IDS_PROFILES_MANAGE_PROFILES_BUTTON) { |
| 658 std::string subpage = chrome::kSearchUsersSubPage; | 657 std::string subpage = chrome::kSearchUsersSubPage; |
| 659 chrome::ShowSettingsSubPage(browser_, subpage); | 658 chrome::ShowSettingsSubPage(browser_, subpage); |
| 660 return; | 659 return; |
| 661 } else if (sender->tag() == IDS_PROFILES_PROFILE_SIGNOUT_BUTTON) { | 660 } else if (sender->tag() == IDS_PROFILES_PROFILE_SIGNOUT_BUTTON) { |
| 662 profiles::LockProfile(browser_->profile()); | 661 avatar_menu_->BeginSignOut(); |
| 663 return; | 662 return; |
| 664 } | 663 } |
| 665 | 664 |
| 666 for (size_t i = 0; i < item_views_.size(); ++i) { | 665 for (size_t i = 0; i < item_views_.size(); ++i) { |
| 667 ProfileItemView* item_view = item_views_[i]; | 666 ProfileItemView* item_view = item_views_[i]; |
| 668 if (sender == item_view) { | 667 if (sender == item_view) { |
| 669 // Clicking on the active profile shouldn't do anything. | 668 // Clicking on the active profile shouldn't do anything. |
| 670 if (!item_view->item().active) { | 669 if (!item_view->item().active) { |
| 671 avatar_menu_->SwitchToProfile( | 670 avatar_menu_->SwitchToProfile( |
| 672 i, ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW); | 671 i, ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 Layout(); | 804 Layout(); |
| 806 if (GetBubbleFrameView()) | 805 if (GetBubbleFrameView()) |
| 807 SizeToContents(); | 806 SizeToContents(); |
| 808 } | 807 } |
| 809 | 808 |
| 810 void AvatarMenuBubbleView::SetBackgroundColors() { | 809 void AvatarMenuBubbleView::SetBackgroundColors() { |
| 811 for (size_t i = 0; i < item_views_.size(); ++i) { | 810 for (size_t i = 0; i < item_views_.size(); ++i) { |
| 812 item_views_[i]->OnHighlightStateChanged(); | 811 item_views_[i]->OnHighlightStateChanged(); |
| 813 } | 812 } |
| 814 } | 813 } |
| OLD | NEW |