| Index: chrome/browser/extensions/api/identity/identity_api.cc
|
| diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc
|
| index f76f95d3f3015a6d218732fea890d9b37e1a072c..ffd17a90e85c5f924a4f8f19c979f13a8fb1c709 100644
|
| --- a/chrome/browser/extensions/api/identity/identity_api.cc
|
| +++ b/chrome/browser/extensions/api/identity/identity_api.cc
|
| @@ -75,9 +75,6 @@ const int kCachedIssueAdviceTTLSeconds = 1;
|
|
|
| namespace {
|
|
|
| -static const char kChromiumDomainRedirectUrlPattern[] =
|
| - "https://%s.chromiumapp.org/";
|
| -
|
| #if defined(OS_CHROMEOS)
|
| // The list of apps that are allowed to use the Identity API to retrieve the
|
| // token from the device robot account in a public session.
|
| @@ -942,84 +939,4 @@ ExtensionFunction::ResponseAction IdentityRemoveCachedAuthTokenFunction::Run() {
|
| return RespondNow(NoArguments());
|
| }
|
|
|
| -IdentityLaunchWebAuthFlowFunction::IdentityLaunchWebAuthFlowFunction() {}
|
| -
|
| -IdentityLaunchWebAuthFlowFunction::~IdentityLaunchWebAuthFlowFunction() {
|
| - if (auth_flow_)
|
| - auth_flow_.release()->DetachDelegateAndDelete();
|
| -}
|
| -
|
| -bool IdentityLaunchWebAuthFlowFunction::RunAsync() {
|
| - if (GetProfile()->IsOffTheRecord()) {
|
| - error_ = identity_constants::kOffTheRecord;
|
| - return false;
|
| - }
|
| -
|
| - std::unique_ptr<identity::LaunchWebAuthFlow::Params> params(
|
| - identity::LaunchWebAuthFlow::Params::Create(*args_));
|
| - EXTENSION_FUNCTION_VALIDATE(params.get());
|
| -
|
| - GURL auth_url(params->details.url);
|
| - WebAuthFlow::Mode mode =
|
| - params->details.interactive && *params->details.interactive ?
|
| - WebAuthFlow::INTERACTIVE : WebAuthFlow::SILENT;
|
| -
|
| - // Set up acceptable target URLs. (Does not include chrome-extension
|
| - // scheme for this version of the API.)
|
| - InitFinalRedirectURLPrefix(extension()->id());
|
| -
|
| - AddRef(); // Balanced in OnAuthFlowSuccess/Failure.
|
| -
|
| - auth_flow_.reset(new WebAuthFlow(this, GetProfile(), auth_url, mode));
|
| - auth_flow_->Start();
|
| - return true;
|
| -}
|
| -
|
| -void IdentityLaunchWebAuthFlowFunction::InitFinalRedirectURLPrefixForTest(
|
| - const std::string& extension_id) {
|
| - InitFinalRedirectURLPrefix(extension_id);
|
| -}
|
| -
|
| -void IdentityLaunchWebAuthFlowFunction::InitFinalRedirectURLPrefix(
|
| - const std::string& extension_id) {
|
| - if (final_url_prefix_.is_empty()) {
|
| - final_url_prefix_ = GURL(base::StringPrintf(
|
| - kChromiumDomainRedirectUrlPattern, extension_id.c_str()));
|
| - }
|
| -}
|
| -
|
| -void IdentityLaunchWebAuthFlowFunction::OnAuthFlowFailure(
|
| - WebAuthFlow::Failure failure) {
|
| - switch (failure) {
|
| - case WebAuthFlow::WINDOW_CLOSED:
|
| - error_ = identity_constants::kUserRejected;
|
| - break;
|
| - case WebAuthFlow::INTERACTION_REQUIRED:
|
| - error_ = identity_constants::kInteractionRequired;
|
| - break;
|
| - case WebAuthFlow::LOAD_FAILED:
|
| - error_ = identity_constants::kPageLoadFailure;
|
| - break;
|
| - default:
|
| - NOTREACHED() << "Unexpected error from web auth flow: " << failure;
|
| - error_ = identity_constants::kInvalidRedirect;
|
| - break;
|
| - }
|
| - SendResponse(false);
|
| - if (auth_flow_)
|
| - auth_flow_.release()->DetachDelegateAndDelete();
|
| - Release(); // Balanced in RunAsync.
|
| -}
|
| -
|
| -void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange(
|
| - const GURL& redirect_url) {
|
| - if (redirect_url.GetWithEmptyPath() == final_url_prefix_) {
|
| - SetResult(base::MakeUnique<base::StringValue>(redirect_url.spec()));
|
| - SendResponse(true);
|
| - if (auth_flow_)
|
| - auth_flow_.release()->DetachDelegateAndDelete();
|
| - Release(); // Balanced in RunAsync.
|
| - }
|
| -}
|
| -
|
| } // namespace extensions
|
|
|