| 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_button.h" | 5 #include "chrome/browser/ui/views/avatar_menu_button.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/profiles/avatar_menu_model.h" | 11 #include "chrome/browser/profiles/avatar_menu_model.h" |
| 12 #include "chrome/browser/profiles/profile_info_util.h" | 12 #include "chrome/browser/profiles/profile_info_util.h" |
| 13 #include "chrome/browser/profiles/profile_manager.h" | |
| 14 #include "chrome/browser/profiles/profile_metrics.h" | 13 #include "chrome/browser/profiles/profile_metrics.h" |
| 14 #include "chrome/browser/profiles/profiles_state.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" | 16 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" |
| 17 #include "chrome/browser/ui/views/frame/browser_view.h" | 17 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 18 #include "chrome/browser/ui/views/profile_chooser_view.h" | 18 #include "chrome/browser/ui/views/profile_chooser_view.h" |
| 19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| 20 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
| 21 #include "ui/gfx/canvas.h" | 21 #include "ui/gfx/canvas.h" |
| 22 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| 23 | 23 |
| 24 static inline int Round(double x) { | 24 static inline int Round(double x) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 if (incognito_) | 89 if (incognito_) |
| 90 return; | 90 return; |
| 91 | 91 |
| 92 ShowAvatarBubble(); | 92 ShowAvatarBubble(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void AvatarMenuButton::ShowAvatarBubble() { | 95 void AvatarMenuButton::ShowAvatarBubble() { |
| 96 gfx::Point origin; | 96 gfx::Point origin; |
| 97 views::View::ConvertPointToScreen(this, &origin); | 97 views::View::ConvertPointToScreen(this, &origin); |
| 98 gfx::Rect bounds(origin, size()); | 98 gfx::Rect bounds(origin, size()); |
| 99 if (ProfileManager::IsNewProfileManagementEnabled()) { | 99 if (profiles::IsNewProfileManagementEnabled()) { |
| 100 ProfileChooserView::ShowBubble( | 100 ProfileChooserView::ShowBubble( |
| 101 this, views::BubbleBorder::TOP_LEFT, | 101 this, views::BubbleBorder::TOP_LEFT, |
| 102 views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bounds, browser_); | 102 views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bounds, browser_); |
| 103 } else { | 103 } else { |
| 104 AvatarMenuBubbleView::ShowBubble( | 104 AvatarMenuBubbleView::ShowBubble( |
| 105 this, views::BubbleBorder::TOP_LEFT, | 105 this, views::BubbleBorder::TOP_LEFT, |
| 106 views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bounds, browser_); | 106 views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, bounds, browser_); |
| 107 } | 107 } |
| 108 | 108 |
| 109 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); | 109 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); |
| 110 } | 110 } |
| OLD | NEW |