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

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

Issue 318283002: Added new GCD/Privet interfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SETUP_FLOW_H_ 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SETUP_FLOW_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SETUP_FLOW_H_ 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SETUP_FLOW_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/local_discovery/gcd_api_flow.h" 12 #include "chrome/browser/local_discovery/gcd_api_flow.h"
13 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h"
14 13
15 namespace local_discovery { 14 namespace local_discovery {
16 15
17 // Provides complete flow for Privet v3 device setup. 16 // Provides complete flow for Privet v3 device setup.
18 class PrivetV3SetupFlow { 17 class PrivetV3SetupFlow {
19 public: 18 public:
20 // Delegate to be implemented by client code. 19 // Delegate to be implemented by client code.
21 class Delegate { 20 class Delegate {
22 public: 21 public:
23 typedef base::Callback<void(bool success)> ResultCallback; 22 typedef base::Callback<void(bool success)> ResultCallback;
24 // If |ssid| is empty, call failed to get credentials. 23 // If |ssid| is empty, call failed to get credentials.
25 // If |key| is empty, network is open. 24 // If |key| is empty, network is open.
26 typedef base::Callback<void(const std::string& ssid, 25 typedef base::Callback<void(const std::string& ssid,
27 const std::string& key)> CredentialsCallback; 26 const std::string& key)> CredentialsCallback;
28 27
28 typedef base::Callback<void(scoped_ptr<PrivetV3HTTPClient>)>
29 PrivetClientCallback;
30
29 virtual ~Delegate(); 31 virtual ~Delegate();
30 32
31 // Creates |GCDApiFlow| for making requests to GCD server. 33 // Creates |GCDApiFlow| for making requests to GCD server.
32 virtual scoped_ptr<GCDApiFlow> CreateApiFlow( 34 virtual scoped_ptr<GCDApiFlowInterface> CreateApiFlow() = 0;
33 scoped_ptr<GCDApiFlow::Request> request) = 0;
34 35
35 // Requests WiFi credentials. 36 // Requests WiFi credentials.
36 virtual void GetWiFiCredentials(const CredentialsCallback& callback) = 0; 37 virtual void GetWiFiCredentials(const CredentialsCallback& callback) = 0;
37 38
38 // Switches to setup WiFi network. 39 // Switches to setup WiFi network.
39 // If switch was successfully |RestoreWifi| should be called later. 40 // If switch was successfully |RestoreWifi| should be called later.
40 virtual void SwitchToSetupWiFi(const ResultCallback& callback) = 0; 41 virtual void SwitchToSetupWiFi(const ResultCallback& callback) = 0;
41 42
42 // Starts device resolution that should callback with ready 43 // Starts device resolution that should callback with ready
43 // |PrivetHTTPClient|. 44 // |PrivetV3HTTPClient|.
44 virtual scoped_ptr<PrivetHTTPResolution> CreatePrivetHTTP( 45 virtual void CreatePrivetV3Client(const std::string& service_name,
45 const std::string& service_name, 46 const PrivetClientCallback& callback) = 0;
46 const PrivetHTTPAsynchronousFactory::ResultCallback& callback) = 0;
47 47
48 // Requests client to prompt user to check |confirmation_code|. 48 // Requests client to prompt user to check |confirmation_code|.
49 virtual void ConfirmSecurityCode(const std::string& confirmation_code, 49 virtual void ConfirmSecurityCode(const std::string& confirmation_code,
50 const ResultCallback& callback) = 0; 50 const ResultCallback& callback) = 0;
51 51
52 // Restores WiFi network. 52 // Restores WiFi network.
53 virtual void RestoreWifi(const ResultCallback& callback) = 0; 53 virtual void RestoreWifi(const ResultCallback& callback) = 0;
54 54
55 // Notifies client that device is set up. 55 // Notifies client that device is set up.
56 virtual void OnSetupDone() = 0; 56 virtual void OnSetupDone() = 0;
(...skipping 16 matching lines...) Expand all
73 Delegate* delegate_; 73 Delegate* delegate_;
74 std::string service_name_; 74 std::string service_name_;
75 base::WeakPtrFactory<PrivetV3SetupFlow> weak_ptr_factory_; 75 base::WeakPtrFactory<PrivetV3SetupFlow> weak_ptr_factory_;
76 76
77 DISALLOW_COPY_AND_ASSIGN(PrivetV3SetupFlow); 77 DISALLOW_COPY_AND_ASSIGN(PrivetV3SetupFlow);
78 }; 78 };
79 79
80 } // namespace local_discovery 80 } // namespace local_discovery
81 81
82 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SETUP_FLOW_H_ 82 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_SETUP_FLOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698