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