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

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: Updates to AndroidPO2TS and removing the DCHECK(signin_manager) from GetPrimaryAccountId 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_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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 virtual google_apis::CancelCallback AuthorizeApp( 181 virtual google_apis::CancelCallback AuthorizeApp(
180 const std::string& resource_id, 182 const std::string& resource_id,
181 const std::string& app_id, 183 const std::string& app_id,
182 const google_apis::AuthorizeAppCallback& callback) OVERRIDE; 184 const google_apis::AuthorizeAppCallback& callback) OVERRIDE;
183 185
184 private: 186 private:
185 // AuthService::Observer override. 187 // AuthService::Observer override.
186 virtual void OnOAuth2RefreshTokenChanged() OVERRIDE; 188 virtual void OnOAuth2RefreshTokenChanged() OVERRIDE;
187 189
188 OAuth2TokenService* oauth2_token_service_; // Not owned. 190 OAuth2TokenService* oauth2_token_service_; // Not owned.
191 std::string account_id_;
189 net::URLRequestContextGetter* url_request_context_getter_; // Not owned. 192 net::URLRequestContextGetter* url_request_context_getter_; // Not owned.
190 scoped_refptr<base::TaskRunner> blocking_task_runner_; 193 scoped_refptr<base::TaskRunner> blocking_task_runner_;
191 scoped_ptr<google_apis::RequestSender> sender_; 194 scoped_ptr<google_apis::RequestSender> sender_;
192 ObserverList<DriveServiceObserver> observers_; 195 ObserverList<DriveServiceObserver> observers_;
193 // Request objects should hold a copy of this, rather than a const 196 // Request objects should hold a copy of this, rather than a const
194 // reference, as they may outlive this object. 197 // reference, as they may outlive this object.
195 const google_apis::GDataWapiUrlGenerator url_generator_; 198 const google_apis::GDataWapiUrlGenerator url_generator_;
196 const std::string custom_user_agent_; 199 const std::string custom_user_agent_;
197 200
198 DISALLOW_COPY_AND_ASSIGN(GDataWapiService); 201 DISALLOW_COPY_AND_ASSIGN(GDataWapiService);
199 }; 202 };
200 203
201 } // namespace drive 204 } // namespace drive
202 205
203 #endif // CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_ 206 #endif // CHROME_BROWSER_DRIVE_GDATA_WAPI_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698