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

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

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing a bug affecting ProfileSyncService and CR comments. Created 7 years, 3 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 #ifndef CHROME_BROWSER_DRIVE_DRIVE_API_SERVICE_H_ 5 #ifndef CHROME_BROWSER_DRIVE_DRIVE_API_SERVICE_H_
6 #define CHROME_BROWSER_DRIVE_DRIVE_API_SERVICE_H_ 6 #define CHROME_BROWSER_DRIVE_DRIVE_API_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"
(...skipping 23 matching lines...) Expand all
34 34
35 namespace drive { 35 namespace drive {
36 36
37 // This class provides Drive request calls using Drive V2 API. 37 // This class provides Drive request calls using Drive V2 API.
38 // Details of API call are abstracted in each request class and this class 38 // Details of API call are abstracted in each request class and this class
39 // works as a thin wrapper for the API. 39 // works as a thin wrapper for the API.
40 class DriveAPIService : public DriveServiceInterface, 40 class DriveAPIService : public DriveServiceInterface,
41 public google_apis::AuthServiceObserver { 41 public google_apis::AuthServiceObserver {
42 public: 42 public:
43 // |oauth2_token_service| is used for obtaining OAuth2 access tokens. 43 // |oauth2_token_service| is used for obtaining OAuth2 access tokens.
44 // |account_id| identifies account used to obtain OAuth2 access tokens.
44 // |url_request_context_getter| is used to initialize URLFetcher. 45 // |url_request_context_getter| is used to initialize URLFetcher.
45 // |blocking_task_runner| is used to run blocking tasks (like parsing JSON). 46 // |blocking_task_runner| is used to run blocking tasks (like parsing JSON).
46 // |base_url| is used to generate URLs for communication with the drive API. 47 // |base_url| is used to generate URLs for communication with the drive API.
47 // |base_download_url| is used to generate URLs for downloading file from the 48 // |base_download_url| is used to generate URLs for downloading file from the
48 // drive API. 49 // drive API.
49 // |wapi_base_url| is used to generate URLs for shared_url. Unfortunately, 50 // |wapi_base_url| is used to generate URLs for shared_url. Unfortunately,
50 // the share_url is not yet supported on Drive API v2, so as a fallback, 51 // the share_url is not yet supported on Drive API v2, so as a fallback,
51 // we use GData WAPI. 52 // we use GData WAPI.
52 // |custom_user_agent| will be used for the User-Agent header in HTTP 53 // |custom_user_agent| will be used for the User-Agent header in HTTP
53 // requests issues through the service if the value is not empty. 54 // requests issues through the service if the value is not empty.
54 DriveAPIService( 55 DriveAPIService(
55 OAuth2TokenService* oauth2_token_service, 56 OAuth2TokenService* oauth2_token_service,
57 const std::string& account_id,
56 net::URLRequestContextGetter* url_request_context_getter, 58 net::URLRequestContextGetter* url_request_context_getter,
57 base::TaskRunner* blocking_task_runner, 59 base::TaskRunner* blocking_task_runner,
58 const GURL& base_url, 60 const GURL& base_url,
59 const GURL& base_download_url, 61 const GURL& base_download_url,
60 const GURL& wapi_base_url, 62 const GURL& wapi_base_url,
61 const std::string& custom_user_agent); 63 const std::string& custom_user_agent);
62 virtual ~DriveAPIService(); 64 virtual ~DriveAPIService();
63 65
64 // DriveServiceInterface Overrides 66 // DriveServiceInterface Overrides
65 virtual void Initialize() OVERRIDE; 67 virtual void Initialize() OVERRIDE;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 virtual google_apis::CancelCallback AuthorizeApp( 185 virtual google_apis::CancelCallback AuthorizeApp(
184 const std::string& resource_id, 186 const std::string& resource_id,
185 const std::string& app_id, 187 const std::string& app_id,
186 const google_apis::AuthorizeAppCallback& callback) OVERRIDE; 188 const google_apis::AuthorizeAppCallback& callback) OVERRIDE;
187 189
188 private: 190 private:
189 // AuthServiceObserver override. 191 // AuthServiceObserver override.
190 virtual void OnOAuth2RefreshTokenChanged() OVERRIDE; 192 virtual void OnOAuth2RefreshTokenChanged() OVERRIDE;
191 193
192 OAuth2TokenService* oauth2_token_service_; 194 OAuth2TokenService* oauth2_token_service_;
195 std::string account_id_;
193 net::URLRequestContextGetter* url_request_context_getter_; 196 net::URLRequestContextGetter* url_request_context_getter_;
194 scoped_refptr<base::TaskRunner> blocking_task_runner_; 197 scoped_refptr<base::TaskRunner> blocking_task_runner_;
195 scoped_ptr<google_apis::RequestSender> sender_; 198 scoped_ptr<google_apis::RequestSender> sender_;
196 ObserverList<DriveServiceObserver> observers_; 199 ObserverList<DriveServiceObserver> observers_;
197 google_apis::DriveApiUrlGenerator url_generator_; 200 google_apis::DriveApiUrlGenerator url_generator_;
198 google_apis::GDataWapiUrlGenerator wapi_url_generator_; 201 google_apis::GDataWapiUrlGenerator wapi_url_generator_;
199 const std::string custom_user_agent_; 202 const std::string custom_user_agent_;
200 203
201 DISALLOW_COPY_AND_ASSIGN(DriveAPIService); 204 DISALLOW_COPY_AND_ASSIGN(DriveAPIService);
202 }; 205 };
203 206
204 } // namespace drive 207 } // namespace drive
205 208
206 #endif // CHROME_BROWSER_DRIVE_DRIVE_API_SERVICE_H_ 209 #endif // CHROME_BROWSER_DRIVE_DRIVE_API_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698