Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / local_discovery / gcd_api_flow_impl.h
blob6786e23e86e780532bf381ca18402a31d3a7ed04
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_GCD_API_FLOW_IMPL_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_GCD_API_FLOW_IMPL_H_
8 #include "chrome/browser/local_discovery/gcd_api_flow.h"
9 #include "net/url_request/url_fetcher.h"
10 #include "net/url_request/url_fetcher_delegate.h"
12 namespace local_discovery {
14 namespace {
15 const char kCloudPrintOAuthHeaderFormat[] = "Authorization: Bearer %s";
18 class GCDApiFlowImpl : public GCDApiFlow,
19 public net::URLFetcherDelegate,
20 public OAuth2TokenService::Consumer {
21 public:
22 // Create an OAuth2-based confirmation.
23 GCDApiFlowImpl(net::URLRequestContextGetter* request_context,
24 OAuth2TokenService* token_service,
25 const std::string& account_id);
27 ~GCDApiFlowImpl() override;
29 void Start(scoped_ptr<Request> request) override;
31 // net::URLFetcherDelegate implementation:
32 void OnURLFetchComplete(const net::URLFetcher* source) override;
34 // OAuth2TokenService::Consumer implementation:
35 void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
36 const std::string& access_token,
37 const base::Time& expiration_time) override;
38 void OnGetTokenFailure(const OAuth2TokenService::Request* request,
39 const GoogleServiceAuthError& error) override;
41 private:
42 void CreateRequest(const GURL& url);
44 scoped_ptr<net::URLFetcher> url_fetcher_;
45 scoped_ptr<OAuth2TokenService::Request> oauth_request_;
46 scoped_refptr<net::URLRequestContextGetter> request_context_;
47 OAuth2TokenService* token_service_;
48 std::string account_id_;
49 scoped_ptr<Request> request_;
51 DISALLOW_COPY_AND_ASSIGN(GCDApiFlowImpl);
54 } // namespace local_discovery
56 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_GCD_API_FLOW_IMPL_H_