OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/api/principals_private/principals_private_ap
i.h" | 5 #include "chrome/browser/extensions/api/principals_private/principals_private_ap
i.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/profiles/avatar_menu.h" | 8 #include "chrome/browser/profiles/avatar_menu.h" |
9 #include "chrome/browser/profiles/profile_window.h" | 9 #include "chrome/browser/profiles/profile_window.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
12 #include "components/signin/core/browser/signin_header_helper.h" | 12 #include "components/signin/core/browser/signin_header_helper.h" |
| 13 #include "components/signin/core/browser/signin_metrics.h" |
13 #include "components/signin/core/common/profile_management_switches.h" | 14 #include "components/signin/core/common/profile_management_switches.h" |
14 | 15 |
15 namespace extensions { | 16 namespace extensions { |
16 | 17 |
17 bool PrincipalsPrivateExtensionFunction::RunSync() { | 18 bool PrincipalsPrivateExtensionFunction::RunSync() { |
18 if (!switches::IsEnableAccountConsistency()) { | 19 if (!switches::IsEnableAccountConsistency()) { |
19 SetError( | 20 SetError( |
20 "Need to enable account consistency to use principalsPrivate API."); | 21 "Need to enable account consistency to use principalsPrivate API."); |
21 return false; | 22 return false; |
22 } | 23 } |
23 return RunSyncSafe(); | 24 return RunSyncSafe(); |
24 } | 25 } |
25 | 26 |
26 bool PrincipalsPrivateSignOutFunction::RunSyncSafe() { | 27 bool PrincipalsPrivateSignOutFunction::RunSyncSafe() { |
27 Browser* browser = GetCurrentBrowser(); | 28 Browser* browser = GetCurrentBrowser(); |
28 if (browser) { | 29 if (browser) { |
29 profiles::LockProfile(browser->profile()); | 30 profiles::LockProfile(browser->profile()); |
30 } | 31 } |
31 return true; | 32 return true; |
32 } | 33 } |
33 | 34 |
34 bool PrincipalsPrivateShowAvatarBubbleFunction::RunSyncSafe() { | 35 bool PrincipalsPrivateShowAvatarBubbleFunction::RunSyncSafe() { |
35 Browser* browser = GetCurrentBrowser(); | 36 Browser* browser = GetCurrentBrowser(); |
36 if (browser) { | 37 if (browser) { |
37 browser->window()->ShowAvatarBubbleFromAvatarButton( | 38 browser->window()->ShowAvatarBubbleFromAvatarButton( |
38 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, | 39 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
39 signin::ManageAccountsParams()); | 40 signin::ManageAccountsParams(), |
| 41 signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN); |
40 } | 42 } |
41 return true; | 43 return true; |
42 } | 44 } |
43 | 45 |
44 } // namespace extensions | 46 } // namespace extensions |
OLD | NEW |