Merge remote-tracking branch 'weave/master' into aosp-master

* weave/master: (21 commits)
  Remove unused constant
  Update documentation with new command name
  Remove the unneeded libweave directory
  Update the virtual lock to the real schema
  Update documentation for repo tool
  Update virtual light to standard schema
  Remove hardcoded paths
  Give network privider some time to figure out connectivity state
  Fix -bootstrapping option
  Check if we have root access
  Add support for virtual lock & light devices
  Add interface documentation through comments
  Remove hard-coded check for standard command definitions
  Replace services list with value generated from model device id
  Remove standard state definitions
  Update more interfaces with comments / documentation
  Missing part of CL:1421
  Move standard commands and state definitions into separate file
  Rename *Base* method and properties to *Standard* ones
  Remove unused file
  ...

Change-Id: I9cf11138ce2414aca0b856c1a52d5794becf2723
diff --git a/libweave/.gitignore b/.gitignore
similarity index 100%
rename from libweave/.gitignore
rename to .gitignore
diff --git a/libweave/AUTHORS b/AUTHORS
similarity index 100%
rename from libweave/AUTHORS
rename to AUTHORS
diff --git a/libweave/Android.mk b/Android.mk
similarity index 99%
rename from libweave/Android.mk
rename to Android.mk
index 36af7e2..fc7e62b 100644
--- a/libweave/Android.mk
+++ b/Android.mk
@@ -106,6 +106,7 @@
 	src/privet/cloud_delegate.cc \
 	src/privet/constants.cc \
 	src/privet/device_delegate.cc \
+	src/privet/device_ui_kind.cc \
 	src/privet/openssl_utils.cc \
 	src/privet/privet_handler.cc \
 	src/privet/privet_manager.cc \
diff --git a/libweave/CONTRIBUTORS b/CONTRIBUTORS
similarity index 100%
rename from libweave/CONTRIBUTORS
rename to CONTRIBUTORS
diff --git a/libweave/LICENSE b/LICENSE
similarity index 100%
rename from libweave/LICENSE
rename to LICENSE
diff --git a/libweave/README b/README
similarity index 73%
rename from libweave/README
rename to README
index b772553..b62b547 100644
--- a/libweave/README
+++ b/README
@@ -8,13 +8,24 @@
 Sources are located in git repository at
 https://weave.googlesource.com/weave/libweave/
 
-Checkout code with:
 
-  git clone https://weave.googlesource.com/weave/libweave && \
-    (cd libweave && \
-     curl -Lo `git rev-parse --git-dir`/hooks/commit-msg \
-        https://gerrit-review.googlesource.com/tools/hooks/commit-msg ;\
-        chmod +x `git rev-parse --git-dir`/hooks/commit-msg)
+Install Repo
+-------
+1. Make sure you have a bin/ directory in your home directory
+and that it is included in your path:
+
+    mkdir ~/bin
+    PATH=~/bin:$PATH
+
+2. Download the Repo tool and ensure that it is executable:
+
+    curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
+    chmod a+x ~/bin/repo
+
+Checkout code
+-------
+    repo init -u https://weave.googlesource.com/weave/manifest
+    repo sync
 
 Directory structure
 -------------------
@@ -47,7 +58,7 @@
 
 Execute example:
 
-  sudo out/Debug/weave
+  sudo out/Debug/weave_daemon
 
 
 Prerequisites
@@ -106,15 +117,19 @@
   git config --local user.name "John Doe"
   git config --local user.email johndoe@example.com
 
+Start local branch
+
+  repo start <branch name> .
+
 Edit code and commit locally e.g.:
 
   git commit -a -v
 
 Upload CL:
 
-  git push origin HEAD:refs/for/master
+  repo upload .
 
-Go to the url from the output of "push" and add reviewers.
+Go to the url from the output of "repo upload" and add reviewers.
 
 Known Issues
 ------------
diff --git a/libweave/examples/build.sh b/examples/build.sh
similarity index 100%
rename from libweave/examples/build.sh
rename to examples/build.sh
diff --git a/libweave/examples/daemon/README b/examples/daemon/README
similarity index 96%
rename from libweave/examples/daemon/README
rename to examples/daemon/README
index 48a4e95..4743883 100644
--- a/libweave/examples/daemon/README
+++ b/examples/daemon/README
@@ -9,7 +9,7 @@
   - build daemon
         examples/build.sh
   - binaries for daemon is at
-        out/Debug/weave
+        out/Debug/weave_daemon
 
 Prepare Host OS
 ---------------
@@ -50,7 +50,7 @@
         93019287-6b26-04a0-22ee-d55ad23a4226
   - go to terminal, register and start the daemon with
 
-        sudo out/Debug/weave --registration_ticket=93019287-6b26-04a0-22ee-d55ad23a4226
+        sudo out/Debug/weave_daemon --registration_ticket=93019287-6b26-04a0-22ee-d55ad23a4226
 
         you should see something like:
           Publishing service
diff --git a/libweave/examples/daemon/daemon.gyp b/examples/daemon/daemon.gyp
similarity index 73%
rename from libweave/examples/daemon/daemon.gyp
rename to examples/daemon/daemon.gyp
index f421601..c6f8837 100644
--- a/libweave/examples/daemon/daemon.gyp
+++ b/examples/daemon/daemon.gyp
@@ -10,8 +10,8 @@
         'main.cc',
       ],
       'dependencies': [
-        '../../libweave_standalone.gyp:libweave',
-        '../provider/provider.gyp:libweave_provider',
+        '<@(DEPTH)/libweave_standalone.gyp:libweave',
+        '<@(DEPTH)/examples/provider/provider.gyp:libweave_provider',
       ]
     }
   ]
diff --git a/libweave/examples/daemon/ledflasher_handler.h b/examples/daemon/ledflasher_handler.h
similarity index 100%
rename from libweave/examples/daemon/ledflasher_handler.h
rename to examples/daemon/ledflasher_handler.h
diff --git a/examples/daemon/light_handler.h b/examples/daemon/light_handler.h
new file mode 100644
index 0000000..33b440a
--- /dev/null
+++ b/examples/daemon/light_handler.h
@@ -0,0 +1,129 @@
+// Copyright 2015 The Weave Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <weave/device.h>
+
+#include <base/bind.h>
+#include <base/memory/weak_ptr.h>
+
+namespace weave {
+namespace examples {
+namespace daemon {
+
+// LightHandler is a command handler example that shows
+// how to handle commands for a Weave light.
+class LightHandler {
+ public:
+  LightHandler() = default;
+  void Register(Device* device) {
+    device_ = device;
+
+    device->AddStateDefinitionsFromJson(R"({
+      "onOff": {"state": ["on", "standby"]},
+      "brightness": {"brightness": "integer"}
+    })");
+
+    device->SetStatePropertiesFromJson(R"({
+      "onOff":{"state": "standby"},
+      "brightness":{"brightness": 0}
+    })",
+                                       nullptr);
+
+    device->AddCommandDefinitionsFromJson(R"({
+      "onOff": {
+         "setConfig":{
+           "parameters": {
+             "state": ["on", "standby"]
+           }
+         }
+       },
+       "brightness": {
+         "setConfig":{
+           "parameters": {
+             "brightness": {
+               "type": "integer",
+               "minimum": 0,
+               "maximum": 100
+             }
+           }
+        }
+      }
+    })");
+    device->AddCommandHandler(
+        "onOff.setConfig",
+        base::Bind(&LightHandler::OnOnOffSetConfig,
+                   weak_ptr_factory_.GetWeakPtr()));
+    device->AddCommandHandler(
+        "brightness.setConfig",
+         base::Bind(&LightHandler::OnBrightnessSetConfig,
+                    weak_ptr_factory_.GetWeakPtr()));
+  }
+
+ private:
+  void OnBrightnessSetConfig(const std::weak_ptr<Command>& command) {
+    auto cmd = command.lock();
+    if (!cmd)
+      return;
+    LOG(INFO) << "received command: " << cmd->GetName();
+    int32_t brightness_value = 0;
+    if (cmd->GetParameters()->GetInteger("brightness", &brightness_value)) {
+      // Display this command in terminal.
+      LOG(INFO) << cmd->GetName() << " brightness: " << brightness_value;
+
+      if (brightness_state_ != brightness_value) {
+        brightness_state_ = brightness_value;
+        UpdateLightState();
+      }
+      cmd->Complete({}, nullptr);
+      return;
+    }
+    ErrorPtr error;
+    Error::AddTo(&error, FROM_HERE, "example", "invalid_parameter_value",
+                 "Invalid parameters");
+    cmd->Abort(error.get(), nullptr);
+  }
+
+  void OnOnOffSetConfig(const std::weak_ptr<Command>& command) {
+    auto cmd = command.lock();
+    if (!cmd)
+      return;
+    LOG(INFO) << "received command: " << cmd->GetName();
+    std::string requested_state;
+    if (cmd->GetParameters()->GetString("state", &requested_state)) {
+      LOG(INFO) << cmd->GetName() << " state: " << requested_state;
+
+      bool new_light_status = requested_state == "on";
+      if (new_light_status != light_status_) {
+        light_status_ = new_light_status;
+
+        LOG(INFO) << "Light is now: " << (light_status_ ? "ON" : "OFF");
+        UpdateLightState();
+      }
+      cmd->Complete({}, nullptr);
+      return;
+    }
+    ErrorPtr error;
+    Error::AddTo(&error, FROM_HERE, "example", "invalid_parameter_value",
+                 "Invalid parameters");
+    cmd->Abort(error.get(), nullptr);
+  }
+
+  void UpdateLightState(void) {
+    base::DictionaryValue state;
+    state.SetString("onOff.state", light_status_ ? "on" : "standby");
+    state.SetInteger("brightness.brightness", brightness_state_);
+    device_->SetStateProperties(state, nullptr);
+  }
+
+  Device* device_{nullptr};
+
+  // Simulate the state of the light.
+  bool light_status_;
+  int32_t brightness_state_;
+  base::WeakPtrFactory<LightHandler> weak_ptr_factory_{this};
+};
+
+}  // namespace daemon
+}  // namespace examples
+}  // namespace weave
diff --git a/examples/daemon/lock_handler.h b/examples/daemon/lock_handler.h
new file mode 100644
index 0000000..b2fd9b5
--- /dev/null
+++ b/examples/daemon/lock_handler.h
@@ -0,0 +1,113 @@
+// Copyright 2015 The Weave Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <weave/device.h>
+#include <weave/enum_to_string.h>
+
+#include <base/bind.h>
+#include <base/memory/weak_ptr.h>
+
+namespace weave {
+
+namespace lockstate {
+enum class LockState { kUnlocked, kLocked, kPartiallyLocked };
+
+const weave::EnumToStringMap<LockState>::Map kLockMapMethod[] = {
+  {LockState::kLocked, "locked"},
+  {LockState::kUnlocked, "unlocked"},
+  {LockState::kPartiallyLocked, "partiallyLocked"}};
+}  // namespace lockstate
+
+template <>
+EnumToStringMap<lockstate::LockState>::EnumToStringMap()
+  : EnumToStringMap(lockstate::kLockMapMethod) {}
+
+namespace examples {
+namespace daemon {
+
+// LockHandler is a command handler example that shows
+// how to handle commands for a Weave lock.
+class LockHandler {
+ public:
+  LockHandler() = default;
+  void Register(Device* device) {
+    device_ = device;
+
+    device->AddStateDefinitionsFromJson(R"({
+      "lock": {"lockedState": ["locked", "unlocked", "partiallyLocked"]}
+    })");
+
+    device->SetStatePropertiesFromJson(R"({
+      "lock":{"lockedState": "locked"}
+    })",
+                                       nullptr);
+
+    device->AddCommandDefinitionsFromJson(R"({
+        "lock": {
+          "setConfig":{
+            "parameters": {
+              "lockedState": ["locked", "unlocked"]
+            }
+          }
+        }
+    })");
+    device->AddCommandHandler(
+        "lock.setConfig",
+        base::Bind(&LockHandler::OnLockSetConfig,
+                   weak_ptr_factory_.GetWeakPtr()));
+  }
+
+ private:
+  void OnLockSetConfig(const std::weak_ptr<Command>& command) {
+    auto cmd = command.lock();
+    if (!cmd)
+      return;
+    LOG(INFO) << "received command: " << cmd->GetName();
+    std::string requested_state;
+    if (cmd->GetParameters()->GetString("lockedState", &requested_state)) {
+      LOG(INFO) << cmd->GetName() << " state: " << requested_state;
+
+      lockstate::LockState new_lock_status;
+
+      if (!weave::StringToEnum(requested_state, &new_lock_status)) {
+        // Invalid lock state was specified.
+        ErrorPtr error;
+        Error::AddTo(&error, FROM_HERE, "example", "invalid_parameter_value",
+                     "Invalid parameters");
+        cmd->Abort(error.get(), nullptr);
+        return;
+      }
+
+      if (new_lock_status != lock_state_) {
+        lock_state_ = new_lock_status;
+
+        LOG(INFO) << "Lock is now: " << requested_state;
+        UpdateLockState();
+      }
+      cmd->Complete({}, nullptr);
+      return;
+    }
+    ErrorPtr error;
+    Error::AddTo(&error, FROM_HERE, "example", "invalid_parameter_value",
+                 "Invalid parameters");
+    cmd->Abort(error.get(), nullptr);
+  }
+
+  void UpdateLockState(void) {
+    base::DictionaryValue state;
+    std::string updated_state = weave::EnumToString(lock_state_);
+    state.SetString("lock.lockedState", updated_state);
+    device_->SetStateProperties(state, nullptr);
+  }
+
+  Device* device_{nullptr};
+
+  // Simulate the state of the light.
+  lockstate::LockState lock_state_{lockstate::LockState::kLocked};
+  base::WeakPtrFactory<LockHandler> weak_ptr_factory_{this};
+};
+
+}  // namespace daemon
+}  // namespace examples
+}  // namespace weave
diff --git a/libweave/examples/daemon/main.cc b/examples/daemon/main.cc
similarity index 77%
rename from libweave/examples/daemon/main.cc
rename to examples/daemon/main.cc
index 263e730..a4ec366 100644
--- a/libweave/examples/daemon/main.cc
+++ b/examples/daemon/main.cc
@@ -8,6 +8,8 @@
 #include <base/bind.h>
 
 #include "examples/daemon/ledflasher_handler.h"
+#include "examples/daemon/light_handler.h"
+#include "examples/daemon/lock_handler.h"
 #include "examples/daemon/sample_handler.h"
 
 #include "examples/provider/avahi_client.h"
@@ -33,7 +35,9 @@
              << "\t-d,--disable_security        Disable privet security\n"
              << "\t--registration_ticket=TICKET Register device with the "
                 "given ticket\n"
