Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: chrome/browser/local_discovery/privetv3_setup_flow.h

Issue 873103002: Removed unused native code related to wifi bootstrapping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sun 01/25/2015 21:44:58.31 Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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 #include "chrome/browser/local_discovery/gcd_api_flow.h"
13 #include "chrome/browser/local_discovery/privet_http.h"
14 #include "chrome/browser/local_discovery/privetv3_session.h"
15
16 namespace local_discovery {
17
18 // Provides complete flow for Privet v3 device setup.
19 class PrivetV3SetupFlow {
20 public:
21 // Delegate to be implemented by client code.
22 class Delegate {
23 public:
24 typedef base::Callback<void(bool success)> ResultCallback;
25 // If |ssid| is empty, call failed to get credentials.
26 // If |key| is empty, network is open.
27 typedef base::Callback<void(const std::string& ssid,
28 const std::string& key)> CredentialsCallback;
29
30 typedef base::Callback<void(scoped_ptr<PrivetHTTPClient>)>
31 PrivetClientCallback;
32
33 virtual ~Delegate();
34
35 // Creates |GCDApiFlowImpl| for making requests to GCD server.
36 virtual scoped_ptr<GCDApiFlow> CreateApiFlow() = 0;
37
38 // Requests WiFi credentials.
39 virtual void GetWiFiCredentials(const CredentialsCallback& callback) = 0;
40
41 // Switches to setup WiFi network.
42 // If switch was successfully |RestoreWifi| should be called later.
43 virtual void SwitchToSetupWiFi(const ResultCallback& callback) = 0;
44
45 // Starts device resolution that should callback with ready
46 // |PrivetV3HTTPClient|.
47 virtual void CreatePrivetV3Client(const std::string& service_name,
48 const PrivetClientCallback& callback) = 0;
49
50 // Requests client to prompt user to check pairing code.
51 virtual void ConfirmSecurityCode(const ResultCallback& callback) = 0;
52
53 // Restores WiFi network.
54 virtual void RestoreWifi(const ResultCallback& callback) = 0;
55
56 // Notifies client that device is set up.
57 virtual void OnSetupDone() = 0;
58
59 // Notifies client setup failed.
60 virtual void OnSetupError() = 0;
61 };
62
63 explicit PrivetV3SetupFlow(Delegate* delegate);
64 virtual ~PrivetV3SetupFlow();
65
66 // Starts registration.
67 void Register(const std::string& service_name);
68
69 #if defined(ENABLE_WIFI_BOOTSTRAPPING)
70 void SetupWifiAndRegister(const std::string& device_ssid);
71 #endif // ENABLE_WIFI_BOOTSTRAPPING
72
73 void OnSetupError();
74
75 const std::string& service_name() const { return service_name_; }
76
77 private:
78 void OnTicketCreated(const std::string& ticket_id,
79 const std::string& device_id);
80 void OnPrivetClientCreated(scoped_ptr<PrivetHTTPClient> privet_http_client);
81 void OnCodeConfirmed(bool success);
82
83 void OnSessionInitialized(
84 PrivetV3Session::Result result,
85 const std::vector<PrivetV3Session::PairingType>& types);
86 void OnPairingStarted(PrivetV3Session::Result result);
87 void OnPairingDone(PrivetV3Session::Result result);
88 void OnSetupMessageSent(PrivetV3Session::Result result,
89 const base::DictionaryValue& response);
90
91 Delegate* delegate_;
92 std::string service_name_;
93 std::string device_id_;
94 std::string ticket_id_;
95 scoped_ptr<GCDApiFlow> ticket_request_;
96 scoped_ptr<PrivetV3Session> session_;
97 base::WeakPtrFactory<PrivetV3SetupFlow> weak_ptr_factory_;
98
99 DISALLOW_COPY_AND_ASSIGN(PrivetV3SetupFlow);
100 };
101
102 } // namespace local_discovery
103
104 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SETUP_FLOW_H_
OLDNEW
« no previous file with comments | « chrome/browser/local_discovery/privetv3_crypto_provider.cc ('k') | chrome/browser/local_discovery/privetv3_setup_flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698