| 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 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 api::identity::ProfileUserInfo profile_user_info; | 912 api::identity::ProfileUserInfo profile_user_info; |
| 913 if (extension()->permissions_data()->HasAPIPermission( | 913 if (extension()->permissions_data()->HasAPIPermission( |
| 914 APIPermission::kIdentityEmail)) { | 914 APIPermission::kIdentityEmail)) { |
| 915 profile_user_info.email = account.email; | 915 profile_user_info.email = account.email; |
| 916 profile_user_info.id = account.gaia; | 916 profile_user_info.id = account.gaia; |
| 917 } | 917 } |
| 918 | 918 |
| 919 return RespondNow(OneArgument(profile_user_info.ToValue())); | 919 return RespondNow(OneArgument(profile_user_info.ToValue())); |
| 920 } | 920 } |
| 921 | 921 |
| 922 IdentityRemoveCachedAuthTokenFunction::IdentityRemoveCachedAuthTokenFunction() { | |
| 923 } | |
| 924 | |
| 925 IdentityRemoveCachedAuthTokenFunction:: | |
| 926 ~IdentityRemoveCachedAuthTokenFunction() { | |
| 927 } | |
| 928 | |
| 929 ExtensionFunction::ResponseAction IdentityRemoveCachedAuthTokenFunction::Run() { | |
| 930 if (Profile::FromBrowserContext(browser_context())->IsOffTheRecord()) | |
| 931 return RespondNow(Error(identity_constants::kOffTheRecord)); | |
| 932 | |
| 933 std::unique_ptr<identity::RemoveCachedAuthToken::Params> params( | |
| 934 identity::RemoveCachedAuthToken::Params::Create(*args_)); | |
| 935 EXTENSION_FUNCTION_VALIDATE(params.get()); | |
| 936 IdentityAPI::GetFactoryInstance() | |
| 937 ->Get(browser_context()) | |
| 938 ->EraseCachedToken(extension()->id(), params->details.token); | |
| 939 return RespondNow(NoArguments()); | |
| 940 } | |
| 941 | |
| 942 } // namespace extensions | 922 } // namespace extensions |
| OLD | NEW |