Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / local_discovery / privet_confirm_api_flow.h
blob9f2ace161c6cea72766577874199cb9c0f7e37bc
1 // Copyright 2013 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_PRIVET_CONFIRM_API_FLOW_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_CONFIRM_API_FLOW_H_
8 #include <string>
10 #include "chrome/browser/local_discovery/cloud_print_base_api_flow.h"
11 #include "net/url_request/url_request_context_getter.h"
14 namespace local_discovery {
16 // API call flow for server-side communication with cloudprint for registration.
17 class PrivetConfirmApiCallFlow : public CloudPrintBaseApiFlow::Delegate {
18 public:
19 typedef base::Callback<void(CloudPrintBaseApiFlow::Status /*success*/)>
20 ResponseCallback;
22 // Create an OAuth2-based confirmation
23 PrivetConfirmApiCallFlow(net::URLRequestContextGetter* request_context,
24 OAuth2TokenService* token_service_,
25 const std::string& account_id,
26 const GURL& automated_claim_url,
27 const ResponseCallback& callback);
29 // Create a cookie-based confirmation
30 PrivetConfirmApiCallFlow(net::URLRequestContextGetter* request_context,
31 int user_index,
32 const std::string& xsrf_token,
33 const GURL& automated_claim_url,
34 const ResponseCallback& callback);
36 virtual ~PrivetConfirmApiCallFlow();
38 void Start();
40 virtual void OnCloudPrintAPIFlowError(
41 CloudPrintBaseApiFlow* flow,
42 CloudPrintBaseApiFlow::Status status) OVERRIDE;
43 virtual void OnCloudPrintAPIFlowComplete(
44 CloudPrintBaseApiFlow* flow,
45 const base::DictionaryValue* value) OVERRIDE;
47 CloudPrintBaseApiFlow* GetBaseApiFlowForTests() {
48 return &flow_;
51 private:
52 CloudPrintBaseApiFlow flow_;
53 ResponseCallback callback_;
56 } // namespace local_discovery
58 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_CONFIRM_API_FLOW_H_