| 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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 return RespondNow(OneArgument(profile_user_info.ToValue())); | 921 return RespondNow(OneArgument(profile_user_info.ToValue())); |
| 922 } | 922 } |
| 923 | 923 |
| 924 IdentityRemoveCachedAuthTokenFunction::IdentityRemoveCachedAuthTokenFunction() { | 924 IdentityRemoveCachedAuthTokenFunction::IdentityRemoveCachedAuthTokenFunction() { |
| 925 } | 925 } |
| 926 | 926 |
| 927 IdentityRemoveCachedAuthTokenFunction:: | 927 IdentityRemoveCachedAuthTokenFunction:: |
| 928 ~IdentityRemoveCachedAuthTokenFunction() { | 928 ~IdentityRemoveCachedAuthTokenFunction() { |
| 929 } | 929 } |
| 930 | 930 |
| 931 bool IdentityRemoveCachedAuthTokenFunction::RunSync() { | 931 ExtensionFunction::ResponseAction IdentityRemoveCachedAuthTokenFunction::Run() { |
| 932 if (GetProfile()->IsOffTheRecord()) { | 932 if (Profile::FromBrowserContext(browser_context())->IsOffTheRecord()) |
| 933 error_ = identity_constants::kOffTheRecord; | 933 return RespondNow(Error(identity_constants::kOffTheRecord)); |
| 934 return false; | |
| 935 } | |
| 936 | 934 |
| 937 std::unique_ptr<identity::RemoveCachedAuthToken::Params> params( | 935 std::unique_ptr<identity::RemoveCachedAuthToken::Params> params( |
| 938 identity::RemoveCachedAuthToken::Params::Create(*args_)); | 936 identity::RemoveCachedAuthToken::Params::Create(*args_)); |
| 939 EXTENSION_FUNCTION_VALIDATE(params.get()); | 937 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 940 IdentityAPI::GetFactoryInstance()->Get(GetProfile())->EraseCachedToken( | 938 IdentityAPI::GetFactoryInstance() |
| 941 extension()->id(), params->details.token); | 939 ->Get(browser_context()) |
| 942 return true; | 940 ->EraseCachedToken(extension()->id(), params->details.token); |
| 941 return RespondNow(NoArguments()); |
| 943 } | 942 } |
| 944 | 943 |
| 945 IdentityLaunchWebAuthFlowFunction::IdentityLaunchWebAuthFlowFunction() {} | 944 IdentityLaunchWebAuthFlowFunction::IdentityLaunchWebAuthFlowFunction() {} |
| 946 | 945 |
| 947 IdentityLaunchWebAuthFlowFunction::~IdentityLaunchWebAuthFlowFunction() { | 946 IdentityLaunchWebAuthFlowFunction::~IdentityLaunchWebAuthFlowFunction() { |
| 948 if (auth_flow_) | 947 if (auth_flow_) |
| 949 auth_flow_.release()->DetachDelegateAndDelete(); | 948 auth_flow_.release()->DetachDelegateAndDelete(); |
| 950 } | 949 } |
| 951 | 950 |
| 952 bool IdentityLaunchWebAuthFlowFunction::RunAsync() { | 951 bool IdentityLaunchWebAuthFlowFunction::RunAsync() { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { | 1015 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { |
| 1017 SetResult(base::MakeUnique<base::StringValue>(redirect_url.spec())); | 1016 SetResult(base::MakeUnique<base::StringValue>(redirect_url.spec())); |
| 1018 SendResponse(true); | 1017 SendResponse(true); |
| 1019 if (auth_flow_) | 1018 if (auth_flow_) |
| 1020 auth_flow_.release()->DetachDelegateAndDelete(); | 1019 auth_flow_.release()->DetachDelegateAndDelete(); |
| 1021 Release(); // Balanced in RunAsync. | 1020 Release(); // Balanced in RunAsync. |
| 1022 } | 1021 } |
| 1023 } | 1022 } |
| 1024 | 1023 |
| 1025 } // namespace extensions | 1024 } // namespace extensions |
| OLD | NEW |