-             << "\t--disable_privet             Disable local privet\n";
+             << "\t--disable_privet             Disable local privet\n"
+             << "\t--type=UIDEVICEKIND          Create a device with the "
+                "specified ui device kind\n";
 }
 
 void OnRegisterDeviceDone(weave::Device* device, weave::ErrorPtr error) {
@@ -50,6 +54,7 @@
   bool disable_security = false;
   bool disable_privet = false;
   std::string registration_ticket;
+  std::string ui_device_kind;
   for (int i = 1; i < argc; ++i) {
     std::string arg = argv[i];
     if (arg == "-h" || arg == "--help") {
@@ -75,6 +80,13 @@
         return 1;
       }
       logging::SetMinLogLevel(-std::stoi(arg.substr(pos + 1)));
+    } else if (arg.find("--type") != std::string::npos) {
+      auto pos = arg.find("=");
+      if (pos == std::string::npos) {
+        ShowUsage(argv[0]);
+        return 1;
+      }
+      ui_device_kind = arg.substr(pos + 1);
     } else {
       ShowUsage(argv[0]);
       return 1;
@@ -91,11 +103,12 @@
   std::unique_ptr<weave::examples::WifiImpl> wifi;
 
   if (!disable_privet) {
+    network.SetSimulateOffline(force_bootstrapping);
+
     dns_sd.reset(new weave::examples::AvahiClient);
     http_server.reset(new weave::examples::HttpServerImpl{&task_runner});
     if (weave::examples::WifiImpl::HasWifiCapability())
-      wifi.reset(
-          new weave::examples::WifiImpl{&task_runner, force_bootstrapping});
+      wifi.reset(new weave::examples::WifiImpl{&task_runner, &network});
   }
   std::unique_ptr<weave::Device> device{weave::Device::Create(
       &config_store, &task_runner, &http_client, &network, dns_sd.get(),
@@ -111,6 +124,20 @@
   sample.Register(device.get());
   ledFlasher.Register(device.get());
 
+  // If the caller specified a particular ui device kind, register the
+  // correspoinding device handlers
+  // TODO: move this to before device registration, as this should also
+  // cause a particular model manifest to be used.
+  weave::examples::daemon::LightHandler lightHandler;
+  weave::examples::daemon::LockHandler lockHandler;
+  if (!ui_device_kind.empty()) {
+    if (ui_device_kind == "light") {
+      lightHandler.Register(device.get());
+    } else if (ui_device_kind == "lock") {
+      lockHandler.Register(device.get());
+    }
+  }
+
   task_runner.Run();
 
   LOG(INFO) << "exit";
diff --git a/libweave/examples/daemon/sample_handler.h b/examples/daemon/sample_handler.h
similarity index 100%
rename from libweave/examples/daemon/sample_handler.h
rename to examples/daemon/sample_handler.h
diff --git a/libweave/examples/prerequisites.sh b/examples/prerequisites.sh
similarity index 100%
rename from libweave/examples/prerequisites.sh
rename to examples/prerequisites.sh
diff --git a/libweave/examples/provider/avahi_client.cc b/examples/provider/avahi_client.cc
similarity index 100%
rename from libweave/examples/provider/avahi_client.cc
rename to examples/provider/avahi_client.cc
diff --git a/libweave/examples/provider/avahi_client.h b/examples/provider/avahi_client.h
similarity index 100%
rename from libweave/examples/provider/avahi_client.h
rename to examples/provider/avahi_client.h
diff --git a/libweave/examples/provider/bluez_client.cc b/examples/provider/bluez_client.cc
similarity index 100%
rename from libweave/examples/provider/bluez_client.cc
rename to examples/provider/bluez_client.cc
diff --git a/libweave/examples/provider/bluez_client.h b/examples/provider/bluez_client.h
similarity index 100%
rename from libweave/examples/provider/bluez_client.h
rename to examples/provider/bluez_client.h
diff --git a/libweave/examples/provider/curl_http_client.cc b/examples/provider/curl_http_client.cc
similarity index 100%
rename from libweave/examples/provider/curl_http_client.cc
rename to examples/provider/curl_http_client.cc
diff --git a/libweave/examples/provider/curl_http_client.h b/examples/provider/curl_http_client.h
similarity index 100%
rename from libweave/examples/provider/curl_http_client.h
rename to examples/provider/curl_http_client.h
diff --git a/libweave/examples/provider/event_http_client.cc b/examples/provider/event_http_client.cc
similarity index 100%
rename from libweave/examples/provider/event_http_client.cc
rename to examples/provider/event_http_client.cc
diff --git a/libweave/examples/provider/event_http_client.h b/examples/provider/event_http_client.h
similarity index 100%
rename from libweave/examples/provider/event_http_client.h
rename to examples/provider/event_http_client.h
diff --git a/libweave/examples/provider/event_http_server.cc b/examples/provider/event_http_server.cc
similarity index 100%
rename from libweave/examples/provider/event_http_server.cc
rename to examples/provider/event_http_server.cc
diff --git a/libweave/examples/provider/event_http_server.h b/examples/provider/event_http_server.h
similarity index 100%
rename from libweave/examples/provider/event_http_server.h
rename to examples/provider/event_http_server.h
diff --git a/libweave/examples/provider/event_network.cc b/examples/provider/event_network.cc
similarity index 82%
rename from libweave/examples/provider/event_network.cc
rename to examples/provider/event_network.cc
index d86db69..ba03e8f 100644
--- a/libweave/examples/provider/event_network.cc
+++ b/examples/provider/event_network.cc
@@ -41,22 +41,27 @@
 }
 
 void EventNetworkImpl::UpdateNetworkState() {
-  std::unique_ptr<bufferevent, Deleter> bev{
+  if (simulate_offline_) {
+    LOG(INFO) << "Simulating offline state";
+    connectivity_probe_.reset();
+    return UpdateNetworkStateCallback(State::kOffline);
+  }
+
+  connectivity_probe_.reset(
       bufferevent_socket_new(task_runner_->GetEventBase(), -1,
-                             BEV_OPT_CLOSE_ON_FREE | BEV_OPT_DEFER_CALLBACKS)};
+                             BEV_OPT_CLOSE_ON_FREE | BEV_OPT_DEFER_CALLBACKS));
   timeval timeout{kNetworkProbeTimeoutS, 0};
-  bufferevent_set_timeouts(bev.get(), &timeout, &timeout);
+  bufferevent_set_timeouts(connectivity_probe_.get(), &timeout, &timeout);
   bufferevent_setcb(
-      bev.get(), nullptr, nullptr,
+      connectivity_probe_.get(), nullptr, nullptr,
       [](struct bufferevent* buf, short events, void* ctx) {
         EventNetworkImpl* network = static_cast<EventNetworkImpl*>(ctx);
-        std::unique_ptr<bufferevent, Deleter> bev{buf};
         if (events & BEV_EVENT_CONNECTED) {
           network->UpdateNetworkStateCallback(State::kOnline);
           return;
         }
         if (events & (BEV_EVENT_ERROR | BEV_EVENT_EOF | BEV_EVENT_TIMEOUT)) {
-          int err = bufferevent_socket_get_dns_error(bev.get());
+          int err = bufferevent_socket_get_dns_error(buf);
           if (err) {
             LOG(ERROR) << "network connect dns error: "
                        << evutil_gai_strerror(err);
@@ -66,16 +71,13 @@
         }
       },
       this);
-  int err = bufferevent_socket_connect_hostname(bev.get(), dns_base_.get(),
-                                                AF_INET, kNetworkProbeHostname,
-                                                kNetworkProbePort);
+  int err = bufferevent_socket_connect_hostname(
+      connectivity_probe_.get(), dns_base_.get(), AF_INET,
+      kNetworkProbeHostname, kNetworkProbePort);
   if (err) {
     LOG(ERROR) << " network connect socket error: " << evutil_gai_strerror(err);
-    UpdateNetworkStateCallback(State::kOffline);
-    return;
+    return UpdateNetworkStateCallback(State::kOffline);
   }
-  // release the bufferevent, so that the eventcallback can free it.
-  bev.release();
 }
 
 void EventNetworkImpl::UpdateNetworkStateCallback(
@@ -91,6 +93,9 @@
       cb.Run();
   }
 
+  // Reset current posted task.
+  weak_ptr_factory_.InvalidateWeakPtrs();
+
   // TODO(proppy): use netlink interface event instead of polling
   task_runner_->PostDelayedTask(
       FROM_HERE, base::Bind(&EventNetworkImpl::UpdateNetworkState,
diff --git a/libweave/examples/provider/event_network.h b/examples/provider/event_network.h
similarity index 88%
rename from libweave/examples/provider/event_network.h
rename to examples/provider/event_network.h
index 79c458c..3aeac24 100644
--- a/libweave/examples/provider/event_network.h
+++ b/examples/provider/event_network.h
@@ -33,13 +33,21 @@
                      uint16_t port,
                      const OpenSslSocketCallback& callback) override;
 
+  void SetSimulateOffline(bool value) {
+    simulate_offline_ = value;
+    UpdateNetworkState();
+  }
+
  private:
   void UpdateNetworkState();
   void UpdateNetworkStateCallback(provider::Network::State state);
+  bool simulate_offline_{false};
   EventTaskRunner* task_runner_{nullptr};
   std::unique_ptr<evdns_base, Deleter> dns_base_;
   std::vector<ConnectionChangedCallback> callbacks_;
   provider::Network::State network_state_{provider::Network::State::kOffline};
+  std::unique_ptr<bufferevent, Deleter> connectivity_probe_;
+
   base::WeakPtrFactory<EventNetworkImpl> weak_ptr_factory_{this};
 };
 
diff --git a/libweave/examples/provider/event_task_runner.cc b/examples/provider/event_task_runner.cc
similarity index 100%
rename from libweave/examples/provider/event_task_runner.cc
rename to examples/provider/event_task_runner.cc
diff --git a/libweave/examples/provider/event_task_runner.h b/examples/provider/event_task_runner.h
similarity index 100%
rename from libweave/examples/provider/event_task_runner.h
rename to examples/provider/event_task_runner.h
diff --git a/libweave/examples/provider/file_config_store.cc b/examples/provider/file_config_store.cc
similarity index 100%
rename from libweave/examples/provider/file_config_store.cc
rename to examples/provider/file_config_store.cc
diff --git a/libweave/examples/provider/file_config_store.h b/examples/provider/file_config_store.h
similarity index 100%
rename from libweave/examples/provider/file_config_store.h
rename to examples/provider/file_config_store.h
diff --git a/libweave/examples/provider/provider.gyp b/examples/provider/provider.gyp
similarity index 95%
rename from libweave/examples/provider/provider.gyp
rename to examples/provider/provider.gyp
index 9dcf184..3d13d8f 100644
--- a/libweave/examples/provider/provider.gyp
+++ b/examples/provider/provider.gyp
@@ -32,7 +32,7 @@
         'ssl_stream.cc',
       ],
       'dependencies': [
-        '../../libweave_standalone.gyp:libweave',
+        '<@(DEPTH)/libweave_standalone.gyp:libweave',
       ],
       'direct_dependent_settings' : {
         'variables': {
diff --git a/libweave/examples/provider/ssl_stream.cc b/examples/provider/ssl_stream.cc
similarity index 100%
rename from libweave/examples/provider/ssl_stream.cc
rename to examples/provider/ssl_stream.cc
diff --git a/libweave/examples/provider/ssl_stream.h b/examples/provider/ssl_stream.h
similarity index 100%
rename from libweave/examples/provider/ssl_stream.h
rename to examples/provider/ssl_stream.h
diff --git a/libweave/examples/provider/wifi_manager.cc b/examples/provider/wifi_manager.cc
similarity index 93%
rename from libweave/examples/provider/wifi_manager.cc
rename to examples/provider/wifi_manager.cc
index ac1c604..6e216e4 100644
--- a/libweave/examples/provider/wifi_manager.cc
+++ b/examples/provider/wifi_manager.cc
@@ -14,6 +14,7 @@
 #include <base/bind.h>
 #include <weave/provider/task_runner.h>
 
+#include "examples/provider/event_network.h"
 #include "examples/provider/ssl_stream.h"
 
 namespace weave {
@@ -39,8 +40,10 @@
 
 }  // namespace
 
-WifiImpl::WifiImpl(provider::TaskRunner* task_runner, bool force_bootstrapping)
-    : force_bootstrapping_{force_bootstrapping}, task_runner_{task_runner} {
+WifiImpl::WifiImpl(provider::TaskRunner* task_runner, EventNetworkImpl* network)
+    : task_runner_{task_runner}, network_{network} {
+  CHECK_EQ(0, getuid())
+      << "WiFi manager expects root access to control WiFi capabilities";
   StopAccessPoint();
 }
 WifiImpl::~WifiImpl() {
@@ -98,7 +101,7 @@
 void WifiImpl::Connect(const std::string& ssid,
                        const std::string& passphrase,
                        const DoneCallback& callback) {
-  force_bootstrapping_ = false;
+  network_->SetSimulateOffline(false);
   CHECK(!hostapd_started_);
   if (hostapd_started_) {
     ErrorPtr error;
diff --git a/libweave/examples/provider/wifi_manager.h b/examples/provider/wifi_manager.h
similarity index 90%
rename from libweave/examples/provider/wifi_manager.h
rename to examples/provider/wifi_manager.h
index 849beef..c043523 100644
--- a/libweave/examples/provider/wifi_manager.h
+++ b/examples/provider/wifi_manager.h
@@ -20,12 +20,13 @@
 
 namespace examples {
 
+class EventNetworkImpl;
+
 // Basic weave::Wifi implementation.
 // Production version of SSL socket needs secure server certificate check.
 class WifiImpl : public provider::Wifi {
  public:
-  explicit WifiImpl(provider::TaskRunner* task_runner,
-                    bool force_bootstrapping);
+  WifiImpl(provider::TaskRunner* task_runner, EventNetworkImpl* network);
   ~WifiImpl();
 
   // Wifi implementation.
@@ -43,9 +44,9 @@
                     int pid,
                     base::Time until,
                     const DoneCallback& callback);
-  bool force_bootstrapping_{false};
   bool hostapd_started_{false};
   provider::TaskRunner* task_runner_{nullptr};
+  EventNetworkImpl* network_{nullptr};
   base::WeakPtrFactory<WifiImpl> weak_ptr_factory_{this};
 };
 
diff --git a/libweave/include/weave/command.h b/include/weave/command.h
similarity index 100%
rename from libweave/include/weave/command.h
rename to include/weave/command.h
diff --git a/libweave/include/weave/device.h b/include/weave/device.h
similarity index 100%
rename from libweave/include/weave/device.h
rename to include/weave/device.h
diff --git a/libweave/include/weave/enum_to_string.h b/include/weave/enum_to_string.h
similarity index 100%
rename from libweave/include/weave/enum_to_string.h
rename to include/weave/enum_to_string.h
diff --git a/libweave/include/weave/error.h b/include/weave/error.h
similarity index 100%
rename from libweave/include/weave/error.h
rename to include/weave/error.h
diff --git a/libweave/include/weave/export.h b/include/weave/export.h
similarity index 100%
rename from libweave/include/weave/export.h
rename to include/weave/export.h
diff --git a/libweave/include/weave/provider/bluetooth.h b/include/weave/provider/bluetooth.h
similarity index 100%
rename from libweave/include/weave/provider/bluetooth.h
rename to include/weave/provider/bluetooth.h
diff --git a/include/weave/provider/config_store.h b/include/weave/provider/config_store.h
new file mode 100644
index 0000000..53c1128
--- /dev/null
+++ b/include/weave/provider/config_store.h
@@ -0,0 +1,84 @@
+// Copyright 2015 The Weave Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_CONFIG_STORE_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_CONFIG_STORE_H_
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+#include <base/callback.h>
+#include <base/time/time.h>
+#include <weave/enum_to_string.h>
+#include <weave/settings.h>
+
+namespace weave {
+namespace provider {
+
+// This interface should be implemented by the user of libweave and
+// provided during device creation in Device::Create(...)
+// libweave will use this interface to get default settings and load / save
+// settings to a persistent storage.
+//
+// Implementation of the LoadDefaults(...) method may load settings from
+// a file or just hardcode defaults for this device.
+// For example:
+//   bool FileConfigStore::LoadDefaults(Settings* settings) {
+//     settings->name = "My device";
+//     settings->pairing_modes.insert(kPinCode);
+//     // set all other required settings, see include/weave/settings.h
+//     return true;
+//   }
+//
+// Implementation of LoadSettings() method should load previously
+// stored settings from the persistent storage (file, flash, etc).
+// For example:
+//   std::string FileConfigStore::LoadSettings() {
+//     std::ifstream str("/var/lib/weave/weave_settings.json");
+//     return std::string(std::istreambuf_iterator<char>(str),
+//                        std::istreambuf_iterator<char>());
+//   }
+// If data stored encrypted (highly recommended), LoadSettings()
+// implementation should decrypt the data before returning it to libweave.
+//
+// Implementation of SaveSettings(...) method should store data in the
+// persistent storage (file, flash, etc).
+// For example:
+//   void FileConfigStore::SaveSettings(const std::string& settings) {
+//     std::ofstream str(kSettingsPath);
+//     str << settings;
+//   }
+// It is highly recommended to protected data using encryption with
+// hardware backed key.
+//
+// See libweave/examples/provider/file_config_store.cc for a complete
+// example.
+
+// Interface with methods to read/write libweave settings, device state and
+// commands definitions.
+class ConfigStore {
+ public:
+  // Returns default settings. This settings used for a new device or after
+  // a factory reset.
+  virtual bool LoadDefaults(Settings* settings) = 0;
+
+  // Returns settings saved by SaveSettings during last run of libweave.
+  // Implementation should return data as-is without parsing or modifications.
+  virtual std::string LoadSettings() = 0;
+
+  // Saves settings. Implementation should save data as-is without parsing or
+  // modifications. Data stored in settings can be sensitive, so it's highly
+  // recommended to protect data, e.g. using encryption.
+  virtual void SaveSettings(const std::string& settings) = 0;
+
+ protected:
+  virtual ~ConfigStore() = default;
+};
+
+}  // namespace provider
+}  // namespace weave
+
+#endif  // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_CONFIG_STORE_H_
diff --git a/include/weave/provider/dns_service_discovery.h b/include/weave/provider/dns_service_discovery.h
new file mode 100644
index 0000000..fa9d50e
--- /dev/null
+++ b/include/weave/provider/dns_service_discovery.h
@@ -0,0 +1,100 @@
+// Copyright 2015 The Weave Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_DNS_SERVICE_DISCOVERY_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_DNS_SERVICE_DISCOVERY_H_
+
+#include <string>
+#include <vector>
+
+#include <base/callback.h>
+
+namespace weave {
+namespace provider {
+
+// This interface should be implemented by the user of libweave and
+// provided during device creation in Device::Create(...)
+// libweave will use this interface to start/stop mDNS service discovery.
+//
+// Implementation of the PublishService(...) method should publish mDNS
+// service. Publishing service should be done according to RFC 6762 (mDNS)
+// and RFC 6763 (DNS Service discovery).
+//
+// service_type will contain name of the service before .local.
+//   For example, "_privet._tcp".
+// port will have a port number where Weave HTTP server is running.
+//   For example, 80.
+// txt will contain a list of strings for mDNS TXT records.
+//   For example, "txtver=3", "name=MyDevice"
+//
+// The following mDNS records should be published in the above examples:
+// _privet._tcp.local PTR <service_name>._privet._tcp.local
+// <service_name>._privet._tcp.local SRV <local_domain> 80
+// <service_name>._privet._tcp.local TXT "txtver=3" "name=MyDevice"
+// <local_domain> A <IPv4 address>
+// <local_domain> AAAA <IPv6 address>
+//
+// In the list above, it is implementer's responsibility to choose
+// <service_name> and <local_domain>.
+// If device only supports IPv4 or IPv6, then only the corresponding mDNS
+// records should be published. <IPv4 address> and <IPv6 address> should
+// be the addresses of the network interface this record is advertised on.
+//
+// Implementation of PublishService(...) may use existing libraries or
+// services to implement mDNS service discovery. For example, Avahi or
+// Bonjour. Such implementation may require IPC or similar async
+// communication mechanisms. PublishService(...) implementation may
+// just start the process and return quickly (non-blocking) while the
+// full mDNS implementation is started in the background. In such case
+// PublishService(...) implementation should remember all input parameters
+// so it can restart service publishing in case of failures.
+// From libweave perspective, discovery is started after
+// PublishService(...) returns and libweave may not call this method again.
+//
+// Implementation of the StopPublishing(...) method should stop advertising
+// specified service type on the mDNS. This should be done according to mDNS
+// (RFC 6762) and DNS-SD (RFC 6763) specifications, which require announcing
+// DNS records that will be going away with TTL=1.
+//
+// Since this interface allows multiple service types to be published, proper
+// implementation should maintain list of service types and stop advertising
+// only the type specified in this request. Other service types, as well as
+// records necessary for other services, like A, AAAA may still be available
+// over mDNS.
+//
+// In case a device has multiple networking interfaces, the device developer
+// needs to make a decision where mDNS advertising is necessary and where it is
+// not. For example, there should be no mDNS advertising on cellular (LTE) or
+// WAN (for routers) network interfaces. In some cases, there might be more
+// then one network interface where advertising makes sense. For example,
+// a device may have both WiFi and Ethernet connections. In such case,
+// PublishService(...) should make service available on both interface.
+//
+// From libweave perspective, it always looks like there is only one network
+// interface (for both service discovery and web server). It is
+// the job of this interface implementation to hide network complexity from
+// the libweave and to bring webserver up on the same port on both interfaces,
+// as well as publish an mDNS service (uses webserver port).
+//
+// See libweave/examples/provider/avahi_client.cc for complete example
+// using Avahi for DNS service discovery.
+
+class DnsServiceDiscovery {
+ public:
+  // Publishes new service using DNS-SD or updates existing one.
+  virtual void PublishService(const std::string& service_type,
+                              uint16_t port,
+                              const std::vector<std::string>& txt) = 0;
+
+  // Stops publishing service.
+  virtual void StopPublishing(const std::string& service_type) = 0;
+
+ protected:
+  virtual ~DnsServiceDiscovery() = default;
+};
+
+}  // namespace provider
+}  // namespace weave
+
+#endif  // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_DNS_SERVICE_DISCOVERY_H_
diff --git a/include/weave/provider/http_client.h b/include/weave/provider/http_client.h
new file mode 100644
index 0000000..deb127a
--- /dev/null
+++ b/include/weave/provider/http_client.h
@@ -0,0 +1,101 @@
+// Copyright 2015 The Weave Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_CLIENT_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_CLIENT_H_
+
+#include <string>
+#include <utility>
+#include <vector>
+
+#include <base/callback.h>
+#include <weave/error.h>
+
+namespace weave {
+namespace provider {
+
+// This interface should be implemented by the user of libweave and
+// provided during device creation in Device::Create(...)
+// libweave will use this interface to make HTTP/HTTPS calls to external
+// services.
+//
+// HttpClient interface has only one method SendRequest(...) to implement.
+// However, user code should also implement Response interface, that will be
+// passed into callback.
+//
+// Implementation of the SendRequest(...) method should make a proper
+// HTTP / HTTPS call according to the input parameters:
+//   method - of the supported methods (kGet, kPatch, kPost, kPut) which
+//     should map to the corresponding HTTP verb (GET, PATCH, POST, PUT) in
+//     the request.
+//   url - full URL including protocol, domain, path and parameters. Protocol
+//     may be "http" or "https". In case of "https", it is implementer's
+//     responsibility to establish a secure connection and verify endpoint
+//     certificate chain. libweave will attempt connecting to Google Weave
+//     servers. Proper root CA certificates should be available on the device.
+//   headers - list of HTTP request headers that should be attached to the
+//     request.
+//   data - binary data that should be sent within HTTP request body. Empty
+//     string means no data. Implementation needs to check for that. For
+//     example, kGet method should never have data. It is also possible to have
+//     no data for other methods as well.
+//   callback - standard callback to notify libweave when request is complete
+//     and provide results and response data.
+//
+// Implementation of the SendRequest(...) should be non-blocking, meaning it
+// should schedule network request and return right away. Later (after the
+// request is complete), callback should be invokes on the same thread.
+// Callback should never be called before SendRequest(...) returns.
+//
+// When invoking callback function, user should privide implementation
+// of the Response interface. For example, the following could be used as a
+// simple implementation:
+//   struct ResponseImpl : public provider::HttpClient::Response {
+//     int GetStatusCode() const override { return status; }
+//     std::string GetContentType() const override { return content_type; }
+//     std::string GetData() const override { return data; }
+//     int status{0};
+//     std::string content_type;
+//     std::string data;
+//   };
+//
+// See libweave/examples/provider/curl_http_client.cc for complete example
+// implementing HttpClient interface using curl.
+
+class HttpClient {
+ public:
+  enum class Method {
+    kGet,
+    kPatch,
+    kPost,
+    kPut,
+  };
+
+  class Response {
+   public:
+    virtual int GetStatusCode() const = 0;
+    virtual std::string GetContentType() const = 0;
+    virtual std::string GetData() const = 0;
+
+    virtual ~Response() = default;
+  };
+
+  using Headers = std::vector<std::pair<std::string, std::string>>;
+  using SendRequestCallback =
+      base::Callback<void(std::unique_ptr<Response> response, ErrorPtr error)>;
+
+  virtual void SendRequest(Method method,
+                           const std::string& url,
+                           const Headers& headers,
+                           const std::string& data,
+                           const SendRequestCallback& callback) = 0;
+
+ protected:
+  virtual ~HttpClient() = default;
+};
+
+}  // namespace provider
+}  // namespace weave
+
+#endif  // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_CLIENT_H_
diff --git a/include/weave/provider/http_server.h b/include/weave/provider/http_server.h
new file mode 100644
index 0000000..ced7975
--- /dev/null
+++ b/include/weave/provider/http_server.h
@@ -0,0 +1,145 @@
+// Copyright 2015 The Weave Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_SERVER_H_
+#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_SERVER_H_
+
+#include <string>
+#include <vector>
+
+#include <base/callback.h>
+#include <weave/stream.h>
+
+namespace weave {
+namespace provider {
+
+// This interface should be implemented by the user of libweave and
+// provided during device creation in Device::Create(...)
+// libweave will use this interface to handle HTTP / HTTPS requests for Privet
+// APIs.
+//
+// This interface consist of 2 parts that need to be implemented by the
+// libweave user: HttpServer and HttpServer::Request. HttpServer provides
+// interface to control webserver, and is used to initialize Device object.
+// Request provides an abstraction for a specific HTTP request and may be a
+// short-lived object.
+//
+// Implementation of AddHttpsRequestHandler(...) method should follow the
+// same guidelines as implementation of AddHttpRequestHandler(...) with the
+// only difference, it is for HTTPS connection (not HTTP).
+//
+// Implementation of GetHttpPort() method should return port number on
+// which HTTP server will be listening. Normally it is port 80, but this
+// allows implementer to choose different port if necessary and tell it to
+// libweave.
+//
+// Implementation of GetHttpsPort() should follow the same guidelines as
+// GetHttpPort(). Default HTTPS port is 443, but could be changed and
+// communicated to libweave using this method.
+//
+// Implementation of GetHttpsCertificateFingerprint() method should
+// compute fingerprint of the certificate that HTTPS web server will be using.
+// Method of computing fingerprint is the following:
+//   fingerprint = SHA256 ( DER certificate )
+// You can see example implementation in HttpServerImpl::GenerateX509()
+// in libweave/examples/provider/event_http_server.cc
+//
+// Implementation of AddHttpRequestHandler(...) method should add path
+// to the list of the exposed entry points for the webserver and store
+// path and callback pair somewhere. Once webserver receives an HTTP request,
+// it should check if there is a libweave-registered handler corresponding to
+// the path in the request. If there is one, implementation should invoke
+// the callback associated with this path. If there is no callback associated
+// with request path, webserver should return HTTP status code 404.
+//
+// For example, let's say local IP is "192.168.0.1" and libweave called
+//   AddHttpRequestHandler("/privet/info", InfoHandlerCallback);
+// If webserver receives "http://192.168.0.1/privet/info" request, HttpServer
+// implementation must invoke InfoHandlerCallback.
+// If webserver receives "http://192.168.0.1/privet/auth" request, it must
+// return HTTP status code 404 response.
+//
+// As everywhere else, invoking callbacks have some limitations:
+//   - callback should not be called before AddHttpRequestHandler() returns
+//   - callback should be called on the same thread
+//
+// Once HttpServer implementation invokes a registered callback, it should
+// provide the Request interface implementation to access a request data.
+//
+// Implementation of GetPath() method should return path of the HTTP
+// request. For example, "/privet/info".
+//
+// Implementation of the GetFirstHeader(...) method should return the first
+// header in the request matching name parameter of this method.
+// For example, GetFirstHeader("Content-Length") may return "3495".
+//
+// Implementation of GetData() method should return full request data
+// in a binary format wrapped into std::string object.
+//
+// Implementation of the SendReply(...) method should send request response
+// message with specified parameters:
+//   status_code - standard HTTP status code, for example 200 to indicate
+//     successful response.
+//   data - binary data of the response body wrapped into std::string object.
+//   mime_type - MIME type of the response, that should be transferred into
+//     "Content-Type" HTTP header.
+// Implementation of the SendReply(...) method may also add other standard
+// HTTP headers, like "Content-Length" or "Transfer-Encoding" depending on
+// capabilities of the server and client which made this request.
+//
+// In case a device has multiple networking interfaces, the device developer
+// needs to make a decision where local APIs (Privet) are necessary and where
+// they are not needed. For example, it may not make sense to expose local
+// APIs on any external-facing network interface (cellular or WAN).
+//
+// In some cases, there might be more then one network interface where local
+// APIs makes sense. For example, a device may have both WiFi and Ethernet
+// connections. In such case, webserver should start on both interfaces
+// simultaneously, and allow requests from both interfaces to be handled by
+// libweave.
+//
+// From libweave perspective, it always looks like there is only one network
+// interface. It is the job of HttpServer implementation to hide network
+// complexity from libweave and to bring webserver up on the same port on all
+// interfaces.
+
+class HttpServer {
+ public:
+  class Request {
+   public:
+    virtual ~Request() = default;
+
+    virtual std::string GetPath() const = 0;
+    virtual std::string GetFirstHeader(const std::string& name) const = 0;
+    virtual std::string GetData() = 0;
+
+    virtual void SendReply(int status_code,
+                           const std::string& data,
+                           const std::string& mime_type) = 0;
+  };
+
+  // Callback type for AddRequestHandler.
+  using RequestHandlerCallback =
+      base::Callback<void(std::unique_ptr<Request> request)>;
+
+  // Adds callback called on new http/https requests with the given path.
+  virtual void AddHttpRequestHandler(
+      const std::string& path,
+      const RequestHandlerCallback& callback) = 0;
+  virtual void AddHttpsRequestHandler(
+      const std::string& path,
+      const RequestHandlerCallback& callback) = 0;
+
+  virtual uint16_t GetHttpPort() const = 0;
+  virtual uint16_t GetHttpsPort() const = 0;
+  virtual std::vector<uint8_t> GetHttpsCertificateFingerprint() const = 0;
+
+ protected:
+  virtual ~HttpServer() = default;
+};
+
+}  // namespace provider
+}  // namespace weave
+
+#endif  // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_SERVER_H_
diff --git a/libweave/include/weave/provider/network.h b/include/weave/provider/network.h
similarity index 100%
rename from libweave/include/weave/provider/network.h
rename to include/weave/provider/network.h
diff --git a/libweave/include/weave/provider/task_runner.h b/include/weave/provider/task_runner.h
similarity index 100%
rename from libweave/include/weave/provider/task_runner.h
rename to include/weave/provider/task_runner.h
diff --git a/libweave/include/weave/provider/test/fake_task_runner.h b/include/weave/provider/test/fake_task_runner.h
similarity index 100%
rename from libweave/include/weave/provider/test/fake_task_runner.h
rename to include/weave/provider/test/fake_task_runner.h
diff --git a/libweave/include/weave/provider/test/mock_bluetooth.h b/include/weave/provider/test/mock_bluetooth.h
similarity index 100%
rename from libweave/include/weave/provider/test/mock_bluetooth.h
rename to include/weave/provider/test/mock_bluetooth.h
diff --git a/libweave/include/weave/provider/test/mock_config_store.h b/include/weave/provider/test/mock_config_store.h
similarity index 100%
rename from libweave/include/weave/provider/test/mock_config_store.h
rename to include/weave/provider/test/mock_config_store.h
diff --git a/libweave/include/weave/provider/test/mock_dns_service_discovery.h b/include/weave/provider/test/mock_dns_service_discovery.h
similarity index 100%
rename from libweave/include/weave/provider/test/mock_dns_service_discovery.h
rename to include/weave/provider/test/mock_dns_service_discovery.h
diff --git a/libweave/include/weave/provider/test/mock_http_client.h b/include/weave/provider/test/mock_http_client.h
similarity index 100%
rename from libweave/include/weave/provider/test/mock_http_client.h
rename to include/weave/provider/test/mock_http_client.h
diff --git a/libweave/include/weave/provider/test/mock_http_server.h b/include/weave/provider/test/mock_http_server.h
similarity index 100%
rename from libweave/include/weave/provider/test/mock_http_server.h
rename to include/weave/provider/test/mock_http_server.h
diff --git a/libweave/include/weave/provider/test/mock_network.h b/include/weave/provider/test/mock_network.h
similarity index 100%
rename from libweave/include/weave/provider/test/mock_network.h
rename to include/weave/provider/test/mock_network.h
diff --git a/libweave/include/weave/provider/test/mock_wifi.h b/include/weave/provider/test/mock_wifi.h
similarity index 100%
rename from libweave/include/weave/provider/test/mock_wifi.h
rename to include/weave/provider/test/mock_wifi.h
diff --git a/libweave/include/weave/provider/wifi.h b/include/weave/provider/wifi.h
similarity index 100%
rename from libweave/include/weave/provider/wifi.h
rename to include/weave/provider/wifi.h
diff --git a/libweave/include/weave/settings.h b/include/weave/settings.h
similarity index 100%
rename from libweave/include/weave/settings.h
rename to include/weave/settings.h
diff --git a/libweave/include/weave/stream.h b/include/weave/stream.h
similarity index 100%
rename from libweave/include/weave/stream.h
rename to include/weave/stream.h
diff --git a/libweave/include/weave/test/fake_stream.h b/include/weave/test/fake_stream.h
similarity index 100%
rename from libweave/include/weave/test/fake_stream.h
rename to include/weave/test/fake_stream.h
diff --git a/libweave/include/weave/test/mock_command.h b/include/weave/test/mock_command.h
similarity index 100%
rename from libweave/include/weave/test/mock_command.h
rename to include/weave/test/mock_command.h
diff --git a/libweave/include/weave/test/mock_device.h b/include/weave/test/mock_device.h
similarity index 100%
rename from libweave/include/weave/test/mock_device.h
rename to include/weave/test/mock_device.h
diff --git a/libweave/include/weave/test/unittest_utils.h b/include/weave/test/unittest_utils.h
similarity index 100%
rename from libweave/include/weave/test/unittest_utils.h
rename to include/weave/test/unittest_utils.h
diff --git a/libweave/libweave-test.pc.in b/libweave-test.pc.in
similarity index 100%
rename from libweave/libweave-test.pc.in
rename to libweave-test.pc.in
diff --git a/libweave/libweave.gypi b/libweave.gypi
similarity index 98%
rename from libweave/libweave.gypi
rename to libweave.gypi
index 1e42f83..c32e99b 100644
--- a/libweave/libweave.gypi
+++ b/libweave.gypi
@@ -34,6 +34,7 @@
       'src/privet/cloud_delegate.cc',
       'src/privet/constants.cc',
       'src/privet/device_delegate.cc',
+      'src/privet/device_ui_kind.cc',
       'src/privet/openssl_utils.cc',
       'src/privet/privet_handler.cc',
       'src/privet/privet_manager.cc',
diff --git a/libweave/libweave.pc.in b/libweave.pc.in
similarity index 100%
rename from libweave/libweave.pc.in
rename to libweave.pc.in
diff --git a/libweave/include/weave/provider/config_store.h b/libweave/include/weave/provider/config_store.h
deleted file mode 100644
index 4107748..0000000
--- a/libweave/include/weave/provider/config_store.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2015 The Weave Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_CONFIG_STORE_H_
-#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_CONFIG_STORE_H_
-
-#include <map>
-#include <set>
-#include <string>
-#include <vector>
-
-#include <base/callback.h>
-#include <base/time/time.h>
-#include <weave/enum_to_string.h>
-#include <weave/settings.h>
-
-namespace weave {
-namespace provider {
-
-// Interface with methods to read/write libweave settings, device state and
-// commands definitions.
-class ConfigStore {
- public:
-  // Returns default settings. This settings used for a new device or after
-  // a factory reset.
-  virtual bool LoadDefaults(Settings* settings) = 0;
-
-  // Returns settings saved by SaveSettings during last run of libWeave.
-  // Implementation should return data as-is without parsing or modifications.
-  virtual std::string LoadSettings() = 0;
-
-  // Saves settings. Implementation should save data as-is without parsing or
-  // modifications. Data stored in settings can be sensitive, so it's highly
-  // recommended to protect data, e.g. using encryption.
-  virtual void SaveSettings(const std::string& settings) = 0;
-
- protected:
-  virtual ~ConfigStore() = default;
-};
-
-}  // namespace provider
-}  // namespace weave
-
-#endif  // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_CONFIG_STORE_H_
diff --git a/libweave/include/weave/provider/dns_service_discovery.h b/libweave/include/weave/provider/dns_service_discovery.h
deleted file mode 100644
index d96e22d..0000000
--- a/libweave/include/weave/provider/dns_service_discovery.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2015 The Weave Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_DNS_SERVICE_DISCOVERY_H_
-#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_DNS_SERVICE_DISCOVERY_H_
-
-#include <string>
-#include <vector>
-
-#include <base/callback.h>
-
-namespace weave {
-namespace provider {
-
-class DnsServiceDiscovery {
- public:
-  // Publishes new service using DNS-SD or updates existing one.
-  virtual void PublishService(const std::string& service_type,
-                              uint16_t port,
-                              const std::vector<std::string>& txt) = 0;
-
-  // Stops publishing service.
-  virtual void StopPublishing(const std::string& service_type) = 0;
-
- protected:
-  virtual ~DnsServiceDiscovery() = default;
-};
-
-}  // namespace provider
-}  // namespace weave
-
-#endif  // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_DNS_SERVICE_DISCOVERY_H_
diff --git a/libweave/include/weave/provider/http_client.h b/libweave/include/weave/provider/http_client.h
deleted file mode 100644
index 6edf4bf..0000000
--- a/libweave/include/weave/provider/http_client.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2015 The Weave Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_CLIENT_H_
-#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_CLIENT_H_
-
-#include <string>
-#include <utility>
-#include <vector>
-
-#include <base/callback.h>
-#include <weave/error.h>
-
-namespace weave {
-namespace provider {
-
-class HttpClient {
- public:
-  enum class Method {
-    kGet,
-    kPatch,
-    kPost,
-    kPut,
-  };
-
-  class Response {
-   public:
-    virtual int GetStatusCode() const = 0;
-    virtual std::string GetContentType() const = 0;
-    virtual std::string GetData() const = 0;
-
-    virtual ~Response() = default;
-  };
-
-  using Headers = std::vector<std::pair<std::string, std::string>>;
-  using SendRequestCallback =
-      base::Callback<void(std::unique_ptr<Response> response, ErrorPtr error)>;
-
-  virtual void SendRequest(Method method,
-                           const std::string& url,
-                           const Headers& headers,
-                           const std::string& data,
-                           const SendRequestCallback& callback) = 0;
-
- protected:
-  virtual ~HttpClient() = default;
-};
-
-}  // namespace provider
-}  // namespace weave
-
-#endif  // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_CLIENT_H_
diff --git a/libweave/include/weave/provider/http_server.h b/libweave/include/weave/provider/http_server.h
deleted file mode 100644
index da53e1f..0000000
--- a/libweave/include/weave/provider/http_server.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2015 The Weave Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_SERVER_H_
-#define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_SERVER_H_
-
-#include <string>
-#include <vector>
-
-#include <base/callback.h>
-#include <weave/stream.h>
-
-namespace weave {
-namespace provider {
-
-class HttpServer {
- public:
-  class Request {
-   public:
-    virtual ~Request() = default;
-
-    virtual std::string GetPath() const = 0;
-    virtual std::string GetFirstHeader(const std::string& name) const = 0;
-    virtual std::string GetData() = 0;
-
-    virtual void SendReply(int status_code,
-                           const std::string& data,
-                           const std::string& mime_type) = 0;
-  };
-
-  // Callback type for AddRequestHandler.
-  using RequestHandlerCallback =
-      base::Callback<void(std::unique_ptr<Request> request)>;
-
-  // Adds callback called on new http/https requests with the given path.
-  virtual void AddHttpRequestHandler(
-      const std::string& path,
-      const RequestHandlerCallback& callback) = 0;
-  virtual void AddHttpsRequestHandler(
-      const std::string& path,
-      const RequestHandlerCallback& callback) = 0;
-
-  virtual uint16_t GetHttpPort() const = 0;
-  virtual uint16_t GetHttpsPort() const = 0;
-  virtual std::vector<uint8_t> GetHttpsCertificateFingerprint() const = 0;
-
- protected:
-  virtual ~HttpServer() = default;
-};
-
-}  // namespace provider
-}  // namespace weave
-
-#endif  // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_HTTP_SERVER_H_
diff --git a/libweave/third_party/chromium/base/third_party/dmg_fp/dtoa_wrapper.cc b/libweave/third_party/chromium/base/third_party/dmg_fp/dtoa_wrapper.cc
deleted file mode 100644
index c314c59..0000000
--- a/libweave/third_party/chromium/base/third_party/dmg_fp/dtoa_wrapper.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// The purpose of this file is to supply the macro definintions necessary
-// to make third_party/dmg_fp/dtoa.cc threadsafe.
-#include "base/lazy_instance.h"
-#include "base/logging.h"
-#include "base/synchronization/lock.h"
-
-// We need two locks because they're sometimes grabbed at the same time.
-// A single lock would lead to an attempted recursive grab.
-static base::LazyInstance<base::Lock>::Leaky
-    dtoa_lock_0 = LAZY_INSTANCE_INITIALIZER;
-static base::LazyInstance<base::Lock>::Leaky
-    dtoa_lock_1 = LAZY_INSTANCE_INITIALIZER;
-
-/*
- * This define and the code below is to trigger thread-safe behavior
- * in dtoa.cc, per this comment from the file:
- *
- * #define MULTIPLE_THREADS if the system offers preemptively scheduled
- *	multiple threads.  In this case, you must provide (or suitably
- *	#define) two locks, acquired by ACQUIRE_DTOA_LOCK(n) and freed
- *	by FREE_DTOA_LOCK(n) for n = 0 or 1.  (The second lock, accessed
- *	in pow5mult, ensures lazy evaluation of only one copy of high
- *	powers of 5; omitting this lock would introduce a small
- *	probability of wasting memory, but would otherwise be harmless.)
- *	You must also invoke freedtoa(s) to free the value s returned by
- *	dtoa.  You may do so whether or not MULTIPLE_THREADS is #defined.
- */
-#define MULTIPLE_THREADS
-
-inline static void ACQUIRE_DTOA_LOCK(size_t n) {
-  DCHECK(n < 2);
-  base::Lock* lock = n == 0 ? dtoa_lock_0.Pointer() : dtoa_lock_1.Pointer();
-  lock->Acquire();
-}
-
-inline static void FREE_DTOA_LOCK(size_t n) {
-  DCHECK(n < 2);
-  base::Lock* lock = n == 0 ? dtoa_lock_0.Pointer() : dtoa_lock_1.Pointer();
-  lock->Release();
-}
-
-#include "base/third_party/dmg_fp/dtoa.cc"
diff --git a/libweave/libweave_common.gypi b/libweave_common.gypi
similarity index 94%
rename from libweave/libweave_common.gypi
rename to libweave_common.gypi
index bf81f76..49f7ff9 100644
--- a/libweave/libweave_common.gypi
+++ b/libweave_common.gypi
@@ -47,8 +47,6 @@
       '-Wpointer-arith',
       '-Wwrite-strings',
     ],
-    'libraries': [
-      '-L../../third_party/lib',
-    ],
+    'library_dirs': ['third_party/lib']
   },
 }
diff --git a/libweave/libweave_standalone.gyp b/libweave_standalone.gyp
similarity index 92%
rename from libweave/libweave_standalone.gyp
rename to libweave_standalone.gyp
index 6b73f84..fd87f16 100644
--- a/libweave/libweave_standalone.gyp
+++ b/libweave_standalone.gyp
@@ -8,9 +8,9 @@
   'target_defaults': {
     'libraries': [
       '-lcrypto',
-      '-lexpat',
       '-lgtest',
       '-lgmock',
+      '-lexpat',
       '-lpthread',
     ],
   },
@@ -19,7 +19,7 @@
       'target_name': 'libweave_common',
       'type': 'static_library',
       'include_dirs': [
-        '../libweave/external',
+        '<@(DEPTH)/external',
       ],
       'sources': [
         '<@(weave_sources)',
@@ -44,7 +44,7 @@
       'type': 'static_library',
       'standalone_static_library': 1,
       'include_dirs': [
-        '../libweave/external',
+        '<@(DEPTH)/external',
       ],
       'sources': [
         '<@(weave_test_sources)',
@@ -54,7 +54,7 @@
       'target_name': 'libweave_testrunner',
       'type': 'executable',
       'include_dirs': [
-        '../libweave/external',
+        '<@(DEPTH)/external',
       ],
       'dependencies': [
         'libweave_common',
@@ -69,7 +69,7 @@
       'target_name': 'libweave_exports_testrunner',
       'type': 'executable',
       'include_dirs': [
-        '../libweave/external',
+        '<@(DEPTH)/external',
       ],
       'dependencies': [
         'libweave',
diff --git a/libweave/src/backoff_entry.cc b/src/backoff_entry.cc
similarity index 100%
rename from libweave/src/backoff_entry.cc
rename to src/backoff_entry.cc
diff --git a/libweave/src/backoff_entry.h b/src/backoff_entry.h
similarity index 100%
rename from libweave/src/backoff_entry.h
rename to src/backoff_entry.h
diff --git a/libweave/src/backoff_entry_unittest.cc b/src/backoff_entry_unittest.cc
similarity index 100%
rename from libweave/src/backoff_entry_unittest.cc
rename to src/backoff_entry_unittest.cc
diff --git a/libweave/src/base_api_handler.cc b/src/base_api_handler.cc
similarity index 83%
rename from libweave/src/base_api_handler.cc
rename to src/base_api_handler.cc
index 52b5399..c3aa616 100644
--- a/libweave/src/base_api_handler.cc
+++ b/src/base_api_handler.cc
@@ -22,8 +22,15 @@
 BaseApiHandler::BaseApiHandler(DeviceRegistrationInfo* device_info,
                                Device* device)
     : device_info_{device_info}, device_{device} {
-  device_info_->GetMutableConfig()->AddOnChangedCallback(base::Bind(
-      &BaseApiHandler::OnConfigChanged, weak_ptr_factory_.GetWeakPtr()));
+  device_->AddStateDefinitionsFromJson(R"({
+    "base": {
+      "firmwareVersion": "string",
+      "localDiscoveryEnabled": "boolean",
+      "localAnonymousAccessMaxRole": [ "none", "viewer", "user" ],
+      "localPairingEnabled": "boolean"
+    }
+  })");
+  OnConfigChanged(device_->GetSettings());
 
   const auto& settings = device_info_->GetSettings();
   base::DictionaryValue state;
@@ -32,8 +39,24 @@
 
   device->AddCommandDefinitionsFromJson(R"({
     "base": {
-      "updateBaseConfiguration": {},
-      "updateDeviceInfo": {}
+      "updateBaseConfiguration": {
+        "minimalRole": "manager",
+        "parameters": {
+          "localDiscoveryEnabled": "boolean",
+          "localAnonymousAccessMaxRole": [ "none", "viewer", "user" ],
+          "localPairingEnabled": "boolean"
+        },
+        "results": {}
+      },
+      "updateDeviceInfo": {
+        "minimalRole": "manager",
+        "parameters": {
+          "description": "string",
+          "name": "string",
+          "location": "string"
+        },
+        "results": {}
+      }
     }
   })");
 
@@ -45,6 +68,9 @@
   device_->AddCommandHandler("base.updateDeviceInfo",
                              base::Bind(&BaseApiHandler::UpdateDeviceInfo,
                                         weak_ptr_factory_.GetWeakPtr()));
+
+  device_info_->GetMutableConfig()->AddOnChangedCallback(base::Bind(
+      &BaseApiHandler::OnConfigChanged, weak_ptr_factory_.GetWeakPtr()));
 }
 
 void BaseApiHandler::UpdateBaseConfiguration(
diff --git a/libweave/src/base_api_handler.h b/src/base_api_handler.h
similarity index 100%
rename from libweave/src/base_api_handler.h
rename to src/base_api_handler.h
diff --git a/libweave/src/base_api_handler_unittest.cc b/src/base_api_handler_unittest.cc
similarity index 73%
rename from libweave/src/base_api_handler_unittest.cc
rename to src/base_api_handler_unittest.cc
index 172c8f1..a025e44 100644
--- a/libweave/src/base_api_handler_unittest.cc
+++ b/src/base_api_handler_unittest.cc
@@ -23,6 +23,7 @@
 using testing::Eq;
 using testing::Invoke;
 using testing::Return;
+using testing::ReturnRef;
 using testing::StrictMock;
 
 namespace weave {
@@ -34,11 +35,14 @@
         .WillRepeatedly(Return(true));
 
     command_manager_ = std::make_shared<CommandManager>();
-    command_manager_->Startup();
 
     state_manager_ = std::make_shared<StateManager>(&mock_state_change_queue_);
-    state_manager_->Startup();
 
+    EXPECT_CALL(device_, AddStateDefinitionsFromJson(_))
+        .WillRepeatedly(Invoke([this](const std::string& json) {
+          EXPECT_TRUE(
+              state_manager_->LoadStateDefinitionFromJson(json, nullptr));
+        }));
     EXPECT_CALL(device_, SetStateProperties(_, _))
         .WillRepeatedly(
             Invoke(state_manager_.get(), &StateManager::SetProperties));
@@ -58,6 +62,10 @@
     dev_reg_.reset(new DeviceRegistrationInfo(command_manager_, state_manager_,
                                               std::move(config), nullptr,
                                               &http_client_, nullptr));
+
+    EXPECT_CALL(device_, GetSettings())
+        .WillRepeatedly(ReturnRef(dev_reg_->GetSettings()));
+
     handler_.reset(new BaseApiHandler{dev_reg_.get(), &device_});
   }
 
@@ -75,6 +83,17 @@
               command_manager_->FindCommand(id)->GetState());
   }
 
+  std::unique_ptr<base::DictionaryValue> GetBaseState() {
+    auto state = state_manager_->GetState();
+    std::set<std::string> result;
+    for (base::DictionaryValue::Iterator it{*state}; !it.IsAtEnd();
+         it.Advance()) {
+      if (it.key() != "base")
+        state->Remove(it.key(), nullptr);
+    }
+    return state;
+  }
+
   provider::test::MockConfigStore config_store_;
   StrictMock<provider::test::MockHttpClient> http_client_;
   std::unique_ptr<DeviceRegistrationInfo> dev_reg_;
@@ -86,6 +105,47 @@
   int command_id_{0};
 };
 
+TEST_F(BaseApiHandlerTest, Initialization) {
+  auto command_defs =
+      command_manager_->GetCommandDictionary().GetCommandsAsJson(
+          [](const CommandDefinition* def) { return true; }, true, nullptr);
+
+  auto expected = R"({
+    "base": {
+      "updateBaseConfiguration": {
+         "minimalRole": "manager",
+         "parameters": {
+            "localAnonymousAccessMaxRole": {
+               "enum": [ "none", "viewer", "user" ],
+               "type": "string"
+            },
+            "localDiscoveryEnabled": {
+               "type": "boolean"
+            },
+            "localPairingEnabled": {
+               "type": "boolean"
+            }
+         }
+      },
+      "updateDeviceInfo": {
+         "minimalRole": "manager",
+         "parameters": {
+            "description": {
+               "type": "string"
+            },
+            "location": {
+               "type": "string"
+            },
+            "name": {
+               "type": "string"
+            }
+         }
+      }
+    }
+  })";
+  EXPECT_JSON_EQ(expected, *command_defs);
+}
+
 TEST_F(BaseApiHandlerTest, UpdateBaseConfiguration) {
   const Settings& settings = dev_reg_->GetSettings();
 
@@ -106,11 +166,10 @@
       'firmwareVersion': 'TEST_FIRMWARE',
       'localAnonymousAccessMaxRole': 'none',
       'localDiscoveryEnabled': false,
-      'localPairingEnabled': false,
-      'network': {}
+      'localPairingEnabled': false
     }
   })";
-  EXPECT_JSON_EQ(expected, *state_manager_->GetState());
+  EXPECT_JSON_EQ(expected, *GetBaseState());
 
   AddCommand(R"({
     'name' : 'base.updateBaseConfiguration',
@@ -128,11 +187,10 @@
       'firmwareVersion': 'TEST_FIRMWARE',
       'localAnonymousAccessMaxRole': 'user',
       'localDiscoveryEnabled': true,
-      'localPairingEnabled': true,
-      'network': {}
+      'localPairingEnabled': true
     }
   })";
