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

Side by Side Diff: chrome/browser/drive/gdata_wapi_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: Created 7 years, 4 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_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"
(...skipping 25 matching lines...) Expand all
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 // |account_id| identifies account used to obtain OAuth2 access tokens.
46 // |url_request_context_getter| is used to initialize URLFetcher. 47 // |url_request_context_getter| is used to initialize URLFetcher.
47 // |blocking_task_runner| is used to run blocking tasks (like parsing JSON). 48 // |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 49 // |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 50 // |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 51 // |custom_user_agent| is used for the User-Agent header in HTTP
51 // requests issued through the service if the value is not empty. 52 // requests issued through the service if the value is not empty.
52 GDataWapiService(OAuth2TokenService* oauth2_token_service, 53 GDataWapiService(OAuth2TokenService* oauth2_token_service,
54 const std::string& account_id,
53 net::URLRequestContextGetter* url_request_context_getter, 55 net::URLRequestContextGetter* url_request_context_getter,
54 base::TaskRunner* blocking_task_runner, 56 base::TaskRunner* blocking_task_runner,
55 const GURL& base_url, 57 const GURL& base_url,
56 const GURL& base_download_url, 58 const GURL& base_download_url,
57 const std::string& custom_user_agent); 59 const std::string& custom_user_agent);
58 virtual ~GDataWapiService(); 60 virtual ~GDataWapiService();
59 61
60 // DriveServiceInterface Overrides 62 // DriveServiceInterface Overrides
61 virtual void Initialize() OVERRIDE; 63 virtual void Initialize() OVERRIDE;
62 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; 64 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 virtual google_apis::CancelCallback AuthorizeApp( 175 virtual google_apis::CancelCallback AuthorizeApp(
174 const std::string& resource_id, 176 const std::string& resource_id,
175 const std::string& app_id, 177 const std::string& app_id,
176 const google_apis::AuthorizeAppCallback& callback) OVERRIDE; 178 const google_apis::AuthorizeAppCallback& callback) OVERRIDE;
177 179
178 private: 180 private:
179 // AuthService::Observer override. 181 // AuthService::Observer override.
180 virtual void OnOAuth2RefreshTokenChanged() OVERRIDE; 182 virtual void OnOAuth2RefreshTokenChanged() OVERRIDE;
181 183
182 OAuth2TokenService* oauth2_token_service_; // Not owned. 184 OAuth2TokenService* oauth2_token_service_; // Not owned.
185 std::string account_id_;
183 net::URLRequestContextGetter* url_request_context_getter_; // Not owned. 186 net::URLRequestContextGetter* url_request_context_getter_; // Not owned.
184 scoped_refptr<base::TaskRunner> blocking_task_runner_; 187 scoped_refptr<base::TaskRunner> blocking_task_runner_;
185 scoped_ptr<google_apis::RequestSender> sender_; 188 scoped_ptr<google_apis::RequestSender> sender_;
186 ObserverList<DriveServiceObserver> observers_; 189 ObserverList<DriveServiceObserver> observers_;
187 // Request objects should hold a copy of this, rather than a const 190 // Request objects should hold a copy of this, rather than a const
188 // reference, as they may outlive this object. 191 // reference, as they may outlive this object.
189 const google_apis::GDataWapiUrlGenerator url_generator_; 192 const google_apis::GDataWapiUrlGenerator url_generator_;
190 const std::string custom_user_agent_; 193 const std::string custom_user_agent_;
191 194
192 DISALLOW_COPY_AND_ASSIGN(GDataWapiService); 195 DISALLOW_COPY_AND_ASSIGN(GDataWapiService);
193 }; 196 };
194 197
195 } // namespace drive 198 } // namespace drive
196 199
197 #endif // CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_ 200 #endif // CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698