diff options
author | zork <zork@chromium.org> | 2015-04-21 18:13:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-22 01:14:08 +0000 |
commit | b7c25e1ec39ec11d2156b2918d58f4de7fcd9791 (patch) | |
tree | be92bd713e17eadfc65f4b24a49593a92983b5a0 /components | |
parent | 63d36f32e780f052716384851adfabd17edf8639 (diff) | |
download | chromium_src-b7c25e1ec39ec11d2156b2918d58f4de7fcd9791.zip chromium_src-b7c25e1ec39ec11d2156b2918d58f4de7fcd9791.tar.gz chromium_src-b7c25e1ec39ec11d2156b2918d58f4de7fcd9791.tar.bz2 |
Add AddNetwork message to pairing API.
BUG=None
Review URL: https://codereview.chromium.org/1090483002
Cr-Commit-Position: refs/heads/master@{#326206}
Diffstat (limited to 'components')
-rw-r--r-- | components/pairing/bluetooth_controller_pairing_controller.cc | 5 | ||||
-rw-r--r-- | components/pairing/bluetooth_controller_pairing_controller.h | 1 | ||||
-rw-r--r-- | components/pairing/bluetooth_host_pairing_controller.cc | 21 | ||||
-rw-r--r-- | components/pairing/bluetooth_host_pairing_controller.h | 1 | ||||
-rw-r--r-- | components/pairing/fake_host_pairing_controller.cc | 11 | ||||
-rw-r--r-- | components/pairing/fake_host_pairing_controller.h | 6 | ||||
-rw-r--r-- | components/pairing/host_pairing_controller.h | 15 | ||||
-rw-r--r-- | components/pairing/pairing_api.proto | 9 | ||||
-rw-r--r-- | components/pairing/proto_decoder.cc | 9 | ||||
-rw-r--r-- | components/pairing/proto_decoder.h | 3 | ||||
-rw-r--r-- | components/pairing/shark_connection_listener.cc | 13 | ||||
-rw-r--r-- | components/pairing/shark_connection_listener.h | 6 |
12 files changed, 51 insertions, 49 deletions
diff --git a/components/pairing/bluetooth_controller_pairing_controller.cc b/components/pairing/bluetooth_controller_pairing_controller.cc index 1d8e026..476b205 100644 --- a/components/pairing/bluetooth_controller_pairing_controller.cc +++ b/components/pairing/bluetooth_controller_pairing_controller.cc @@ -417,6 +417,11 @@ void BluetoothControllerPairingController::OnErrorMessage( ChangeStage(STAGE_HOST_ENROLLMENT_ERROR); } +void BluetoothControllerPairingController::OnAddNetworkMessage( + const pairing_api::AddNetwork& message) { + NOTREACHED(); +} + void BluetoothControllerPairingController::DeviceAdded( device::BluetoothAdapter* adapter, device::BluetoothDevice* device) { diff --git a/components/pairing/bluetooth_controller_pairing_controller.h b/components/pairing/bluetooth_controller_pairing_controller.h index c4a3258..ab67aed 100644 --- a/components/pairing/bluetooth_controller_pairing_controller.h +++ b/components/pairing/bluetooth_controller_pairing_controller.h @@ -83,6 +83,7 @@ class BluetoothControllerPairingController void OnCompleteSetupMessage( const pairing_api::CompleteSetup& message) override; void OnErrorMessage(const pairing_api::Error& message) override; + void OnAddNetworkMessage(const pairing_api::AddNetwork& message) override; // BluetoothAdapter::Observer: void DeviceAdded(device::BluetoothAdapter* adapter, diff --git a/components/pairing/bluetooth_host_pairing_controller.cc b/components/pairing/bluetooth_host_pairing_controller.cc index 5ffd2f5..580d92f 100644 --- a/components/pairing/bluetooth_host_pairing_controller.cc +++ b/components/pairing/bluetooth_host_pairing_controller.cc @@ -307,11 +307,12 @@ void BluetoothHostPairingController::OnHostStatusMessage( void BluetoothHostPairingController::OnConfigureHostMessage( const pairing_api::ConfigureHost& message) { FOR_EACH_OBSERVER(Observer, observers_, - ConfigureHost(message.parameters().accepted_eula(), - message.parameters().lang(), - message.parameters().timezone(), - message.parameters().send_reports(), - message.parameters().keyboard_layout())); + ConfigureHostRequested( + message.parameters().accepted_eula(), + message.parameters().lang(), + message.parameters().timezone(), + message.parameters().send_reports(), + message.parameters().keyboard_layout())); } void BluetoothHostPairingController::OnPairDevicesMessage( @@ -319,7 +320,8 @@ void BluetoothHostPairingController::OnPairDevicesMessage( DCHECK(thread_checker_.CalledOnValidThread()); ChangeStage(STAGE_ENROLLING); FOR_EACH_OBSERVER(Observer, observers_, - EnrollHost(message.parameters().admin_access_token())); + EnrollHostRequested( + message.parameters().admin_access_token())); } void BluetoothHostPairingController::OnCompleteSetupMessage( @@ -339,6 +341,13 @@ void BluetoothHostPairingController::OnErrorMessage( NOTREACHED(); } +void BluetoothHostPairingController::OnAddNetworkMessage( + const pairing_api::AddNetwork& message) { + DCHECK(thread_checker_.CalledOnValidThread()); + FOR_EACH_OBSERVER(Observer, observers_, + AddNetworkRequested(message.parameters().onc_spec())); +} + void BluetoothHostPairingController::AdapterPresentChanged( device::BluetoothAdapter* adapter, bool present) { diff --git a/components/pairing/bluetooth_host_pairing_controller.h b/components/pairing/bluetooth_host_pairing_controller.h index b99af24..20ba506 100644 --- a/components/pairing/bluetooth_host_pairing_controller.h +++ b/components/pairing/bluetooth_host_pairing_controller.h @@ -80,6 +80,7 @@ class BluetoothHostPairingController void OnCompleteSetupMessage( const pairing_api::CompleteSetup& message) override; void OnErrorMessage(const pairing_api::Error& message) override; + void OnAddNetworkMessage(const pairing_api::AddNetwork& message) override; // BluetoothAdapter::Observer: void AdapterPresentChanged(device::BluetoothAdapter* adapter, diff --git a/components/pairing/fake_host_pairing_controller.cc b/components/pairing/fake_host_pairing_controller.cc index e6d1e76..25250d02 100644 --- a/components/pairing/fake_host_pairing_controller.cc +++ b/components/pairing/fake_host_pairing_controller.cc @@ -169,15 +169,4 @@ void FakeHostPairingController::PairingStageChanged(Stage new_stage) { } } -void FakeHostPairingController::ConfigureHost( - bool accepted_eula, - const std::string& lang, - const std::string& timezone, - bool send_reports, - const std::string& keyboard_layout) { -} - -void FakeHostPairingController::EnrollHost(const std::string& auth_token) { -} - } // namespace pairing_chromeos diff --git a/components/pairing/fake_host_pairing_controller.h b/components/pairing/fake_host_pairing_controller.h index 8ef2f4b..17d6884 100644 --- a/components/pairing/fake_host_pairing_controller.h +++ b/components/pairing/fake_host_pairing_controller.h @@ -50,12 +50,6 @@ class FakeHostPairingController // HostPairingController::Observer: void PairingStageChanged(Stage new_stage) override; - void ConfigureHost(bool accepted_eula, - const std::string& lang, - const std::string& timezone, - bool send_reports, - const std::string& keyboard_layout) override; - void EnrollHost(const std::string& auth_token) override; ObserverList<Observer> observers_; Stage current_stage_; diff --git a/components/pairing/host_pairing_controller.h b/components/pairing/host_pairing_controller.h index 7d79c4f..731707a 100644 --- a/components/pairing/host_pairing_controller.h +++ b/components/pairing/host_pairing_controller.h @@ -49,14 +49,17 @@ class HostPairingController { virtual void PairingStageChanged(Stage new_stage) = 0; // Called when the controller has sent a configuration to apply. - virtual void ConfigureHost(bool accepted_eula, - const std::string& lang, - const std::string& timezone, - bool send_reports, - const std::string& keyboard_layout) = 0; + virtual void ConfigureHostRequested(bool accepted_eula, + const std::string& lang, + const std::string& timezone, + bool send_reports, + const std::string& keyboard_layout) {} + + // Called when the controller has sent a network to add. + virtual void AddNetworkRequested(const std::string& onc_spec) {} // Called when the controller has provided an |auth_token| for enrollment. - virtual void EnrollHost(const std::string& auth_token) = 0; + virtual void EnrollHostRequested(const std::string& auth_token) {} private: DISALLOW_COPY_AND_ASSIGN(Observer); diff --git a/components/pairing/pairing_api.proto b/components/pairing/pairing_api.proto index 0d8e668..856feae 100644 --- a/components/pairing/pairing_api.proto +++ b/components/pairing/pairing_api.proto @@ -86,3 +86,12 @@ message Error { optional int32 api_version = 1; optional ErrorParameters parameters = 2; } + +message AddNetworkParameters { + optional string onc_spec = 1; +} + +message AddNetwork { + optional int32 api_version = 1; + optional AddNetworkParameters parameters = 2; +} diff --git a/components/pairing/proto_decoder.cc b/components/pairing/proto_decoder.cc index 96b3c24..f8e42a4 100644 --- a/components/pairing/proto_decoder.cc +++ b/components/pairing/proto_decoder.cc @@ -15,6 +15,7 @@ enum { MESSAGE_PAIR_DEVICES, MESSAGE_COMPLETE_SETUP, MESSAGE_ERROR, + MESSAGE_ADD_NETWORK, NUM_MESSAGES, }; } @@ -105,9 +106,15 @@ bool ProtoDecoder::DecodeIOBuffer(int size, observer_->OnErrorMessage(message); } break; + case MESSAGE_ADD_NETWORK: { + pairing_api::AddNetwork message; + message.ParseFromArray(&buffer[0], buffer.size()); + observer_->OnAddNetworkMessage(message); + } + break; default: - NOTREACHED(); + LOG(WARNING) << "Skipping unknown message type: " << next_message_type_; break; } diff --git a/components/pairing/proto_decoder.h b/components/pairing/proto_decoder.h index e36eb7f..826c4bb 100644 --- a/components/pairing/proto_decoder.h +++ b/components/pairing/proto_decoder.h @@ -18,6 +18,7 @@ class IOBuffer; } namespace pairing_api { +class AddNetwork; class CompleteSetup; class ConfigureHost; class Error; @@ -47,6 +48,8 @@ class ProtoDecoder { const pairing_api::CompleteSetup& message) = 0; virtual void OnErrorMessage( const pairing_api::Error& message) = 0; + virtual void OnAddNetworkMessage( + const pairing_api::AddNetwork& message) = 0; protected: Observer() {} diff --git a/components/pairing/shark_connection_listener.cc b/components/pairing/shark_connection_listener.cc index ce63aa0..a6bc655 100644 --- a/components/pairing/shark_connection_listener.cc +++ b/components/pairing/shark_connection_listener.cc @@ -30,17 +30,4 @@ void SharkConnectionListener::PairingStageChanged(Stage new_stage) { } } -void SharkConnectionListener::ConfigureHost( - bool accepted_eula, - const std::string& lang, - const std::string& timezone, - bool send_reports, - const std::string& keyboard_layout) { - NOTREACHED(); -} - -void SharkConnectionListener::EnrollHost(const std::string& auth_token) { - NOTREACHED(); -} - } // namespace pairing_chromeos diff --git a/components/pairing/shark_connection_listener.h b/components/pairing/shark_connection_listener.h index 98a7829..c0b3836 100644 --- a/components/pairing/shark_connection_listener.h +++ b/components/pairing/shark_connection_listener.h @@ -30,12 +30,6 @@ class SharkConnectionListener : public HostPairingController::Observer { // HostPairingController::Observer overrides: void PairingStageChanged(Stage new_stage) override; - void ConfigureHost(bool accepted_eula, - const std::string& lang, - const std::string& timezone, - bool send_reports, - const std::string& keyboard_layout) override; - void EnrollHost(const std::string& auth_token) override; OnConnectedCallback callback_; scoped_ptr<HostPairingController> controller_; |