-  EXPECT_JSON_EQ(expected, *state_manager_->GetState());
+  EXPECT_JSON_EQ(expected, *GetBaseState());
 
   {
     Config::Transaction change{dev_reg_->GetMutableConfig()};
@@ -143,11 +201,10 @@
       'firmwareVersion': 'TEST_FIRMWARE',
       'localAnonymousAccessMaxRole': 'viewer',
       'localDiscoveryEnabled': true,
-      'localPairingEnabled': true,
-      'network': {}
+      'localPairingEnabled': true
     }
   })";
-  EXPECT_JSON_EQ(expected, *state_manager_->GetState());
+  EXPECT_JSON_EQ(expected, *GetBaseState());
 }
 
 TEST_F(BaseApiHandlerTest, UpdateDeviceInfo) {
diff --git a/libweave/src/bind_lambda.h b/src/bind_lambda.h
similarity index 100%
rename from libweave/src/bind_lambda.h
rename to src/bind_lambda.h
diff --git a/libweave/src/commands/cloud_command_proxy.cc b/src/commands/cloud_command_proxy.cc
similarity index 100%
rename from libweave/src/commands/cloud_command_proxy.cc
rename to src/commands/cloud_command_proxy.cc
diff --git a/libweave/src/commands/cloud_command_proxy.h b/src/commands/cloud_command_proxy.h
similarity index 100%
rename from libweave/src/commands/cloud_command_proxy.h
rename to src/commands/cloud_command_proxy.h
diff --git a/libweave/src/commands/cloud_command_proxy_unittest.cc b/src/commands/cloud_command_proxy_unittest.cc
similarity index 100%
rename from libweave/src/commands/cloud_command_proxy_unittest.cc
rename to src/commands/cloud_command_proxy_unittest.cc
diff --git a/libweave/src/commands/cloud_command_update_interface.h b/src/commands/cloud_command_update_interface.h
similarity index 100%
rename from libweave/src/commands/cloud_command_update_interface.h
rename to src/commands/cloud_command_update_interface.h
diff --git a/libweave/src/commands/command_definition.cc b/src/commands/command_definition.cc
similarity index 100%
rename from libweave/src/commands/command_definition.cc
rename to src/commands/command_definition.cc
diff --git a/libweave/src/commands/command_definition.h b/src/commands/command_definition.h
similarity index 100%
rename from libweave/src/commands/command_definition.h
rename to src/commands/command_definition.h
diff --git a/libweave/src/commands/command_definition_unittest.cc b/src/commands/command_definition_unittest.cc
similarity index 100%
rename from libweave/src/commands/command_definition_unittest.cc
rename to src/commands/command_definition_unittest.cc
diff --git a/libweave/src/commands/command_dictionary.cc b/src/commands/command_dictionary.cc
similarity index 100%
rename from libweave/src/commands/command_dictionary.cc
rename to src/commands/command_dictionary.cc
diff --git a/libweave/src/commands/command_dictionary.h b/src/commands/command_dictionary.h
similarity index 100%
rename from libweave/src/commands/command_dictionary.h
rename to src/commands/command_dictionary.h
diff --git a/libweave/src/commands/command_dictionary_unittest.cc b/src/commands/command_dictionary_unittest.cc
similarity index 100%
rename from libweave/src/commands/command_dictionary_unittest.cc
rename to src/commands/command_dictionary_unittest.cc
diff --git a/libweave/src/commands/command_instance.cc b/src/commands/command_instance.cc
similarity index 100%
rename from libweave/src/commands/command_instance.cc
rename to src/commands/command_instance.cc
diff --git a/libweave/src/commands/command_instance.h b/src/commands/command_instance.h
similarity index 100%
rename from libweave/src/commands/command_instance.h
rename to src/commands/command_instance.h
diff --git a/libweave/src/commands/command_instance_unittest.cc b/src/commands/command_instance_unittest.cc
similarity index 100%
rename from libweave/src/commands/command_instance_unittest.cc
rename to src/commands/command_instance_unittest.cc
diff --git a/libweave/src/commands/command_manager.cc b/src/commands/command_manager.cc
similarity index 73%
rename from libweave/src/commands/command_manager.cc
rename to src/commands/command_manager.cc
index 70e804b..75d8295 100644
--- a/libweave/src/commands/command_manager.cc
+++ b/src/commands/command_manager.cc
@@ -13,43 +13,6 @@
 
 namespace weave {
 
-namespace {
-
-const char kBaseCommandDefs[] = R"({
-  "base": {
-    "updateBaseConfiguration": {
-      "minimalRole": "manager",
-      "parameters": {
-        "localDiscoveryEnabled": "boolean",
-        "localAnonymousAccessMaxRole": [ "none", "viewer", "user" ],
-        "localPairingEnabled": "boolean"
-      },
-      "results": {}
-    },
-    "reboot": {
-      "minimalRole": "user",
-      "parameters": {},
-      "results": {}
-    },
-    "identify": {
-      "minimalRole": "user",
-      "parameters": {},
-      "results": {}
-    },
-    "updateDeviceInfo": {
-      "minimalRole": "manager",
-      "parameters": {
-        "description": "string",
-        "name": "string",
-        "location": "string"
-      },
-      "results": {}
-    }
-  }
-})";
-
-}  // namespace
-
 CommandManager::CommandManager() {}
 
 CommandManager::~CommandManager() {}
