privetv3_setup_flow.h revision cedac228d2dd51db4b79ea1e72c7f249408ee061
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. 4 5#ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SETUP_FLOW_H_ 6#define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SETUP_FLOW_H_ 7 8#include <string> 9 10#include "base/callback.h" 11#include "base/memory/scoped_ptr.h" 12 13namespace local_discovery { 14 15class ServiceDiscoveryClient; 16 17#if defined(ENABLE_WIFI_BOOTSTRAPPING) 18namespace wifi { 19class WifiManager; 20}; 21#endif 22 23class PrivetV3SetupFlow { 24 public: 25 class Delegate { 26 public: 27 typedef base::Callback<void(bool confirm)> ConfirmationCallback; 28 typedef base::Callback<void(const std::string& key)> CredentialsCallback; 29 30 virtual ~Delegate() {} 31 32#if defined(ENABLE_WIFI_BOOTSTRAPPING) 33 virtual void OnSetupCredentialsNeeded(const std::string& ssid, 34 const CredentialsCallback& callback); 35#endif 36 37 virtual void OnSetupConfirmationNeeded( 38 const std::string& confirmation_code, 39 const ConfirmationCallback& callback) = 0; 40 41 virtual void OnSetupDone() = 0; 42 43 virtual void OnSetupError() = 0; 44 }; 45 46 virtual ~PrivetV3SetupFlow() {} 47 48 static scoped_ptr<PrivetV3SetupFlow> CreateMDnsOnlyFlow( 49 ServiceDiscoveryClient* service_discovery_client, 50 const std::string& service_name); 51 52#if defined(ENABLE_WIFI_BOOTSTRAPPING) 53 static scoped_ptr<PrivetV3SetupFlow> CreateWifiFlow( 54 ServiceDiscoveryClient* service_discovery_client, 55 wifi::WifiManager* wifi_manager, 56 // The SSID of the network whose credentials we will be provisioning. 57 const std::string& credentials_ssid, 58 // The SSID of the device we will be provisioning. 59 const std::string& device_ssid); 60#endif 61 62 virtual void Start() = 0; 63}; 64 65} // namespace local_discovery 66 67#endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SETUP_FLOW_H_ 68