| 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/signin/signin_header_helper.h" |
| 10 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
| 12 #include "components/signin/core/common/profile_management_switches.h" | 13 #include "components/signin/core/common/profile_management_switches.h" |
| 13 | 14 |
| 14 namespace extensions { | 15 namespace extensions { |
| 15 | 16 |
| 16 bool PrincipalsPrivateExtensionFunction::RunSync() { | 17 bool PrincipalsPrivateExtensionFunction::RunSync() { |
| 17 if (!switches::IsNewProfileManagement()) { | 18 if (!switches::IsNewProfileManagement()) { |
| 18 SetError( | 19 SetError( |
| 19 "Need to enable new-profile-management to use principalsPrivate API."); | 20 "Need to enable new-profile-management to use principalsPrivate API."); |
| 20 return false; | 21 return false; |
| 21 } | 22 } |
| 22 return RunSyncSafe(); | 23 return RunSyncSafe(); |
| 23 } | 24 } |
| 24 | 25 |
| 25 bool PrincipalsPrivateSignOutFunction::RunSyncSafe() { | 26 bool PrincipalsPrivateSignOutFunction::RunSyncSafe() { |
| 26 Browser* browser = GetCurrentBrowser(); | 27 Browser* browser = GetCurrentBrowser(); |
| 27 if (browser) { | 28 if (browser) { |
| 28 profiles::LockProfile(browser->profile()); | 29 profiles::LockProfile(browser->profile()); |
| 29 } | 30 } |
| 30 return true; | 31 return true; |
| 31 } | 32 } |
| 32 | 33 |
| 33 bool PrincipalsPrivateShowAvatarBubbleFunction::RunSyncSafe() { | 34 bool PrincipalsPrivateShowAvatarBubbleFunction::RunSyncSafe() { |
| 34 Browser* browser = GetCurrentBrowser(); | 35 Browser* browser = GetCurrentBrowser(); |
| 35 if (browser) { | 36 if (browser) { |
| 36 browser->window()->ShowAvatarBubbleFromAvatarButton( | 37 browser->window()->ShowAvatarBubbleFromAvatarButton( |
| 37 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT); | 38 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
| 39 signin::GAIA_SERVICE_TYPE_NONE); |
| 38 } | 40 } |
| 39 return true; | 41 return true; |
| 40 } | 42 } |
| 41 | 43 |
| 42 } // namespace extensions | 44 } // namespace extensions |
| OLD | NEW |