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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/signin/oauth2_token_service.h" | 12 #include "chrome/browser/signin/oauth2_token_service.h" |
13 #include "chrome/browser/signin/oauth2_token_service_factory.h" | 13 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
| 14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
14 #include "google_apis/gaia/gaia_urls.h" | 15 #include "google_apis/gaia/gaia_urls.h" |
15 #include "google_apis/gaia/google_service_auth_error.h" | 16 #include "google_apis/gaia/google_service_auth_error.h" |
16 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
17 #include "net/base/load_flags.h" | 18 #include "net/base/load_flags.h" |
18 #include "net/base/url_util.h" | 19 #include "net/base/url_util.h" |
19 #include "net/http/http_status_code.h" | 20 #include "net/http/http_status_code.h" |
20 #include "net/url_request/url_fetcher.h" | 21 #include "net/url_request/url_fetcher.h" |
21 #include "net/url_request/url_fetcher_delegate.h" | 22 #include "net/url_request/url_fetcher_delegate.h" |
22 | 23 |
23 namespace history { | 24 namespace history { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 url_(GURL(url)), | 65 url_(GURL(url)), |
65 response_code_(0), | 66 response_code_(0), |
66 callback_(callback) { | 67 callback_(callback) { |
67 } | 68 } |
68 | 69 |
69 // Tells the request to do its thang. | 70 // Tells the request to do its thang. |
70 void Start() { | 71 void Start() { |
71 OAuth2TokenService::ScopeSet oauth_scopes; | 72 OAuth2TokenService::ScopeSet oauth_scopes; |
72 oauth_scopes.insert(kHistoryOAuthScope); | 73 oauth_scopes.insert(kHistoryOAuthScope); |
73 | 74 |
74 OAuth2TokenService* token_service = | 75 ProfileOAuth2TokenService* token_service = |
75 OAuth2TokenServiceFactory::GetForProfile(profile_); | 76 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); |
76 token_request_ = token_service->StartRequest(oauth_scopes, this); | 77 token_request_ = token_service->StartRequest(oauth_scopes, this); |
77 } | 78 } |
78 | 79 |
79 // content::URLFetcherDelegate interface. | 80 // content::URLFetcherDelegate interface. |
80 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE { | 81 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE { |
81 DCHECK_EQ(source, url_fetcher_.get()); | 82 DCHECK_EQ(source, url_fetcher_.get()); |
82 response_code_ = url_fetcher_->GetResponseCode(); | 83 response_code_ = url_fetcher_->GetResponseCode(); |
83 url_fetcher_->GetResponseAsString(&response_body_); | 84 url_fetcher_->GetResponseAsString(&response_body_); |
84 url_fetcher_.reset(); | 85 url_fetcher_.reset(); |
85 callback_.Run(this, true); | 86 callback_.Run(this, true); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 base::Time end_time, | 291 base::Time end_time, |
291 const ExpireWebHistoryCallback& callback) { | 292 const ExpireWebHistoryCallback& callback) { |
292 std::vector<ExpireHistoryArgs> expire_list(1); | 293 std::vector<ExpireHistoryArgs> expire_list(1); |
293 expire_list.back().urls = restrict_urls; | 294 expire_list.back().urls = restrict_urls; |
294 expire_list.back().begin_time = begin_time; | 295 expire_list.back().begin_time = begin_time; |
295 expire_list.back().end_time = end_time; | 296 expire_list.back().end_time = end_time; |
296 return ExpireHistory(expire_list, callback); | 297 return ExpireHistory(expire_list, callback); |
297 } | 298 } |
298 | 299 |
299 } // namespace history | 300 } // namespace history |
OLD | NEW |