| 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/extensions/api/identity/identity_api.h" | 5 #include "chrome/browser/extensions/api/identity/identity_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 | 873 |
| 874 // Component apps using auto_approve may use Chrome's client ID by | 874 // Component apps using auto_approve may use Chrome's client ID by |
| 875 // omitting the field. | 875 // omitting the field. |
| 876 if (client_id.empty() && extension()->location() == Manifest::COMPONENT && | 876 if (client_id.empty() && extension()->location() == Manifest::COMPONENT && |
| 877 oauth2_info.auto_approve) { | 877 oauth2_info.auto_approve) { |
| 878 client_id = GaiaUrls::GetInstance()->oauth2_chrome_client_id(); | 878 client_id = GaiaUrls::GetInstance()->oauth2_chrome_client_id(); |
| 879 } | 879 } |
| 880 return client_id; | 880 return client_id; |
| 881 } | 881 } |
| 882 | 882 |
| 883 IdentityGetProfileUserInfoFunction::IdentityGetProfileUserInfoFunction() { | |
| 884 } | |
| 885 | |
| 886 IdentityGetProfileUserInfoFunction::~IdentityGetProfileUserInfoFunction() { | |
| 887 } | |
| 888 | |
| 889 ExtensionFunction::ResponseAction IdentityGetProfileUserInfoFunction::Run() { | |
| 890 if (GetProfile()->IsOffTheRecord()) { | |
| 891 return RespondNow(Error(identity_constants::kOffTheRecord)); | |
| 892 } | |
| 893 | |
| 894 AccountInfo account = | |
| 895 AccountTrackerServiceFactory::GetForProfile(GetProfile()) | |
| 896 ->GetAccountInfo(GetPrimaryAccountId(GetProfile())); | |
| 897 api::identity::ProfileUserInfo profile_user_info; | |
| 898 if (extension()->permissions_data()->HasAPIPermission( | |
| 899 APIPermission::kIdentityEmail)) { | |
| 900 profile_user_info.email = account.email; | |
| 901 profile_user_info.id = account.gaia; | |
| 902 } | |
| 903 | |
| 904 return RespondNow(OneArgument(profile_user_info.ToValue())); | |
| 905 } | |
| 906 | |
| 907 } // namespace extensions | 883 } // namespace extensions |
| OLD | NEW |