libweave: Rename buffet namespace into weave Namespace renamed only in libweave dirrectory. Namespace of buffet/ stays same. BUG=brillo:1235 TEST=FEATURES=test emerge-gizmo buffet Change-Id: If45c63f443fab792b661ea85f57ddacc380d0a13 Reviewed-on: https://chromium-review.googlesource.com/284578 Reviewed-by: Vitaly Buka <vitalybuka@chromium.org> Commit-Queue: Vitaly Buka <vitalybuka@chromium.org> Tested-by: Vitaly Buka <vitalybuka@chromium.org>
diff --git a/buffet/dbus_constants.cc b/buffet/dbus_constants.cc index ac6e080..6ab587a 100644 --- a/buffet/dbus_constants.cc +++ b/buffet/dbus_constants.cc
@@ -5,13 +5,9 @@ #include "buffet/dbus_constants.h" namespace buffet { -namespace dbus_constants { const char kServiceName[] = "org.chromium.Buffet"; - const char kRootServicePath[] = "/org/chromium/Buffet"; - const char kCommandServicePathPrefix[] = "/org/chromium/Buffet/commands/"; -} // namespace dbus_constants } // namespace buffet
diff --git a/buffet/dbus_constants.h b/buffet/dbus_constants.h index 04701fe..0bb72dc 100644 --- a/buffet/dbus_constants.h +++ b/buffet/dbus_constants.h
@@ -6,7 +6,6 @@ #define BUFFET_DBUS_CONSTANTS_H_ namespace buffet { -namespace dbus_constants { // The service name claimed by the Buffet daemon. extern const char kServiceName[]; @@ -17,7 +16,6 @@ // D-Bus object path prefix for Command objects. extern const char kCommandServicePathPrefix[]; -} // namespace dbus_constants } // namespace buffet #endif // BUFFET_DBUS_CONSTANTS_H_
diff --git a/buffet/main.cc b/buffet/main.cc index e173269..3a76046 100644 --- a/buffet/main.cc +++ b/buffet/main.cc
@@ -17,8 +17,8 @@ using chromeos::dbus_utils::AsyncEventSequencer; using chromeos::DBusServiceDaemon; -using buffet::dbus_constants::kServiceName; -using buffet::dbus_constants::kRootServicePath; +using buffet::kServiceName; +using buffet::kRootServicePath; namespace buffet {
diff --git a/buffet/manager.cc b/buffet/manager.cc index dd3b523..f7ecc0e 100644 --- a/buffet/manager.cc +++ b/buffet/manager.cc
@@ -36,6 +36,7 @@ using chromeos::dbus_utils::AsyncEventSequencer; using chromeos::dbus_utils::ExportedObjectManager; +namespace privet = weave::privet; namespace buffet { @@ -63,18 +64,21 @@ void Manager::Start(const Options& options, AsyncEventSequencer* sequencer) { command_manager_ = - std::make_shared<CommandManager>(dbus_object_.GetObjectManager()); + std::make_shared<weave::CommandManager>(dbus_object_.GetObjectManager()); command_manager_->AddOnCommandDefChanged(base::Bind( &Manager::OnCommandDefsChanged, weak_ptr_factory_.GetWeakPtr())); command_manager_->Startup(base::FilePath{"/etc/buffet"}, options.test_definitions_path); - state_change_queue_.reset(new StateChangeQueue(kMaxStateChangeQueueSize)); - state_manager_ = std::make_shared<StateManager>(state_change_queue_.get()); + state_change_queue_.reset( + new weave::StateChangeQueue(kMaxStateChangeQueueSize)); + state_manager_ = + std::make_shared<weave::StateManager>(state_change_queue_.get()); state_manager_->AddOnChangedCallback( base::Bind(&Manager::OnStateChanged, weak_ptr_factory_.GetWeakPtr())); state_manager_->Startup(); - std::unique_ptr<BuffetConfig> config{new BuffetConfig{options.state_path}}; + std::unique_ptr<weave::BuffetConfig> config{ + new weave::BuffetConfig{options.state_path}}; config->AddOnChangedCallback( base::Bind(&Manager::OnConfigChanged, weak_ptr_factory_.GetWeakPtr())); config->Load(options.config_path); @@ -83,19 +87,19 @@ transport->SetDefaultTimeout(base::TimeDelta::FromSeconds( kRequestTimeoutSeconds)); - shill_client_.reset(new privetd::ShillClient(dbus_object_.GetBus(), - options.device_whitelist)); + shill_client_.reset(new weave::privet::ShillClient(dbus_object_.GetBus(), + options.device_whitelist)); // TODO(avakulenko): Figure out security implications of storing // device info state data unencrypted. - device_info_.reset(new DeviceRegistrationInfo( + device_info_.reset(new weave::DeviceRegistrationInfo( command_manager_, state_manager_, std::move(config), transport, - base::MessageLoop::current()->task_runner(), - options.xmpp_enabled, shill_client_.get())); + base::MessageLoop::current()->task_runner(), options.xmpp_enabled, + shill_client_.get())); device_info_->AddOnRegistrationChangedCallback(base::Bind( &Manager::OnRegistrationChanged, weak_ptr_factory_.GetWeakPtr())); - base_api_handler_.reset(new BaseApiHandler{ + base_api_handler_.reset(new weave::BaseApiHandler{ device_info_->AsWeakPtr(), state_manager_, command_manager_}); device_info_->Start(); @@ -108,9 +112,9 @@ StartPrivet(options.privet, sequencer); } -void Manager::StartPrivet(const privetd::Manager::Options& options, +void Manager::StartPrivet(const weave::privet::Manager::Options& options, AsyncEventSequencer* sequencer) { - privet_.reset(new privetd::Manager{}); + privet_.reset(new weave::privet::Manager{}); privet_->Start(options, dbus_object_.GetBus(), shill_client_.get(), device_info_.get(), command_manager_.get(), state_manager_.get(), sequencer); @@ -119,7 +123,7 @@ privet_->GetWifiBootstrapManager()->RegisterStateListener(base::Bind( &Manager::UpdateWiFiBootstrapState, weak_ptr_factory_.GetWeakPtr())); } else { - UpdateWiFiBootstrapState(privetd::WifiBootstrapManager::kDisabled); + UpdateWiFiBootstrapState(weave::privet::WifiBootstrapManager::kDisabled); } privet_->GetSecurityManager()->RegisterPairingListeners( @@ -141,7 +145,7 @@ // If it fails due to any reason other than 'device not registered', // treat it as a real error and report it to the caller. if (!registered && - !error->HasError(kErrorDomainGCD, "device_not_registered")) { + !error->HasError(weave::kErrorDomainGCD, "device_not_registered")) { response->ReplyWithError(error.get()); return; } @@ -190,7 +194,8 @@ if (!error) { // TODO(zeuthen): This can be changed to CHECK(error) once // RegisterDevice() has been fixed to set |error| when failing. - chromeos::Error::AddTo(&error, FROM_HERE, kErrorDomainGCD, "internal_error", + chromeos::Error::AddTo(&error, FROM_HERE, weave::kErrorDomainGCD, + "internal_error", "device_id empty but error not set"); } response->ReplyWithError(error.get()); @@ -230,7 +235,7 @@ } chromeos::ErrorPtr error; - UserRole role; + weave::UserRole role; if (!FromString(in_user_role, &role, &error)) return response->ReplyWithError(error.get()); @@ -243,9 +248,10 @@ void Manager::GetCommand(DBusMethodResponsePtr<std::string> response, const std::string& id) { - const CommandInstance* command = command_manager_->FindCommand(id); + const weave::CommandInstance* command = command_manager_->FindCommand(id); if (!command) { - response->ReplyWithError(FROM_HERE, kErrorDomainGCD, "unknown_command", + response->ReplyWithError(FROM_HERE, weave::kErrorDomainGCD, + "unknown_command", "Can't find command with id: " + id); return; } @@ -258,7 +264,7 @@ void Manager::SetCommandVisibility(DBusMethodResponsePtr<> response, const std::vector<std::string>& in_names, const std::string& in_visibility) { - CommandDefinition::Visibility visibility; + weave::CommandDefinition::Visibility visibility; chromeos::ErrorPtr error; if (!visibility.FromString(in_visibility, &error)) { response->ReplyWithError(error.get()); @@ -280,15 +286,15 @@ chromeos::ErrorPtr* error, const dbus::ObjectPath& in_listener_path, const chromeos::VariantDictionary& in_options) { - chromeos::Error::AddTo(error, FROM_HERE, privetd::errors::kDomain, - privetd::errors::kNotImplemented, + chromeos::Error::AddTo(error, FROM_HERE, weave::privet::errors::kDomain, + weave::privet::errors::kNotImplemented, "Manual WiFi bootstrapping is not implemented"); return false; } bool Manager::DisableWiFiBootstrapping(chromeos::ErrorPtr* error) { - chromeos::Error::AddTo(error, FROM_HERE, privetd::errors::kDomain, - privetd::errors::kNotImplemented, + chromeos::Error::AddTo(error, FROM_HERE, weave::privet::errors::kDomain, + weave::privet::errors::kNotImplemented, "Manual WiFi bootstrapping is not implemented"); return false; } @@ -297,15 +303,15 @@ chromeos::ErrorPtr* error, const dbus::ObjectPath& in_listener_path, const chromeos::VariantDictionary& in_options) { - chromeos::Error::AddTo(error, FROM_HERE, privetd::errors::kDomain, - privetd::errors::kNotImplemented, + chromeos::Error::AddTo(error, FROM_HERE, weave::privet::errors::kDomain, + weave::privet::errors::kNotImplemented, "Manual GCD bootstrapping is not implemented"); return false; } bool Manager::DisableGCDBootstrapping(chromeos::ErrorPtr* error) { - chromeos::Error::AddTo(error, FROM_HERE, privetd::errors::kDomain, - privetd::errors::kNotImplemented, + chromeos::Error::AddTo(error, FROM_HERE, weave::privet::errors::kDomain, + weave::privet::errors::kNotImplemented, "Manual GCD bootstrapping is not implemented"); return false; } @@ -331,9 +337,10 @@ void Manager::OnCommandDefsChanged() { // Limit only to commands that are visible to the local clients. auto commands = command_manager_->GetCommandDictionary().GetCommandsAsJson( - [](const buffet::CommandDefinition* def) { + [](const weave::CommandDefinition* def) { return def->GetVisibility().local; - }, true, nullptr); + }, + true, nullptr); CHECK(commands); std::string json; base::JSONWriter::WriteWithOptions( @@ -350,11 +357,11 @@ dbus_adaptor_.SetState(json); } -void Manager::OnRegistrationChanged(RegistrationStatus status) { +void Manager::OnRegistrationChanged(weave::RegistrationStatus status) { dbus_adaptor_.SetStatus(StatusToString(status)); } -void Manager::OnConfigChanged(const BuffetConfig& config) { +void Manager::OnConfigChanged(const weave::BuffetConfig& config) { dbus_adaptor_.SetDeviceId(config.device_id()); dbus_adaptor_.SetOemName(config.oem_name()); dbus_adaptor_.SetModelName(config.model_name()); @@ -366,33 +373,33 @@ } void Manager::UpdateWiFiBootstrapState( - privetd::WifiBootstrapManager::State state) { + weave::privet::WifiBootstrapManager::State state) { if (auto wifi = privet_->GetWifiBootstrapManager()) { const std::string& ssid{wifi->GetCurrentlyConnectedSsid()}; if (ssid != device_info_->GetConfig().last_configured_ssid()) { - BuffetConfig::Transaction change{device_info_->GetMutableConfig()}; + weave::BuffetConfig::Transaction change{device_info_->GetMutableConfig()}; change.set_last_configured_ssid(ssid); } } switch (state) { - case privetd::WifiBootstrapManager::kDisabled: + case weave::privet::WifiBootstrapManager::kDisabled: dbus_adaptor_.SetWiFiBootstrapState("disabled"); break; - case privetd::WifiBootstrapManager::kBootstrapping: + case weave::privet::WifiBootstrapManager::kBootstrapping: dbus_adaptor_.SetWiFiBootstrapState("waiting"); break; - case privetd::WifiBootstrapManager::kMonitoring: + case weave::privet::WifiBootstrapManager::kMonitoring: dbus_adaptor_.SetWiFiBootstrapState("monitoring"); break; - case privetd::WifiBootstrapManager::kConnecting: + case weave::privet::WifiBootstrapManager::kConnecting: dbus_adaptor_.SetWiFiBootstrapState("connecting"); break; } } void Manager::OnPairingStart(const std::string& session_id, - privetd::PairingType pairing_type, + privet::PairingType pairing_type, const std::vector<uint8_t>& code) { // For now, just overwrite the exposed PairInfo with // the most recent pairing attempt.
diff --git a/buffet/manager.h b/buffet/manager.h index 5e9b25f..4f73a3c 100644 --- a/buffet/manager.h +++ b/buffet/manager.h
@@ -31,12 +31,14 @@ } // namespace dbus_utils } // namespace chromeos -namespace buffet { - +namespace weave { class BaseApiHandler; class BuffetConfig; class StateChangeQueue; class StateManager; +} // namespace weave + +namespace buffet { template<typename... Types> using DBusMethodResponsePtr = @@ -62,7 +64,7 @@ base::FilePath test_definitions_path; bool xmpp_enabled{true}; std::set<std::string> device_whitelist; - privetd::Manager::Options privet; + weave::privet::Manager::Options privet; }; void Start(const Options& options, @@ -117,29 +119,30 @@ const std::shared_ptr<DBusMethodResponse<std::string>>& response, const chromeos::Error* error); - void StartPrivet(const privetd::Manager::Options& options, + void StartPrivet(const weave::privet::Manager::Options& options, chromeos::dbus_utils::AsyncEventSequencer* sequencer); void OnCommandDefsChanged(); void OnStateChanged(); - void OnRegistrationChanged(RegistrationStatus status); - void OnConfigChanged(const BuffetConfig& config); - void UpdateWiFiBootstrapState(privetd::WifiBootstrapManager::State state); + void OnRegistrationChanged(weave::RegistrationStatus status); + void OnConfigChanged(const weave::BuffetConfig& config); + void UpdateWiFiBootstrapState( + weave::privet::WifiBootstrapManager::State state); void OnPairingStart(const std::string& session_id, - privetd::PairingType pairing_type, + weave::privet::PairingType pairing_type, const std::vector<uint8_t>& code); void OnPairingEnd(const std::string& session_id); org::chromium::Buffet::ManagerAdaptor dbus_adaptor_{this}; chromeos::dbus_utils::DBusObject dbus_object_; - std::shared_ptr<CommandManager> command_manager_; - std::unique_ptr<StateChangeQueue> state_change_queue_; - std::shared_ptr<StateManager> state_manager_; - std::unique_ptr<DeviceRegistrationInfo> device_info_; - std::unique_ptr<BaseApiHandler> base_api_handler_; - std::unique_ptr<privetd::ShillClient> shill_client_; - std::unique_ptr<privetd::Manager> privet_; + std::shared_ptr<weave::CommandManager> command_manager_; + std::unique_ptr<weave::StateChangeQueue> state_change_queue_; + std::shared_ptr<weave::StateManager> state_manager_; + std::unique_ptr<weave::DeviceRegistrationInfo> device_info_; + std::unique_ptr<weave::BaseApiHandler> base_api_handler_; + std::unique_ptr<weave::privet::ShillClient> shill_client_; + std::unique_ptr<weave::privet::Manager> privet_; base::WeakPtrFactory<Manager> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(Manager);
diff --git a/libweave/src/base_api_handler.cc b/libweave/src/base_api_handler.cc index 135dffa..acb136e 100644 --- a/libweave/src/base_api_handler.cc +++ b/libweave/src/base_api_handler.cc
@@ -9,7 +9,7 @@ #include "libweave/src/device_registration_info.h" #include "libweave/src/states/state_manager.h" -namespace buffet { +namespace weave { namespace { @@ -119,4 +119,4 @@ command->Done(); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/base_api_handler.h b/libweave/src/base_api_handler.h index 73c0980..8d9add7 100644 --- a/libweave/src/base_api_handler.h +++ b/libweave/src/base_api_handler.h
@@ -10,7 +10,7 @@ #include <base/memory/weak_ptr.h> -namespace buffet { +namespace weave { class CommandInstance; class CommandManager; @@ -41,6 +41,6 @@ DISALLOW_COPY_AND_ASSIGN(BaseApiHandler); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_BASE_API_HANDLER_H_
diff --git a/libweave/src/base_api_handler_unittest.cc b/libweave/src/base_api_handler_unittest.cc index c7456cf..8bc174a 100644 --- a/libweave/src/base_api_handler_unittest.cc +++ b/libweave/src/base_api_handler_unittest.cc
@@ -17,7 +17,7 @@ #include "libweave/src/states/state_manager.h" #include "libweave/src/storage_impls.h" -namespace buffet { +namespace weave { class BaseApiHandlerTest : public ::testing::Test { protected: @@ -65,7 +65,7 @@ } void AddCommand(const std::string& command) { - auto command_instance = buffet::CommandInstance::FromJson( + auto command_instance = CommandInstance::FromJson( unittests::CreateDictionaryValue(command.c_str()).get(), commands::attributes::kCommand_Visibility_Local, command_manager_->GetCommandDictionary(), nullptr, nullptr); @@ -192,4 +192,4 @@ EXPECT_EQ("newLocation", config.location()); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/buffet_config.cc b/libweave/src/buffet_config.cc index 854b0c2..2d4aa58 100644 --- a/libweave/src/buffet_config.cc +++ b/libweave/src/buffet_config.cc
@@ -60,7 +60,7 @@ } // namespace -namespace buffet { +namespace weave { namespace config_keys { @@ -150,16 +150,16 @@ if (store.GetString(config_keys::kEmbeddedCodePath, &embedded_code_path)) { embedded_code_path_ = base::FilePath(embedded_code_path); if (!embedded_code_path_.empty()) - pairing_modes_ = {privetd::PairingType::kEmbeddedCode}; + pairing_modes_ = {privet::PairingType::kEmbeddedCode}; } std::string modes_str; if (store.GetString(config_keys::kPairingModes, &modes_str)) { - std::set<privetd::PairingType> pairing_modes; + std::set<privet::PairingType> pairing_modes; for (const std::string& mode : chromeos::string_utils::Split(modes_str, ",", true, true)) { - privetd::PairingType pairing_mode; - CHECK(privetd::StringToPairingType(mode, &pairing_mode)); + privet::PairingType pairing_mode; + CHECK(privet::StringToPairingType(mode, &pairing_mode)); pairing_modes.insert(pairing_mode); } pairing_modes_ = std::move(pairing_modes); @@ -291,4 +291,4 @@ config_ = nullptr; } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/buffet_config.h b/libweave/src/buffet_config.h index 73ed04f..d08a1b8 100644 --- a/libweave/src/buffet_config.h +++ b/libweave/src/buffet_config.h
@@ -16,7 +16,7 @@ #include "libweave/src/privet/security_delegate.h" -namespace buffet { +namespace weave { class StorageInterface; @@ -108,7 +108,7 @@ } bool wifi_auto_setup_enabled() const { return wifi_auto_setup_enabled_; } - const std::set<privetd::PairingType>& pairing_modes() const { + const std::set<privet::PairingType>& pairing_modes() const { return pairing_modes_; } const base::FilePath& embedded_code_path() const { @@ -153,7 +153,7 @@ base::TimeDelta backup_polling_period_{base::TimeDelta::FromMinutes(30)}; bool wifi_auto_setup_enabled_{true}; - std::set<privetd::PairingType> pairing_modes_{privetd::PairingType::kPinCode}; + std::set<privet::PairingType> pairing_modes_{privet::PairingType::kPinCode}; base::FilePath embedded_code_path_; std::string device_id_; @@ -169,6 +169,6 @@ DISALLOW_COPY_AND_ASSIGN(BuffetConfig); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_BUFFET_CONFIG_H_
diff --git a/libweave/src/buffet_config_unittest.cc b/libweave/src/buffet_config_unittest.cc index 4b458fe..bd46403 100644 --- a/libweave/src/buffet_config_unittest.cc +++ b/libweave/src/buffet_config_unittest.cc
@@ -15,7 +15,7 @@ using testing::_; -namespace buffet { +namespace weave { class BuffetConfigTest : public ::testing::Test { protected: @@ -58,7 +58,7 @@ EXPECT_EQ(base::TimeDelta::FromSeconds(7), config_->polling_period()); EXPECT_EQ(base::TimeDelta::FromMinutes(30), config_->backup_polling_period()); EXPECT_TRUE(config_->wifi_auto_setup_enabled()); - EXPECT_EQ(std::set<privetd::PairingType>{privetd::PairingType::kPinCode}, + EXPECT_EQ(std::set<privet::PairingType>{privet::PairingType::kPinCode}, config_->pairing_modes()); EXPECT_EQ("", config_->embedded_code_path().value()); EXPECT_EQ("Developer device", config_->name()); @@ -120,11 +120,9 @@ EXPECT_EQ(base::TimeDelta::FromMilliseconds(6589), config_->backup_polling_period()); EXPECT_FALSE(config_->wifi_auto_setup_enabled()); - std::set<privetd::PairingType> pairing_types{ - privetd::PairingType::kPinCode, - privetd::PairingType::kEmbeddedCode, - privetd::PairingType::kUltrasound32, - privetd::PairingType::kAudible32}; + std::set<privet::PairingType> pairing_types{ + privet::PairingType::kPinCode, privet::PairingType::kEmbeddedCode, + privet::PairingType::kUltrasound32, privet::PairingType::kAudible32}; EXPECT_EQ(pairing_types, config_->pairing_modes()); EXPECT_EQ("/conf_code", config_->embedded_code_path().value()); EXPECT_EQ("conf_name", config_->name()); @@ -185,7 +183,7 @@ 'last_configured_ssid': 'state_last_configured_ssid', 'service_url': 'state_service_url' })"; - storage_->Save(*buffet::unittests::CreateDictionaryValue(state)); + storage_->Save(*unittests::CreateDictionaryValue(state)); chromeos::KeyValueStore config_store; EXPECT_CALL(*this, OnConfigChanged(_)).Times(1); @@ -312,4 +310,4 @@ })"; EXPECT_JSON_EQ(expected, *storage_->Load()); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/cloud_command_proxy.cc b/libweave/src/commands/cloud_command_proxy.cc index 0ef511f..1bc4007 100644 --- a/libweave/src/commands/cloud_command_proxy.cc +++ b/libweave/src/commands/cloud_command_proxy.cc
@@ -11,7 +11,7 @@ #include "libweave/src/commands/prop_types.h" #include "libweave/src/commands/schema_constants.h" -namespace buffet { +namespace weave { CloudCommandProxy::CloudCommandProxy( CommandInstance* command_instance, @@ -147,4 +147,4 @@ SendCommandUpdate(); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/cloud_command_proxy.h b/libweave/src/commands/cloud_command_proxy.h index 3d47e9d..4bacdc9 100644 --- a/libweave/src/commands/cloud_command_proxy.h +++ b/libweave/src/commands/cloud_command_proxy.h
@@ -20,7 +20,7 @@ #include "libweave/src/commands/command_proxy_interface.h" #include "libweave/src/states/state_change_queue_interface.h" -namespace buffet { +namespace weave { class CommandInstance; @@ -94,6 +94,6 @@ DISALLOW_COPY_AND_ASSIGN(CloudCommandProxy); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_CLOUD_COMMAND_PROXY_H_
diff --git a/libweave/src/commands/cloud_command_proxy_unittest.cc b/libweave/src/commands/cloud_command_proxy_unittest.cc index 5452f93..501c873 100644 --- a/libweave/src/commands/cloud_command_proxy_unittest.cc +++ b/libweave/src/commands/cloud_command_proxy_unittest.cc
@@ -22,7 +22,7 @@ using testing::ReturnPointee; using testing::_; -namespace buffet { +namespace weave { using unittests::CreateDictionaryValue; using unittests::CreateValue; @@ -411,4 +411,4 @@ callbacks_.Notify(20); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/cloud_command_update_interface.h b/libweave/src/commands/cloud_command_update_interface.h index 4778db4..5bd5c11 100644 --- a/libweave/src/commands/cloud_command_update_interface.h +++ b/libweave/src/commands/cloud_command_update_interface.h
@@ -10,7 +10,7 @@ #include <base/callback_forward.h> #include <base/values.h> -namespace buffet { +namespace weave { // An abstract interface to allow for sending command update requests to the // cloud server. @@ -25,6 +25,6 @@ virtual ~CloudCommandUpdateInterface() = default; }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_CLOUD_COMMAND_UPDATE_INTERFACE_H_
diff --git a/libweave/src/commands/command_definition.cc b/libweave/src/commands/command_definition.cc index 0b7bcb3..e14a182 100644 --- a/libweave/src/commands/command_definition.cc +++ b/libweave/src/commands/command_definition.cc
@@ -11,7 +11,7 @@ #include "libweave/src/commands/schema_constants.h" -namespace buffet { +namespace weave { bool CommandDefinition::Visibility::FromString(const std::string& str, chromeos::ErrorPtr* error) { @@ -72,4 +72,4 @@ visibility_ = visibility; } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/command_definition.h b/libweave/src/commands/command_definition.h index 21eed9c..9c0d370 100644 --- a/libweave/src/commands/command_definition.h +++ b/libweave/src/commands/command_definition.h
@@ -13,7 +13,7 @@ #include "libweave/src/commands/object_schema.h" #include "libweave/src/commands/user_role.h" -namespace buffet { +namespace weave { // A simple GCD command definition. This class contains the command category // and a full object schema describing the command parameter types and @@ -79,6 +79,6 @@ DISALLOW_COPY_AND_ASSIGN(CommandDefinition); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_COMMAND_DEFINITION_H_
diff --git a/libweave/src/commands/command_definition_unittest.cc b/libweave/src/commands/command_definition_unittest.cc index bd1835f..abb5d62 100644 --- a/libweave/src/commands/command_definition_unittest.cc +++ b/libweave/src/commands/command_definition_unittest.cc
@@ -6,7 +6,7 @@ #include <gtest/gtest.h> -namespace buffet { +namespace weave { TEST(CommandVisibility, DefaultConstructor) { CommandDefinition::Visibility visibility; @@ -91,4 +91,4 @@ EXPECT_EQ("local", def.GetVisibility().ToString()); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/command_dictionary.cc b/libweave/src/commands/command_dictionary.cc index 69932d7..5ad1939 100644 --- a/libweave/src/commands/command_dictionary.cc +++ b/libweave/src/commands/command_dictionary.cc
@@ -10,7 +10,7 @@ #include "libweave/src/commands/command_definition.h" #include "libweave/src/commands/schema_constants.h" -namespace buffet { +namespace weave { std::vector<std::string> CommandDictionary::GetCommandNamesByCategory( const std::string& category) const { @@ -258,4 +258,4 @@ definitions_.clear(); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/command_dictionary.h b/libweave/src/commands/command_dictionary.h index e800c4f..9a3c407 100644 --- a/libweave/src/commands/command_dictionary.h +++ b/libweave/src/commands/command_dictionary.h
@@ -21,7 +21,7 @@ class DictionaryValue; } // namespace base -namespace buffet { +namespace weave { class ObjectSchema; @@ -94,6 +94,6 @@ DISALLOW_COPY_AND_ASSIGN(CommandDictionary); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_COMMAND_DICTIONARY_H_
diff --git a/libweave/src/commands/command_dictionary_unittest.cc b/libweave/src/commands/command_dictionary_unittest.cc index 278364f..093aee3 100644 --- a/libweave/src/commands/command_dictionary_unittest.cc +++ b/libweave/src/commands/command_dictionary_unittest.cc
@@ -8,7 +8,7 @@ #include "libweave/src/commands/unittest_utils.h" -namespace buffet { +namespace weave { using unittests::CreateDictionaryValue; using unittests::IsEqualValue; @@ -585,4 +585,4 @@ error.reset(); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/command_instance.cc b/libweave/src/commands/command_instance.cc index ed28687..f836a64 100644 --- a/libweave/src/commands/command_instance.cc +++ b/libweave/src/commands/command_instance.cc
@@ -16,7 +16,7 @@ #include "libweave/src/commands/schema_constants.h" #include "libweave/src/commands/schema_utils.h" -namespace buffet { +namespace weave { const char CommandInstance::kStatusQueued[] = "queued"; const char CommandInstance::kStatusInProgress[] = "inProgress"; @@ -228,4 +228,4 @@ queue_->DelayedRemove(GetID()); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/command_instance.h b/libweave/src/commands/command_instance.h index 85e78eb..73d4646 100644 --- a/libweave/src/commands/command_instance.h +++ b/libweave/src/commands/command_instance.h
@@ -20,7 +20,7 @@ class Value; } // namespace base -namespace buffet { +namespace weave { class CommandDefinition; class CommandDictionary; @@ -151,6 +151,6 @@ DISALLOW_COPY_AND_ASSIGN(CommandInstance); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_COMMAND_INSTANCE_H_
diff --git a/libweave/src/commands/command_instance_unittest.cc b/libweave/src/commands/command_instance_unittest.cc index 0da58d8..0107042 100644 --- a/libweave/src/commands/command_instance_unittest.cc +++ b/libweave/src/commands/command_instance_unittest.cc
@@ -11,7 +11,7 @@ #include "libweave/src/commands/schema_utils.h" #include "libweave/src/commands/unittest_utils.h" -namespace buffet { +namespace weave { using unittests::CreateDictionaryValue; using unittests::CreateValue; @@ -237,4 +237,4 @@ }, *json, *converted); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/command_manager.cc b/libweave/src/commands/command_manager.cc index d8bc226..3deb36a 100644 --- a/libweave/src/commands/command_manager.cc +++ b/libweave/src/commands/command_manager.cc
@@ -14,7 +14,7 @@ using chromeos::dbus_utils::ExportedObjectManager; -namespace buffet { +namespace weave { CommandManager::CommandManager() : CommandManager(base::WeakPtr<ExportedObjectManager>{}) { @@ -102,7 +102,7 @@ UserRole role, std::string* id, chromeos::ErrorPtr* error) { - auto command_instance = buffet::CommandInstance::FromJson( + auto command_instance = CommandInstance::FromJson( &command, commands::attributes::kCommand_Visibility_Local, GetCommandDictionary(), nullptr, error); if (!command_instance) @@ -169,4 +169,4 @@ command_queue_.AddOnCommandRemovedCallback(callback); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/command_manager.h b/libweave/src/commands/command_manager.h index a404256..0aa703d 100644 --- a/libweave/src/commands/command_manager.h +++ b/libweave/src/commands/command_manager.h
@@ -24,7 +24,7 @@ } // namespace dbus_utils } // namespace chromeos -namespace buffet { +namespace weave { class CommandInstance; @@ -119,6 +119,6 @@ DISALLOW_COPY_AND_ASSIGN(CommandManager); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_COMMAND_MANAGER_H_
diff --git a/libweave/src/commands/command_manager_unittest.cc b/libweave/src/commands/command_manager_unittest.cc index 3087a49..1a90408 100644 --- a/libweave/src/commands/command_manager_unittest.cc +++ b/libweave/src/commands/command_manager_unittest.cc
@@ -12,7 +12,7 @@ #include "libweave/src/commands/unittest_utils.h" -namespace buffet { +namespace weave { using unittests::CreateDictionaryValue; @@ -214,4 +214,4 @@ EXPECT_EQ("cloud", dict.FindCommand("bar._quux")->GetVisibility().ToString()); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/command_proxy_interface.h b/libweave/src/commands/command_proxy_interface.h index 53faa60..9f4df61 100644 --- a/libweave/src/commands/command_proxy_interface.h +++ b/libweave/src/commands/command_proxy_interface.h
@@ -9,7 +9,7 @@ #include "libweave/src/commands/schema_utils.h" -namespace buffet { +namespace weave { // This interface lets the command instance to update its proxy of command // state changes, so that the proxy can then notify clients of the changes over @@ -23,6 +23,6 @@ virtual void OnProgressChanged() = 0; }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_COMMAND_PROXY_INTERFACE_H_
diff --git a/libweave/src/commands/command_queue.cc b/libweave/src/commands/command_queue.cc index 904cf8e..6b63a29 100644 --- a/libweave/src/commands/command_queue.cc +++ b/libweave/src/commands/command_queue.cc
@@ -7,7 +7,7 @@ #include <base/bind.h> #include <base/time/time.h> -namespace buffet { +namespace weave { namespace { const int kRemoveCommandDelayMin = 5; @@ -78,4 +78,4 @@ return (p != map_.end()) ? p->second.get() : nullptr; } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/command_queue.h b/libweave/src/commands/command_queue.h index 8d43cc9..307b61c 100644 --- a/libweave/src/commands/command_queue.h +++ b/libweave/src/commands/command_queue.h
@@ -17,7 +17,7 @@ #include "libweave/src/commands/command_instance.h" -namespace buffet { +namespace weave { class CommandQueue final { public: @@ -82,6 +82,6 @@ DISALLOW_COPY_AND_ASSIGN(CommandQueue); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_COMMAND_QUEUE_H_
diff --git a/libweave/src/commands/command_queue_unittest.cc b/libweave/src/commands/command_queue_unittest.cc index 6b78709..36f31a8 100644 --- a/libweave/src/commands/command_queue_unittest.cc +++ b/libweave/src/commands/command_queue_unittest.cc
@@ -16,7 +16,7 @@ #include "libweave/src/commands/command_definition.h" #include "libweave/src/commands/object_schema.h" -namespace buffet { +namespace weave { class CommandQueueTest : public testing::Test { public: @@ -162,4 +162,4 @@ EXPECT_EQ(id2, cmd2->GetID()); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/dbus_command_dispatcher.cc b/libweave/src/commands/dbus_command_dispatcher.cc index f832789..65684d3 100644 --- a/libweave/src/commands/dbus_command_dispatcher.cc +++ b/libweave/src/commands/dbus_command_dispatcher.cc
@@ -13,7 +13,7 @@ using chromeos::dbus_utils::AsyncEventSequencer; using chromeos::dbus_utils::ExportedObjectManager; -namespace buffet { +namespace weave { DBusCommandDispacher::DBusCommandDispacher( const base::WeakPtr<ExportedObjectManager>& object_manager) @@ -25,9 +25,9 @@ return; std::unique_ptr<DBusCommandProxy> proxy{new DBusCommandProxy( object_manager_.get(), object_manager_->GetBus(), command_instance, - dbus_constants::kCommandServicePathPrefix + std::to_string(++next_id_))}; + buffet::kCommandServicePathPrefix + std::to_string(++next_id_))}; proxy->RegisterAsync(AsyncEventSequencer::GetDefaultCompletionAction()); command_instance->AddProxy(std::move(proxy)); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/dbus_command_dispatcher.h b/libweave/src/commands/dbus_command_dispatcher.h index 12fdf78..ad5d880 100644 --- a/libweave/src/commands/dbus_command_dispatcher.h +++ b/libweave/src/commands/dbus_command_dispatcher.h
@@ -17,7 +17,7 @@ } // namespace dbus_utils } // namespace chromeos -namespace buffet { +namespace weave { class CommandInstance; @@ -47,6 +47,6 @@ DISALLOW_COPY_AND_ASSIGN(DBusCommandDispacher); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_DBUS_COMMAND_DISPATCHER_H_
diff --git a/libweave/src/commands/dbus_command_dispatcher_unittest.cc b/libweave/src/commands/dbus_command_dispatcher_unittest.cc index 3f56ba1..8b5412b 100644 --- a/libweave/src/commands/dbus_command_dispatcher_unittest.cc +++ b/libweave/src/commands/dbus_command_dispatcher_unittest.cc
@@ -20,7 +20,7 @@ #include "libweave/src/commands/dbus_command_proxy.h" #include "libweave/src/commands/unittest_utils.h" -namespace buffet { +namespace weave { using chromeos::dbus_utils::AsyncEventSequencer; using testing::_; @@ -41,7 +41,7 @@ command_queue_.SetNowForTest(base::Time::Max()); const dbus::ObjectPath kExportedObjectManagerPath("/test/om_path"); - std::string cmd_path = dbus_constants::kCommandServicePathPrefix; + std::string cmd_path = buffet::kCommandServicePathPrefix; cmd_path += "1"; const dbus::ObjectPath kCmdObjPath(cmd_path); @@ -200,4 +200,4 @@ EXPECT_EQ(nullptr, command_queue_.Find(id)); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/dbus_command_proxy.cc b/libweave/src/commands/dbus_command_proxy.cc index d7cbd14..d2fea64 100644 --- a/libweave/src/commands/dbus_command_proxy.cc +++ b/libweave/src/commands/dbus_command_proxy.cc
@@ -16,7 +16,7 @@ using chromeos::dbus_utils::AsyncEventSequencer; using chromeos::dbus_utils::ExportedObjectManager; -namespace buffet { +namespace weave { DBusCommandProxy::DBusCommandProxy(ExportedObjectManager* object_manager, const scoped_refptr<dbus::Bus>& bus, @@ -110,4 +110,4 @@ command_instance_->Done(); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/dbus_command_proxy.h b/libweave/src/commands/dbus_command_proxy.h index 571c996..5ea5ad4 100644 --- a/libweave/src/commands/dbus_command_proxy.h +++ b/libweave/src/commands/dbus_command_proxy.h
@@ -20,7 +20,7 @@ } // namespace dbus_utils } // namespace chromeos -namespace buffet { +namespace weave { class CommandInstance; @@ -65,6 +65,6 @@ DISALLOW_COPY_AND_ASSIGN(DBusCommandProxy); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_DBUS_COMMAND_PROXY_H_
diff --git a/libweave/src/commands/dbus_command_proxy_unittest.cc b/libweave/src/commands/dbus_command_proxy_unittest.cc index d933958..e1685ea 100644 --- a/libweave/src/commands/dbus_command_proxy_unittest.cc +++ b/libweave/src/commands/dbus_command_proxy_unittest.cc
@@ -19,7 +19,7 @@ #include "libweave/src/commands/command_instance.h" #include "libweave/src/commands/unittest_utils.h" -namespace buffet { +namespace weave { using ::testing::AnyNumber; using ::testing::Invoke; @@ -97,7 +97,7 @@ command_instance_->SetID(kTestCommandId); // Set up a mock ExportedObject to be used with the DBus command proxy. - std::string cmd_path = dbus_constants::kCommandServicePathPrefix; + std::string cmd_path = buffet::kCommandServicePathPrefix; cmd_path += kTestCommandId; const dbus::ObjectPath kCmdObjPath(cmd_path); // Use a mock exported object for the exported object manager. @@ -213,4 +213,4 @@ EXPECT_EQ(CommandInstance::kStatusDone, GetCommandAdaptor()->GetStatus()); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/enum_to_string.h b/libweave/src/commands/enum_to_string.h index 4c7d9aa..f1de19b 100644 --- a/libweave/src/commands/enum_to_string.h +++ b/libweave/src/commands/enum_to_string.h
@@ -7,7 +7,7 @@ #include <string> -namespace buffet { +namespace weave { // Helps to map enumeration to stings and back. // @@ -64,6 +64,6 @@ static const Map kMap[]; }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_ENUM_TO_STRING_H_
diff --git a/libweave/src/commands/object_schema.cc b/libweave/src/commands/object_schema.cc index 27ace1c..1f7b7fa 100644 --- a/libweave/src/commands/object_schema.cc +++ b/libweave/src/commands/object_schema.cc
@@ -15,7 +15,7 @@ #include "libweave/src/commands/prop_values.h" #include "libweave/src/commands/schema_constants.h" -namespace buffet { +namespace weave { namespace { @@ -375,4 +375,4 @@ return std::unique_ptr<ObjectSchema>{new ObjectSchema}; } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/object_schema.h b/libweave/src/commands/object_schema.h index 577a5d4..51c555f 100644 --- a/libweave/src/commands/object_schema.h +++ b/libweave/src/commands/object_schema.h
@@ -16,7 +16,7 @@ class DictionaryValue; } // namespace base -namespace buffet { +namespace weave { class PropType; @@ -92,6 +92,6 @@ bool extra_properties_allowed_{false}; }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_OBJECT_SCHEMA_H_
diff --git a/libweave/src/commands/object_schema_unittest.cc b/libweave/src/commands/object_schema_unittest.cc index b05e315..753ad46 100644 --- a/libweave/src/commands/object_schema_unittest.cc +++ b/libweave/src/commands/object_schema_unittest.cc
@@ -19,7 +19,7 @@ #include "libweave/src/commands/schema_constants.h" #include "libweave/src/commands/unittest_utils.h" -namespace buffet { +namespace weave { using unittests::CreateValue; using unittests::CreateDictionaryValue; @@ -1714,4 +1714,4 @@ EXPECT_EQ("Required parameter missing: param1", error->GetMessage()); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/prop_constraints.cc b/libweave/src/commands/prop_constraints.cc index 29d3348..f223978 100644 --- a/libweave/src/commands/prop_constraints.cc +++ b/libweave/src/commands/prop_constraints.cc
@@ -9,7 +9,7 @@ #include "libweave/src/commands/prop_values.h" #include "libweave/src/commands/schema_constants.h" -namespace buffet { +namespace weave { namespace { @@ -217,4 +217,4 @@ return commands::attributes::kOneOf_Enum; } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/prop_constraints.h b/libweave/src/commands/prop_constraints.h index 71d273a..74f69da 100644 --- a/libweave/src/commands/prop_constraints.h +++ b/libweave/src/commands/prop_constraints.h
@@ -18,7 +18,7 @@ #include "libweave/src/commands/schema_constants.h" #include "libweave/src/commands/schema_utils.h" -namespace buffet { +namespace weave { enum class ConstraintType { Min, Max, StringLengthMin, StringLengthMax, OneOf }; @@ -320,6 +320,6 @@ DISALLOW_COPY_AND_ASSIGN(ConstraintOneOf); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_PROP_CONSTRAINTS_H_
diff --git a/libweave/src/commands/prop_types.cc b/libweave/src/commands/prop_types.cc index eb4fc6e..54d8028 100644 --- a/libweave/src/commands/prop_types.cc +++ b/libweave/src/commands/prop_types.cc
@@ -18,7 +18,7 @@ #include "libweave/src/commands/prop_values.h" #include "libweave/src/commands/schema_constants.h" -namespace buffet { +namespace weave { // PropType ------------------------------------------------------------------- PropType::PropType() { @@ -292,22 +292,22 @@ std::unique_ptr<PropType> PropType::Create(ValueType type) { PropType* prop = nullptr; switch (type) { - case buffet::ValueType::Int: + case ValueType::Int: prop = new IntPropType; break; - case buffet::ValueType::Double: + case ValueType::Double: prop = new DoublePropType; break; - case buffet::ValueType::String: + case ValueType::String: prop = new StringPropType; break; - case buffet::ValueType::Boolean: + case ValueType::Boolean: prop = new BooleanPropType; break; - case buffet::ValueType::Object: + case ValueType::Object: prop = new ObjectPropType; break; - case buffet::ValueType::Array: + case ValueType::Array: prop = new ArrayPropType; break; } @@ -727,4 +727,4 @@ item_type_.is_inherited = false; } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/prop_types.h b/libweave/src/commands/prop_types.h index 9acab29..e98d2eb 100644 --- a/libweave/src/commands/prop_types.h +++ b/libweave/src/commands/prop_types.h
@@ -19,7 +19,7 @@ #include "libweave/src/commands/prop_constraints.h" #include "libweave/src/commands/prop_values.h" -namespace buffet { +namespace weave { class IntPropType; class DoublePropType; @@ -420,6 +420,6 @@ InheritableAttribute<std::unique_ptr<const PropType>> item_type_; }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_PROP_TYPES_H_
diff --git a/libweave/src/commands/prop_values.cc b/libweave/src/commands/prop_values.cc index 28a2c43..abde3b7 100644 --- a/libweave/src/commands/prop_values.cc +++ b/libweave/src/commands/prop_values.cc
@@ -6,7 +6,7 @@ #include "libweave/src/commands/prop_types.h" -namespace buffet { +namespace weave { PropValue::PropValue(std::unique_ptr<const PropType> type) : type_{std::move(type)} { @@ -18,4 +18,4 @@ PropValue::~PropValue() { } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/prop_values.h b/libweave/src/commands/prop_values.h index b178330..90ce909 100644 --- a/libweave/src/commands/prop_values.h +++ b/libweave/src/commands/prop_values.h
@@ -19,7 +19,7 @@ class DictionaryValue; } // namespace base -namespace buffet { +namespace weave { // Enumeration to indicate supported command parameter types. enum class ValueType { @@ -229,6 +229,6 @@ ArrayValue const* GetArray() const override { return this; } }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_PROP_VALUES_H_
diff --git a/libweave/src/commands/schema_constants.cc b/libweave/src/commands/schema_constants.cc index 2cb1dfb..9c7bc45 100644 --- a/libweave/src/commands/schema_constants.cc +++ b/libweave/src/commands/schema_constants.cc
@@ -4,7 +4,7 @@ #include "libweave/src/commands/schema_constants.h" -namespace buffet { +namespace weave { namespace errors { namespace commands { @@ -75,4 +75,4 @@ } // namespace attributes } // namespace commands -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/schema_constants.h b/libweave/src/commands/schema_constants.h index 379c729..2d4ae07 100644 --- a/libweave/src/commands/schema_constants.h +++ b/libweave/src/commands/schema_constants.h
@@ -5,7 +5,7 @@ #ifndef LIBWEAVE_SRC_COMMANDS_SCHEMA_CONSTANTS_H_ #define LIBWEAVE_SRC_COMMANDS_SCHEMA_CONSTANTS_H_ -namespace buffet { +namespace weave { namespace errors { namespace commands { @@ -78,6 +78,6 @@ } // namespace attributes } // namespace commands -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_SCHEMA_CONSTANTS_H_
diff --git a/libweave/src/commands/schema_utils.cc b/libweave/src/commands/schema_utils.cc index 1575fdc..8e34032 100644 --- a/libweave/src/commands/schema_utils.cc +++ b/libweave/src/commands/schema_utils.cc
@@ -14,7 +14,7 @@ #include "libweave/src/commands/prop_types.h" #include "libweave/src/commands/prop_values.h" -namespace buffet { +namespace weave { namespace { // Helper function to report "type mismatch" errors when parsing JSON. void ReportJsonTypeMismatch(const tracked_objects::Location& location, @@ -384,4 +384,4 @@ return true; } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/schema_utils.h b/libweave/src/commands/schema_utils.h index d16374c..6b756e7 100644 --- a/libweave/src/commands/schema_utils.h +++ b/libweave/src/commands/schema_utils.h
@@ -17,7 +17,7 @@ #include <chromeos/errors/error.h> #include <chromeos/variant_dictionary.h> -namespace buffet { +namespace weave { class PropType; class PropValue; @@ -159,6 +159,6 @@ native_types::Object* obj, chromeos::ErrorPtr* error); -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_SCHEMA_UTILS_H_
diff --git a/libweave/src/commands/schema_utils_unittest.cc b/libweave/src/commands/schema_utils_unittest.cc index 92194dd..6fd5e0f 100644 --- a/libweave/src/commands/schema_utils_unittest.cc +++ b/libweave/src/commands/schema_utils_unittest.cc
@@ -18,7 +18,7 @@ #include "libweave/src/commands/schema_constants.h" #include "libweave/src/commands/unittest_utils.h" -namespace buffet { +namespace weave { using unittests::CreateDictionaryValue; using unittests::CreateValue; @@ -370,4 +370,4 @@ EXPECT_EQ(errors::commands::kOutOfRange, error->GetCode()); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/unittest_utils.cc b/libweave/src/commands/unittest_utils.cc index b5eb166..85e63fc 100644 --- a/libweave/src/commands/unittest_utils.cc +++ b/libweave/src/commands/unittest_utils.cc
@@ -7,7 +7,7 @@ #include <base/json/json_reader.h> #include <base/json/json_writer.h> -namespace buffet { +namespace weave { namespace unittests { std::unique_ptr<base::Value> CreateValue(const char* json) { @@ -34,4 +34,4 @@ } } // namespace unittests -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/unittest_utils.h b/libweave/src/commands/unittest_utils.h index 1674084..0e685d1 100644 --- a/libweave/src/commands/unittest_utils.h +++ b/libweave/src/commands/unittest_utils.h
@@ -14,7 +14,7 @@ #include "libweave/src/commands/prop_types.h" #include "libweave/src/commands/prop_values.h" -namespace buffet { +namespace weave { namespace unittests { // Helper method to create base::Value from a string as a smart pointer. @@ -55,10 +55,10 @@ } } // namespace unittests -} // namespace buffet +} // namespace weave -#define EXPECT_JSON_EQ(expected, actual) \ - EXPECT_PRED2(buffet::unittests::IsEqualValue, \ - *buffet::unittests::CreateValue(expected), actual) +#define EXPECT_JSON_EQ(expected, actual) \ + EXPECT_PRED2(unittests::IsEqualValue, *unittests::CreateValue(expected), \ + actual) #endif // LIBWEAVE_SRC_COMMANDS_UNITTEST_UTILS_H_
diff --git a/libweave/src/commands/user_role.cc b/libweave/src/commands/user_role.cc index b6f898d..2edd620 100644 --- a/libweave/src/commands/user_role.cc +++ b/libweave/src/commands/user_role.cc
@@ -9,7 +9,7 @@ #include "libweave/src/commands/enum_to_string.h" #include "libweave/src/commands/schema_constants.h" -namespace buffet { +namespace weave { template <> const EnumToString<UserRole>::Map EnumToString<UserRole>::kMap[] = { @@ -34,4 +34,4 @@ return false; } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/commands/user_role.h b/libweave/src/commands/user_role.h index 00dcf60..c422dfa 100644 --- a/libweave/src/commands/user_role.h +++ b/libweave/src/commands/user_role.h
@@ -8,7 +8,7 @@ #include <string> #include <chromeos/errors/error.h> -namespace buffet { +namespace weave { enum class UserRole { kViewer, @@ -23,6 +23,6 @@ UserRole* role, chromeos::ErrorPtr* error); -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_COMMANDS_USER_ROLE_H_
diff --git a/libweave/src/device_registration_info.cc b/libweave/src/device_registration_info.cc index f19b973..8b1dca1 100644 --- a/libweave/src/device_registration_info.cc +++ b/libweave/src/device_registration_info.cc
@@ -30,9 +30,11 @@ #include "libweave/src/states/state_manager.h" #include "libweave/src/utils.h" -const char buffet::kErrorDomainOAuth2[] = "oauth2"; -const char buffet::kErrorDomainGCD[] = "gcd"; -const char buffet::kErrorDomainGCDServer[] = "gcd_server"; +namespace weave { + +const char kErrorDomainOAuth2[] = "oauth2"; +const char kErrorDomainGCD[] = "gcd"; +const char kErrorDomainGCDServer[] = "gcd_server"; namespace { @@ -49,7 +51,7 @@ } inline void SetUnexpectedError(chromeos::ErrorPtr* error) { - chromeos::Error::AddTo(error, FROM_HERE, buffet::kErrorDomainGCD, + chromeos::Error::AddTo(error, FROM_HERE, kErrorDomainGCD, "unexpected_response", "Unexpected GCD error"); } @@ -74,7 +76,7 @@ std::string error_code, error_message; if (error_object->GetString("reason", &error_code) && error_object->GetString("message", &error_message)) { - chromeos::Error::AddTo(error, FROM_HERE, buffet::kErrorDomainGCDServer, + chromeos::Error::AddTo(error, FROM_HERE, kErrorDomainGCDServer, error_code, error_message); } else { SetUnexpectedError(error); @@ -107,8 +109,6 @@ } // anonymous namespace -namespace buffet { - DeviceRegistrationInfo::DeviceRegistrationInfo( const std::shared_ptr<CommandManager>& command_manager, const std::shared_ptr<StateManager>& state_manager, @@ -116,7 +116,7 @@ const std::shared_ptr<chromeos::http::Transport>& transport, const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, bool notifications_enabled, - privetd::ShillClient* shill_client) + privet::ShillClient* shill_client) : transport_{transport}, task_runner_{task_runner}, command_manager_{command_manager}, @@ -239,8 +239,8 @@ if (!resp->GetString("error_description", &error_message)) { error_message = "Unexpected OAuth error"; } - chromeos::Error::AddTo(error, FROM_HERE, buffet::kErrorDomainOAuth2, - error_code, error_message); + chromeos::Error::AddTo(error, FROM_HERE, kErrorDomainOAuth2, error_code, + error_message); return std::unique_ptr<base::DictionaryValue>(); } return resp; @@ -610,7 +610,7 @@ if (!response->IsSuccessful()) { ParseGCDError(json_resp.get(), &error); if (status_code == chromeos::http::status_code::Forbidden && - error->HasError(buffet::kErrorDomainGCDServer, "rateLimitExceeded")) { + error->HasError(kErrorDomainGCDServer, "rateLimitExceeded")) { // If we exceeded server quota, retry the request later. RetryCloudRequest(data); return; @@ -648,7 +648,7 @@ void DeviceRegistrationInfo::OnAccessTokenError( const std::shared_ptr<const CloudRequestData>& data, const chromeos::Error* error) { - if (error->HasError(buffet::kErrorDomainOAuth2, "invalid_grant")) + if (error->HasError(kErrorDomainOAuth2, "invalid_grant")) MarkDeviceUnregistered(); data->error_callback.Run(error); } @@ -1058,7 +1058,7 @@ auto mark_unregistered = base::Bind(&DeviceRegistrationInfo::MarkDeviceUnregistered, AsWeakPtr()); auto error_callback = [mark_unregistered](const chromeos::Error* error) { - if (error->HasError(buffet::kErrorDomainOAuth2, "invalid_grant")) + if (error->HasError(kErrorDomainOAuth2, "invalid_grant")) mark_unregistered.Run(); }; RefreshAccessToken(base::Bind(&base::DoNothing), base::Bind(error_callback)); @@ -1113,4 +1113,4 @@ SetRegistrationStatus(RegistrationStatus::kInvalidCredentials); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/device_registration_info.h b/libweave/src/device_registration_info.h index 8c9cf80..5d55ee6 100644 --- a/libweave/src/device_registration_info.h +++ b/libweave/src/device_registration_info.h
@@ -41,14 +41,14 @@ class KeyValueStore; } // namespace chromeos -namespace privetd { -class ShillClient; -} - -namespace buffet { +namespace weave { class StateManager; +namespace privet { +class ShillClient; +} + extern const char kErrorDomainOAuth2[]; extern const char kErrorDomainGCD[]; extern const char kErrorDomainGCDServer[]; @@ -71,7 +71,7 @@ const std::shared_ptr<chromeos::http::Transport>& transport, const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, bool notifications_enabled, - privetd::ShillClient* shill_client); + privet::ShillClient* shill_client); ~DeviceRegistrationInfo() override; @@ -135,7 +135,7 @@ std::string RegisterDevice(const std::string& ticket_id, chromeos::ErrorPtr* error); - // Updates a command (override from buffet::CloudCommandUpdateInterface). + // Updates a command (override from CloudCommandUpdateInterface). void UpdateCommand(const std::string& command_id, const base::DictionaryValue& command_patch, const base::Closure& on_success, @@ -330,7 +330,7 @@ NotificationChannel* current_notification_channel_{nullptr}; bool notification_channel_starting_{false}; - privetd::ShillClient* shill_client_{nullptr}; + privet::ShillClient* shill_client_{nullptr}; // Tracks our current registration status. RegistrationStatus registration_status_{RegistrationStatus::kUnconfigured}; @@ -341,6 +341,6 @@ DISALLOW_COPY_AND_ASSIGN(DeviceRegistrationInfo); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_DEVICE_REGISTRATION_INFO_H_
diff --git a/libweave/src/device_registration_info_unittest.cc b/libweave/src/device_registration_info_unittest.cc index ba5a4e4..b41e182 100644 --- a/libweave/src/device_registration_info_unittest.cc +++ b/libweave/src/device_registration_info_unittest.cc
@@ -22,7 +22,7 @@ #include "libweave/src/states/state_manager.h" #include "libweave/src/storage_impls.h" -namespace buffet { +namespace weave { using chromeos::http::request_header::kAuthorization; using chromeos::http::fake::ServerRequest; @@ -598,4 +598,4 @@ command->Cancel(); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/notification/notification_channel.h b/libweave/src/notification/notification_channel.h index 1c5bf06..972629f 100644 --- a/libweave/src/notification/notification_channel.h +++ b/libweave/src/notification/notification_channel.h
@@ -11,7 +11,7 @@ class DictionaryValue; } // namespace base -namespace buffet { +namespace weave { class NotificationDelegate; @@ -27,6 +27,6 @@ virtual void Stop() = 0; }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_NOTIFICATION_NOTIFICATION_CHANNEL_H_
diff --git a/libweave/src/notification/notification_delegate.h b/libweave/src/notification/notification_delegate.h index 4b66f31..a7df13b 100644 --- a/libweave/src/notification/notification_delegate.h +++ b/libweave/src/notification/notification_delegate.h
@@ -10,7 +10,7 @@ #include <base/values.h> -namespace buffet { +namespace weave { class NotificationDelegate { public: @@ -26,6 +26,6 @@ virtual ~NotificationDelegate() = default; }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_NOTIFICATION_NOTIFICATION_DELEGATE_H_
diff --git a/libweave/src/notification/notification_parser.cc b/libweave/src/notification/notification_parser.cc index 1fe8878..1e70feb 100644 --- a/libweave/src/notification/notification_parser.cc +++ b/libweave/src/notification/notification_parser.cc
@@ -6,7 +6,7 @@ #include <base/logging.h> -namespace buffet { +namespace weave { namespace { @@ -67,4 +67,4 @@ return true; } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/notification/notification_parser.h b/libweave/src/notification/notification_parser.h index 062ce4c..9474570 100644 --- a/libweave/src/notification/notification_parser.h +++ b/libweave/src/notification/notification_parser.h
@@ -11,7 +11,7 @@ #include "libweave/src/notification/notification_delegate.h" -namespace buffet { +namespace weave { // Parses the notification JSON object received from GCD server and invokes // the appropriate method from the |delegate|. @@ -19,6 +19,6 @@ bool ParseNotificationJson(const base::DictionaryValue& notification, NotificationDelegate* delegate); -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_NOTIFICATION_NOTIFICATION_PARSER_H_
diff --git a/libweave/src/notification/notification_parser_unittest.cc b/libweave/src/notification/notification_parser_unittest.cc index d60cde7..8c13460 100644 --- a/libweave/src/notification/notification_parser_unittest.cc +++ b/libweave/src/notification/notification_parser_unittest.cc
@@ -13,7 +13,7 @@ using testing::Invoke; using testing::_; -namespace buffet { +namespace weave { using unittests::CreateDictionaryValue; @@ -154,4 +154,4 @@ EXPECT_TRUE(ParseNotificationJson(*json, &delegate_)); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/notification/pull_channel.cc b/libweave/src/notification/pull_channel.cc index 69f20d1..2f954e5 100644 --- a/libweave/src/notification/pull_channel.cc +++ b/libweave/src/notification/pull_channel.cc
@@ -8,7 +8,7 @@ #include "libweave/src/notification/notification_delegate.h" -namespace buffet { +namespace weave { PullChannel::PullChannel( base::TimeDelta pull_interval, @@ -53,4 +53,4 @@ delegate_->OnCommandCreated(empty_dict); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/notification/pull_channel.h b/libweave/src/notification/pull_channel.h index d1ff490..79955d0 100644 --- a/libweave/src/notification/pull_channel.h +++ b/libweave/src/notification/pull_channel.h
@@ -15,7 +15,7 @@ #include "libweave/src/notification/notification_channel.h" -namespace buffet { +namespace weave { class PullChannel : public NotificationChannel { public: @@ -43,6 +43,6 @@ DISALLOW_COPY_AND_ASSIGN(PullChannel); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_NOTIFICATION_PULL_CHANNEL_H_
diff --git a/libweave/src/notification/xml_node.cc b/libweave/src/notification/xml_node.cc index 040d8eb..6550ddc 100644 --- a/libweave/src/notification/xml_node.cc +++ b/libweave/src/notification/xml_node.cc
@@ -7,7 +7,7 @@ #include <base/strings/stringprintf.h> #include <chromeos/strings/string_utils.h> -namespace buffet { +namespace weave { XmlNode::XmlNode(const std::string& name, std::map<std::string, std::string> attributes) @@ -120,4 +120,4 @@ return xml; } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/notification/xml_node.h b/libweave/src/notification/xml_node.h index 16c3b21..9977fb4 100644 --- a/libweave/src/notification/xml_node.h +++ b/libweave/src/notification/xml_node.h
@@ -12,7 +12,7 @@ #include <base/macros.h> -namespace buffet { +namespace weave { class XmlNodeTest; class XmppStreamParser; @@ -117,6 +117,6 @@ DISALLOW_COPY_AND_ASSIGN(XmlNode); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_NOTIFICATION_XML_NODE_H_
diff --git a/libweave/src/notification/xml_node_unittest.cc b/libweave/src/notification/xml_node_unittest.cc index 6cbc9ec..de3fddd 100644 --- a/libweave/src/notification/xml_node_unittest.cc +++ b/libweave/src/notification/xml_node_unittest.cc
@@ -10,7 +10,7 @@ #include "libweave/src/notification/xmpp_stream_parser.h" -namespace buffet { +namespace weave { namespace { class XmlParser : public XmppStreamParser::Delegate { @@ -204,4 +204,4 @@ ASSERT_EQ(0u, children.size()); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/notification/xmpp_channel.cc b/libweave/src/notification/xmpp_channel.cc index c7bc35b..2c6ac61 100644 --- a/libweave/src/notification/xmpp_channel.cc +++ b/libweave/src/notification/xmpp_channel.cc
@@ -18,7 +18,7 @@ #include "libweave/src/privet/shill_client.h" #include "libweave/src/utils.h" -namespace buffet { +namespace weave { namespace { @@ -93,7 +93,7 @@ const std::string& account, const std::string& access_token, const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, - privetd::ShillClient* shill) + privet::ShillClient* shill) : account_{account}, access_token_{access_token}, backoff_entry_{&kDefaultBackoffPolicy}, @@ -532,4 +532,4 @@ ScheduleFastPing(); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/notification/xmpp_channel.h b/libweave/src/notification/xmpp_channel.h index 9402b65..d25669f 100644 --- a/libweave/src/notification/xmpp_channel.h +++ b/libweave/src/notification/xmpp_channel.h
@@ -21,12 +21,12 @@ #include "libweave/src/notification/xmpp_iq_stanza_handler.h" #include "libweave/src/notification/xmpp_stream_parser.h" -namespace privetd { +namespace weave { + +namespace privet { class ShillClient; } -namespace buffet { - // Simple interface to abstract XmppChannel's SendMessage() method. class XmppChannelInterface { public: @@ -46,7 +46,7 @@ XmppChannel(const std::string& account, const std::string& access_token, const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, - privetd::ShillClient* shill); + privet::ShillClient* shill); ~XmppChannel() override = default; // Overrides from NotificationChannel. @@ -168,6 +168,6 @@ DISALLOW_COPY_AND_ASSIGN(XmppChannel); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_NOTIFICATION_XMPP_CHANNEL_H_
diff --git a/libweave/src/notification/xmpp_channel_unittest.cc b/libweave/src/notification/xmpp_channel_unittest.cc index 5f401ba..74b158c 100644 --- a/libweave/src/notification/xmpp_channel_unittest.cc +++ b/libweave/src/notification/xmpp_channel_unittest.cc
@@ -12,7 +12,7 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> -namespace buffet { +namespace weave { using ::testing::DoAll; using ::testing::Return; @@ -249,4 +249,4 @@ EXPECT_EQ(XmppChannel::XmppState::kSubscribed, xmpp_client_->state()); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/notification/xmpp_iq_stanza_handler.cc b/libweave/src/notification/xmpp_iq_stanza_handler.cc index 75529fa..4cee499 100644 --- a/libweave/src/notification/xmpp_iq_stanza_handler.cc +++ b/libweave/src/notification/xmpp_iq_stanza_handler.cc
@@ -11,7 +11,7 @@ #include "libweave/src/notification/xml_node.h" #include "libweave/src/notification/xmpp_channel.h" -namespace buffet { +namespace weave { namespace { @@ -137,4 +137,4 @@ timeout_callback.Run(); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/notification/xmpp_iq_stanza_handler.h b/libweave/src/notification/xmpp_iq_stanza_handler.h index af19395..78e9be2 100644 --- a/libweave/src/notification/xmpp_iq_stanza_handler.h +++ b/libweave/src/notification/xmpp_iq_stanza_handler.h
@@ -16,7 +16,7 @@ #include "libweave/src/notification/xmpp_stream_parser.h" -namespace buffet { +namespace weave { class XmppChannelInterface; @@ -75,6 +75,6 @@ DISALLOW_COPY_AND_ASSIGN(IqStanzaHandler); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_NOTIFICATION_XMPP_IQ_STANZA_HANDLER_H_
diff --git a/libweave/src/notification/xmpp_iq_stanza_handler_unittest.cc b/libweave/src/notification/xmpp_iq_stanza_handler_unittest.cc index a953252..80559ff 100644 --- a/libweave/src/notification/xmpp_iq_stanza_handler_unittest.cc +++ b/libweave/src/notification/xmpp_iq_stanza_handler_unittest.cc
@@ -19,7 +19,7 @@ using testing::Return; using testing::_; -namespace buffet { +namespace weave { namespace { // Mock-like task runner that allow the tests to inspect the calls to @@ -224,4 +224,4 @@ EXPECT_TRUE(called); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/notification/xmpp_stream_parser.cc b/libweave/src/notification/xmpp_stream_parser.cc index 9480e88..0aeac3e 100644 --- a/libweave/src/notification/xmpp_stream_parser.cc +++ b/libweave/src/notification/xmpp_stream_parser.cc
@@ -6,7 +6,7 @@ #include "libweave/src/notification/xml_node.h" -namespace buffet { +namespace weave { XmppStreamParser::XmppStreamParser(Delegate* delegate) : delegate_{delegate} { parser_ = XML_ParserCreate(nullptr); @@ -94,4 +94,4 @@ } } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/notification/xmpp_stream_parser.h b/libweave/src/notification/xmpp_stream_parser.h index 2f5c87b..43dfda7 100644 --- a/libweave/src/notification/xmpp_stream_parser.h +++ b/libweave/src/notification/xmpp_stream_parser.h
@@ -14,7 +14,7 @@ #include <base/macros.h> -namespace buffet { +namespace weave { class XmlNode; @@ -83,6 +83,6 @@ DISALLOW_COPY_AND_ASSIGN(XmppStreamParser); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_NOTIFICATION_XMPP_STREAM_PARSER_H_
diff --git a/libweave/src/notification/xmpp_stream_parser_unittest.cc b/libweave/src/notification/xmpp_stream_parser_unittest.cc index 08cc4e5..57ad51d 100644 --- a/libweave/src/notification/xmpp_stream_parser_unittest.cc +++ b/libweave/src/notification/xmpp_stream_parser_unittest.cc
@@ -10,7 +10,7 @@ #include "libweave/src/notification/xml_node.h" -namespace buffet { +namespace weave { namespace { // Use some real-world XMPP stream snippet to make sure all the expected // elements are parsed properly. @@ -202,4 +202,4 @@ } } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/privet/ap_manager_client.cc b/libweave/src/privet/ap_manager_client.cc index 0b8630d..2395da8 100644 --- a/libweave/src/privet/ap_manager_client.cc +++ b/libweave/src/privet/ap_manager_client.cc
@@ -4,7 +4,8 @@ #include "libweave/src/privet/ap_manager_client.h" -namespace privetd { +namespace weave { +namespace privet { using org::chromium::apmanager::ConfigProxy; using org::chromium::apmanager::ManagerProxy; @@ -112,4 +113,5 @@ Stop(); } -} // namespace privetd +} // namespace privet +} // namespace weave
diff --git a/libweave/src/privet/ap_manager_client.h b/libweave/src/privet/ap_manager_client.h index cbde4fc..073ea08 100644 --- a/libweave/src/privet/ap_manager_client.h +++ b/libweave/src/privet/ap_manager_client.h
@@ -13,7 +13,8 @@ #include "apmanager/dbus-proxies.h" -namespace privetd { +namespace weave { +namespace privet { // Manages soft AP for wifi bootstrapping. // Once created can handle multiple Start/Stop requests. @@ -52,6 +53,7 @@ base::WeakPtrFactory<ApManagerClient> weak_ptr_factory_{this}; }; -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_AP_MANAGER_CLIENT_H_
diff --git a/libweave/src/privet/cloud_delegate.cc b/libweave/src/privet/cloud_delegate.cc index 71db1ee..1737b10 100644 --- a/libweave/src/privet/cloud_delegate.cc +++ b/libweave/src/privet/cloud_delegate.cc
@@ -23,20 +23,21 @@ #include "libweave/src/privet/constants.h" #include "libweave/src/states/state_manager.h" -namespace privetd { - -namespace { - using chromeos::ErrorPtr; using chromeos::VariantDictionary; using org::chromium::Buffet::ManagerProxy; using org::chromium::Buffet::ObjectManagerProxy; +namespace weave { +namespace privet { + +namespace { + const int kMaxSetupRetries = 5; const int kFirstRetryTimeoutSec = 1; -buffet::CommandInstance* ReturnNotFound(const std::string& command_id, - chromeos::ErrorPtr* error) { +CommandInstance* ReturnNotFound(const std::string& command_id, + chromeos::ErrorPtr* error) { chromeos::Error::AddToPrintf(error, FROM_HERE, errors::kDomain, errors::kNotFound, "Command not found, ID='%s'", command_id.c_str()); @@ -45,9 +46,9 @@ class CloudDelegateImpl : public CloudDelegate { public: - CloudDelegateImpl(buffet::DeviceRegistrationInfo* device, - buffet::CommandManager* command_manager, - buffet::StateManager* state_manager) + CloudDelegateImpl(DeviceRegistrationInfo* device, + CommandManager* command_manager, + StateManager* state_manager) : device_{device}, command_manager_{command_manager}, state_manager_{state_manager} { @@ -174,7 +175,7 @@ CHECK_NE(user_info.user_id(), 0u); chromeos::ErrorPtr error; - buffet::UserRole role; + UserRole role; if (!FromString(AuthScopeToString(user_info.scope()), &role, &error)) return error_callback.Run(error.get()); @@ -233,33 +234,30 @@ } private: - void OnCommandAdded(buffet::CommandInstance* command) { + void OnCommandAdded(CommandInstance* command) { // Set to 0 for any new unknown command. command_owners_.emplace(command->GetID(), 0); } - void OnCommandRemoved(buffet::CommandInstance* command) { + void OnCommandRemoved(CommandInstance* command) { CHECK(command_owners_.erase(command->GetID())); } - void OnConfigChanged(const buffet::BuffetConfig&) { - NotifyOnDeviceInfoChanged(); - } + void OnConfigChanged(const BuffetConfig&) { NotifyOnDeviceInfoChanged(); } - void OnRegistrationChanged(buffet::RegistrationStatus status) { - if (status == buffet::RegistrationStatus::kUnconfigured) { + void OnRegistrationChanged(RegistrationStatus status) { + if (status == RegistrationStatus::kUnconfigured) { connection_state_ = ConnectionState{ConnectionState::kUnconfigured}; - } else if (status == buffet::RegistrationStatus::kConnecting) { + } else if (status == RegistrationStatus::kConnecting) { // TODO(vitalybuka): Find conditions for kOffline. connection_state_ = ConnectionState{ConnectionState::kConnecting}; - } else if (status == buffet::RegistrationStatus::kConnected) { + } else if (status == RegistrationStatus::kConnected) { connection_state_ = ConnectionState{ConnectionState::kOnline}; } else { chromeos::ErrorPtr error; - chromeos::Error::AddToPrintf(&error, FROM_HERE, errors::kDomain, - errors::kInvalidState, - "Unexpected buffet status: %s", - buffet::StatusToString(status).c_str()); + chromeos::Error::AddToPrintf( + &error, FROM_HERE, errors::kDomain, errors::kInvalidState, + "Unexpected buffet status: %s", StatusToString(status).c_str()); connection_state_ = ConnectionState{std::move(error)}; } NotifyOnDeviceInfoChanged(); @@ -276,9 +274,7 @@ void OnCommandDefChanged() { command_defs_.Clear(); auto commands = command_manager_->GetCommandDictionary().GetCommandsAsJson( - [](const buffet::CommandDefinition* def) { - return def->GetVisibility().local; - }, + [](const CommandDefinition* def) { return def->GetVisibility().local; }, true, nullptr); CHECK(commands); command_defs_.MergeDictionary(commands.get()); @@ -315,9 +311,9 @@ setup_state_ = SetupState(SetupState::kSuccess); } - buffet::CommandInstance* GetCommandInternal(const std::string& command_id, - const UserInfo& user_info, - chromeos::ErrorPtr* error) const { + CommandInstance* GetCommandInternal(const std::string& command_id, + const UserInfo& user_info, + chromeos::ErrorPtr* error) const { if (user_info.scope() != AuthScope::kOwner) { auto it = command_owners_.find(command_id); if (it == command_owners_.end()) @@ -350,9 +346,9 @@ return false; } - buffet::DeviceRegistrationInfo* device_{nullptr}; - buffet::CommandManager* command_manager_{nullptr}; - buffet::StateManager* state_manager_{nullptr}; + DeviceRegistrationInfo* device_{nullptr}; + CommandManager* command_manager_{nullptr}; + StateManager* state_manager_{nullptr}; // Primary state of GCD. ConnectionState connection_state_{ConnectionState::kDisabled}; @@ -386,9 +382,9 @@ // static std::unique_ptr<CloudDelegate> CloudDelegate::CreateDefault( - buffet::DeviceRegistrationInfo* device, - buffet::CommandManager* command_manager, - buffet::StateManager* state_manager) { + DeviceRegistrationInfo* device, + CommandManager* command_manager, + StateManager* state_manager) { return std::unique_ptr<CloudDelegateImpl>{ new CloudDelegateImpl{device, command_manager, state_manager}}; } @@ -405,4 +401,5 @@ FOR_EACH_OBSERVER(Observer, observer_list_, OnStateChanged()); } -} // namespace privetd +} // namespace privet +} // namespace weave
diff --git a/libweave/src/privet/cloud_delegate.h b/libweave/src/privet/cloud_delegate.h index d0ac32d..60d5f49 100644 --- a/libweave/src/privet/cloud_delegate.h +++ b/libweave/src/privet/cloud_delegate.h
@@ -20,13 +20,13 @@ class DictionaryValue; } // namespace base -namespace buffet { +namespace weave { + class CommandManager; class DeviceRegistrationInfo; class StateManager; -} -namespace privetd { +namespace privet { // Interface to provide GCD functionality for PrivetHandler. // TODO(vitalybuka): Rename to BuffetDelegate. @@ -133,14 +133,15 @@ // Create default instance. static std::unique_ptr<CloudDelegate> CreateDefault( - buffet::DeviceRegistrationInfo* device, - buffet::CommandManager* command_manager, - buffet::StateManager* state_manager); + DeviceRegistrationInfo* device, + CommandManager* command_manager, + StateManager* state_manager); private: base::ObserverList<Observer> observer_list_; }; -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_CLOUD_DELEGATE_H_
diff --git a/libweave/src/privet/constants.cc b/libweave/src/privet/constants.cc index fe69a51..ccea586 100644 --- a/libweave/src/privet/constants.cc +++ b/libweave/src/privet/constants.cc
@@ -4,8 +4,8 @@ #include "libweave/src/privet/constants.h" -namespace privetd { - +namespace weave { +namespace privet { namespace errors { const char kDomain[] = "privetd"; @@ -32,5 +32,5 @@ const char kNotImplemented[] = "notImplemented"; } // namespace errors - -} // namespace privetd +} // namespace privet +} // namespace weave
diff --git a/libweave/src/privet/constants.h b/libweave/src/privet/constants.h index 17497d7..e95ec2f 100644 --- a/libweave/src/privet/constants.h +++ b/libweave/src/privet/constants.h
@@ -5,7 +5,11 @@ #ifndef LIBWEAVE_SRC_PRIVET_CONSTANTS_H_ #define LIBWEAVE_SRC_PRIVET_CONSTANTS_H_ -namespace privetd { +namespace weave { +namespace privet { + +// Time to reply on privet HTTP. +const int kSetupDelaySeconds = 1; namespace errors { @@ -32,10 +36,7 @@ extern const char kNotFound[]; extern const char kNotImplemented[]; } // namespace errors - -// Time to reply on privet HTTP. -const int kSetupDelaySeconds = 1; - -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_CONSTANTS_H_
diff --git a/libweave/src/privet/device_delegate.cc b/libweave/src/privet/device_delegate.cc index 8e5d2bb..d5f516e 100644 --- a/libweave/src/privet/device_delegate.cc +++ b/libweave/src/privet/device_delegate.cc
@@ -9,7 +9,8 @@ #include "libweave/src/privet/constants.h" -namespace privetd { +namespace weave { +namespace privet { namespace { @@ -51,4 +52,5 @@ return std::unique_ptr<DeviceDelegate>(new DeviceDelegateImpl()); } -} // namespace privetd +} // namespace privet +} // namespace weave
diff --git a/libweave/src/privet/device_delegate.h b/libweave/src/privet/device_delegate.h index a125a61..12996d7 100644 --- a/libweave/src/privet/device_delegate.h +++ b/libweave/src/privet/device_delegate.h
@@ -10,7 +10,8 @@ #include <base/time/time.h> -namespace privetd { +namespace weave { +namespace privet { // Interface to provide access to general information about device. class DeviceDelegate { @@ -40,6 +41,7 @@ static std::unique_ptr<DeviceDelegate> CreateDefault(); }; -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_DEVICE_DELEGATE_H_
diff --git a/libweave/src/privet/identity_delegate.h b/libweave/src/privet/identity_delegate.h index ea4fa09..b0ab340 100644 --- a/libweave/src/privet/identity_delegate.h +++ b/libweave/src/privet/identity_delegate.h
@@ -7,7 +7,8 @@ #include <string> -namespace privetd { +namespace weave { +namespace privet { // Interface for an object that can identify ourselves. class IdentityDelegate { @@ -19,6 +20,7 @@ virtual std::string GetId() const = 0; }; -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_IDENTITY_DELEGATE_H_
diff --git a/libweave/src/privet/mock_delegates.h b/libweave/src/privet/mock_delegates.h index 16d95b5..3696276 100644 --- a/libweave/src/privet/mock_delegates.h +++ b/libweave/src/privet/mock_delegates.h
@@ -24,7 +24,8 @@ using testing::ReturnRef; using testing::SetArgPointee; -namespace privetd { +namespace weave { +namespace privet { ACTION_TEMPLATE(RunCallback, HAS_1_TEMPLATE_PARAMS(int, k), @@ -224,6 +225,7 @@ } }; -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_MOCK_DELEGATES_H_
diff --git a/libweave/src/privet/openssl_utils.cc b/libweave/src/privet/openssl_utils.cc index 705eb1f..910b722 100644 --- a/libweave/src/privet/openssl_utils.cc +++ b/libweave/src/privet/openssl_utils.cc
@@ -11,7 +11,8 @@ #include <base/logging.h> -namespace privetd { +namespace weave { +namespace privet { chromeos::Blob HmacSha256(const chromeos::SecureBlob& key, const chromeos::Blob& data) { @@ -23,4 +24,5 @@ return mac; } -} // namespace privetd +} // namespace privet +} // namespace weave
diff --git a/libweave/src/privet/openssl_utils.h b/libweave/src/privet/openssl_utils.h index fffcaed..bd7e637 100644 --- a/libweave/src/privet/openssl_utils.h +++ b/libweave/src/privet/openssl_utils.h
@@ -10,13 +10,15 @@ #include <chromeos/secure_blob.h> -namespace privetd { +namespace weave { +namespace privet { const size_t kSha256OutputSize = 32; chromeos::Blob HmacSha256(const chromeos::SecureBlob& key, const chromeos::Blob& data); -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_OPENSSL_UTILS_H_
diff --git a/libweave/src/privet/peerd_client.cc b/libweave/src/privet/peerd_client.cc index c2d3618..d37740e 100644 --- a/libweave/src/privet/peerd_client.cc +++ b/libweave/src/privet/peerd_client.cc
@@ -18,7 +18,8 @@ using chromeos::string_utils::Join; using org::chromium::peerd::PeerProxy; -namespace privetd { +namespace weave { +namespace privet { namespace { @@ -165,4 +166,5 @@ ExposeService(); } -} // namespace privetd +} // namespace privet +} // namespace weave
diff --git a/libweave/src/privet/peerd_client.h b/libweave/src/privet/peerd_client.h index e5f90b7..b75e253 100644 --- a/libweave/src/privet/peerd_client.h +++ b/libweave/src/privet/peerd_client.h
@@ -18,7 +18,8 @@ class Bus; } // namespace dbus -namespace privetd { +namespace weave { +namespace privet { class CloudDelegate; class DeviceDelegate; @@ -67,6 +68,7 @@ base::WeakPtrFactory<PeerdClient> weak_ptr_factory_{this}; }; -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_PEERD_CLIENT_H_
diff --git a/libweave/src/privet/privet_handler.cc b/libweave/src/privet/privet_handler.cc index 67df4e7..22f10a0 100644 --- a/libweave/src/privet/privet_handler.cc +++ b/libweave/src/privet/privet_handler.cc
@@ -25,7 +25,8 @@ #include "libweave/src/privet/security_delegate.h" #include "libweave/src/privet/wifi_delegate.h" -namespace privetd { +namespace weave { +namespace privet { namespace { @@ -946,4 +947,5 @@ return EnumToString(id); } -} // namespace privetd +} // namespace privet +} // namespace weave
diff --git a/libweave/src/privet/privet_handler.h b/libweave/src/privet/privet_handler.h index f251cc4..5cc8e8a 100644 --- a/libweave/src/privet/privet_handler.h +++ b/libweave/src/privet/privet_handler.h
@@ -20,7 +20,8 @@ class DictionaryValue; } // namespace base -namespace privetd { +namespace weave { +namespace privet { class DeviceDelegate; class IdentityDelegate; @@ -134,6 +135,7 @@ DISALLOW_COPY_AND_ASSIGN(PrivetHandler); }; -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_PRIVET_HANDLER_H_
diff --git a/libweave/src/privet/privet_handler_unittest.cc b/libweave/src/privet/privet_handler_unittest.cc index a903d21..5ce3caf 100644 --- a/libweave/src/privet/privet_handler_unittest.cc +++ b/libweave/src/privet/privet_handler_unittest.cc
@@ -27,7 +27,8 @@ using testing::Return; using testing::SetArgPointee; -namespace privetd { +namespace weave { +namespace privet { namespace { @@ -724,4 +725,5 @@ HandleRequest("/privet/v3/commands/list", "{}")); } -} // namespace privetd +} // namespace privet +} // namespace weave
diff --git a/libweave/src/privet/privet_manager.cc b/libweave/src/privet/privet_manager.cc index 1281c91..7fe3a78 100644 --- a/libweave/src/privet/privet_manager.cc +++ b/libweave/src/privet/privet_manager.cc
@@ -39,7 +39,8 @@ #include "libweave/src/privet/shill_client.h" #include "libweave/src/privet/wifi_bootstrap_manager.h" -namespace privetd { +namespace weave { +namespace privet { namespace { @@ -64,9 +65,9 @@ void Manager::Start(const Options& options, const scoped_refptr<dbus::Bus>& bus, ShillClient* shill_client, - buffet::DeviceRegistrationInfo* device, - buffet::CommandManager* command_manager, - buffet::StateManager* state_manager, + DeviceRegistrationInfo* device, + CommandManager* command_manager, + StateManager* state_manager, AsyncEventSequencer* sequencer) { disable_security_ = options.disable_security; @@ -101,7 +102,7 @@ web_server_->OnProtocolHandlerDisconnected(base::Bind( &Manager::OnProtocolHandlerDisconnected, weak_ptr_factory_.GetWeakPtr())); - web_server_->Connect(bus, buffet::dbus_constants::kServiceName, + web_server_->Connect(bus, buffet::kServiceName, sequencer->GetHandler("Server::Connect failed.", true), base::Bind(&base::DoNothing), base::Bind(&base::DoNothing)); @@ -206,4 +207,5 @@ } } -} // namespace privetd +} // namespace privet +} // namespace weave
diff --git a/libweave/src/privet/privet_manager.h b/libweave/src/privet/privet_manager.h index 757136a..f16330d 100644 --- a/libweave/src/privet/privet_manager.h +++ b/libweave/src/privet/privet_manager.h
@@ -15,12 +15,6 @@ #include "libweave/src/privet/cloud_delegate.h" -namespace buffet { -class CommandManager; -class DeviceRegistrationInfo; -class StateManager; -} - namespace chromeos { namespace dbus_utils { class AsyncEventSequencer; @@ -34,7 +28,13 @@ class Server; } -namespace privetd { +namespace weave { + +class CommandManager; +class DeviceRegistrationInfo; +class StateManager; + +namespace privet { class ApManagerClient; class CloudDelegate; @@ -61,20 +61,20 @@ void Start(const Options& options, const scoped_refptr<dbus::Bus>& bus, ShillClient* shill_client, - buffet::DeviceRegistrationInfo* device, - buffet::CommandManager* command_manager, - buffet::StateManager* state_manager, + DeviceRegistrationInfo* device, + CommandManager* command_manager, + StateManager* state_manager, chromeos::dbus_utils::AsyncEventSequencer* sequencer); void OnShutdown(); void OnDeviceInfoChanged() override; - privetd::WifiBootstrapManager* GetWifiBootstrapManager() { + privet::WifiBootstrapManager* GetWifiBootstrapManager() { return wifi_bootstrap_manager_.get(); } - privetd::SecurityManager* GetSecurityManager() { return security_.get(); } + privet::SecurityManager* GetSecurityManager() { return security_.get(); } private: void PrivetRequestHandler(std::unique_ptr<libwebserv::Request> request, @@ -113,6 +113,7 @@ DISALLOW_COPY_AND_ASSIGN(Manager); }; -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_PRIVET_MANAGER_H_
diff --git a/libweave/src/privet/privet_types.h b/libweave/src/privet/privet_types.h index 06c10b8..6247f6d 100644 --- a/libweave/src/privet/privet_types.h +++ b/libweave/src/privet/privet_types.h
@@ -9,7 +9,8 @@ #include <chromeos/errors/error.h> -namespace privetd { +namespace weave { +namespace privet { // Scopes in order of increasing privileges. enum class AuthScope { @@ -93,6 +94,7 @@ chromeos::ErrorPtr error_; }; -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_PRIVET_TYPES_H_
diff --git a/libweave/src/privet/security_delegate.h b/libweave/src/privet/security_delegate.h index 13467c9..430e882 100644 --- a/libweave/src/privet/security_delegate.h +++ b/libweave/src/privet/security_delegate.h
@@ -14,7 +14,8 @@ #include "libweave/src/privet/privet_types.h" -namespace privetd { +namespace weave { +namespace privet { enum class PairingType { kPinCode, @@ -74,6 +75,7 @@ bool StringToAuthScope(const std::string& scope, AuthScope* id); std::string AuthScopeToString(AuthScope id); -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_SECURITY_DELEGATE_H_
diff --git a/libweave/src/privet/security_manager.cc b/libweave/src/privet/security_manager.cc index 9ab6266..86a09dc 100644 --- a/libweave/src/privet/security_manager.cc +++ b/libweave/src/privet/security_manager.cc
@@ -26,7 +26,8 @@ #include "libweave/src/privet/constants.h" #include "libweave/src/privet/openssl_utils.h" -namespace privetd { +namespace weave { +namespace privet { namespace { @@ -412,4 +413,5 @@ return confirmed_sessions_.erase(session_id) != 0; } -} // namespace privetd +} // namespace privet +} // namespace weave
diff --git a/libweave/src/privet/security_manager.h b/libweave/src/privet/security_manager.h index fbce41b..1f00265 100644 --- a/libweave/src/privet/security_manager.h +++ b/libweave/src/privet/security_manager.h
@@ -23,7 +23,8 @@ class P224EncryptedKeyExchange; } // namespace crypto -namespace privetd { +namespace weave { +namespace privet { class SecurityManager : public SecurityDelegate { public: @@ -105,6 +106,7 @@ DISALLOW_COPY_AND_ASSIGN(SecurityManager); }; -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_SECURITY_MANAGER_H_
diff --git a/libweave/src/privet/security_manager_unittest.cc b/libweave/src/privet/security_manager_unittest.cc index 135668e..cf1e044 100644 --- a/libweave/src/privet/security_manager_unittest.cc +++ b/libweave/src/privet/security_manager_unittest.cc
@@ -31,7 +31,8 @@ using testing::Eq; using testing::_; -namespace privetd { +namespace weave { +namespace privet { namespace { @@ -313,4 +314,5 @@ EXPECT_EQ("deviceBusy", error->GetCode()); } -} // namespace privetd +} // namespace privet +} // namespace weave
diff --git a/libweave/src/privet/shill_client.cc b/libweave/src/privet/shill_client.cc index da9eb35..defed3f 100644 --- a/libweave/src/privet/shill_client.cc +++ b/libweave/src/privet/shill_client.cc
@@ -23,7 +23,8 @@ using std::string; using std::vector; -namespace privetd { +namespace weave { +namespace privet { namespace { @@ -500,4 +501,5 @@ connecting_service_reset_pending_ = false; } -} // namespace privetd +} // namespace privet +} // namespace weave
diff --git a/libweave/src/privet/shill_client.h b/libweave/src/privet/shill_client.h index 95b9b6d..ba36154 100644 --- a/libweave/src/privet/shill_client.h +++ b/libweave/src/privet/shill_client.h
@@ -19,7 +19,8 @@ #include "shill/dbus-proxies.h" -namespace privetd { +namespace weave { +namespace privet { enum class ServiceState { kOffline = 0, @@ -128,6 +129,7 @@ DISALLOW_COPY_AND_ASSIGN(ShillClient); }; -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_SHILL_CLIENT_H_
diff --git a/libweave/src/privet/wifi_bootstrap_manager.cc b/libweave/src/privet/wifi_bootstrap_manager.cc index 00e1503..ef7096a 100644 --- a/libweave/src/privet/wifi_bootstrap_manager.cc +++ b/libweave/src/privet/wifi_bootstrap_manager.cc
@@ -14,7 +14,8 @@ #include "libweave/src/privet/constants.h" #include "libweave/src/privet/shill_client.h" -namespace privetd { +namespace weave { +namespace privet { namespace { const int kConnectTimeoutSeconds = 60; @@ -277,4 +278,5 @@ connection_state_ = ConnectionState{std::move(error)}; } -} // namespace privetd +} // namespace privet +} // namespace weave
diff --git a/libweave/src/privet/wifi_bootstrap_manager.h b/libweave/src/privet/wifi_bootstrap_manager.h index b749ff0..5b51c87 100644 --- a/libweave/src/privet/wifi_bootstrap_manager.h +++ b/libweave/src/privet/wifi_bootstrap_manager.h
@@ -20,7 +20,8 @@ #include "libweave/src/privet/wifi_delegate.h" #include "libweave/src/privet/wifi_ssid_generator.h" -namespace privetd { +namespace weave { +namespace privet { class ApManagerClient; class CloudDelegate; @@ -116,6 +117,7 @@ DISALLOW_COPY_AND_ASSIGN(WifiBootstrapManager); }; -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_WIFI_BOOTSTRAP_MANAGER_H_
diff --git a/libweave/src/privet/wifi_delegate.h b/libweave/src/privet/wifi_delegate.h index b590b01..7cab3d0 100644 --- a/libweave/src/privet/wifi_delegate.h +++ b/libweave/src/privet/wifi_delegate.h
@@ -11,7 +11,8 @@ #include "libweave/src/privet/privet_types.h" -namespace privetd { +namespace weave { +namespace privet { enum class WifiType { kWifi24, @@ -50,6 +51,7 @@ virtual std::set<WifiType> GetTypes() const = 0; }; -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_WIFI_DELEGATE_H_
diff --git a/libweave/src/privet/wifi_ssid_generator.cc b/libweave/src/privet/wifi_ssid_generator.cc index 15a5471..c1b7ff0 100644 --- a/libweave/src/privet/wifi_ssid_generator.cc +++ b/libweave/src/privet/wifi_ssid_generator.cc
@@ -15,7 +15,8 @@ #include "libweave/src/privet/device_delegate.h" #include "libweave/src/privet/wifi_delegate.h" -namespace privetd { +namespace weave { +namespace privet { namespace { @@ -89,4 +90,5 @@ get_random_ = base::Bind(&base::RandInt, n, n); } -} // namespace privetd +} // namespace privet +} // namespace weave
diff --git a/libweave/src/privet/wifi_ssid_generator.h b/libweave/src/privet/wifi_ssid_generator.h index 8e7ec63..90f1493 100644 --- a/libweave/src/privet/wifi_ssid_generator.h +++ b/libweave/src/privet/wifi_ssid_generator.h
@@ -9,7 +9,8 @@ #include <base/callback.h> -namespace privetd { +namespace weave { +namespace privet { class CloudDelegate; class WifiDelegate; @@ -38,6 +39,7 @@ DISALLOW_COPY_AND_ASSIGN(WifiSsidGenerator); }; -} // namespace privetd +} // namespace privet +} // namespace weave #endif // LIBWEAVE_SRC_PRIVET_WIFI_SSID_GENERATOR_H_
diff --git a/libweave/src/privet/wifi_ssid_generator_unittest.cc b/libweave/src/privet/wifi_ssid_generator_unittest.cc index fed1fb1..3b8c3ea 100644 --- a/libweave/src/privet/wifi_ssid_generator_unittest.cc +++ b/libweave/src/privet/wifi_ssid_generator_unittest.cc
@@ -10,7 +10,8 @@ #include "libweave/src/privet/mock_delegates.h" #include "libweave/src/privet/openssl_utils.h" -namespace privetd { +namespace weave { +namespace privet { class WifiSsidGeneratorTest : public testing::Test { protected: @@ -65,4 +66,5 @@ EXPECT_EQ("", ssid_generator_.GenerateSsid()); } -} // namespace privetd +} // namespace privet +} // namespace weave
diff --git a/libweave/src/registration_status.cc b/libweave/src/registration_status.cc index cfa2cca..1a56f75 100644 --- a/libweave/src/registration_status.cc +++ b/libweave/src/registration_status.cc
@@ -6,7 +6,7 @@ #include <base/logging.h> -namespace buffet { +namespace weave { std::string StatusToString(RegistrationStatus status) { switch (status) { @@ -23,4 +23,4 @@ return "unknown"; } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/registration_status.h b/libweave/src/registration_status.h index 1eeef7e..7b6694f 100644 --- a/libweave/src/registration_status.h +++ b/libweave/src/registration_status.h
@@ -7,7 +7,7 @@ #include <string> -namespace buffet { +namespace weave { // See the DBus interface XML file for complete descriptions of these states. enum class RegistrationStatus { @@ -19,6 +19,6 @@ std::string StatusToString(RegistrationStatus status); -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_REGISTRATION_STATUS_H_
diff --git a/libweave/src/states/error_codes.cc b/libweave/src/states/error_codes.cc index 2e3940b..b86baee 100644 --- a/libweave/src/states/error_codes.cc +++ b/libweave/src/states/error_codes.cc
@@ -4,7 +4,7 @@ #include "libweave/src/states/error_codes.h" -namespace buffet { +namespace weave { namespace errors { namespace state { @@ -17,4 +17,4 @@ } // namespace state } // namespace errors -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/states/error_codes.h b/libweave/src/states/error_codes.h index 71fe3fe..c5f876f 100644 --- a/libweave/src/states/error_codes.h +++ b/libweave/src/states/error_codes.h
@@ -5,7 +5,7 @@ #ifndef LIBWEAVE_SRC_STATES_ERROR_CODES_H_ #define LIBWEAVE_SRC_STATES_ERROR_CODES_H_ -namespace buffet { +namespace weave { namespace errors { namespace state { @@ -20,6 +20,6 @@ } // namespace state } // namespace errors -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_STATES_ERROR_CODES_H_
diff --git a/libweave/src/states/mock_state_change_queue_interface.h b/libweave/src/states/mock_state_change_queue_interface.h index 5a2fcef..b4e6257 100644 --- a/libweave/src/states/mock_state_change_queue_interface.h +++ b/libweave/src/states/mock_state_change_queue_interface.h
@@ -11,7 +11,7 @@ #include "libweave/src/states/state_change_queue_interface.h" -namespace buffet { +namespace weave { class MockStateChangeQueueInterface : public StateChangeQueueInterface { public: @@ -33,6 +33,6 @@ } }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_STATES_MOCK_STATE_CHANGE_QUEUE_INTERFACE_H_
diff --git a/libweave/src/states/state_change_queue.cc b/libweave/src/states/state_change_queue.cc index c0f3520..a9ae497 100644 --- a/libweave/src/states/state_change_queue.cc +++ b/libweave/src/states/state_change_queue.cc
@@ -6,7 +6,7 @@ #include <base/logging.h> -namespace buffet { +namespace weave { StateChangeQueue::StateChangeQueue(size_t max_queue_size) : max_queue_size_(max_queue_size) { @@ -68,4 +68,4 @@ callbacks_.Notify(update_id); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/states/state_change_queue.h b/libweave/src/states/state_change_queue.h index 332c542..877db73 100644 --- a/libweave/src/states/state_change_queue.h +++ b/libweave/src/states/state_change_queue.h
@@ -13,7 +13,7 @@ #include "libweave/src/states/state_change_queue_interface.h" -namespace buffet { +namespace weave { // An object to record and retrieve device state change notification events. class StateChangeQueue : public StateChangeQueueInterface { @@ -54,6 +54,6 @@ DISALLOW_COPY_AND_ASSIGN(StateChangeQueue); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_STATES_STATE_CHANGE_QUEUE_H_
diff --git a/libweave/src/states/state_change_queue_interface.h b/libweave/src/states/state_change_queue_interface.h index fb9b6e5..8e67baa 100644 --- a/libweave/src/states/state_change_queue_interface.h +++ b/libweave/src/states/state_change_queue_interface.h
@@ -13,7 +13,7 @@ #include "libweave/src/commands/schema_utils.h" -namespace buffet { +namespace weave { // A simple notification record event to track device state changes. // The |timestamp| records the time of the state change. @@ -64,6 +64,6 @@ virtual ~StateChangeQueueInterface() {} }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_STATES_STATE_CHANGE_QUEUE_INTERFACE_H_
diff --git a/libweave/src/states/state_change_queue_unittest.cc b/libweave/src/states/state_change_queue_unittest.cc index e19ab08..5877eeb 100644 --- a/libweave/src/states/state_change_queue_unittest.cc +++ b/libweave/src/states/state_change_queue_unittest.cc
@@ -9,7 +9,7 @@ #include "libweave/src/commands/unittest_utils.h" -namespace buffet { +namespace weave { class StateChangeQueueTest : public ::testing::Test { public: @@ -177,4 +177,4 @@ queue_->AddOnStateUpdatedCallback(base::Bind(callback)); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/states/state_manager.cc b/libweave/src/states/state_manager.cc index 504f25b..a548062 100644 --- a/libweave/src/states/state_manager.cc +++ b/libweave/src/states/state_manager.cc
@@ -16,7 +16,7 @@ #include "libweave/src/states/state_change_queue_interface.h" #include "libweave/src/utils.h" -namespace buffet { +namespace weave { namespace { @@ -311,4 +311,4 @@ return package; } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/states/state_manager.h b/libweave/src/states/state_manager.h index e502381..a60c0dc 100644 --- a/libweave/src/states/state_manager.h +++ b/libweave/src/states/state_manager.h
@@ -26,7 +26,7 @@ class Time; } // namespace base -namespace buffet { +namespace weave { // StateManager is the class that aggregates the device state fragments // provided by device daemons and makes the aggregate device state available @@ -110,7 +110,7 @@ // Finds a package by its name. If none exists, one will be created. StatePackage* FindOrCreatePackage(const std::string& package_name); - StateChangeQueueInterface* state_change_queue_; // Owned by buffet::Manager. + StateChangeQueueInterface* state_change_queue_; // Owned by Manager. std::map<std::string, std::unique_ptr<StatePackage>> packages_; std::set<std::string> categories_; @@ -119,6 +119,6 @@ DISALLOW_COPY_AND_ASSIGN(StateManager); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_STATES_STATE_MANAGER_H_
diff --git a/libweave/src/states/state_manager_unittest.cc b/libweave/src/states/state_manager_unittest.cc index 2c65b54..6f39dfe 100644 --- a/libweave/src/states/state_manager_unittest.cc +++ b/libweave/src/states/state_manager_unittest.cc
@@ -17,7 +17,7 @@ #include "libweave/src/states/error_codes.h" #include "libweave/src/states/mock_state_change_queue_interface.h" -namespace buffet { +namespace weave { using testing::_; using testing::Return; @@ -228,4 +228,4 @@ EXPECT_JSON_EQ(expected, *mgr_->GetStateValuesAsJson(nullptr)); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/states/state_package.cc b/libweave/src/states/state_package.cc index 825374e..302eb47 100644 --- a/libweave/src/states/state_package.cc +++ b/libweave/src/states/state_package.cc
@@ -13,7 +13,7 @@ #include "libweave/src/commands/schema_utils.h" #include "libweave/src/states/error_codes.h" -namespace buffet { +namespace weave { StatePackage::StatePackage(const std::string& name) : name_(name) { } @@ -113,4 +113,4 @@ return true; } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/states/state_package.h b/libweave/src/states/state_package.h index c2471f0..19b0c0f 100644 --- a/libweave/src/states/state_package.h +++ b/libweave/src/states/state_package.h
@@ -20,7 +20,7 @@ class DictionaryValue; } // namespace base -namespace buffet { +namespace weave { // A package is a set of related state properties. GCD specification defines // a number of standard state properties in "base" package such as @@ -84,6 +84,6 @@ DISALLOW_COPY_AND_ASSIGN(StatePackage); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_STATES_STATE_PACKAGE_H_
diff --git a/libweave/src/states/state_package_unittest.cc b/libweave/src/states/state_package_unittest.cc index c6372a9..1479f79 100644 --- a/libweave/src/states/state_package_unittest.cc +++ b/libweave/src/states/state_package_unittest.cc
@@ -15,7 +15,7 @@ #include "libweave/src/commands/unittest_utils.h" #include "libweave/src/states/error_codes.h" -namespace buffet { +namespace weave { using unittests::CreateDictionaryValue; @@ -370,4 +370,4 @@ EXPECT_EQ("State property 'test.volume' is not defined", error->GetMessage()); } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/storage_impls.cc b/libweave/src/storage_impls.cc index 44a8925..3a6a32d 100644 --- a/libweave/src/storage_impls.cc +++ b/libweave/src/storage_impls.cc
@@ -11,7 +11,7 @@ #include "libweave/src/utils.h" -namespace buffet { +namespace weave { FileStorage::FileStorage(const base::FilePath& file_path) : file_path_(file_path) { @@ -42,4 +42,4 @@ return true; } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/storage_impls.h b/libweave/src/storage_impls.h index 57d74b2..760b2a9 100644 --- a/libweave/src/storage_impls.h +++ b/libweave/src/storage_impls.h
@@ -11,7 +11,7 @@ #include "libweave/src/storage_interface.h" -namespace buffet { +namespace weave { // Persists the given Value to an atomically written file. class FileStorage : public StorageInterface { @@ -39,6 +39,6 @@ DISALLOW_COPY_AND_ASSIGN(MemStorage); }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_STORAGE_IMPLS_H_
diff --git a/libweave/src/storage_interface.h b/libweave/src/storage_interface.h index dc750ae..5a2834f 100644 --- a/libweave/src/storage_interface.h +++ b/libweave/src/storage_interface.h
@@ -9,7 +9,7 @@ #include <base/values.h> -namespace buffet { +namespace weave { // We need to persist data in a couple places, and it is convenient to hide // the details of this storage behind an interface for test purposes. @@ -27,6 +27,6 @@ virtual bool Save(const base::DictionaryValue& config) = 0; }; -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_STORAGE_INTERFACE_H_
diff --git a/libweave/src/utils.cc b/libweave/src/utils.cc index 411e74d..71ea0d4 100644 --- a/libweave/src/utils.cc +++ b/libweave/src/utils.cc
@@ -16,7 +16,7 @@ #include <base/json/json_reader.h> #include <chromeos/errors/error_codes.h> -namespace buffet { +namespace weave { namespace { @@ -106,4 +106,4 @@ return socket_fd; } -} // namespace buffet +} // namespace weave
diff --git a/libweave/src/utils.h b/libweave/src/utils.h index c83aa9a..8fa556a 100644 --- a/libweave/src/utils.h +++ b/libweave/src/utils.h
@@ -12,7 +12,7 @@ #include <base/files/file_path.h> #include <chromeos/errors/error.h> -namespace buffet { +namespace weave { // Buffet-wide errors. // TODO(avakulenko): This should be consolidated into errors::<domain> namespace @@ -44,6 +44,6 @@ // Returns the connected socket file descriptor or -1 if failed. int ConnectSocket(const std::string& host, uint16_t port); -} // namespace buffet +} // namespace weave #endif // LIBWEAVE_SRC_UTILS_H_