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

Side by Side Diff: chrome/browser/history/web_history_service.cc

Issue 11464028: Introduce ERR_NETWORK_CHANGED and allow URLFetcher to automatically retry on that error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed nits Created 8 years 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 | Annotate | Revision Log
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 "chrome/browser/history/web_history_service.h" 5 #include "chrome/browser/history/web_history_service.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/signin/oauth2_token_service.h" 9 #include "chrome/browser/signin/oauth2_token_service.h"
10 #include "chrome/browser/signin/oauth2_token_service_factory.h" 10 #include "chrome/browser/signin/oauth2_token_service_factory.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 token_request_.reset(); 93 token_request_.reset();
94 LOG(WARNING) << "Failed to get OAuth token: " << error.ToString(); 94 LOG(WARNING) << "Failed to get OAuth token: " << error.ToString();
95 query_history_callback_.Run(this, NULL); 95 query_history_callback_.Run(this, NULL);
96 } 96 }
97 97
98 // Helper for creating a new URLFetcher for the API request. 98 // Helper for creating a new URLFetcher for the API request.
99 net::URLFetcher* CreateUrlFetcher(const std::string& access_token) { 99 net::URLFetcher* CreateUrlFetcher(const std::string& access_token) {
100 net::URLFetcher* fetcher = net::URLFetcher::Create( 100 net::URLFetcher* fetcher = net::URLFetcher::Create(
101 url_, net::URLFetcher::GET, this); 101 url_, net::URLFetcher::GET, this);
102 fetcher->SetRequestContext(profile_->GetRequestContext()); 102 fetcher->SetRequestContext(profile_->GetRequestContext());
103 fetcher->SetMaxRetries(kMaxRetries); 103 fetcher->SetMaxRetriesOn5xx(kMaxRetries);
104 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 104 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
105 net::LOAD_DO_NOT_SAVE_COOKIES); 105 net::LOAD_DO_NOT_SAVE_COOKIES);
106 fetcher->AddExtraRequestHeader("Authorization: Bearer " + access_token); 106 fetcher->AddExtraRequestHeader("Authorization: Bearer " + access_token);
107 return fetcher; 107 return fetcher;
108 } 108 }
109 109
110 Profile* profile_; 110 Profile* profile_;
111 111
112 // The URL of the API endpoint. 112 // The URL of the API endpoint.
113 GURL url_; 113 GURL url_;
(...skipping 28 matching lines...) Expand all
142 const string16& text_query, 142 const string16& text_query,
143 const QueryOptions& options, 143 const QueryOptions& options,
144 const WebHistoryService::QueryWebHistoryCallback& callback) { 144 const WebHistoryService::QueryWebHistoryCallback& callback) {
145 scoped_ptr<RequestImpl> request( 145 scoped_ptr<RequestImpl> request(
146 new RequestImpl(profile_, kHistoryGetHistoryUrl, callback)); 146 new RequestImpl(profile_, kHistoryGetHistoryUrl, callback));
147 request->Start(); 147 request->Start();
148 return request.PassAs<Request>(); 148 return request.PassAs<Request>();
149 } 149 }
150 150
151 } // namespace history 151 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/google/google_url_tracker.cc ('k') | chrome/browser/metrics/variations/variations_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698