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/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 Loading... |
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 Loading... |
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 |
OLD | NEW |