OLD | NEW |
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 #include "chrome/browser/local_discovery/privetv3_setup_flow.h" | 5 #include "chrome/browser/local_discovery/privetv3_setup_flow.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/local_discovery/gcd_registration_ticket_request.h" | 8 #include "chrome/browser/local_discovery/gcd_registration_ticket_request.h" |
9 | 9 |
10 namespace local_discovery { | 10 namespace local_discovery { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 const char kSsidJsonKeyName[] = "wifi.ssid"; | 14 const char kSsidJsonKeyName[] = "wifi.ssid"; |
15 const char kPasswordJsonKeyName[] = "wifi.passphrase"; | 15 const char kPasswordJsonKeyName[] = "wifi.passphrase"; |
16 const char kTicketJsonKeyName[] = "registration.ticketID"; | 16 const char kTicketJsonKeyName[] = "registration.ticketID"; |
17 const char kUserJsonKeyName[] = "registration.user"; | 17 const char kUserJsonKeyName[] = "registration.user"; |
18 | 18 |
19 class SetupRequest : public PrivetV3Session::Request { | 19 class SetupRequest : public PrivetV3Session::Request { |
20 public: | 20 public: |
21 explicit SetupRequest(PrivetV3SetupFlow* setup_flow); | 21 explicit SetupRequest(PrivetV3SetupFlow* setup_flow); |
22 virtual ~SetupRequest(); | 22 virtual ~SetupRequest(); |
23 | 23 |
24 virtual std::string GetName() OVERRIDE { return "/privet/v3/setup/start"; } | 24 virtual std::string GetName() override { return "/privet/v3/setup/start"; } |
25 virtual const base::DictionaryValue& GetInput() OVERRIDE; | 25 virtual const base::DictionaryValue& GetInput() override; |
26 | 26 |
27 virtual void OnError(PrivetURLFetcher::ErrorType error) OVERRIDE; | 27 virtual void OnError(PrivetURLFetcher::ErrorType error) override; |
28 virtual void OnParsedJson(const base::DictionaryValue& value, | 28 virtual void OnParsedJson(const base::DictionaryValue& value, |
29 bool has_error) OVERRIDE; | 29 bool has_error) override; |
30 | 30 |
31 void SetWiFiCridentials(const std::string& ssid, const std::string& password); | 31 void SetWiFiCridentials(const std::string& ssid, const std::string& password); |
32 | 32 |
33 void SetRegistrationTicket(const std::string& ticket_id, | 33 void SetRegistrationTicket(const std::string& ticket_id, |
34 const std::string& owner_email); | 34 const std::string& owner_email); |
35 | 35 |
36 private: | 36 private: |
37 base::DictionaryValue input_; | 37 base::DictionaryValue input_; |
38 PrivetV3SetupFlow* setup_flow_; | 38 PrivetV3SetupFlow* setup_flow_; |
39 }; | 39 }; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 session_->Start(); | 162 session_->Start(); |
163 } | 163 } |
164 | 164 |
165 void PrivetV3SetupFlow::OnCodeConfirmed(const std::string& code, bool success) { | 165 void PrivetV3SetupFlow::OnCodeConfirmed(const std::string& code, bool success) { |
166 if (!success) | 166 if (!success) |
167 return OnSetupError(); | 167 return OnSetupError(); |
168 session_->ConfirmCode(code); | 168 session_->ConfirmCode(code); |
169 } | 169 } |
170 | 170 |
171 } // namespace local_discovery | 171 } // namespace local_discovery |
OLD | NEW |