1a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch// Copyright 2013 The Chromium Authors. All rights reserved. 2a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch// Use of this source code is governed by a BSD-style license that can be 3a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch// found in the LICENSE file. 4a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 5a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch#ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_CONFIRM_API_FLOW_H_ 6a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch#define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_CONFIRM_API_FLOW_H_ 7a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 8a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch#include <string> 9a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 10f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)#include "base/values.h" 11cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "chrome/browser/local_discovery/gcd_api_flow.h" 12a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch#include "net/url_request/url_request_context_getter.h" 13a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 14a3f7b4e666c476898878fa745f637129375cd889Ben Murdochnamespace local_discovery { 15a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 16cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// API call flow for server-side communication with CloudPrint for registration. 17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class PrivetConfirmApiCallFlow : public CloudPrintApiFlowRequest { 18a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch public: 19cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) typedef base::Callback<void(GCDApiFlow::Status /*success*/)> ResponseCallback; 20a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 21424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // Create an OAuth2-based confirmation 22cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) PrivetConfirmApiCallFlow(const std::string& token, 23424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) const ResponseCallback& callback); 24424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 25a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch virtual ~PrivetConfirmApiCallFlow(); 26a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 27cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void OnGCDAPIFlowError(GCDApiFlow::Status status) OVERRIDE; 28cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void OnGCDAPIFlowComplete( 29cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const base::DictionaryValue& value) OVERRIDE; 300529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch virtual net::URLFetcher::RequestType GetRequestType() OVERRIDE; 31a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 32cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual GURL GetURL() OVERRIDE; 33a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 34a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch private: 35a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch ResponseCallback callback_; 36cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) std::string token_; 37a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch}; 38a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 39a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch} // namespace local_discovery 40a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 41a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch#endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_CONFIRM_API_FLOW_H_ 42