Update mojo surfaces bindings and mojo/cc/ glue
[chromium-blink-merge.git] / chrome / browser / local_discovery / gcd_api_flow_impl.h
blobb636cfd5e8b5d4e3ca94ee88dcb3356149bd1bb8
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 virtual ~GCDApiFlowImpl();
29 virtual void Start(scoped_ptr<Request> request) OVERRIDE;
31 // net::URLFetcherDelegate implementation:
32 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
34 // OAuth2TokenService::Consumer implementation:
35 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
36 const std::string& access_token,
37 const base::Time& expiration_time) OVERRIDE;
38 virtual 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_