Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: extensions/browser/updater/extension_downloader.cc

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address final comments Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "extensions/browser/updater/extension_downloader.h" 5 #include "extensions/browser/updater/extension_downloader.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 return true; 908 return true;
909 case ExtensionFetch::CREDENTIALS_OAUTH2_TOKEN: 909 case ExtensionFetch::CREDENTIALS_OAUTH2_TOKEN:
910 fetch->oauth2_attempt_count++; 910 fetch->oauth2_attempt_count++;
911 // OAuth2 may fail due to an expired access token, in which case we 911 // OAuth2 may fail due to an expired access token, in which case we
912 // should invalidate the token and try again. 912 // should invalidate the token and try again.
913 if (response_code == net::HTTP_UNAUTHORIZED && 913 if (response_code == net::HTTP_UNAUTHORIZED &&
914 fetch->oauth2_attempt_count <= kMaxOAuth2Attempts) { 914 fetch->oauth2_attempt_count <= kMaxOAuth2Attempts) {
915 DCHECK(identity_provider_.get()); 915 DCHECK(identity_provider_.get());
916 OAuth2TokenService::ScopeSet webstore_scopes; 916 OAuth2TokenService::ScopeSet webstore_scopes;
917 webstore_scopes.insert(kWebstoreOAuth2Scope); 917 webstore_scopes.insert(kWebstoreOAuth2Scope);
918 identity_provider_->GetTokenService()->InvalidateToken( 918 identity_provider_->GetTokenService()->InvalidateAccessToken(
919 identity_provider_->GetActiveAccountId(), 919 identity_provider_->GetActiveAccountId(), webstore_scopes,
920 webstore_scopes,
921 access_token_); 920 access_token_);
922 access_token_.clear(); 921 access_token_.clear();
923 return true; 922 return true;
924 } 923 }
925 // Either there is no Gaia identity available, the active identity 924 // Either there is no Gaia identity available, the active identity
926 // doesn't have access to this resource, or the server keeps returning 925 // doesn't have access to this resource, or the server keeps returning
927 // 401s and we've retried too many times. Fall back on cookies. 926 // 401s and we've retried too many times. Fall back on cookies.
928 if (access_token_.empty() || response_code == net::HTTP_FORBIDDEN || 927 if (access_token_.empty() || response_code == net::HTTP_FORBIDDEN ||
929 fetch->oauth2_attempt_count > kMaxOAuth2Attempts) { 928 fetch->oauth2_attempt_count > kMaxOAuth2Attempts) {
930 fetch->credentials = ExtensionFetch::CREDENTIALS_COOKIES; 929 fetch->credentials = ExtensionFetch::CREDENTIALS_COOKIES;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 const GURL& update_url, 968 const GURL& update_url,
970 int request_id) { 969 int request_id) {
971 ManifestFetchData::PingMode ping_mode = ManifestFetchData::NO_PING; 970 ManifestFetchData::PingMode ping_mode = ManifestFetchData::NO_PING;
972 if (update_url.DomainIs(ping_enabled_domain_.c_str())) 971 if (update_url.DomainIs(ping_enabled_domain_.c_str()))
973 ping_mode = ManifestFetchData::PING_WITH_ENABLED_STATE; 972 ping_mode = ManifestFetchData::PING_WITH_ENABLED_STATE;
974 return new ManifestFetchData( 973 return new ManifestFetchData(
975 update_url, request_id, brand_code_, manifest_query_params_, ping_mode); 974 update_url, request_id, brand_code_, manifest_query_params_, ping_mode);
976 } 975 }
977 976
978 } // namespace extensions 977 } // namespace extensions
OLDNEW
« no previous file with comments | « components/signin/ios/browser/profile_oauth2_token_service_ios_unittest.mm ('k') | extensions/shell/app_shell.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698