@@ -63,22 +26,9 @@
   return dictionary_;
 }
 
-bool CommandManager::LoadBaseCommands(const base::DictionaryValue& dict,
-                                      ErrorPtr* error) {
-  return base_dictionary_.LoadCommands(dict, nullptr, error);
-}
-
-bool CommandManager::LoadBaseCommands(const std::string& json,
-                                      ErrorPtr* error) {
-  std::unique_ptr<const base::DictionaryValue> dict = LoadJsonDict(json, error);
-  if (!dict)
-    return false;
-  return LoadBaseCommands(*dict, error);
-}
-
 bool CommandManager::LoadCommands(const base::DictionaryValue& dict,
                                   ErrorPtr* error) {
-  bool result = dictionary_.LoadCommands(dict, &base_dictionary_, error);
+  bool result = dictionary_.LoadCommands(dict, nullptr, error);
   for (const auto& cb : on_command_changed_)
     cb.Run();
   return result;
@@ -92,13 +42,6 @@
   return LoadCommands(*dict, error);
 }
 
-void CommandManager::Startup() {
-  LOG(INFO) << "Initializing CommandManager.";
-
-  // Load global standard GCD command dictionary.
-  CHECK(LoadBaseCommands(kBaseCommandDefs, nullptr));
-}
-
 void CommandManager::AddCommand(
     std::unique_ptr<CommandInstance> command_instance) {
   command_queue_.Add(std::move(command_instance));
diff --git a/libweave/src/commands/command_manager.h b/src/commands/command_manager.h
similarity index 76%
rename from libweave/src/commands/command_manager.h
rename to src/commands/command_manager.h
index e2b212e..7cc8907 100644
--- a/libweave/src/commands/command_manager.h
+++ b/src/commands/command_manager.h
@@ -44,18 +44,9 @@
   // Returns the command definitions for the device.
   const CommandDictionary& GetCommandDictionary() const;
 
-  // Loads base/standard GCD command definitions.
-  // |dict| is the full JSON schema of standard GCD commands. These commands
-  // are not necessarily supported by a particular device but rather
-  // all the standard commands defined by GCD standard for all known/supported
-  // device kinds.
-  // On success, returns true. Otherwise, |error| contains additional
-  // error information.
-  bool LoadBaseCommands(const base::DictionaryValue& dict, ErrorPtr* error);
-
   // Same as the overload above, but takes a path to a json file to read
   // the base command definitions from.
-  bool LoadBaseCommands(const std::string& json, ErrorPtr* error);
+  bool LoadStandardCommands(const std::string& json, ErrorPtr* error);
 
   // Loads device command schema.
   bool LoadCommands(const base::DictionaryValue& dict,
@@ -66,10 +57,6 @@
   bool LoadCommands(const std::string& json,
                     ErrorPtr* error);
 
-  // Startup method to be called by buffet daemon at startup.
-  // Initializes standard GCD command dictionary.
-  void Startup();
-
   // Adds a new command to the command queue.
   void AddCommand(std::unique_ptr<CommandInstance> command_instance);
 
@@ -84,8 +71,7 @@
                   ErrorPtr* error);
 
  private:
-  CommandDictionary base_dictionary_;  // Base/std command definitions/schemas.
-  CommandDictionary dictionary_;       // Command definitions/schemas.
+  CommandDictionary dictionary_;  // Registered definitions.
   CommandQueue command_queue_;
   std::vector<base::Callback<void()>> on_command_changed_;
   uint32_t next_command_id_{0};
diff --git a/libweave/src/commands/command_manager_unittest.cc b/src/commands/command_manager_unittest.cc
similarity index 85%
rename from libweave/src/commands/command_manager_unittest.cc
rename to src/commands/command_manager_unittest.cc
index aacf30c..0c890a9 100644
--- a/libweave/src/commands/command_manager_unittest.cc
+++ b/src/commands/command_manager_unittest.cc
@@ -21,19 +21,6 @@
 
 namespace {
 
-const char kTestBaseCommands[] = R"({
-  "base": {
-    "reboot": {
-      "parameters": {"delay": "integer"},
-      "results": {}
-    },
-    "shutdown": {
-      "parameters": {},
-      "results": {}
-    }
-  }
-})";
-
 const char kTestVendorCommands[] = R"({
   "robot": {
     "_jump": {
@@ -63,12 +50,6 @@
   EXPECT_TRUE(manager.GetCommandDictionary().IsEmpty());
 }
 
-TEST(CommandManager, LoadBaseCommandsJSON) {
-  CommandManager manager;
-  auto json = CreateDictionaryValue(kTestBaseCommands);
-  EXPECT_TRUE(manager.LoadBaseCommands(*json, nullptr));
-}
-
 TEST(CommandManager, LoadCommandsDict) {
   CommandManager manager;
   auto json = CreateDictionaryValue(kTestVendorCommands);
@@ -77,20 +58,6 @@
 
 TEST(CommandManager, LoadCommandsJson) {
   CommandManager manager;
-  // Load some standard command definitions first.
-  auto json = CreateDictionaryValue(R"({
-    'base': {
-      'reboot': {
-        'parameters': {'delay': 'integer'},
-        'results': {}
-      },
-      'shutdown': {
-        'parameters': {},
-        'results': {}
-      }
-    }
-  })");
-  manager.LoadBaseCommands(*json, nullptr);
 
   // Load device-supported commands.
   auto json_str = R"({
@@ -115,7 +82,6 @@
 
 TEST(CommandManager, ShouldLoadStandardAndTestDefinitions) {
   CommandManager manager;
-  manager.Startup();
   ASSERT_TRUE(manager.LoadCommands(kTestVendorCommands, nullptr));
   ASSERT_TRUE(manager.LoadCommands(kTestTestCommands, nullptr));
   EXPECT_EQ(3, manager.GetCommandDictionary().GetSize());
diff --git a/libweave/src/commands/command_queue.cc b/src/commands/command_queue.cc
similarity index 100%
rename from libweave/src/commands/command_queue.cc
rename to src/commands/command_queue.cc
diff --git a/libweave/src/commands/command_queue.h b/src/commands/command_queue.h
similarity index 100%
rename from libweave/src/commands/command_queue.h
rename to src/commands/command_queue.h
diff --git a/libweave/src/commands/command_queue_unittest.cc b/src/commands/command_queue_unittest.cc
similarity index 100%
rename from libweave/src/commands/command_queue_unittest.cc
rename to src/commands/command_queue_unittest.cc
diff --git a/libweave/src/commands/object_schema.cc b/src/commands/object_schema.cc
similarity index 100%
rename from libweave/src/commands/object_schema.cc
rename to src/commands/object_schema.cc
diff --git a/libweave/src/commands/object_schema.h b/src/commands/object_schema.h
similarity index 100%
rename from libweave/src/commands/object_schema.h
rename to src/commands/object_schema.h
diff --git a/libweave/src/commands/object_schema_unittest.cc b/src/commands/object_schema_unittest.cc
similarity index 100%
rename from libweave/src/commands/object_schema_unittest.cc
rename to src/commands/object_schema_unittest.cc
diff --git a/libweave/src/commands/prop_constraints.cc b/src/commands/prop_constraints.cc
similarity index 100%
rename from libweave/src/commands/prop_constraints.cc
rename to src/commands/prop_constraints.cc
diff --git a/libweave/src/commands/prop_constraints.h b/src/commands/prop_constraints.h
similarity index 100%
rename from libweave/src/commands/prop_constraints.h
rename to src/commands/prop_constraints.h
diff --git a/libweave/src/commands/prop_types.cc b/src/commands/prop_types.cc
similarity index 100%
rename from libweave/src/commands/prop_types.cc
rename to src/commands/prop_types.cc
diff --git a/libweave/src/commands/prop_types.h b/src/commands/prop_types.h
similarity index 100%
rename from libweave/src/commands/prop_types.h
rename to src/commands/prop_types.h
diff --git a/libweave/src/commands/prop_values.cc b/src/commands/prop_values.cc
similarity index 100%
rename from libweave/src/commands/prop_values.cc
rename to src/commands/prop_values.cc
diff --git a/libweave/src/commands/prop_values.h b/src/commands/prop_values.h
similarity index 100%
rename from libweave/src/commands/prop_values.h
rename to src/commands/prop_values.h
diff --git a/libweave/src/commands/schema_constants.cc b/src/commands/schema_constants.cc
similarity index 100%
rename from libweave/src/commands/schema_constants.cc
rename to src/commands/schema_constants.cc
diff --git a/libweave/src/commands/schema_constants.h b/src/commands/schema_constants.h
similarity index 100%
rename from libweave/src/commands/schema_constants.h
rename to src/commands/schema_constants.h
diff --git a/libweave/src/commands/schema_utils.cc b/src/commands/schema_utils.cc
similarity index 100%
rename from libweave/src/commands/schema_utils.cc
rename to src/commands/schema_utils.cc
diff --git a/libweave/src/commands/schema_utils.h b/src/commands/schema_utils.h
similarity index 100%
rename from libweave/src/commands/schema_utils.h
rename to src/commands/schema_utils.h
diff --git a/libweave/src/commands/schema_utils_unittest.cc b/src/commands/schema_utils_unittest.cc
similarity index 100%
rename from libweave/src/commands/schema_utils_unittest.cc
rename to src/commands/schema_utils_unittest.cc
diff --git a/libweave/src/commands/unittest_utils.h b/src/commands/unittest_utils.h
similarity index 100%
rename from libweave/src/commands/unittest_utils.h
rename to src/commands/unittest_utils.h
diff --git a/libweave/src/config.cc b/src/config.cc
similarity index 100%
rename from libweave/src/config.cc
rename to src/config.cc
diff --git a/libweave/src/config.h b/src/config.h
similarity index 100%
rename from libweave/src/config.h
rename to src/config.h
diff --git a/libweave/src/config_unittest.cc b/src/config_unittest.cc
similarity index 100%
rename from libweave/src/config_unittest.cc
rename to src/config_unittest.cc
diff --git a/libweave/src/data_encoding.cc b/src/data_encoding.cc
similarity index 100%
rename from libweave/src/data_encoding.cc
rename to src/data_encoding.cc
diff --git a/libweave/src/data_encoding.h b/src/data_encoding.h
similarity index 100%
rename from libweave/src/data_encoding.h
rename to src/data_encoding.h
diff --git a/libweave/src/data_encoding_unittest.cc b/src/data_encoding_unittest.cc
similarity index 100%
rename from libweave/src/data_encoding_unittest.cc
rename to src/data_encoding_unittest.cc
diff --git a/libweave/src/device_manager.cc b/src/device_manager.cc
similarity index 98%
rename from libweave/src/device_manager.cc
rename to src/device_manager.cc
index a0c6199..c0b8e9a 100644
--- a/libweave/src/device_manager.cc
+++ b/src/device_manager.cc
@@ -34,10 +34,8 @@
                              provider::Wifi* wifi,
                              provider::Bluetooth* bluetooth) {
   command_manager_ = std::make_shared<CommandManager>();
-  command_manager_->Startup();
   state_change_queue_.reset(new StateChangeQueue(kMaxStateChangeQueueSize));
   state_manager_ = std::make_shared<StateManager>(state_change_queue_.get());
-  state_manager_->Startup();
 
   std::unique_ptr<Config> config{new Config{config_store}};
   config->Load();
diff --git a/libweave/src/device_manager.h b/src/device_manager.h
similarity index 100%
rename from libweave/src/device_manager.h
rename to src/device_manager.h
diff --git a/libweave/src/device_registration_info.cc b/src/device_registration_info.cc
similarity index 100%
rename from libweave/src/device_registration_info.cc
rename to src/device_registration_info.cc
diff --git a/libweave/src/device_registration_info.h b/src/device_registration_info.h
similarity index 100%
rename from libweave/src/device_registration_info.h
rename to src/device_registration_info.h
diff --git a/libweave/src/device_registration_info_unittest.cc b/src/device_registration_info_unittest.cc
similarity index 97%
rename from libweave/src/device_registration_info_unittest.cc
rename to src/device_registration_info_unittest.cc
index a885b7b..91b8ff5 100644
--- a/libweave/src/device_registration_info_unittest.cc
+++ b/src/device_registration_info_unittest.cc
@@ -350,21 +350,6 @@
 }
 
 TEST_F(DeviceRegistrationInfoTest, RegisterDevice) {
-  auto json_base = CreateDictionaryValue(R"({
-    'base': {
-      'reboot': {
-        'parameters': {'delay': 'integer'},
-        'minimalRole': 'user',
-        'results': {}
-      },
-      'shutdown': {
-        'parameters': {},
-        'minimalRole': 'user',
-        'results': {}
-      }
-    }
-  })");
-  EXPECT_TRUE(command_manager_->LoadBaseCommands(*json_base, nullptr));
   auto json_cmds = CreateDictionaryValue(R"({
     'base': {
       'reboot': {
diff --git a/libweave/src/empty.cc b/src/empty.cc
similarity index 100%
rename from libweave/src/empty.cc
rename to src/empty.cc
diff --git a/libweave/src/error.cc b/src/error.cc
similarity index 100%
rename from libweave/src/error.cc
rename to src/error.cc
diff --git a/libweave/src/error_unittest.cc b/src/error_unittest.cc
similarity index 100%
rename from libweave/src/error_unittest.cc
rename to src/error_unittest.cc
diff --git a/libweave/src/http_constants.cc b/src/http_constants.cc
similarity index 100%
rename from libweave/src/http_constants.cc
rename to src/http_constants.cc
diff --git a/libweave/src/http_constants.h b/src/http_constants.h
similarity index 100%
rename from libweave/src/http_constants.h
rename to src/http_constants.h
diff --git a/libweave/src/json_error_codes.cc b/src/json_error_codes.cc
similarity index 100%
rename from libweave/src/json_error_codes.cc
rename to src/json_error_codes.cc
diff --git a/libweave/src/json_error_codes.h b/src/json_error_codes.h
similarity index 100%
rename from libweave/src/json_error_codes.h
rename to src/json_error_codes.h
diff --git a/libweave/src/notification/notification_channel.h b/src/notification/notification_channel.h
similarity index 100%
rename from libweave/src/notification/notification_channel.h
rename to src/notification/notification_channel.h
diff --git a/libweave/src/notification/notification_delegate.h b/src/notification/notification_delegate.h
similarity index 100%
rename from libweave/src/notification/notification_delegate.h
rename to src/notification/notification_delegate.h
diff --git a/libweave/src/notification/notification_parser.cc b/src/notification/notification_parser.cc
similarity index 100%
rename from libweave/src/notification/notification_parser.cc
rename to src/notification/notification_parser.cc
diff --git a/libweave/src/notification/notification_parser.h b/src/notification/notification_parser.h
similarity index 100%
rename from libweave/src/notification/notification_parser.h
rename to src/notification/notification_parser.h
diff --git a/libweave/src/notification/notification_parser_unittest.cc b/src/notification/notification_parser_unittest.cc
similarity index 100%
rename from libweave/src/notification/notification_parser_unittest.cc
rename to src/notification/notification_parser_unittest.cc
diff --git a/libweave/src/notification/pull_channel.cc b/src/notification/pull_channel.cc
similarity index 100%
rename from libweave/src/notification/pull_channel.cc
rename to src/notification/pull_channel.cc
diff --git a/libweave/src/notification/pull_channel.h b/src/notification/pull_channel.h
similarity index 100%
rename from libweave/src/notification/pull_channel.h
rename to src/notification/pull_channel.h
diff --git a/libweave/src/notification/xml_node.cc b/src/notification/xml_node.cc
similarity index 100%
rename from libweave/src/notification/xml_node.cc
rename to src/notification/xml_node.cc
diff --git a/libweave/src/notification/xml_node.h b/src/notification/xml_node.h
similarity index 100%
rename from libweave/src/notification/xml_node.h
rename to src/notification/xml_node.h
diff --git a/libweave/src/notification/xml_node_unittest.cc b/src/notification/xml_node_unittest.cc
similarity index 100%
rename from libweave/src/notification/xml_node_unittest.cc
rename to src/notification/xml_node_unittest.cc
diff --git a/libweave/src/notification/xmpp_channel.cc b/src/notification/xmpp_channel.cc
similarity index 100%
rename from libweave/src/notification/xmpp_channel.cc
rename to src/notification/xmpp_channel.cc
diff --git a/libweave/src/notification/xmpp_channel.h b/src/notification/xmpp_channel.h
similarity index 100%
rename from libweave/src/notification/xmpp_channel.h
rename to src/notification/xmpp_channel.h
diff --git a/libweave/src/notification/xmpp_channel_unittest.cc b/src/notification/xmpp_channel_unittest.cc
similarity index 100%
rename from libweave/src/notification/xmpp_channel_unittest.cc
rename to src/notification/xmpp_channel_unittest.cc
diff --git a/libweave/src/notification/xmpp_iq_stanza_handler.cc b/src/notification/xmpp_iq_stanza_handler.cc
similarity index 100%
rename from libweave/src/notification/xmpp_iq_stanza_handler.cc
rename to src/notification/xmpp_iq_stanza_handler.cc
diff --git a/libweave/src/notification/xmpp_iq_stanza_handler.h b/src/notification/xmpp_iq_stanza_handler.h
similarity index 100%
rename from libweave/src/notification/xmpp_iq_stanza_handler.h
rename to src/notification/xmpp_iq_stanza_handler.h
diff --git a/libweave/src/notification/xmpp_iq_stanza_handler_unittest.cc b/src/notification/xmpp_iq_stanza_handler_unittest.cc
similarity index 100%
rename from libweave/src/notification/xmpp_iq_stanza_handler_unittest.cc
rename to src/notification/xmpp_iq_stanza_handler_unittest.cc
diff --git a/libweave/src/notification/xmpp_stream_parser.cc b/src/notification/xmpp_stream_parser.cc
similarity index 100%
rename from libweave/src/notification/xmpp_stream_parser.cc
rename to src/notification/xmpp_stream_parser.cc
diff --git a/libweave/src/notification/xmpp_stream_parser.h b/src/notification/xmpp_stream_parser.h
similarity index 100%
rename from libweave/src/notification/xmpp_stream_parser.h
rename to src/notification/xmpp_stream_parser.h
diff --git a/libweave/src/notification/xmpp_stream_parser_unittest.cc b/src/notification/xmpp_stream_parser_unittest.cc
similarity index 100%
rename from libweave/src/notification/xmpp_stream_parser_unittest.cc
rename to src/notification/xmpp_stream_parser_unittest.cc
diff --git a/libweave/src/privet/cloud_delegate.cc b/src/privet/cloud_delegate.cc
similarity index 97%
rename from libweave/src/privet/cloud_delegate.cc
rename to src/privet/cloud_delegate.cc
index b4ab288..4c28141 100644
--- a/libweave/src/privet/cloud_delegate.cc
+++ b/src/privet/cloud_delegate.cc
@@ -99,15 +99,6 @@
     return device_->GetSettings().model_name;
   }
 
-  std::set<std::string> GetServices() const override {
-    std::set<std::string> result;
-    for (base::DictionaryValue::Iterator it{command_defs_}; !it.IsAtEnd();
-         it.Advance()) {
-      result.emplace(it.key());
-    }
-    return result;
-  }
-
   AuthScope GetAnonymousMaxScope() const override {
     return device_->GetSettings().local_anonymous_access_role;
   }
diff --git a/libweave/src/privet/cloud_delegate.h b/src/privet/cloud_delegate.h
similarity index 95%
rename from libweave/src/privet/cloud_delegate.h
rename to src/privet/cloud_delegate.h
index 3875580..8763fbe 100644
--- a/libweave/src/privet/cloud_delegate.h
+++ b/src/privet/cloud_delegate.h
@@ -78,10 +78,6 @@
   // Returns the model name of the device.
   virtual std::string GetModelName() const = 0;
 
-  // Returns the list of services supported by device.
-  // E.g. printer, scanner etc. Should match services published on DNS-SD.
-  virtual std::set<std::string> GetServices() const = 0;
-
   // Returns max scope available for anonymous user.
   virtual AuthScope GetAnonymousMaxScope() const = 0;
 
diff --git a/libweave/src/privet/constants.cc b/src/privet/constants.cc
similarity index 100%
rename from libweave/src/privet/constants.cc
rename to src/privet/constants.cc
diff --git a/libweave/src/privet/constants.h b/src/privet/constants.h
similarity index 100%
rename from libweave/src/privet/constants.h
rename to src/privet/constants.h
diff --git a/libweave/src/privet/device_delegate.cc b/src/privet/device_delegate.cc
similarity index 100%
rename from libweave/src/privet/device_delegate.cc
rename to src/privet/device_delegate.cc
diff --git a/libweave/src/privet/device_delegate.h b/src/privet/device_delegate.h
similarity index 100%
rename from libweave/src/privet/device_delegate.h
rename to src/privet/device_delegate.h
diff --git a/src/privet/device_ui_kind.cc b/src/privet/device_ui_kind.cc
new file mode 100644
index 0000000..08b9312
--- /dev/null
+++ b/src/privet/device_ui_kind.cc
@@ -0,0 +1,42 @@
+// Copyright 2015 The Weave Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/privet/device_ui_kind.h"
+
+#include <base/logging.h>
+
+namespace weave {
+namespace privet {
+
+std::string GetDeviceUiKind(const std::string& manifest_id) {
+  CHECK_EQ(5u, manifest_id.size());
+  std::string kind = manifest_id.substr(0, 2);
+  if (kind == "AC")
+    return "accessPoint";
+  if (kind == "AK")
+    return "aggregator";
+  if (kind == "AM")
+    return "camera";
+  if (kind == "AB")
+    return "developmentBoard";
+  if (kind == "AE")
+    return "printer";
+  if (kind == "AF")
+    return "scanner";
+  if (kind == "AD")
+    return "speaker";
+  if (kind == "AL")
+    return "storage";
+  if (kind == "AJ")
+    return "toy";
+  if (kind == "AA")
+    return "vendor";
+  if (kind == "AN")
+    return "video";
+  LOG(FATAL) << "Invalid model id: " << manifest_id;
+  return std::string();
+}
+
+}  // namespace privet
+}  // namespace weave
diff --git a/src/privet/device_ui_kind.h b/src/privet/device_ui_kind.h
new file mode 100644
index 0000000..cd05f0e
--- /dev/null
+++ b/src/privet/device_ui_kind.h
@@ -0,0 +1,18 @@
+// Copyright 2015 The Weave Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef LIBWEAVE_SRC_PRIVET_DEVICE_UI_KIND_H_
+#define LIBWEAVE_SRC_PRIVET_DEVICE_UI_KIND_H_
+
+#include <string>
+
+namespace weave {
+namespace privet {
+
+std::string GetDeviceUiKind(const std::string& manifest_id);
+
+}  // namespace privet
+}  // namespace weave
+
+#endif  // LIBWEAVE_SRC_PRIVET_DEVICE_UI_KIND_H_
diff --git a/libweave/src/privet/mock_delegates.h b/src/privet/mock_delegates.h
similarity index 97%
rename from libweave/src/privet/mock_delegates.h
rename to src/privet/mock_delegates.h
index 159fa09..755110e 100644
--- a/libweave/src/privet/mock_delegates.h
+++ b/src/privet/mock_delegates.h
@@ -146,7 +146,6 @@
                     const std::string&));
   MOCK_CONST_METHOD0(GetOemName, std::string());
   MOCK_CONST_METHOD0(GetModelName, std::string());
-  MOCK_CONST_METHOD0(GetServices, std::set<std::string>());
   MOCK_CONST_METHOD0(GetAnonymousMaxScope, AuthScope());
   MOCK_CONST_METHOD0(GetConnectionState, const ConnectionState&());
   MOCK_CONST_METHOD0(GetSetupState, const SetupState&());
@@ -177,8 +176,6 @@
     EXPECT_CALL(*this, UpdateDeviceInfo(_, _, _)).WillRepeatedly(Return());
     EXPECT_CALL(*this, GetOemName()).WillRepeatedly(Return("Chromium"));
     EXPECT_CALL(*this, GetModelName()).WillRepeatedly(Return("Brillo"));
-    EXPECT_CALL(*this, GetServices())
-        .WillRepeatedly(Return(std::set<std::string>{}));
     EXPECT_CALL(*this, GetAnonymousMaxScope())
         .WillRepeatedly(Return(AuthScope::kUser));
     EXPECT_CALL(*this, GetConnectionState())
diff --git a/libweave/src/privet/openssl_utils.cc b/src/privet/openssl_utils.cc
similarity index 100%
rename from libweave/src/privet/openssl_utils.cc
rename to src/privet/openssl_utils.cc
diff --git a/libweave/src/privet/openssl_utils.h b/src/privet/openssl_utils.h
similarity index 100%
rename from libweave/src/privet/openssl_utils.h
rename to src/privet/openssl_utils.h
diff --git a/libweave/src/privet/privet_handler.cc b/src/privet/privet_handler.cc
similarity index 96%
rename from libweave/src/privet/privet_handler.cc
rename to src/privet/privet_handler.cc
index 2180cad..d959f66 100644
--- a/libweave/src/privet/privet_handler.cc
+++ b/src/privet/privet_handler.cc
@@ -20,6 +20,7 @@
 #include "src/privet/cloud_delegate.h"
 #include "src/privet/constants.h"
 #include "src/privet/device_delegate.h"
+#include "src/privet/device_ui_kind.h"
 #include "src/privet/security_delegate.h"
 #include "src/privet/wifi_delegate.h"
 #include "src/string_utils.h"
@@ -216,40 +217,11 @@
   return ReturnError(*error, callback);
 }
 
-std::string GetDeviceKind(const std::string& manifest_id) {
-  CHECK_EQ(5u, manifest_id.size());
-  std::string kind = manifest_id.substr(0, 2);
-  if (kind == "AC")
-    return "accessPoint";
-  if (kind == "AK")
-    return "aggregator";
-  if (kind == "AM")
-    return "camera";
-  if (kind == "AB")
-    return "developmentBoard";
-  if (kind == "AE")
-    return "printer";
-  if (kind == "AF")
-    return "scanner";
-  if (kind == "AD")
-    return "speaker";
-  if (kind == "AL")
-    return "storage";
-  if (kind == "AJ")
-    return "toy";
-  if (kind == "AA")
-    return "vendor";
-  if (kind == "AN")
-    return "video";
-  LOG(FATAL) << "Invalid model id: " << manifest_id;
-  return std::string();
-}
-
 std::unique_ptr<base::DictionaryValue> CreateManifestSection(
-    const std::string& model_id,
     const CloudDelegate& cloud) {
   std::unique_ptr<base::DictionaryValue> manifest(new base::DictionaryValue());
-  manifest->SetString(kInfoManifestUiDeviceKind, GetDeviceKind(model_id));
+  manifest->SetString(kInfoManifestUiDeviceKind,
+                      GetDeviceUiKind(cloud.GetModelId()));
   manifest->SetString(kInfoManifestOemName, cloud.GetOemName());
   manifest->SetString(kInfoManifestModelName, cloud.GetModelName());
   return manifest;
@@ -341,8 +313,10 @@
 }  // namespace
 
 std::vector<std::string> PrivetHandler::GetHttpPaths() const {
-  // TODO(vitalybuka): Should be subset only.
-  return GetHttpsPaths();
+  return {
+      "/privet/info", "/privet/v3/pairing/start", "/privet/v3/pairing/confirm",
+      "/privet/v3/pairing/cancel",
+  };
 }
 
 std::vector<std::string> PrivetHandler::GetHttpsPaths() const {
@@ -485,9 +459,11 @@
     output.SetString(kLocationKey, location);
 
   output.SetString(kInfoModelIdKey, model_id);
-  output.Set(kInfoModelManifestKey,
-             CreateManifestSection(model_id, *cloud_).release());
-  output.Set(kInfoServicesKey, ToValue(cloud_->GetServices()).release());
+  output.Set(kInfoModelManifestKey, CreateManifestSection(*cloud_).release());
+  output.Set(
+      kInfoServicesKey,
+      ToValue(std::vector<std::string>{GetDeviceUiKind(cloud_->GetModelId())})
+          .release());
 
   output.Set(
       kInfoAuthenticationKey,
diff --git a/libweave/src/privet/privet_handler.h b/src/privet/privet_handler.h
similarity index 100%
rename from libweave/src/privet/privet_handler.h
rename to src/privet/privet_handler.h
diff --git a/libweave/src/privet/privet_handler_unittest.cc b/src/privet/privet_handler_unittest.cc
similarity index 98%
rename from libweave/src/privet/privet_handler_unittest.cc
rename to src/privet/privet_handler_unittest.cc
index 6f123e2..d430935 100644
--- a/libweave/src/privet/privet_handler_unittest.cc
+++ b/src/privet/privet_handler_unittest.cc
@@ -238,7 +238,7 @@
     'version': '3.0',
     'id': 'TestId',
     'name': 'TestDevice',
-    'services': [],
+    'services': [ "developmentBoard" ],
     'modelManifestId': "ABMID",
     'basicModelManifest': {
       'uiDeviceKind': 'developmentBoard',
@@ -275,8 +275,6 @@
   EXPECT_CALL(cloud_, GetDescription())
       .WillRepeatedly(Return("TestDescription"));
   EXPECT_CALL(cloud_, GetLocation()).WillRepeatedly(Return("TestLocation"));
-  EXPECT_CALL(cloud_, GetServices())
-      .WillRepeatedly(Return(std::set<std::string>{"service1", "service2"}));
   EXPECT_CALL(device_, GetHttpEnpoint())
       .WillRepeatedly(Return(std::make_pair(80, 10080)));
   EXPECT_CALL(device_, GetHttpsEnpoint())
@@ -290,10 +288,7 @@
     'name': 'TestDevice',
     'description': 'TestDescription',
     'location': 'TestLocation',
-    'services': [
-      "service1",
-      "service2"
-    ],
+    'services': [ "developmentBoard" ],
     'modelManifestId': "ABMID",
     'basicModelManifest': {
       'uiDeviceKind': 'developmentBoard',
diff --git a/libweave/src/privet/privet_manager.cc b/src/privet/privet_manager.cc
similarity index 100%
rename from libweave/src/privet/privet_manager.cc
rename to src/privet/privet_manager.cc
diff --git a/libweave/src/privet/privet_manager.h b/src/privet/privet_manager.h
similarity index 100%
rename from libweave/src/privet/privet_manager.h
rename to src/privet/privet_manager.h
diff --git a/libweave/src/privet/privet_types.cc b/src/privet/privet_types.cc
similarity index 100%
rename from libweave/src/privet/privet_types.cc
rename to src/privet/privet_types.cc
diff --git a/libweave/src/privet/privet_types.h b/src/privet/privet_types.h
similarity index 100%
rename from libweave/src/privet/privet_types.h
rename to src/privet/privet_types.h
diff --git a/libweave/src/privet/publisher.cc b/src/privet/publisher.cc
similarity index 93%
rename from libweave/src/privet/publisher.cc
rename to src/privet/publisher.cc
index f323dac..62e980e 100644
--- a/libweave/src/privet/publisher.cc
+++ b/src/privet/publisher.cc
@@ -11,6 +11,7 @@
 
 #include "src/privet/cloud_delegate.h"
 #include "src/privet/device_delegate.h"
+#include "src/privet/device_ui_kind.h"
 #include "src/privet/wifi_bootstrap_manager.h"
 #include "src/privet/wifi_ssid_generator.h"
 #include "src/string_utils.h"
@@ -54,15 +55,10 @@
   const uint16_t port = device_->GetHttpEnpoint().first;
   DCHECK_NE(port, 0);
 
-  std::string services;
-  if (!cloud_->GetServices().empty())
-    services += "_";
-  services += Join(",_", cloud_->GetServices());
-
   std::vector<std::string> txt_record{
       {"txtvers=3"},
       {"ty=" + name},
-      {"services=" + services},
+      {"services=" + GetDeviceUiKind(model_id)},
       {"id=" + cloud_->GetDeviceId()},
       {"mmid=" + model_id},
       {"flags=" + WifiSsidGenerator{cloud_, wifi_}.GenerateFlags()},
diff --git a/libweave/src/privet/publisher.h b/src/privet/publisher.h
similarity index 100%
rename from libweave/src/privet/publisher.h
rename to src/privet/publisher.h
diff --git a/libweave/src/privet/security_delegate.h b/src/privet/security_delegate.h
similarity index 100%
rename from libweave/src/privet/security_delegate.h
rename to src/privet/security_delegate.h
diff --git a/libweave/src/privet/security_manager.cc b/src/privet/security_manager.cc
similarity index 100%
rename from libweave/src/privet/security_manager.cc
rename to src/privet/security_manager.cc
diff --git a/libweave/src/privet/security_manager.h b/src/privet/security_manager.h
similarity index 100%
rename from libweave/src/privet/security_manager.h
rename to src/privet/security_manager.h
diff --git a/libweave/src/privet/security_manager_unittest.cc b/src/privet/security_manager_unittest.cc
similarity index 100%
rename from libweave/src/privet/security_manager_unittest.cc
rename to src/privet/security_manager_unittest.cc
diff --git a/libweave/src/privet/wifi_bootstrap_manager.cc b/src/privet/wifi_bootstrap_manager.cc
similarity index 93%
rename from libweave/src/privet/wifi_bootstrap_manager.cc
rename to src/privet/wifi_bootstrap_manager.cc
index 255ae6b..4f46ea4 100644
--- a/libweave/src/privet/wifi_bootstrap_manager.cc
+++ b/src/privet/wifi_bootstrap_manager.cc
@@ -20,6 +20,8 @@
 
 namespace {
 
+const int kMonitoringTimeoutSeconds = 120;
+
 const EnumToStringMap<WifiBootstrapManager::State>::Map kWifiSetupStateMap[] = {
     {WifiBootstrapManager::State::kDisabled, "disabled"},
     {WifiBootstrapManager::State::kBootstrapping, "waiting"},
@@ -52,9 +54,10 @@
       base::Bind(&WifiBootstrapManager::OnConnectivityChange,
                  lifetime_weak_factory_.GetWeakPtr()));
   if (config_->GetSettings().last_configured_ssid.empty()) {
-    StartBootstrapping();
+    // Give implementation some time to figure out state.
+    StartMonitoring(base::TimeDelta::FromSeconds(15));
   } else {
-    StartMonitoring();
+    StartMonitoring(base::TimeDelta::FromSeconds(kMonitoringTimeoutSeconds));
   }
 }
 
@@ -65,7 +68,7 @@
     // testing when we have an ethernet connection.  If you need to always
     // start an AP to bootstrap WiFi credentials, then add your WiFi interface
     // to the device whitelist.
-    StartMonitoring();
+    StartMonitoring(base::TimeDelta::FromSeconds(kMonitoringTimeoutSeconds));
     return;
   }
 
@@ -106,7 +109,7 @@
 
 void WifiBootstrapManager::EndConnecting() {}
 
-void WifiBootstrapManager::StartMonitoring() {
+void WifiBootstrapManager::StartMonitoring(const base::TimeDelta& timeout) {
   VLOG(1) << "Monitoring connectivity.";
   // We already have a callback in place with |network_| to update our
   // connectivity state.  See OnConnectivityChange().
@@ -116,7 +119,7 @@
     monitor_until_ = {};
   } else {
     if (monitor_until_.is_null()) {
-      monitor_until_ = base::Time::Now() + base::TimeDelta::FromMinutes(2);
+      monitor_until_ = base::Time::Now() + timeout;
       VLOG(2) << "Waiting for connection until: " << monitor_until_;
     }
 
@@ -207,7 +210,7 @@
   change.set_last_configured_ssid(ssid);
   change.Commit();
   setup_state_ = SetupState{SetupState::kSuccess};
-  StartMonitoring();
+  StartMonitoring(base::TimeDelta::FromSeconds(kMonitoringTimeoutSeconds));
 }
 
 void WifiBootstrapManager::OnConnectTimeout() {
@@ -220,7 +223,7 @@
 
 void WifiBootstrapManager::OnBootstrapTimeout() {
   VLOG(1) << "Bootstrapping has timed out.";
-  StartMonitoring();
+  StartMonitoring(base::TimeDelta::FromSeconds(kMonitoringTimeoutSeconds));
 }
 
 void WifiBootstrapManager::OnConnectivityChange() {
@@ -231,7 +234,7 @@
   if (state_ == State::kMonitoring ||  // Reset monitoring timeout.
       (state_ != State::kDisabled &&
        network_->GetConnectionState() == Network::State::kOnline)) {
-    StartMonitoring();
+    StartMonitoring(base::TimeDelta::FromSeconds(kMonitoringTimeoutSeconds));
   }
 }
 
diff --git a/libweave/src/privet/wifi_bootstrap_manager.h b/src/privet/wifi_bootstrap_manager.h
similarity index 98%
rename from libweave/src/privet/wifi_bootstrap_manager.h
rename to src/privet/wifi_bootstrap_manager.h
index 4ff2d3e..71dbb49 100644
--- a/libweave/src/privet/wifi_bootstrap_manager.h
+++ b/src/privet/wifi_bootstrap_manager.h
@@ -73,7 +73,7 @@
   void StartConnecting(const std::string& ssid, const std::string& passphrase);
   void EndConnecting();
 
-  void StartMonitoring();
+  void StartMonitoring(const base::TimeDelta& timeout);
   void EndMonitoring();
 
   // Update the current state, post tasks to notify listeners accordingly to
diff --git a/libweave/src/privet/wifi_delegate.h b/src/privet/wifi_delegate.h
similarity index 100%
rename from libweave/src/privet/wifi_delegate.h
rename to src/privet/wifi_delegate.h
diff --git a/libweave/src/privet/wifi_ssid_generator.cc b/src/privet/wifi_ssid_generator.cc
similarity index 100%
rename from libweave/src/privet/wifi_ssid_generator.cc
rename to src/privet/wifi_ssid_generator.cc
diff --git a/libweave/src/privet/wifi_ssid_generator.h b/src/privet/wifi_ssid_generator.h
similarity index 100%
rename from libweave/src/privet/wifi_ssid_generator.h
rename to src/privet/wifi_ssid_generator.h
diff --git a/libweave/src/privet/wifi_ssid_generator_unittest.cc b/src/privet/wifi_ssid_generator_unittest.cc
similarity index 100%
rename from libweave/src/privet/wifi_ssid_generator_unittest.cc
rename to src/privet/wifi_ssid_generator_unittest.cc
diff --git a/libweave/src/registration_status.cc b/src/registration_status.cc
similarity index 100%
rename from libweave/src/registration_status.cc
rename to src/registration_status.cc
diff --git a/libweave/src/states/error_codes.cc b/src/states/error_codes.cc
similarity index 100%
rename from libweave/src/states/error_codes.cc
rename to src/states/error_codes.cc
diff --git a/libweave/src/states/error_codes.h b/src/states/error_codes.h
similarity index 100%
rename from libweave/src/states/error_codes.h
rename to src/states/error_codes.h
diff --git a/libweave/src/states/mock_state_change_queue_interface.h b/src/states/mock_state_change_queue_interface.h
similarity index 100%
rename from libweave/src/states/mock_state_change_queue_interface.h
rename to src/states/mock_state_change_queue_interface.h
diff --git a/libweave/src/states/state_change_queue.cc b/src/states/state_change_queue.cc
similarity index 100%
rename from libweave/src/states/state_change_queue.cc
rename to src/states/state_change_queue.cc
diff --git a/libweave/src/states/state_change_queue.h b/src/states/state_change_queue.h
similarity index 100%
rename from libweave/src/states/state_change_queue.h
rename to src/states/state_change_queue.h
diff --git a/libweave/src/states/state_change_queue_interface.h b/src/states/state_change_queue_interface.h
similarity index 100%
rename from libweave/src/states/state_change_queue_interface.h
rename to src/states/state_change_queue_interface.h
diff --git a/libweave/src/states/state_change_queue_unittest.cc b/src/states/state_change_queue_unittest.cc
similarity index 100%
rename from libweave/src/states/state_change_queue_unittest.cc
rename to src/states/state_change_queue_unittest.cc
diff --git a/libweave/src/states/state_manager.cc b/src/states/state_manager.cc
similarity index 85%
rename from libweave/src/states/state_manager.cc
rename to src/states/state_manager.cc
index f629aa1..fe6e669 100644
--- a/libweave/src/states/state_manager.cc
+++ b/src/states/state_manager.cc
@@ -15,32 +15,6 @@
 
 namespace weave {
 
-namespace {
-
-const char kBaseStateDefs[] = R"({
-  "base": {
-    "firmwareVersion": "string",
-    "localDiscoveryEnabled": "boolean",
-    "localAnonymousAccessMaxRole": [ "none", "viewer", "user" ],
-    "localPairingEnabled": "boolean",
-    "network": {
-      "properties": {
-        "name": "string"
-      }
-    }
-  }
-})";
-
-const char kBaseStateDefaults[] = R"({
-  "base": {
-    "firmwareVersion": "unknown",
-    "localDiscoveryEnabled": false,
-    "localAnonymousAccessMaxRole": "none",
-    "localPairingEnabled": false
-  }
-})";
-}
-
 StateManager::StateManager(StateChangeQueueInterface* state_change_queue)
     : state_change_queue_(state_change_queue) {
   CHECK(state_change_queue_) << "State change queue not specified";
@@ -53,19 +27,6 @@
   callback.Run();  // Force to read current state.
 }
 
-void StateManager::Startup() {
-  LOG(INFO) << "Initializing StateManager.";
-
-  // Load standard device state definition.
-  CHECK(LoadBaseStateDefinition(kBaseStateDefs, nullptr));
-
-  // Load standard device state defaults.
-  CHECK(SetPropertiesFromJson(kBaseStateDefaults, nullptr));
-
-  for (const auto& cb : on_changed_)
-    cb.Run();
-}
-
 std::unique_ptr<base::DictionaryValue> StateManager::GetState() const {
   std::unique_ptr<base::DictionaryValue> dict{new base::DictionaryValue};
   for (const auto& pair : packages_) {
@@ -189,20 +150,6 @@
   return true;
 }
 
-bool StateManager::LoadBaseStateDefinition(const std::string& json,
-                                           ErrorPtr* error) {
-  std::unique_ptr<const base::DictionaryValue> dict = LoadJsonDict(json, error);
-  if (!dict)
-    return false;
-  if (!LoadStateDefinition(*dict, error)) {
-    Error::AddToPrintf(
-        error, FROM_HERE, errors::kErrorDomain, errors::kSchemaError,
-        "Failed to load base state definition: '%s'", json.c_str());
-    return false;
-  }
-  return true;
-}
-
 bool StateManager::SetProperties(const base::DictionaryValue& dict,
                                  ErrorPtr* error) {
   base::Time timestamp = base::Time::Now();
diff --git a/libweave/src/states/state_manager.h b/src/states/state_manager.h
similarity index 88%
rename from libweave/src/states/state_manager.h
rename to src/states/state_manager.h
index 2e2e002..55faf76 100644
--- a/libweave/src/states/state_manager.h
+++ b/src/states/state_manager.h
@@ -45,10 +45,6 @@
                    ErrorPtr* error);
   std::unique_ptr<base::DictionaryValue> GetState() const;
 
-  // Initializes the state manager and load device state fragments.
-  // Called by Buffet daemon at startup.
-  void Startup();
-
   // Returns the recorded state changes since last time this method has been
   // called.
   std::pair<StateChangeQueueInterface::UpdateID, std::vector<StateChange>>
@@ -73,11 +69,6 @@
                         const base::Time& timestamp,
                         ErrorPtr* error);
 
-  // Loads the base device state fragment JSON. This state fragment
-  // defines the standard state properties from the 'base' package as defined
-  // by GCD specification.
-  bool LoadBaseStateDefinition(const std::string& json, ErrorPtr* error);
-
   // Finds a package by its name. Returns nullptr if not found.
   StatePackage* FindPackage(const std::string& package_name);
   const StatePackage* FindPackage(const std::string& package_name) const;
diff --git a/libweave/src/states/state_manager_unittest.cc b/src/states/state_manager_unittest.cc
similarity index 91%
rename from libweave/src/states/state_manager_unittest.cc
rename to src/states/state_manager_unittest.cc
index b62dc10..3f854fe 100644
--- a/libweave/src/states/state_manager_unittest.cc
+++ b/src/states/state_manager_unittest.cc
@@ -135,19 +135,34 @@
 TEST_F(StateManagerTest, Startup) {
   StateManager manager(&mock_state_change_queue_);
 
-  manager.Startup();
-  ASSERT_TRUE(manager.LoadStateDefinitionFromJson(
-      R"({"power": {"battery_level":"integer"}})", nullptr));
-  ASSERT_TRUE(manager.SetPropertiesFromJson(
-      R"({"power": {"battery_level":44}})", nullptr));
+  auto state_definition = R"({
+    "base": {
+      "firmwareVersion": "string",
+      "localDiscoveryEnabled": "boolean",
+      "localAnonymousAccessMaxRole": [ "none", "viewer", "user" ],
+      "localPairingEnabled": "boolean"
+    },
+    "power": {"battery_level":"integer"}
+  })";
+  ASSERT_TRUE(manager.LoadStateDefinitionFromJson(state_definition, nullptr));
+
+  auto state_values = R"({
+    "base": {
+      "firmwareVersion": "unknown",
+      "localDiscoveryEnabled": false,
+      "localAnonymousAccessMaxRole": "none",
+      "localPairingEnabled": false
+    },
+    "power": {"battery_level":44}
+  })";
+  ASSERT_TRUE(manager.SetPropertiesFromJson(state_values, nullptr));
 
   auto expected = R"({
     'base': {
       'firmwareVersion': 'unknown',
       'localAnonymousAccessMaxRole': 'none',
       'localDiscoveryEnabled': false,
-      'localPairingEnabled': false,
-      'network': {}
+      'localPairingEnabled': false
     },
     'power': {
       'battery_level': 44
diff --git a/libweave/src/states/state_package.cc b/src/states/state_package.cc
similarity index 100%
rename from libweave/src/states/state_package.cc
rename to src/states/state_package.cc
diff --git a/libweave/src/states/state_package.h b/src/states/state_package.h
similarity index 100%
rename from libweave/src/states/state_package.h
rename to src/states/state_package.h
diff --git a/libweave/src/states/state_package_unittest.cc b/src/states/state_package_unittest.cc
similarity index 100%
rename from libweave/src/states/state_package_unittest.cc
rename to src/states/state_package_unittest.cc
diff --git a/libweave/src/streams.cc b/src/streams.cc
similarity index 100%
rename from libweave/src/streams.cc
rename to src/streams.cc
diff --git a/libweave/src/streams.h b/src/streams.h
similarity index 100%
rename from libweave/src/streams.h
rename to src/streams.h
diff --git a/libweave/src/streams_unittest.cc b/src/streams_unittest.cc
similarity index 100%
rename from libweave/src/streams_unittest.cc
rename to src/streams_unittest.cc
diff --git a/libweave/src/string_utils.cc b/src/string_utils.cc
similarity index 100%
rename from libweave/src/string_utils.cc
rename to src/string_utils.cc
diff --git a/libweave/src/string_utils.h b/src/string_utils.h
similarity index 100%
rename from libweave/src/string_utils.h
rename to src/string_utils.h
diff --git a/libweave/src/string_utils_unittest.cc b/src/string_utils_unittest.cc
similarity index 100%
rename from libweave/src/string_utils_unittest.cc
rename to src/string_utils_unittest.cc
diff --git a/libweave/src/test/fake_stream.cc b/src/test/fake_stream.cc
similarity index 100%
rename from libweave/src/test/fake_stream.cc
rename to src/test/fake_stream.cc
diff --git a/libweave/src/test/fake_task_runner.cc b/src/test/fake_task_runner.cc
similarity index 100%
rename from libweave/src/test/fake_task_runner.cc
rename to src/test/fake_task_runner.cc
diff --git a/libweave/src/test/mock_command.cc b/src/test/mock_command.cc
similarity index 100%
rename from libweave/src/test/mock_command.cc
rename to src/test/mock_command.cc
diff --git a/libweave/src/test/unittest_utils.cc b/src/test/unittest_utils.cc
similarity index 100%
rename from libweave/src/test/unittest_utils.cc
rename to src/test/unittest_utils.cc
diff --git a/libweave/src/test/weave_testrunner.cc b/src/test/weave_testrunner.cc
similarity index 100%
rename from libweave/src/test/weave_testrunner.cc
rename to src/test/weave_testrunner.cc
diff --git a/libweave/src/utils.cc b/src/utils.cc
similarity index 100%
rename from libweave/src/utils.cc
rename to src/utils.cc
diff --git a/libweave/src/utils.h b/src/utils.h
similarity index 100%
rename from libweave/src/utils.h
rename to src/utils.h
diff --git a/libweave/src/weave_unittest.cc b/src/weave_unittest.cc
similarity index 89%
rename from libweave/src/weave_unittest.cc
rename to src/weave_unittest.cc
index 0bfbe0b..6ff3f6d 100644
--- a/libweave/src/weave_unittest.cc
+++ b/src/weave_unittest.cc
@@ -36,6 +36,8 @@
 
 namespace weave {
 
+namespace {
+
 using provider::HttpClient;
 using provider::Network;
 using provider::test::MockHttpClientResponse;
@@ -133,6 +135,16 @@
   return (arg_copy == txt_copy);
 }
 
+template <class Map>
+std::set<typename Map::key_type> GetKeys(const Map& map) {
+  std::set<typename Map::key_type> result;
+  for (const auto& pair : map)
+    result.insert(pair.first);
+  return result;
+}
+
+}  // namespace
+
 class WeaveTest : public ::testing::Test {
  protected:
   void SetUp() override {}
@@ -178,9 +190,9 @@
   }
 
   void InitDnsSdPublishing(bool registered, const std::string& flags) {
-    std::vector<std::string> txt{{"id=TEST_DEVICE_ID"}, {"flags=" + flags},
-                                 {"mmid=ABCDE"},        {"services=_base"},
-                                 {"txtvers=3"},         {"ty=TEST_NAME"}};
+    std::vector<std::string> txt{
+        {"id=TEST_DEVICE_ID"},         {"flags=" + flags}, {"mmid=ABCDE"},
+        {"services=developmentBoard"}, {"txtvers=3"},      {"ty=TEST_NAME"}};
     if (registered) {
       txt.push_back("gcd_id=CLOUD_ID");
 
@@ -208,13 +220,13 @@
         .WillRepeatedly(Invoke(
             [this](const std::string& path_prefix,
                    const provider::HttpServer::RequestHandlerCallback& cb) {
-              http_server_request_cb_.push_back(cb);
+              http_handlers_[path_prefix] = cb;
             }));
     EXPECT_CALL(http_server_, AddHttpsRequestHandler(_, _))
         .WillRepeatedly(Invoke(
             [this](const std::string& path_prefix,
                    const provider::HttpServer::RequestHandlerCallback& cb) {
-              http_server_request_cb_.push_back(cb);
+              https_handlers_[path_prefix] = cb;
             }));
   }
 
@@ -232,6 +244,19 @@
                                     &http_client_, &network_, &dns_sd_,
                                     &http_server_, &wifi_, &bluetooth_);
 
+    EXPECT_EQ((std::set<std::string>{
+                  "/privet/info", "/privet/v3/pairing/cancel",
+                  "/privet/v3/pairing/confirm", "/privet/v3/pairing/start"}),
+              GetKeys(http_handlers_));
+    EXPECT_EQ((std::set<std::string>{
+                  "/privet/info", "/privet/v3/auth", "/privet/v3/commandDefs",
+                  "/privet/v3/commands/cancel", "/privet/v3/commands/execute",
+                  "/privet/v3/commands/list", "/privet/v3/commands/status",
+                  "/privet/v3/pairing/cancel", "/privet/v3/pairing/confirm",
+                  "/privet/v3/pairing/start", "/privet/v3/setup/start",
+                  "/privet/v3/setup/status", "/privet/v3/state"}),
+              GetKeys(https_handlers_));
+
     device_->AddCommandDefinitionsFromJson(kCommandDefs);
     device_->AddStateDefinitionsFromJson(kStateDefs);
     device_->SetStatePropertiesFromJson(kStateDefaults, nullptr);
@@ -247,8 +272,10 @@
     }
   }
 
