| Index: chrome/browser/local_discovery/privet_confirm_api_flow.h
|
| diff --git a/chrome/browser/local_discovery/privet_confirm_api_flow.h b/chrome/browser/local_discovery/privet_confirm_api_flow.h
|
| index f61117f517ee2c028815af3d6928f741c4ea7baf..61a6269492bcc932c5783b09498a16d6188b1a95 100644
|
| --- a/chrome/browser/local_discovery/privet_confirm_api_flow.h
|
| +++ b/chrome/browser/local_discovery/privet_confirm_api_flow.h
|
| @@ -7,28 +7,17 @@
|
|
|
| #include <string>
|
|
|
| -#include "chrome/browser/local_discovery/privet_http.h"
|
| -#include "google_apis/gaia/oauth2_token_service.h"
|
| -#include "net/url_request/url_fetcher.h"
|
| -#include "net/url_request/url_fetcher_delegate.h"
|
| +#include "chrome/browser/local_discovery/cloud_print_base_api_flow.h"
|
| #include "net/url_request/url_request_context_getter.h"
|
|
|
| +
|
| namespace local_discovery {
|
|
|
| // API call flow for server-side communication with cloudprint for registration.
|
| -class PrivetConfirmApiCallFlow : public net::URLFetcherDelegate,
|
| - public OAuth2TokenService::Consumer {
|
| +class PrivetConfirmApiCallFlow : public CloudPrintBaseApiFlow::Delegate {
|
| public:
|
| - // TODO(noamsml): Better error model for this class.
|
| - enum Status {
|
| - SUCCESS,
|
| - ERROR_TOKEN,
|
| - ERROR_NETWORK,
|
| - ERROR_HTTP_CODE,
|
| - ERROR_FROM_SERVER,
|
| - ERROR_MALFORMED_RESPONSE
|
| - };
|
| - typedef base::Callback<void(Status /*success*/)> ResponseCallback;
|
| + typedef base::Callback<void(CloudPrintBaseApiFlow::Status /*success*/)>
|
| + ResponseCallback;
|
|
|
| // Create an OAuth2-based confirmation
|
| PrivetConfirmApiCallFlow(net::URLRequestContextGetter* request_context,
|
| @@ -47,28 +36,19 @@ class PrivetConfirmApiCallFlow : public net::URLFetcherDelegate,
|
|
|
| void Start();
|
|
|
| - // net::URLFetcherDelegate implementation:
|
| - virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
|
| + virtual void OnCloudPrintAPIFlowError(
|
| + CloudPrintBaseApiFlow* flow,
|
| + CloudPrintBaseApiFlow::Status status) OVERRIDE;
|
| + virtual void OnCloudPrintAPIFlowComplete(
|
| + CloudPrintBaseApiFlow* flow,
|
| + const base::DictionaryValue* value) OVERRIDE;
|
|
|
| - // OAuth2TokenService::Consumer implementation:
|
| - virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
|
| - const std::string& access_token,
|
| - const base::Time& expiration_time) OVERRIDE;
|
| - virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
|
| - const GoogleServiceAuthError& error) OVERRIDE;
|
| + CloudPrintBaseApiFlow* GetBaseApiFlowForTests() {
|
| + return &flow_;
|
| + }
|
|
|
| private:
|
| - bool UseOAuth2() { return token_service_ != NULL; }
|
| -
|
| - void CreateRequest(const GURL& url);
|
| -
|
| - scoped_ptr<net::URLFetcher> url_fetcher_;
|
| - scoped_ptr<OAuth2TokenService::Request> oauth_request_;
|
| - scoped_refptr<net::URLRequestContextGetter> request_context_;
|
| - OAuth2TokenService* token_service_;
|
| - int user_index_;
|
| - std::string xsrf_token_;
|
| - GURL automated_claim_url_;
|
| + CloudPrintBaseApiFlow flow_;
|
| ResponseCallback callback_;
|
| };
|
|
|
|
|