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

Side by Side Diff: chrome/browser/drive/gdata_wapi_service.h

Issue 63923002: net: Use SequencedTaskRunner for URLFetcherResponseWriter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add include Created 7 years, 1 month 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 #ifndef CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_ 5 #ifndef CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_
6 #define CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_ 6 #define CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "chrome/browser/drive/drive_service_interface.h" 14 #include "chrome/browser/drive/drive_service_interface.h"
15 #include "chrome/browser/google_apis/auth_service_interface.h" 15 #include "chrome/browser/google_apis/auth_service_interface.h"
16 #include "chrome/browser/google_apis/auth_service_observer.h" 16 #include "chrome/browser/google_apis/auth_service_observer.h"
17 #include "chrome/browser/google_apis/gdata_wapi_requests.h" 17 #include "chrome/browser/google_apis/gdata_wapi_requests.h"
18 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" 18 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h"
19 19
20 class GURL; 20 class GURL;
21 class OAuth2TokenService; 21 class OAuth2TokenService;
22 22
23 namespace base { 23 namespace base {
24 class FilePath; 24 class FilePath;
25 class TaskRunner; 25 class SequencedTaskRunner;
26 } 26 }
27 27
28 namespace google_apis { 28 namespace google_apis {
29 class RequestSender; 29 class RequestSender;
30 } 30 }
31 31
32 namespace net { 32 namespace net {
33 class URLRequestContextGetter; 33 class URLRequestContextGetter;
34 } // namespace net 34 } // namespace net
35 35
36 namespace drive { 36 namespace drive {
37 37
38 // This class provides documents feed service calls for WAPI (codename for 38 // This class provides documents feed service calls for WAPI (codename for
39 // DocumentsList API). 39 // DocumentsList API).
40 // Details of API call are abstracted in each request class and this class 40 // Details of API call are abstracted in each request class and this class
41 // works as a thin wrapper for the API. 41 // works as a thin wrapper for the API.
42 class GDataWapiService : public DriveServiceInterface, 42 class GDataWapiService : public DriveServiceInterface,
43 public google_apis::AuthServiceObserver { 43 public google_apis::AuthServiceObserver {
44 public: 44 public:
45 // |oauth2_token_service| is used for obtaining OAuth2 access tokens. 45 // |oauth2_token_service| is used for obtaining OAuth2 access tokens.
46 // |url_request_context_getter| is used to initialize URLFetcher. 46 // |url_request_context_getter| is used to initialize URLFetcher.
47 // |blocking_task_runner| is used to run blocking tasks (like parsing JSON). 47 // |blocking_task_runner| is used to run blocking tasks (like parsing JSON).
48 // |base_url| is used to generate URLs for communicating with the WAPI 48 // |base_url| is used to generate URLs for communicating with the WAPI
49 // |base_download_url| is used to generate URLs for downloading file with WAPI 49 // |base_download_url| is used to generate URLs for downloading file with WAPI
50 // |custom_user_agent| is used for the User-Agent header in HTTP 50 // |custom_user_agent| is used for the User-Agent header in HTTP
51 // requests issued through the service if the value is not empty. 51 // requests issued through the service if the value is not empty.
52 GDataWapiService(OAuth2TokenService* oauth2_token_service, 52 GDataWapiService(OAuth2TokenService* oauth2_token_service,
53 net::URLRequestContextGetter* url_request_context_getter, 53 net::URLRequestContextGetter* url_request_context_getter,
54 base::TaskRunner* blocking_task_runner, 54 base::SequencedTaskRunner* blocking_task_runner,
55 const GURL& base_url, 55 const GURL& base_url,
56 const GURL& base_download_url, 56 const GURL& base_download_url,
57 const std::string& custom_user_agent); 57 const std::string& custom_user_agent);
58 virtual ~GDataWapiService(); 58 virtual ~GDataWapiService();
59 59
60 // DriveServiceInterface Overrides 60 // DriveServiceInterface Overrides
61 virtual void Initialize(const std::string& account_id) OVERRIDE; 61 virtual void Initialize(const std::string& account_id) OVERRIDE;
62 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; 62 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE;
63 virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; 63 virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE;
64 virtual bool CanSendRequest() const OVERRIDE; 64 virtual bool CanSendRequest() const OVERRIDE;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 virtual google_apis::CancelCallback GetRemainingResourceList( 184 virtual google_apis::CancelCallback GetRemainingResourceList(
185 const GURL& next_link, 185 const GURL& next_link,
186 const google_apis::GetResourceListCallback& callback) OVERRIDE; 186 const google_apis::GetResourceListCallback& callback) OVERRIDE;
187 187
188 private: 188 private:
189 // AuthService::Observer override. 189 // AuthService::Observer override.
190 virtual void OnOAuth2RefreshTokenChanged() OVERRIDE; 190 virtual void OnOAuth2RefreshTokenChanged() OVERRIDE;
191 191
192 OAuth2TokenService* oauth2_token_service_; // Not owned. 192 OAuth2TokenService* oauth2_token_service_; // Not owned.
193 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 193 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
194 scoped_refptr<base::TaskRunner> blocking_task_runner_; 194 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
195 scoped_ptr<google_apis::RequestSender> sender_; 195 scoped_ptr<google_apis::RequestSender> sender_;
196 ObserverList<DriveServiceObserver> observers_; 196 ObserverList<DriveServiceObserver> observers_;
197 // Request objects should hold a copy of this, rather than a const 197 // Request objects should hold a copy of this, rather than a const
198 // reference, as they may outlive this object. 198 // reference, as they may outlive this object.
199 const google_apis::GDataWapiUrlGenerator url_generator_; 199 const google_apis::GDataWapiUrlGenerator url_generator_;
200 const std::string custom_user_agent_; 200 const std::string custom_user_agent_;
201 201
202 DISALLOW_COPY_AND_ASSIGN(GDataWapiService); 202 DISALLOW_COPY_AND_ASSIGN(GDataWapiService);
203 }; 203 };
204 204
205 } // namespace drive 205 } // namespace drive
206 206
207 #endif // CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_ 207 #endif // CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698