-  std::vector<provider::HttpServer::RequestHandlerCallback>
-      http_server_request_cb_;
+  std::map<std::string, provider::HttpServer::RequestHandlerCallback>
+      http_handlers_;
+  std::map<std::string, provider::HttpServer::RequestHandlerCallback>
+      https_handlers_;
 
   StrictMock<provider::test::MockConfigStore> config_store_;
   StrictMock<provider::test::FakeTaskRunner> task_runner_;
diff --git a/libweave/third_party/chromium/LICENSE b/third_party/chromium/LICENSE
similarity index 100%
rename from libweave/third_party/chromium/LICENSE
rename to third_party/chromium/LICENSE
diff --git a/libweave/third_party/chromium/LICENSE.chromium_os b/third_party/chromium/LICENSE.chromium_os
similarity index 100%
rename from libweave/third_party/chromium/LICENSE.chromium_os
rename to third_party/chromium/LICENSE.chromium_os
diff --git a/libweave/third_party/chromium/base/base_export.h b/third_party/chromium/base/base_export.h
similarity index 100%
rename from libweave/third_party/chromium/base/base_export.h
rename to third_party/chromium/base/base_export.h
diff --git a/libweave/third_party/chromium/base/basictypes.h b/third_party/chromium/base/basictypes.h
similarity index 100%
rename from libweave/third_party/chromium/base/basictypes.h
rename to third_party/chromium/base/basictypes.h
diff --git a/libweave/third_party/chromium/base/bind.h b/third_party/chromium/base/bind.h
similarity index 100%
rename from libweave/third_party/chromium/base/bind.h
rename to third_party/chromium/base/bind.h
diff --git a/libweave/third_party/chromium/base/bind_helpers.cc b/third_party/chromium/base/bind_helpers.cc
similarity index 100%
rename from libweave/third_party/chromium/base/bind_helpers.cc
rename to third_party/chromium/base/bind_helpers.cc
diff --git a/libweave/third_party/chromium/base/bind_helpers.h b/third_party/chromium/base/bind_helpers.h
similarity index 100%
rename from libweave/third_party/chromium/base/bind_helpers.h
rename to third_party/chromium/base/bind_helpers.h
diff --git a/libweave/third_party/chromium/base/bind_internal.h b/third_party/chromium/base/bind_internal.h
similarity index 100%
rename from libweave/third_party/chromium/base/bind_internal.h
rename to third_party/chromium/base/bind_internal.h
diff --git a/libweave/third_party/chromium/base/bind_unittest.cc b/third_party/chromium/base/bind_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/bind_unittest.cc
rename to third_party/chromium/base/bind_unittest.cc
diff --git a/libweave/third_party/chromium/base/build/build_config.h b/third_party/chromium/base/build/build_config.h
similarity index 100%
rename from libweave/third_party/chromium/base/build/build_config.h
rename to third_party/chromium/base/build/build_config.h
diff --git a/libweave/third_party/chromium/base/callback.h b/third_party/chromium/base/callback.h
similarity index 100%
rename from libweave/third_party/chromium/base/callback.h
rename to third_party/chromium/base/callback.h
diff --git a/libweave/third_party/chromium/base/callback_forward.h b/third_party/chromium/base/callback_forward.h
similarity index 100%
rename from libweave/third_party/chromium/base/callback_forward.h
rename to third_party/chromium/base/callback_forward.h
diff --git a/libweave/third_party/chromium/base/callback_internal.cc b/third_party/chromium/base/callback_internal.cc
similarity index 100%
rename from libweave/third_party/chromium/base/callback_internal.cc
rename to third_party/chromium/base/callback_internal.cc
diff --git a/libweave/third_party/chromium/base/callback_internal.h b/third_party/chromium/base/callback_internal.h
similarity index 100%
rename from libweave/third_party/chromium/base/callback_internal.h
rename to third_party/chromium/base/callback_internal.h
diff --git a/libweave/third_party/chromium/base/callback_list.h b/third_party/chromium/base/callback_list.h
similarity index 100%
rename from libweave/third_party/chromium/base/callback_list.h
rename to third_party/chromium/base/callback_list.h
diff --git a/libweave/third_party/chromium/base/callback_list_unittest.cc b/third_party/chromium/base/callback_list_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/callback_list_unittest.cc
rename to third_party/chromium/base/callback_list_unittest.cc
diff --git a/libweave/third_party/chromium/base/callback_unittest.cc b/third_party/chromium/base/callback_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/callback_unittest.cc
rename to third_party/chromium/base/callback_unittest.cc
diff --git a/libweave/third_party/chromium/base/command_line.h b/third_party/chromium/base/command_line.h
similarity index 100%
rename from libweave/third_party/chromium/base/command_line.h
rename to third_party/chromium/base/command_line.h
diff --git a/libweave/third_party/chromium/base/compiler_specific.h b/third_party/chromium/base/compiler_specific.h
similarity index 100%
rename from libweave/third_party/chromium/base/compiler_specific.h
rename to third_party/chromium/base/compiler_specific.h
diff --git a/libweave/third_party/chromium/base/gtest_prod_util.h b/third_party/chromium/base/gtest_prod_util.h
similarity index 100%
rename from libweave/third_party/chromium/base/gtest_prod_util.h
rename to third_party/chromium/base/gtest_prod_util.h
diff --git a/libweave/third_party/chromium/base/guid.h b/third_party/chromium/base/guid.h
similarity index 100%
rename from libweave/third_party/chromium/base/guid.h
rename to third_party/chromium/base/guid.h
diff --git a/libweave/third_party/chromium/base/guid_posix.cc b/third_party/chromium/base/guid_posix.cc
similarity index 100%
rename from libweave/third_party/chromium/base/guid_posix.cc
rename to third_party/chromium/base/guid_posix.cc
diff --git a/libweave/third_party/chromium/base/guid_unittest.cc b/third_party/chromium/base/guid_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/guid_unittest.cc
rename to third_party/chromium/base/guid_unittest.cc
diff --git a/libweave/third_party/chromium/base/json/json_parser.cc b/third_party/chromium/base/json/json_parser.cc
similarity index 100%
rename from libweave/third_party/chromium/base/json/json_parser.cc
rename to third_party/chromium/base/json/json_parser.cc
diff --git a/libweave/third_party/chromium/base/json/json_parser.h b/third_party/chromium/base/json/json_parser.h
similarity index 100%
rename from libweave/third_party/chromium/base/json/json_parser.h
rename to third_party/chromium/base/json/json_parser.h
diff --git a/libweave/third_party/chromium/base/json/json_parser_unittest.cc b/third_party/chromium/base/json/json_parser_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/json/json_parser_unittest.cc
rename to third_party/chromium/base/json/json_parser_unittest.cc
diff --git a/libweave/third_party/chromium/base/json/json_reader.cc b/third_party/chromium/base/json/json_reader.cc
similarity index 100%
rename from libweave/third_party/chromium/base/json/json_reader.cc
rename to third_party/chromium/base/json/json_reader.cc
diff --git a/libweave/third_party/chromium/base/json/json_reader.h b/third_party/chromium/base/json/json_reader.h
similarity index 100%
rename from libweave/third_party/chromium/base/json/json_reader.h
rename to third_party/chromium/base/json/json_reader.h
diff --git a/libweave/third_party/chromium/base/json/json_reader_unittest.cc b/third_party/chromium/base/json/json_reader_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/json/json_reader_unittest.cc
rename to third_party/chromium/base/json/json_reader_unittest.cc
diff --git a/libweave/third_party/chromium/base/json/json_writer.cc b/third_party/chromium/base/json/json_writer.cc
similarity index 100%
rename from libweave/third_party/chromium/base/json/json_writer.cc
rename to third_party/chromium/base/json/json_writer.cc
diff --git a/libweave/third_party/chromium/base/json/json_writer.h b/third_party/chromium/base/json/json_writer.h
similarity index 100%
rename from libweave/third_party/chromium/base/json/json_writer.h
rename to third_party/chromium/base/json/json_writer.h
diff --git a/libweave/third_party/chromium/base/json/json_writer_unittest.cc b/third_party/chromium/base/json/json_writer_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/json/json_writer_unittest.cc
rename to third_party/chromium/base/json/json_writer_unittest.cc
diff --git a/libweave/third_party/chromium/base/json/string_escape.cc b/third_party/chromium/base/json/string_escape.cc
similarity index 100%
rename from libweave/third_party/chromium/base/json/string_escape.cc
rename to third_party/chromium/base/json/string_escape.cc
diff --git a/libweave/third_party/chromium/base/json/string_escape.h b/third_party/chromium/base/json/string_escape.h
similarity index 100%
rename from libweave/third_party/chromium/base/json/string_escape.h
rename to third_party/chromium/base/json/string_escape.h
diff --git a/libweave/third_party/chromium/base/json/string_escape_unittest.cc b/third_party/chromium/base/json/string_escape_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/json/string_escape_unittest.cc
rename to third_party/chromium/base/json/string_escape_unittest.cc
diff --git a/libweave/third_party/chromium/base/location.cc b/third_party/chromium/base/location.cc
similarity index 100%
rename from libweave/third_party/chromium/base/location.cc
rename to third_party/chromium/base/location.cc
diff --git a/libweave/third_party/chromium/base/location.h b/third_party/chromium/base/location.h
similarity index 100%
rename from libweave/third_party/chromium/base/location.h
rename to third_party/chromium/base/location.h
diff --git a/libweave/third_party/chromium/base/logging.cc b/third_party/chromium/base/logging.cc
similarity index 100%
rename from libweave/third_party/chromium/base/logging.cc
rename to third_party/chromium/base/logging.cc
diff --git a/libweave/third_party/chromium/base/logging.h b/third_party/chromium/base/logging.h
similarity index 100%
rename from libweave/third_party/chromium/base/logging.h
rename to third_party/chromium/base/logging.h
diff --git a/libweave/third_party/chromium/base/logging_unittest.cc b/third_party/chromium/base/logging_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/logging_unittest.cc
rename to third_party/chromium/base/logging_unittest.cc
diff --git a/libweave/third_party/chromium/base/macros.h b/third_party/chromium/base/macros.h
similarity index 100%
rename from libweave/third_party/chromium/base/macros.h
rename to third_party/chromium/base/macros.h
diff --git a/libweave/third_party/chromium/base/memory/ref_counted.cc b/third_party/chromium/base/memory/ref_counted.cc
similarity index 100%
rename from libweave/third_party/chromium/base/memory/ref_counted.cc
rename to third_party/chromium/base/memory/ref_counted.cc
diff --git a/libweave/third_party/chromium/base/memory/ref_counted.h b/third_party/chromium/base/memory/ref_counted.h
similarity index 100%
rename from libweave/third_party/chromium/base/memory/ref_counted.h
rename to third_party/chromium/base/memory/ref_counted.h
diff --git a/libweave/third_party/chromium/base/memory/ref_counted_unittest.cc b/third_party/chromium/base/memory/ref_counted_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/memory/ref_counted_unittest.cc
rename to third_party/chromium/base/memory/ref_counted_unittest.cc
diff --git a/libweave/third_party/chromium/base/memory/scoped_ptr.h b/third_party/chromium/base/memory/scoped_ptr.h
similarity index 100%
rename from libweave/third_party/chromium/base/memory/scoped_ptr.h
rename to third_party/chromium/base/memory/scoped_ptr.h
diff --git a/libweave/third_party/chromium/base/memory/scoped_ptr_unittest.cc b/third_party/chromium/base/memory/scoped_ptr_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/memory/scoped_ptr_unittest.cc
rename to third_party/chromium/base/memory/scoped_ptr_unittest.cc
diff --git a/libweave/third_party/chromium/base/memory/weak_ptr.cc b/third_party/chromium/base/memory/weak_ptr.cc
similarity index 100%
rename from libweave/third_party/chromium/base/memory/weak_ptr.cc
rename to third_party/chromium/base/memory/weak_ptr.cc
diff --git a/libweave/third_party/chromium/base/memory/weak_ptr.h b/third_party/chromium/base/memory/weak_ptr.h
similarity index 100%
rename from libweave/third_party/chromium/base/memory/weak_ptr.h
rename to third_party/chromium/base/memory/weak_ptr.h
diff --git a/libweave/third_party/chromium/base/memory/weak_ptr_unittest.cc b/third_party/chromium/base/memory/weak_ptr_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/memory/weak_ptr_unittest.cc
rename to third_party/chromium/base/memory/weak_ptr_unittest.cc
diff --git a/libweave/third_party/chromium/base/move.h b/third_party/chromium/base/move.h
similarity index 100%
rename from libweave/third_party/chromium/base/move.h
rename to third_party/chromium/base/move.h
diff --git a/libweave/third_party/chromium/base/move_unittest.cc b/third_party/chromium/base/move_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/move_unittest.cc
rename to third_party/chromium/base/move_unittest.cc
diff --git a/libweave/third_party/chromium/base/numerics/safe_conversions.h b/third_party/chromium/base/numerics/safe_conversions.h
similarity index 100%
rename from libweave/third_party/chromium/base/numerics/safe_conversions.h
rename to third_party/chromium/base/numerics/safe_conversions.h
diff --git a/libweave/third_party/chromium/base/numerics/safe_conversions_impl.h b/third_party/chromium/base/numerics/safe_conversions_impl.h
similarity index 100%
rename from libweave/third_party/chromium/base/numerics/safe_conversions_impl.h
rename to third_party/chromium/base/numerics/safe_conversions_impl.h
diff --git a/libweave/third_party/chromium/base/numerics/safe_math.h b/third_party/chromium/base/numerics/safe_math.h
similarity index 100%
rename from libweave/third_party/chromium/base/numerics/safe_math.h
rename to third_party/chromium/base/numerics/safe_math.h
diff --git a/libweave/third_party/chromium/base/numerics/safe_math_impl.h b/third_party/chromium/base/numerics/safe_math_impl.h
similarity index 100%
rename from libweave/third_party/chromium/base/numerics/safe_math_impl.h
rename to third_party/chromium/base/numerics/safe_math_impl.h
diff --git a/libweave/third_party/chromium/base/numerics/safe_numerics_unittest.cc b/third_party/chromium/base/numerics/safe_numerics_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/numerics/safe_numerics_unittest.cc
rename to third_party/chromium/base/numerics/safe_numerics_unittest.cc
diff --git a/libweave/third_party/chromium/base/observer_list.h b/third_party/chromium/base/observer_list.h
similarity index 100%
rename from libweave/third_party/chromium/base/observer_list.h
rename to third_party/chromium/base/observer_list.h
diff --git a/libweave/third_party/chromium/base/observer_list_unittest.cc b/third_party/chromium/base/observer_list_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/observer_list_unittest.cc
rename to third_party/chromium/base/observer_list_unittest.cc
diff --git a/libweave/third_party/chromium/base/posix/eintr_wrapper.h b/third_party/chromium/base/posix/eintr_wrapper.h
similarity index 100%
rename from libweave/third_party/chromium/base/posix/eintr_wrapper.h
rename to third_party/chromium/base/posix/eintr_wrapper.h
diff --git a/libweave/third_party/chromium/base/rand_util.cc b/third_party/chromium/base/rand_util.cc
similarity index 100%
rename from libweave/third_party/chromium/base/rand_util.cc
rename to third_party/chromium/base/rand_util.cc
diff --git a/libweave/third_party/chromium/base/rand_util.h b/third_party/chromium/base/rand_util.h
similarity index 100%
rename from libweave/third_party/chromium/base/rand_util.h
rename to third_party/chromium/base/rand_util.h
diff --git a/libweave/third_party/chromium/base/rand_util_posix.cc b/third_party/chromium/base/rand_util_posix.cc
similarity index 100%
rename from libweave/third_party/chromium/base/rand_util_posix.cc
rename to third_party/chromium/base/rand_util_posix.cc
diff --git a/libweave/third_party/chromium/base/rand_util_unittest.cc b/third_party/chromium/base/rand_util_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/rand_util_unittest.cc
rename to third_party/chromium/base/rand_util_unittest.cc
diff --git a/libweave/third_party/chromium/base/scoped_clear_errno.h b/third_party/chromium/base/scoped_clear_errno.h
similarity index 100%
rename from libweave/third_party/chromium/base/scoped_clear_errno.h
rename to third_party/chromium/base/scoped_clear_errno.h
diff --git a/libweave/third_party/chromium/base/scoped_clear_errno_unittest.cc b/third_party/chromium/base/scoped_clear_errno_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/scoped_clear_errno_unittest.cc
rename to third_party/chromium/base/scoped_clear_errno_unittest.cc
diff --git a/libweave/third_party/chromium/base/scoped_observer.h b/third_party/chromium/base/scoped_observer.h
similarity index 100%
rename from libweave/third_party/chromium/base/scoped_observer.h
rename to third_party/chromium/base/scoped_observer.h
diff --git a/libweave/third_party/chromium/base/strings/string_number_conversions.cc b/third_party/chromium/base/strings/string_number_conversions.cc
similarity index 100%
rename from libweave/third_party/chromium/base/strings/string_number_conversions.cc
rename to third_party/chromium/base/strings/string_number_conversions.cc
diff --git a/libweave/third_party/chromium/base/strings/string_number_conversions.h b/third_party/chromium/base/strings/string_number_conversions.h
similarity index 100%
rename from libweave/third_party/chromium/base/strings/string_number_conversions.h
rename to third_party/chromium/base/strings/string_number_conversions.h
diff --git a/libweave/third_party/chromium/base/strings/string_number_conversions_unittest.cc b/third_party/chromium/base/strings/string_number_conversions_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/strings/string_number_conversions_unittest.cc
rename to third_party/chromium/base/strings/string_number_conversions_unittest.cc
diff --git a/libweave/third_party/chromium/base/strings/string_piece.cc b/third_party/chromium/base/strings/string_piece.cc
similarity index 100%
rename from libweave/third_party/chromium/base/strings/string_piece.cc
rename to third_party/chromium/base/strings/string_piece.cc
diff --git a/libweave/third_party/chromium/base/strings/string_piece.h b/third_party/chromium/base/strings/string_piece.h
similarity index 100%
rename from libweave/third_party/chromium/base/strings/string_piece.h
rename to third_party/chromium/base/strings/string_piece.h
diff --git a/libweave/third_party/chromium/base/strings/string_piece_unittest.cc b/third_party/chromium/base/strings/string_piece_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/strings/string_piece_unittest.cc
rename to third_party/chromium/base/strings/string_piece_unittest.cc
diff --git a/libweave/third_party/chromium/base/strings/string_util.cc b/third_party/chromium/base/strings/string_util.cc
similarity index 100%
rename from libweave/third_party/chromium/base/strings/string_util.cc
rename to third_party/chromium/base/strings/string_util.cc
diff --git a/libweave/third_party/chromium/base/strings/string_util.h b/third_party/chromium/base/strings/string_util.h
similarity index 100%
rename from libweave/third_party/chromium/base/strings/string_util.h
rename to third_party/chromium/base/strings/string_util.h
diff --git a/libweave/third_party/chromium/base/strings/string_util_constants.cc b/third_party/chromium/base/strings/string_util_constants.cc
similarity index 100%
rename from libweave/third_party/chromium/base/strings/string_util_constants.cc
rename to third_party/chromium/base/strings/string_util_constants.cc
diff --git a/libweave/third_party/chromium/base/strings/string_util_posix.h b/third_party/chromium/base/strings/string_util_posix.h
similarity index 100%
rename from libweave/third_party/chromium/base/strings/string_util_posix.h
rename to third_party/chromium/base/strings/string_util_posix.h
diff --git a/libweave/third_party/chromium/base/strings/string_util_unittest.cc b/third_party/chromium/base/strings/string_util_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/strings/string_util_unittest.cc
rename to third_party/chromium/base/strings/string_util_unittest.cc
diff --git a/libweave/third_party/chromium/base/strings/stringprintf.cc b/third_party/chromium/base/strings/stringprintf.cc
similarity index 100%
rename from libweave/third_party/chromium/base/strings/stringprintf.cc
rename to third_party/chromium/base/strings/stringprintf.cc
diff --git a/libweave/third_party/chromium/base/strings/stringprintf.h b/third_party/chromium/base/strings/stringprintf.h
similarity index 100%
rename from libweave/third_party/chromium/base/strings/stringprintf.h
rename to third_party/chromium/base/strings/stringprintf.h
diff --git a/libweave/third_party/chromium/base/strings/stringprintf_unittest.cc b/third_party/chromium/base/strings/stringprintf_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/strings/stringprintf_unittest.cc
rename to third_party/chromium/base/strings/stringprintf_unittest.cc
diff --git a/libweave/third_party/chromium/base/strings/utf_string_conversion_utils.cc b/third_party/chromium/base/strings/utf_string_conversion_utils.cc
similarity index 100%
rename from libweave/third_party/chromium/base/strings/utf_string_conversion_utils.cc
rename to third_party/chromium/base/strings/utf_string_conversion_utils.cc
diff --git a/libweave/third_party/chromium/base/strings/utf_string_conversion_utils.h b/third_party/chromium/base/strings/utf_string_conversion_utils.h
similarity index 100%
rename from libweave/third_party/chromium/base/strings/utf_string_conversion_utils.h
rename to third_party/chromium/base/strings/utf_string_conversion_utils.h
diff --git a/libweave/third_party/chromium/base/template_util.h b/third_party/chromium/base/template_util.h
similarity index 100%
rename from libweave/third_party/chromium/base/template_util.h
rename to third_party/chromium/base/template_util.h
diff --git a/libweave/third_party/chromium/base/template_util_unittest.cc b/third_party/chromium/base/template_util_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/template_util_unittest.cc
rename to third_party/chromium/base/template_util_unittest.cc
diff --git a/libweave/third_party/chromium/base/third_party/dmg_fp/LICENSE b/third_party/chromium/base/third_party/dmg_fp/LICENSE
similarity index 100%
rename from libweave/third_party/chromium/base/third_party/dmg_fp/LICENSE
rename to third_party/chromium/base/third_party/dmg_fp/LICENSE
diff --git a/libweave/third_party/chromium/base/third_party/dmg_fp/README.chromium b/third_party/chromium/base/third_party/dmg_fp/README.chromium
similarity index 100%
rename from libweave/third_party/chromium/base/third_party/dmg_fp/README.chromium
rename to third_party/chromium/base/third_party/dmg_fp/README.chromium
diff --git a/libweave/third_party/chromium/base/third_party/dmg_fp/dmg_fp.h b/third_party/chromium/base/third_party/dmg_fp/dmg_fp.h
similarity index 100%
rename from libweave/third_party/chromium/base/third_party/dmg_fp/dmg_fp.h
rename to third_party/chromium/base/third_party/dmg_fp/dmg_fp.h
diff --git a/libweave/third_party/chromium/base/third_party/dmg_fp/dtoa.cc b/third_party/chromium/base/third_party/dmg_fp/dtoa.cc
similarity index 100%
rename from libweave/third_party/chromium/base/third_party/dmg_fp/dtoa.cc
rename to third_party/chromium/base/third_party/dmg_fp/dtoa.cc
diff --git a/libweave/third_party/chromium/base/third_party/dmg_fp/g_fmt.cc b/third_party/chromium/base/third_party/dmg_fp/g_fmt.cc
similarity index 100%
rename from libweave/third_party/chromium/base/third_party/dmg_fp/g_fmt.cc
rename to third_party/chromium/base/third_party/dmg_fp/g_fmt.cc
diff --git a/libweave/third_party/chromium/base/third_party/icu/LICENSE b/third_party/chromium/base/third_party/icu/LICENSE
similarity index 100%
rename from libweave/third_party/chromium/base/third_party/icu/LICENSE
rename to third_party/chromium/base/third_party/icu/LICENSE
diff --git a/libweave/third_party/chromium/base/third_party/icu/README.chromium b/third_party/chromium/base/third_party/icu/README.chromium
similarity index 100%
rename from libweave/third_party/chromium/base/third_party/icu/README.chromium
rename to third_party/chromium/base/third_party/icu/README.chromium
diff --git a/libweave/third_party/chromium/base/third_party/icu/icu_utf.cc b/third_party/chromium/base/third_party/icu/icu_utf.cc
similarity index 100%
rename from libweave/third_party/chromium/base/third_party/icu/icu_utf.cc
rename to third_party/chromium/base/third_party/icu/icu_utf.cc
diff --git a/libweave/third_party/chromium/base/third_party/icu/icu_utf.h b/third_party/chromium/base/third_party/icu/icu_utf.h
similarity index 100%
rename from libweave/third_party/chromium/base/third_party/icu/icu_utf.h
rename to third_party/chromium/base/third_party/icu/icu_utf.h
diff --git a/libweave/third_party/chromium/base/time/clock.cc b/third_party/chromium/base/time/clock.cc
similarity index 100%
rename from libweave/third_party/chromium/base/time/clock.cc
rename to third_party/chromium/base/time/clock.cc
diff --git a/libweave/third_party/chromium/base/time/clock.h b/third_party/chromium/base/time/clock.h
similarity index 100%
rename from libweave/third_party/chromium/base/time/clock.h
rename to third_party/chromium/base/time/clock.h
diff --git a/libweave/third_party/chromium/base/time/default_clock.cc b/third_party/chromium/base/time/default_clock.cc
similarity index 100%
rename from libweave/third_party/chromium/base/time/default_clock.cc
rename to third_party/chromium/base/time/default_clock.cc
diff --git a/libweave/third_party/chromium/base/time/default_clock.h b/third_party/chromium/base/time/default_clock.h
similarity index 100%
rename from libweave/third_party/chromium/base/time/default_clock.h
rename to third_party/chromium/base/time/default_clock.h
diff --git a/libweave/third_party/chromium/base/time/time.cc b/third_party/chromium/base/time/time.cc
similarity index 100%
rename from libweave/third_party/chromium/base/time/time.cc
rename to third_party/chromium/base/time/time.cc
diff --git a/libweave/third_party/chromium/base/time/time.h b/third_party/chromium/base/time/time.h
similarity index 100%
rename from libweave/third_party/chromium/base/time/time.h
rename to third_party/chromium/base/time/time.h
diff --git a/libweave/third_party/chromium/base/time/time_posix.cc b/third_party/chromium/base/time/time_posix.cc
similarity index 100%
rename from libweave/third_party/chromium/base/time/time_posix.cc
rename to third_party/chromium/base/time/time_posix.cc
diff --git a/libweave/third_party/chromium/base/time/time_unittest.cc b/third_party/chromium/base/time/time_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/time/time_unittest.cc
rename to third_party/chromium/base/time/time_unittest.cc
diff --git a/libweave/third_party/chromium/base/tuple.h b/third_party/chromium/base/tuple.h
similarity index 100%
rename from libweave/third_party/chromium/base/tuple.h
rename to third_party/chromium/base/tuple.h
diff --git a/libweave/third_party/chromium/base/tuple_unittest.cc b/third_party/chromium/base/tuple_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/tuple_unittest.cc
rename to third_party/chromium/base/tuple_unittest.cc
diff --git a/libweave/third_party/chromium/base/values.cc b/third_party/chromium/base/values.cc
similarity index 100%
rename from libweave/third_party/chromium/base/values.cc
rename to third_party/chromium/base/values.cc
diff --git a/libweave/third_party/chromium/base/values.h b/third_party/chromium/base/values.h
similarity index 100%
rename from libweave/third_party/chromium/base/values.h
rename to third_party/chromium/base/values.h
diff --git a/libweave/third_party/chromium/base/values_unittest.cc b/third_party/chromium/base/values_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/base/values_unittest.cc
rename to third_party/chromium/base/values_unittest.cc
diff --git a/libweave/third_party/chromium/crypto/p224.cc b/third_party/chromium/crypto/p224.cc
similarity index 100%
rename from libweave/third_party/chromium/crypto/p224.cc
rename to third_party/chromium/crypto/p224.cc
diff --git a/libweave/third_party/chromium/crypto/p224.h b/third_party/chromium/crypto/p224.h
similarity index 100%
rename from libweave/third_party/chromium/crypto/p224.h
rename to third_party/chromium/crypto/p224.h
diff --git a/libweave/third_party/chromium/crypto/p224_spake.cc b/third_party/chromium/crypto/p224_spake.cc
similarity index 100%
rename from libweave/third_party/chromium/crypto/p224_spake.cc
rename to third_party/chromium/crypto/p224_spake.cc
diff --git a/libweave/third_party/chromium/crypto/p224_spake.h b/third_party/chromium/crypto/p224_spake.h
similarity index 100%
rename from libweave/third_party/chromium/crypto/p224_spake.h
rename to third_party/chromium/crypto/p224_spake.h
diff --git a/libweave/third_party/chromium/crypto/p224_spake_unittest.cc b/third_party/chromium/crypto/p224_spake_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/crypto/p224_spake_unittest.cc
rename to third_party/chromium/crypto/p224_spake_unittest.cc
diff --git a/libweave/third_party/chromium/crypto/p224_unittest.cc b/third_party/chromium/crypto/p224_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/crypto/p224_unittest.cc
rename to third_party/chromium/crypto/p224_unittest.cc
diff --git a/libweave/third_party/chromium/crypto/sha2.cc b/third_party/chromium/crypto/sha2.cc
similarity index 100%
rename from libweave/third_party/chromium/crypto/sha2.cc
rename to third_party/chromium/crypto/sha2.cc
diff --git a/libweave/third_party/chromium/crypto/sha2.h b/third_party/chromium/crypto/sha2.h
similarity index 100%
rename from libweave/third_party/chromium/crypto/sha2.h
rename to third_party/chromium/crypto/sha2.h
diff --git a/libweave/third_party/chromium/crypto/sha2_unittest.cc b/third_party/chromium/crypto/sha2_unittest.cc
similarity index 100%
rename from libweave/third_party/chromium/crypto/sha2_unittest.cc
rename to third_party/chromium/crypto/sha2_unittest.cc
diff --git a/libweave/third_party/modp_b64/LICENSE b/third_party/modp_b64/LICENSE
similarity index 100%
rename from libweave/third_party/modp_b64/LICENSE
rename to third_party/modp_b64/LICENSE
diff --git a/libweave/third_party/modp_b64/MODULE_LICENSE_BSD b/third_party/modp_b64/MODULE_LICENSE_BSD
similarity index 100%
rename from libweave/third_party/modp_b64/MODULE_LICENSE_BSD
rename to third_party/modp_b64/MODULE_LICENSE_BSD
diff --git a/libweave/third_party/modp_b64/NOTICE b/third_party/modp_b64/NOTICE
similarity index 100%
rename from libweave/third_party/modp_b64/NOTICE
rename to third_party/modp_b64/NOTICE
diff --git a/libweave/third_party/modp_b64/README.chromium b/third_party/modp_b64/README.chromium
similarity index 100%
rename from libweave/third_party/modp_b64/README.chromium
rename to third_party/modp_b64/README.chromium
diff --git a/libweave/third_party/modp_b64/modp_b64.cc b/third_party/modp_b64/modp_b64.cc
similarity index 100%
rename from libweave/third_party/modp_b64/modp_b64.cc
rename to third_party/modp_b64/modp_b64.cc
diff --git a/libweave/third_party/modp_b64/modp_b64/modp_b64.h b/third_party/modp_b64/modp_b64/modp_b64.h
similarity index 100%
rename from libweave/third_party/modp_b64/modp_b64/modp_b64.h
rename to third_party/modp_b64/modp_b64/modp_b64.h
diff --git a/libweave/third_party/modp_b64/modp_b64_data.h b/third_party/modp_b64/modp_b64_data.h
similarity index 100%
rename from libweave/third_party/modp_b64/modp_b64_data.h
rename to third_party/modp_b64/modp_b64_data.h