webservd: Rename "chromeos" -> "brillo" in include paths and namespaces

libchromeos is transitioning to libbrillo and chromeos namespaces
and include directory is changing to brillo.

Bug: 24872993
Change-Id: Iba15692972a0c24ec87ac8e51d4eb032214149b0
diff --git a/libwebserv/export.h b/libwebserv/export.h
index ff68423..78d11f4 100644
--- a/libwebserv/export.h
+++ b/libwebserv/export.h
@@ -16,7 +16,7 @@
 #define WEBSERVER_LIBWEBSERV_EXPORT_H_
 
 // See detailed explanation of the purpose of LIBWEBSERV_EXPORT in
-// chromeos/chromeos_export.h for similar attribute - CHROMEOS_EXPORT.
+// brillo/brillo_export.h for similar attribute - BRILLO_EXPORT.
 #define LIBWEBSERV_EXPORT __attribute__((__visibility__("default")))
 #define LIBWEBSERV_PRIVATE __attribute__((__visibility__("hidden")))
 
diff --git a/libwebserv/protocol_handler.cc b/libwebserv/protocol_handler.cc
index 7224ceb..df8c255 100644
--- a/libwebserv/protocol_handler.cc
+++ b/libwebserv/protocol_handler.cc
@@ -17,9 +17,9 @@
 #include <tuple>
 
 #include <base/logging.h>
-#include <chromeos/map_utils.h>
-#include <chromeos/streams/file_stream.h>
-#include <chromeos/streams/stream_utils.h>
+#include <brillo/map_utils.h>
+#include <brillo/streams/file_stream.h>
+#include <brillo/streams/stream_utils.h>
 
 #include "dbus_bindings/org.chromium.WebServer.RequestHandler.h"
 #include "libwebserv/request.h"
@@ -33,22 +33,22 @@
 namespace {
 
 // Dummy callback for async D-Bus errors.
-void IgnoreDBusError(chromeos::Error* error) {}
+void IgnoreDBusError(brillo::Error* error) {}
 
 // Copies the data from |src_stream| to the destination stream represented
 // by a file descriptor |fd|.
-void WriteResponseData(chromeos::StreamPtr src_stream,
+void WriteResponseData(brillo::StreamPtr src_stream,
                        const dbus::FileDescriptor& fd) {
   int dupfd = dup(fd.value());
   auto dest_stream =
-      chromeos::FileStream::FromFileDescriptor(dupfd, true, nullptr);
+      brillo::FileStream::FromFileDescriptor(dupfd, true, nullptr);
   CHECK(dest_stream);
   // Dummy callbacks for success/error of data-copy operation. We ignore both
   // notifications here.
-  auto on_success = [](chromeos::StreamPtr, chromeos::StreamPtr, uint64_t) {};
-  auto on_error = [](chromeos::StreamPtr, chromeos::StreamPtr,
-                     const chromeos::Error*) {};
-  chromeos::stream_utils::CopyData(
+  auto on_success = [](brillo::StreamPtr, brillo::StreamPtr, uint64_t) {};
+  auto on_error = [](brillo::StreamPtr, brillo::StreamPtr,
+                     const brillo::Error*) {};
+  brillo::stream_utils::CopyData(
       std::move(src_stream), std::move(dest_stream), base::Bind(on_success),
       base::Bind(on_error));
 }
@@ -68,7 +68,7 @@
 
   // We need to get a copy of the map keys since removing the handlers will
   // modify the map in the middle of the loop and that's not a good thing.
-  auto handler_ids = chromeos::GetMapKeys(request_handlers_);
+  auto handler_ids = brillo::GetMapKeys(request_handlers_);
   for (int handler_id : handler_ids) {
     RemoveHandler(handler_id);
   }
@@ -92,8 +92,8 @@
   return protocols;
 }
 
-chromeos::Blob ProtocolHandler::GetCertificateFingerprint() const {
-  chromeos::Blob fingerprint;
+brillo::Blob ProtocolHandler::GetCertificateFingerprint() const {
+  brillo::Blob fingerprint;
   for (const auto& pair : proxies_) {
     fingerprint = pair.second->certificate_fingerprint();
     if (!fingerprint.empty())
@@ -190,7 +190,7 @@
   remote_handler_id_map_.emplace(remote_handler_id, handler_id);
 }
 
-void ProtocolHandler::AddHandlerError(int handler_id, chromeos::Error* error) {
+void ProtocolHandler::AddHandlerError(int handler_id, brillo::Error* error) {
   // Nothing to do at the moment.
 }
 
@@ -198,24 +198,24 @@
                                      const std::string& remote_handler_id,
                                      const std::string& request_id,
                                      std::unique_ptr<Request> request,
-                                     chromeos::ErrorPtr* error) {
+                                     brillo::ErrorPtr* error) {
   request_id_map_.emplace(request_id, protocol_handler_id);
   auto id_iter = remote_handler_id_map_.find(remote_handler_id);
   if (id_iter == remote_handler_id_map_.end()) {
-    chromeos::Error::AddToPrintf(error, FROM_HERE,
-                                 chromeos::errors::dbus::kDomain,
-                                 DBUS_ERROR_FAILED,
-                                 "Unknown request handler '%s'",
-                                 remote_handler_id.c_str());
+    brillo::Error::AddToPrintf(error, FROM_HERE,
+                               brillo::errors::dbus::kDomain,
+                               DBUS_ERROR_FAILED,
+                               "Unknown request handler '%s'",
+                               remote_handler_id.c_str());
     return false;
   }
   auto handler_iter = request_handlers_.find(id_iter->second);
   if (handler_iter == request_handlers_.end()) {
-    chromeos::Error::AddToPrintf(error, FROM_HERE,
-                                 chromeos::errors::dbus::kDomain,
-                                 DBUS_ERROR_FAILED,
-                                 "Handler # %d is no longer available",
-                                 id_iter->second);
+    brillo::Error::AddToPrintf(error, FROM_HERE,
+                               brillo::errors::dbus::kDomain,
+                               DBUS_ERROR_FAILED,
+                               "Handler # %d is no longer available",
+                               id_iter->second);
     return false;
   }
   handler_iter->second.handler->HandleRequest(
@@ -228,7 +228,7 @@
     const std::string& request_id,
     int status_code,
     const std::multimap<std::string, std::string>& headers,
-    chromeos::StreamPtr data_stream) {
+    brillo::StreamPtr data_stream) {
   ProtocolHandlerProxy* proxy = GetRequestProtocolHandlerProxy(request_id);
   if (!proxy)
     return;
@@ -250,8 +250,8 @@
 void ProtocolHandler::GetFileData(
     const std::string& request_id,
     int file_id,
-    const base::Callback<void(chromeos::StreamPtr)>& success_callback,
-    const base::Callback<void(chromeos::Error*)>& error_callback) {
+    const base::Callback<void(brillo::StreamPtr)>& success_callback,
+    const base::Callback<void(brillo::Error*)>& error_callback) {
   ProtocolHandlerProxy* proxy = GetRequestProtocolHandlerProxy(request_id);
   CHECK(proxy);
 
@@ -262,24 +262,24 @@
   // constant). So, here we move both callbacks to |Callbacks| structure and
   // use a shared pointer to it in both success and error callback wrappers.
   struct Callbacks {
-    base::Callback<void(chromeos::StreamPtr)> on_success;
-    base::Callback<void(chromeos::Error*)> on_error;
+    base::Callback<void(brillo::StreamPtr)> on_success;
+    base::Callback<void(brillo::Error*)> on_error;
   };
   auto callbacks = std::make_shared<Callbacks>();
   callbacks->on_success = success_callback;
   callbacks->on_error = error_callback;
 
   auto on_success = [callbacks](const dbus::FileDescriptor& fd) {
-    chromeos::ErrorPtr error;
+    brillo::ErrorPtr error;
     // Unfortunately there is no way to take ownership of the file descriptor
     // since |fd| is a const reference, so duplicate the descriptor.
     int dupfd = dup(fd.value());
-    auto stream = chromeos::FileStream::FromFileDescriptor(dupfd, true, &error);
+    auto stream = brillo::FileStream::FromFileDescriptor(dupfd, true, &error);
     if (!stream)
       return callbacks->on_error.Run(error.get());
     callbacks->on_success.Run(std::move(stream));
   };
-  auto on_error = [callbacks](chromeos::Error* error) {
+  auto on_error = [callbacks](brillo::Error* error) {
     callbacks->on_error.Run(error);
   };
 
diff --git a/libwebserv/protocol_handler.h b/libwebserv/protocol_handler.h
index 797c19a..ab4a749 100644
--- a/libwebserv/protocol_handler.h
+++ b/libwebserv/protocol_handler.h
@@ -24,9 +24,9 @@
 #include <base/callback_forward.h>
 #include <base/macros.h>
 #include <base/memory/weak_ptr.h>
-#include <chromeos/errors/error.h>
-#include <chromeos/secure_blob.h>
-#include <chromeos/streams/stream.h>
+#include <brillo/errors/error.h>
+#include <brillo/secure_blob.h>
+#include <brillo/streams/stream.h>
 #include <dbus/object_path.h>
 
 #include <libwebserv/export.h>
@@ -79,7 +79,7 @@
   // byte buffer if this handler does not serve the HTTPS protocol.
   // If the handler is not connected to the server, this will return an empty
   // array.
-  chromeos::Blob GetCertificateFingerprint() const;
+  brillo::Blob GetCertificateFingerprint() const;
 
   // Adds a request handler for given |url|. If the |url| ends with a '/', this
   // makes the handler respond to any URL beneath this path.
@@ -153,21 +153,21 @@
       ProtocolHandlerProxy* proxy,
       const std::string& remote_handler_id);
   LIBWEBSERV_PRIVATE void AddHandlerError(int handler_id,
-                                          chromeos::Error* error);
+                                          brillo::Error* error);
 
   // Called by Server when an incoming request is dispatched.
   LIBWEBSERV_PRIVATE bool ProcessRequest(const std::string& protocol_handler_id,
                                          const std::string& remote_handler_id,
                                          const std::string& request_id,
                                          std::unique_ptr<Request> request,
-                                         chromeos::ErrorPtr* error);
+                                         brillo::ErrorPtr* error);
 
   // Called by Response object to finish the request and send response data.
   LIBWEBSERV_PRIVATE void CompleteRequest(
       const std::string& request_id,
       int status_code,
       const std::multimap<std::string, std::string>& headers,
-      chromeos::StreamPtr data_stream);
+      brillo::StreamPtr data_stream);
 
   // Makes a call to the (remote) web server request handler over D-Bus to
   // obtain the file content of uploaded file (identified by |file_id|) during
@@ -175,8 +175,8 @@
   LIBWEBSERV_PRIVATE void GetFileData(
       const std::string& request_id,
       int file_id,
-      const base::Callback<void(chromeos::StreamPtr)>& success_callback,
-      const base::Callback<void(chromeos::Error*)>& error_callback);
+      const base::Callback<void(brillo::StreamPtr)>& success_callback,
+      const base::Callback<void(brillo::Error*)>& error_callback);
 
   // A helper method to obtain a corresponding protocol handler D-Bus proxy for
   // outstanding request with ID |request_id|.
diff --git a/libwebserv/request.cc b/libwebserv/request.cc
index 93b80c4..f0bdd79 100644
--- a/libwebserv/request.cc
+++ b/libwebserv/request.cc
@@ -15,8 +15,8 @@
 #include <libwebserv/request.h>
 
 #include <base/callback.h>
-#include <chromeos/http/http_utils.h>
-#include <chromeos/streams/file_stream.h>
+#include <brillo/http/http_utils.h>
+#include <brillo/streams/file_stream.h>
 
 #include <libwebserv/protocol_handler.h>
 
@@ -37,8 +37,8 @@
 }
 
 void FileInfo::GetData(
-    const base::Callback<void(chromeos::StreamPtr)>& success_callback,
-    const base::Callback<void(chromeos::Error*)>& error_callback) const {
+    const base::Callback<void(brillo::StreamPtr)>& success_callback,
+    const base::Callback<void(brillo::Error*)>& error_callback) const {
   handler_->GetFileData(request_id_,
                         file_id_,
                         success_callback,
@@ -54,8 +54,8 @@
 Request::~Request() {
 }
 
-chromeos::StreamPtr Request::GetDataStream() {
-  return chromeos::FileStream::FromFileDescriptor(
+brillo::StreamPtr Request::GetDataStream() {
+  return brillo::FileStream::FromFileDescriptor(
       raw_data_fd_.GetPlatformFile(), false, nullptr);
 }
 
@@ -138,7 +138,7 @@
 std::vector<std::string> Request::GetHeader(const std::string& name) const {
   std::vector<std::string> data;
   auto range =
-      headers_.equal_range(chromeos::http::GetCanonicalHeaderName(name));
+      headers_.equal_range(brillo::http::GetCanonicalHeaderName(name));
   while (range.first != range.second) {
     data.push_back(range.first->second);
     ++range.first;
@@ -147,7 +147,7 @@
 }
 
 std::string Request::GetFirstHeader(const std::string& name) const {
-  auto p = headers_.find(chromeos::http::GetCanonicalHeaderName(name));
+  auto p = headers_.find(brillo::http::GetCanonicalHeaderName(name));
   return (p != headers_.end()) ? p->second : std::string{};
 }
 
diff --git a/libwebserv/request.h b/libwebserv/request.h
index e655be6..63bea8e 100644
--- a/libwebserv/request.h
+++ b/libwebserv/request.h
@@ -25,8 +25,8 @@
 #include <base/files/file.h>
 #include <base/macros.h>
 #include <base/memory/ref_counted.h>
-#include <chromeos/errors/error.h>
-#include <chromeos/streams/stream.h>
+#include <brillo/errors/error.h>
+#include <brillo/streams/stream.h>
 #include <libwebserv/export.h>
 
 struct MHD_Connection;
@@ -45,8 +45,8 @@
   const std::string& GetContentType() const { return content_type_; }
   const std::string& GetTransferEncoding() const { return transfer_encoding_; }
   void GetData(
-      const base::Callback<void(chromeos::StreamPtr)>& success_callback,
-      const base::Callback<void(chromeos::Error*)>& error_callback) const;
+      const base::Callback<void(brillo::StreamPtr)>& success_callback,
+      const base::Callback<void(brillo::Error*)>& error_callback) const;
 
  private:
   friend class Server;
@@ -81,7 +81,7 @@
   // The stream returned is valid for as long as the Request object itself is
   // alive. Accessing the stream after the Request object is destroyed will lead
   // to an undefined behavior (will likely just crash).
-  chromeos::StreamPtr GetDataStream();
+  brillo::StreamPtr GetDataStream();
 
   // Returns the request path (e.g. "/path/document").
   const std::string& GetPath() const { return url_; }
diff --git a/libwebserv/request_utils.cc b/libwebserv/request_utils.cc
index 0c80a21..a7e1043 100644
--- a/libwebserv/request_utils.cc
+++ b/libwebserv/request_utils.cc
@@ -15,8 +15,8 @@
 #include <libwebserv/request_utils.h>
 
 #include <base/bind.h>
-#include <chromeos/streams/memory_stream.h>
-#include <chromeos/streams/stream_utils.h>
+#include <brillo/streams/memory_stream.h>
+#include <brillo/streams/stream_utils.h>
 #include <libwebserv/request.h>
 #include <libwebserv/response.h>
 
@@ -33,7 +33,7 @@
 };
 
 void OnCopySuccess(std::shared_ptr<RequestDataContainer> container,
-                   chromeos::StreamPtr in_stream, chromeos::StreamPtr out_stream,
+                   brillo::StreamPtr in_stream, brillo::StreamPtr out_stream,
                    uint64_t size_copied) {
   // Close/release the memory stream so we can work with underlying data buffer.
   out_stream->CloseBlocking(nullptr);
@@ -44,8 +44,8 @@
 }
 
 void OnCopyError(std::shared_ptr<RequestDataContainer> container,
-                 chromeos::StreamPtr in_stream, chromeos::StreamPtr out_stream,
-                 const chromeos::Error* error) {
+                 brillo::StreamPtr in_stream, brillo::StreamPtr out_stream,
+                 const brillo::Error* error) {
   container->error_callback.Run(std::move(container->request),
                                 std::move(container->response), error);
 }
@@ -59,14 +59,14 @@
   auto container = std::make_shared<RequestDataContainer>();
   auto in_stream = request->GetDataStream();
   auto out_stream =
-      chromeos::MemoryStream::CreateRef(&container->data, nullptr);
+      brillo::MemoryStream::CreateRef(&container->data, nullptr);
   container->request = std::move(request);
   container->response = std::move(response);
   container->success_callback = success_callback;
   container->error_callback = error_callback;
-  chromeos::stream_utils::CopyData(std::move(in_stream), std::move(out_stream),
-                                   base::Bind(&OnCopySuccess, container),
-                                   base::Bind(&OnCopyError, container));
+  brillo::stream_utils::CopyData(std::move(in_stream), std::move(out_stream),
+                                 base::Bind(&OnCopySuccess, container),
+                                 base::Bind(&OnCopyError, container));
 }
 
 }  // namespace libwebserv
diff --git a/libwebserv/request_utils.h b/libwebserv/request_utils.h
index c825c3c..390f1d5 100644
--- a/libwebserv/request_utils.h
+++ b/libwebserv/request_utils.h
@@ -19,7 +19,7 @@
 #include <vector>
 
 #include <base/callback_forward.h>
-#include <chromeos/errors/error.h>
+#include <brillo/errors/error.h>
 #include <libwebserv/export.h>
 
 namespace libwebserv {
@@ -35,7 +35,7 @@
 using GetRequestDataErrorCallback =
     base::Callback<void(std::unique_ptr<Request> request,
                         std::unique_ptr<Response> response,
-                        const chromeos::Error* error)>;
+                        const brillo::Error* error)>;
 
 // Reads the request data from |request| asynchronously and returns the data
 // by calling |success_callback|. If an error occurred, |error_callback| is
diff --git a/libwebserv/response.cc b/libwebserv/response.cc
index 9fc61d6..59dc51f 100644
--- a/libwebserv/response.cc
+++ b/libwebserv/response.cc
@@ -19,10 +19,10 @@
 #include <base/json/json_writer.h>
 #include <base/logging.h>
 #include <base/values.h>
-#include <chromeos/http/http_request.h>
-#include <chromeos/mime_utils.h>
-#include <chromeos/streams/memory_stream.h>
-#include <chromeos/strings/string_utils.h>
+#include <brillo/http/http_request.h>
+#include <brillo/mime_utils.h>
+#include <brillo/streams/memory_stream.h>
+#include <brillo/strings/string_utils.h>
 #include <libwebserv/protocol_handler.h>
 
 namespace libwebserv {
@@ -33,7 +33,7 @@
 
 Response::~Response() {
   if (!reply_sent_) {
-    ReplyWithError(chromeos::http::status_code::InternalServerError,
+    ReplyWithError(brillo::http::status_code::InternalServerError,
                    "Internal server error");
   }
 }
@@ -49,19 +49,19 @@
 }
 
 void Response::Reply(int status_code,
-                     chromeos::StreamPtr data_stream,
+                     brillo::StreamPtr data_stream,
                      const std::string& mime_type) {
   CHECK(data_stream);
   status_code_ = status_code;
   data_stream_ = std::move(data_stream);
-  AddHeader(chromeos::http::response_header::kContentType, mime_type);
+  AddHeader(brillo::http::response_header::kContentType, mime_type);
   SendResponse();
 }
 
 void Response::ReplyWithText(int status_code,
                              const std::string& text,
                              const std::string& mime_type) {
-  Reply(status_code, chromeos::MemoryStream::OpenCopyOf(text, nullptr),
+  Reply(status_code, brillo::MemoryStream::OpenCopyOf(text, nullptr),
         mime_type);
 }
 
@@ -69,9 +69,9 @@
   std::string text;
   base::JSONWriter::WriteWithOptions(
       *json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &text);
-  std::string mime_type = chromeos::mime::AppendParameter(
-      chromeos::mime::application::kJson,
-      chromeos::mime::parameters::kCharset,
+  std::string mime_type = brillo::mime::AppendParameter(
+      brillo::mime::application::kJson,
+      brillo::mime::parameters::kCharset,
       "utf-8");
   ReplyWithText(status_code, text, mime_type);
 }
@@ -86,18 +86,18 @@
 }
 
 void Response::Redirect(int status_code, const std::string& redirect_url) {
-  AddHeader(chromeos::http::response_header::kLocation, redirect_url);
+  AddHeader(brillo::http::response_header::kLocation, redirect_url);
   ReplyWithError(status_code, "");
 }
 
 void Response::ReplyWithError(int status_code, const std::string& error_text) {
   status_code_ = status_code;
-  data_stream_ = chromeos::MemoryStream::OpenCopyOf(error_text, nullptr);
+  data_stream_ = brillo::MemoryStream::OpenCopyOf(error_text, nullptr);
   SendResponse();
 }
 
 void Response::ReplyWithErrorNotFound() {
-  ReplyWithError(chromeos::http::status_code::NotFound, "Not Found");
+  ReplyWithError(brillo::http::status_code::NotFound, "Not Found");
 }
 
 void Response::SendResponse() {
diff --git a/libwebserv/response.h b/libwebserv/response.h
index 1919c09..fdd9cad 100644
--- a/libwebserv/response.h
+++ b/libwebserv/response.h
@@ -22,7 +22,7 @@
 #include <vector>
 
 #include <base/macros.h>
-#include <chromeos/streams/stream.h>
+#include <brillo/streams/stream.h>
 #include <libwebserv/export.h>
 
 namespace base {
@@ -48,7 +48,7 @@
 
   // Generic reply method for sending arbitrary binary data response.
   void Reply(int status_code,
-             chromeos::StreamPtr data_stream,
+             brillo::StreamPtr data_stream,
              const std::string& mime_type);
 
   // Reply with text body.
@@ -87,7 +87,7 @@
   ProtocolHandler* handler_{nullptr};
   std::string request_id_;
   int status_code_{0};
-  chromeos::StreamPtr data_stream_;
+  brillo::StreamPtr data_stream_;
   std::multimap<std::string, std::string> headers_;
   bool reply_sent_{false};
 
diff --git a/libwebserv/server.cc b/libwebserv/server.cc
index a15f7ab..5c42868 100644
--- a/libwebserv/server.cc
+++ b/libwebserv/server.cc
@@ -30,7 +30,7 @@
  public:
   explicit RequestHandler(Server* server) : server_{server} {}
   bool ProcessRequest(
-      chromeos::ErrorPtr* error,
+      brillo::ErrorPtr* error,
       const std::tuple<std::string, std::string, std::string, std::string,
                        std::string>& in_request_info,
       const std::vector<std::tuple<std::string, std::string>>& in_headers,
@@ -45,7 +45,7 @@
 };
 
 bool Server::RequestHandler::ProcessRequest(
-    chromeos::ErrorPtr* error,
+    brillo::ErrorPtr* error,
     const std::tuple<std::string, std::string, std::string, std::string,
                      std::string>& in_request_info,
     const std::vector<std::tuple<std::string, std::string>>& in_headers,
@@ -61,11 +61,11 @@
   ProtocolHandler* protocol_handler =
       server_->GetProtocolHandlerByID(protocol_handler_id);
   if (!protocol_handler) {
-    chromeos::Error::AddToPrintf(error, FROM_HERE,
-                                 chromeos::errors::dbus::kDomain,
-                                 DBUS_ERROR_FAILED,
-                                 "Unknown protocol handler '%s'",
-                                 protocol_handler_id.c_str());
+    brillo::Error::AddToPrintf(error, FROM_HERE,
+                               brillo::errors::dbus::kDomain,
+                               DBUS_ERROR_FAILED,
+                               "Unknown protocol handler '%s'",
+                               protocol_handler_id.c_str());
     return false;
   }
   std::unique_ptr<Request> request{new Request{protocol_handler, url, method}};
@@ -113,11 +113,11 @@
 void Server::Connect(
     const scoped_refptr<dbus::Bus>& bus,
     const std::string& service_name,
-    const chromeos::dbus_utils::AsyncEventSequencer::CompletionAction& cb,
+    const brillo::dbus_utils::AsyncEventSequencer::CompletionAction& cb,
     const base::Closure& on_server_online,
     const base::Closure& on_server_offline) {
   service_name_ = service_name;
-  dbus_object_.reset(new chromeos::dbus_utils::DBusObject{
+  dbus_object_.reset(new brillo::dbus_utils::DBusObject{
       nullptr, bus, dbus_adaptor_->GetObjectPath()});
   dbus_adaptor_->RegisterWithDBusObject(dbus_object_.get());
   dbus_object_->RegisterAsync(cb);
diff --git a/libwebserv/server.h b/libwebserv/server.h
index 70e5dcd..3f3f6be 100644
--- a/libwebserv/server.h
+++ b/libwebserv/server.h
@@ -21,8 +21,8 @@
 
 #include <base/macros.h>
 #include <dbus/bus.h>
-#include <chromeos/dbus/async_event_sequencer.h>
-#include <chromeos/dbus/dbus_object.h>
+#include <brillo/dbus/async_event_sequencer.h>
+#include <brillo/dbus/dbus_object.h>
 #include <libwebserv/export.h>
 #include <libwebserv/request_handler_interface.h>
 
@@ -59,7 +59,7 @@
   void Connect(
       const scoped_refptr<dbus::Bus>& bus,
       const std::string& service_name,
-      const chromeos::dbus_utils::AsyncEventSequencer::CompletionAction& cb,
+      const brillo::dbus_utils::AsyncEventSequencer::CompletionAction& cb,
       const base::Closure& on_server_online,
       const base::Closure& on_server_offline);
 
@@ -128,7 +128,7 @@
   std::unique_ptr<org::chromium::WebServer::RequestHandlerAdaptor>
       dbus_adaptor_;
   // D-Bus object to handler registration of RequestHandlerInterface.
-  std::unique_ptr<chromeos::dbus_utils::DBusObject> dbus_object_;
+  std::unique_ptr<brillo::dbus_utils::DBusObject> dbus_object_;
 
   // A mapping of protocol handler name to the associated object.
   std::map<std::string, std::unique_ptr<ProtocolHandler>>
diff --git a/webservd/config.cc b/webservd/config.cc
index 5cba6c5..f099049 100644
--- a/webservd/config.cc
+++ b/webservd/config.cc
@@ -18,7 +18,7 @@
 #include <base/json/json_reader.h>
 #include <base/logging.h>
 #include <base/values.h>
-#include <chromeos/errors/error_codes.h>
+#include <brillo/errors/error_codes.h>
 
 #include "webservd/error_codes.h"
 
@@ -57,22 +57,22 @@
 
 bool LoadHandlerConfig(const base::DictionaryValue* handler_value,
                        Config::ProtocolHandler* handler_config,
-                       chromeos::ErrorPtr* error) {
+                       brillo::ErrorPtr* error) {
   int port = 0;
   if (!handler_value->GetInteger(kPortKey, &port)) {
-    chromeos::Error::AddTo(error,
-                           FROM_HERE,
-                           webservd::errors::kDomain,
-                           webservd::errors::kInvalidConfig,
-                           "Port is missing");
+    brillo::Error::AddTo(error,
+                         FROM_HERE,
+                         webservd::errors::kDomain,
+                         webservd::errors::kInvalidConfig,
+                         "Port is missing");
     return false;
   }
   if (port < 1 || port > 0xFFFF) {
-    chromeos::Error::AddToPrintf(error,
-                                 FROM_HERE,
-                                 webservd::errors::kDomain,
-                                 webservd::errors::kInvalidConfig,
-                                 "Invalid port value: %d", port);
+    brillo::Error::AddToPrintf(error,
+                               FROM_HERE,
+                               webservd::errors::kDomain,
+                               webservd::errors::kInvalidConfig,
+                               "Invalid port value: %d", port);
     return false;
   }
   handler_config->port = port;
@@ -111,7 +111,7 @@
 
 bool LoadConfigFromString(const std::string& config_json,
                           Config* config,
-                          chromeos::ErrorPtr* error) {
+                          brillo::ErrorPtr* error) {
   std::string error_msg;
   std::unique_ptr<const base::Value> value{
       base::JSONReader::ReadAndReturnError(
@@ -119,21 +119,21 @@
           .release()};
 
   if (!value) {
-    chromeos::Error::AddToPrintf(error, FROM_HERE,
-                                 chromeos::errors::json::kDomain,
-                                 chromeos::errors::json::kParseError,
-                                 "Error parsing server configuration: %s",
-                                 error_msg.c_str());
+    brillo::Error::AddToPrintf(error, FROM_HERE,
+                               brillo::errors::json::kDomain,
+                               brillo::errors::json::kParseError,
+                               "Error parsing server configuration: %s",
+                               error_msg.c_str());
     return false;
   }
 
   const base::DictionaryValue* dict_value = nullptr;  // Owned by |value|
   if (!value->GetAsDictionary(&dict_value)) {
-    chromeos::Error::AddTo(error,
-                           FROM_HERE,
-                           chromeos::errors::json::kDomain,
-                           chromeos::errors::json::kObjectExpected,
-                           "JSON object is expected.");
+    brillo::Error::AddTo(error,
+                         FROM_HERE,
+                         brillo::errors::json::kDomain,
+                         brillo::errors::json::kObjectExpected,
+                         "JSON object is expected.");
     return false;
   }
 
@@ -145,18 +145,18 @@
     for (base::Value* handler_value : *protocol_handlers) {
       const base::DictionaryValue* handler_dict = nullptr;  // Owned by |value|
       if (!handler_value->GetAsDictionary(&handler_dict)) {
-        chromeos::Error::AddTo(
+        brillo::Error::AddTo(
             error,
             FROM_HERE,
-            chromeos::errors::json::kDomain,
-            chromeos::errors::json::kObjectExpected,
+            brillo::errors::json::kDomain,
+            brillo::errors::json::kObjectExpected,
             "Protocol handler definition must be a JSON object");
         return false;
       }
 
       std::string name;
       if (!handler_dict->GetString(kNameKey, &name)) {
-        chromeos::Error::AddTo(
+        brillo::Error::AddTo(
             error,
             FROM_HERE,
             errors::kDomain,
@@ -168,7 +168,7 @@
       Config::ProtocolHandler handler_config;
       handler_config.name = name;
       if (!LoadHandlerConfig(handler_dict, &handler_config, error)) {
-        chromeos::Error::AddToPrintf(
+        brillo::Error::AddToPrintf(
             error,
             FROM_HERE,
             errors::kDomain,
diff --git a/webservd/config.h b/webservd/config.h
index 91d7941..3dc7855 100644
--- a/webservd/config.h
+++ b/webservd/config.h
@@ -19,8 +19,8 @@
 #include <vector>
 
 #include <base/files/file_path.h>
-#include <chromeos/errors/error.h>
-#include <chromeos/secure_blob.h>
+#include <brillo/errors/error.h>
+#include <brillo/secure_blob.h>
 
 namespace webservd {
 
@@ -45,9 +45,9 @@
     // For HTTPS handlers, these specify the certificates/private keys used
     // during TLS handshake and communication session. For HTTP protocol
     // handlers these fields are not used and are empty.
-    chromeos::SecureBlob private_key;
-    chromeos::Blob certificate;
-    chromeos::Blob certificate_fingerprint;
+    brillo::SecureBlob private_key;
+    brillo::Blob certificate;
+    brillo::Blob certificate_fingerprint;
 
     // Custom socket created for protocol handlers that are bound to specific
     // network interfaces only. SO_BINDTODEVICE option on a socket does exactly
@@ -91,7 +91,7 @@
 // specifies the reason for the failure in |error| object.
 bool LoadConfigFromString(const std::string& config_json,
                           Config* config,
-                          chromeos::ErrorPtr* error);
+                          brillo::ErrorPtr* error);
 
 }  // namespace webservd
 
diff --git a/webservd/config_unittest.cc b/webservd/config_unittest.cc
index d5589f4..d519848 100644
--- a/webservd/config_unittest.cc
+++ b/webservd/config_unittest.cc
@@ -17,7 +17,7 @@
 #include <base/files/file_util.h>
 #include <base/files/scoped_temp_dir.h>
 #include <base/strings/string_util.h>
-#include <chromeos/errors/error_codes.h>
+#include <brillo/errors/error_codes.h>
 #include <gtest/gtest.h>
 
 #include "webservd/error_codes.h"
@@ -164,17 +164,17 @@
 }
 
 TEST(Config, ParseError_ProtocolHandlersNotDict) {
-  chromeos::ErrorPtr error;
+  brillo::ErrorPtr error;
   Config config;
   ASSERT_FALSE(LoadConfigFromString(kInvalidConfig_NotDict, &config, &error));
-  EXPECT_EQ(chromeos::errors::json::kDomain, error->GetDomain());
-  EXPECT_EQ(chromeos::errors::json::kObjectExpected, error->GetCode());
+  EXPECT_EQ(brillo::errors::json::kDomain, error->GetDomain());
+  EXPECT_EQ(brillo::errors::json::kObjectExpected, error->GetCode());
   EXPECT_EQ("Protocol handler definition must be a JSON object",
             error->GetMessage());
 }
 
 TEST(Config, ParseError_NoName) {
-  chromeos::ErrorPtr error;
+  brillo::ErrorPtr error;
   Config config;
   ASSERT_FALSE(LoadConfigFromString(kInvalidConfig_NoName, &config, &error));
   EXPECT_EQ(webservd::errors::kDomain, error->GetDomain());
@@ -184,7 +184,7 @@
 }
 
 TEST(Config, ParseError_NoPort) {
-  chromeos::ErrorPtr error;
+  brillo::ErrorPtr error;
   Config config;
   ASSERT_FALSE(LoadConfigFromString(kInvalidConfig_NoPort, &config, &error));
   EXPECT_EQ(webservd::errors::kDomain, error->GetDomain());
@@ -198,7 +198,7 @@
 }
 
 TEST(Config, ParseError_InvalidPort) {
-  chromeos::ErrorPtr error;
+  brillo::ErrorPtr error;
   Config config;
   ASSERT_FALSE(LoadConfigFromString(kInvalidConfig_InvalidPort, &config,
                &error));
diff --git a/webservd/dbus_protocol_handler.cc b/webservd/dbus_protocol_handler.cc
index 28549b2..2dc5d3e 100644
--- a/webservd/dbus_protocol_handler.cc
+++ b/webservd/dbus_protocol_handler.cc
@@ -15,17 +15,17 @@
 #include "webservd/dbus_protocol_handler.h"
 
 #include <base/bind.h>
-#include <chromeos/dbus/async_event_sequencer.h>
-#include <chromeos/dbus/exported_object_manager.h>
+#include <brillo/dbus/async_event_sequencer.h>
+#include <brillo/dbus/exported_object_manager.h>
 
 #include "webservd/dbus_request_handler.h"
 #include "webservd/protocol_handler.h"
 #include "webservd/request.h"
 #include "webservd/server.h"
 
-using chromeos::dbus_utils::AsyncEventSequencer;
-using chromeos::dbus_utils::DBusObject;
-using chromeos::dbus_utils::ExportedObjectManager;
+using brillo::dbus_utils::AsyncEventSequencer;
+using brillo::dbus_utils::DBusObject;
+using brillo::dbus_utils::ExportedObjectManager;
 
 namespace webservd {
 
@@ -96,17 +96,17 @@
 }
 
 bool DBusProtocolHandler::RemoveRequestHandler(
-    chromeos::ErrorPtr* error,
+    brillo::ErrorPtr* error,
     const std::string& in_handler_id) {
 
   auto p = handler_to_service_name_map_.find(in_handler_id);
   if (p == handler_to_service_name_map_.end()) {
-    chromeos::Error::AddToPrintf(error,
-                                 FROM_HERE,
-                                 chromeos::errors::dbus::kDomain,
-                                 DBUS_ERROR_FAILED,
-                                 "Handler with ID %s does not exist",
-                                 in_handler_id.c_str());
+    brillo::Error::AddToPrintf(error,
+                               FROM_HERE,
+                               brillo::errors::dbus::kDomain,
+                               DBUS_ERROR_FAILED,
+                               "Handler with ID %s does not exist",
+                               in_handler_id.c_str());
     return false;
   }
   std::string service_name = p->second;
@@ -143,7 +143,7 @@
 }
 
 bool DBusProtocolHandler::GetRequestFileData(
-    chromeos::ErrorPtr* error,
+    brillo::ErrorPtr* error,
     const std::string& in_request_id,
     int32_t in_file_id,
     dbus::FileDescriptor* out_contents) {
@@ -158,17 +158,17 @@
     return true;
   }
 
-  chromeos::Error::AddToPrintf(error,
-                               FROM_HERE,
-                               chromeos::errors::dbus::kDomain,
-                               DBUS_ERROR_FAILED,
-                               "File with ID %d does not exist",
-                               in_file_id);
+  brillo::Error::AddToPrintf(error,
+                             FROM_HERE,
+                             brillo::errors::dbus::kDomain,
+                             DBUS_ERROR_FAILED,
+                             "File with ID %d does not exist",
+                             in_file_id);
   return false;
 }
 
 bool DBusProtocolHandler::CompleteRequest(
-    chromeos::ErrorPtr* error,
+    brillo::ErrorPtr* error,
     const std::string& in_request_id,
     int32_t in_status_code,
     const std::vector<std::tuple<std::string, std::string>>& in_headers,
@@ -184,21 +184,21 @@
     out_response_stream->CheckValidity();
     return true;
   }
-  chromeos::Error::AddTo(error, FROM_HERE, chromeos::errors::dbus::kDomain,
-                         DBUS_ERROR_FAILED, "Response already received");
+  brillo::Error::AddTo(error, FROM_HERE, brillo::errors::dbus::kDomain,
+                       DBUS_ERROR_FAILED, "Response already received");
   return false;
 }
 
 Request* DBusProtocolHandler::GetRequest(const std::string& request_id,
-                                         chromeos::ErrorPtr* error) {
+                                         brillo::ErrorPtr* error) {
   Request* request = protocol_handler_->GetRequest(request_id);
   if (!request) {
-    chromeos::Error::AddToPrintf(error,
-                                 FROM_HERE,
-                                 chromeos::errors::dbus::kDomain,
-                                 DBUS_ERROR_FAILED,
-                                 "Unknown request ID: %s",
-                                 request_id.c_str());
+    brillo::Error::AddToPrintf(error,
+                               FROM_HERE,
+                               brillo::errors::dbus::kDomain,
+                               DBUS_ERROR_FAILED,
+                               "Unknown request ID: %s",
+                               request_id.c_str());
   }
   return request;
 }
diff --git a/webservd/dbus_protocol_handler.h b/webservd/dbus_protocol_handler.h
index 66af163..dc725ef 100644
--- a/webservd/dbus_protocol_handler.h
+++ b/webservd/dbus_protocol_handler.h
@@ -24,17 +24,17 @@
 
 #include <base/macros.h>
 #include <base/memory/weak_ptr.h>
-#include <chromeos/dbus/dbus_object.h>
+#include <brillo/dbus/dbus_object.h>
 #include <dbus/bus.h>
 
 #include "libwebserv/dbus-proxies.h"
 #include "dbus_bindings/org.chromium.WebServer.ProtocolHandler.h"
 
-namespace chromeos {
+namespace brillo {
 namespace dbus_utils {
 class ExportedObjectManager;
 }  // dbus_utils
-}  // chromeos
+}  // brillo
 
 namespace webservd {
 
@@ -47,17 +47,17 @@
     : public org::chromium::WebServer::ProtocolHandlerInterface {
  public:
   DBusProtocolHandler(
-      chromeos::dbus_utils::ExportedObjectManager* object_manager,
+      brillo::dbus_utils::ExportedObjectManager* object_manager,
       const dbus::ObjectPath& object_path,
       ProtocolHandler* protocol_handler,
       Server* server);
   ~DBusProtocolHandler();
 
   void RegisterAsync(
-      const chromeos::dbus_utils::AsyncEventSequencer::CompletionAction& cb);
+      const brillo::dbus_utils::AsyncEventSequencer::CompletionAction& cb);
 
   // Returns the instance of D-Bus exported object manager.
-  chromeos::dbus_utils::ExportedObjectManager* GetObjectManager() const;
+  brillo::dbus_utils::ExportedObjectManager* GetObjectManager() const;
 
   // Overrides from org::chromium::WebServer::DBusProtocolHandlerInterface.
   std::string AddRequestHandler(
@@ -65,16 +65,16 @@
       const std::string& in_method,
       const std::string& in_service_name) override;
 
-  bool RemoveRequestHandler(chromeos::ErrorPtr* error,
+  bool RemoveRequestHandler(brillo::ErrorPtr* error,
                             const std::string& in_request_handler_id) override;
 
-  bool GetRequestFileData(chromeos::ErrorPtr* error,
+  bool GetRequestFileData(brillo::ErrorPtr* error,
                           const std::string& in_request_id,
                           int32_t in_file_id,
                           dbus::FileDescriptor* out_contents) override;
 
   bool CompleteRequest(
-      chromeos::ErrorPtr* error,
+      brillo::ErrorPtr* error,
       const std::string& in_request_id,
       int32_t in_status_code,
       const std::vector<std::tuple<std::string, std::string>>& in_headers,
@@ -99,7 +99,7 @@
 
   // Looks up a request with |request_id|.
   // Returns nullptr and sets additional |error| information, if not found.
-  Request* GetRequest(const std::string& request_id, chromeos::ErrorPtr* error);
+  Request* GetRequest(const std::string& request_id, brillo::ErrorPtr* error);
 
   // Callback invoked when a client owning |service_name| is changed.
   void OnClientDisconnected(const std::string& service_name,
@@ -107,7 +107,7 @@
 
   // D-Bus object adaptor for ProtocolHandler D-Bus object.
   org::chromium::WebServer::ProtocolHandlerAdaptor dbus_adaptor_{this};
-  std::unique_ptr<chromeos::dbus_utils::DBusObject> dbus_object_;
+  std::unique_ptr<brillo::dbus_utils::DBusObject> dbus_object_;
 
   // Reference back to the real ProtocolHandler object.
   ProtocolHandler* protocol_handler_{nullptr};
diff --git a/webservd/dbus_request_handler.cc b/webservd/dbus_request_handler.cc
index 43b1d78..d6f8d21 100644
--- a/webservd/dbus_request_handler.cc
+++ b/webservd/dbus_request_handler.cc
@@ -18,8 +18,8 @@
 #include <vector>
 
 #include <base/bind.h>
-#include <chromeos/http/http_request.h>
-#include <chromeos/mime_utils.h>
+#include <brillo/http/http_request.h>
+#include <brillo/mime_utils.h>
 
 #include "libwebserv/dbus-proxies.h"
 #include "webservd/request.h"
@@ -31,13 +31,13 @@
 
 void OnError(Request* request,
              bool debug,
-             chromeos::Error* error) {
+             brillo::Error* error) {
   std::string error_msg{"Internal Server Error"};
   if (debug) {
     error_msg += "\r\n" + error->GetMessage();
   }
-  request->Complete(chromeos::http::status_code::InternalServerError, {},
-                    chromeos::mime::text::kPlain, error_msg);
+  request->Complete(brillo::http::status_code::InternalServerError, {},
+                    brillo::mime::text::kPlain, error_msg);
 }
 
 }  // anonymous namespace
diff --git a/webservd/fake_encryptor.cc b/webservd/fake_encryptor.cc
index 0dd7e9a..d5dd4db 100644
--- a/webservd/fake_encryptor.cc
+++ b/webservd/fake_encryptor.cc
@@ -14,7 +14,7 @@
 
 #include "webservd/encryptor.h"
 
-#include <chromeos/data_encoding.h>
+#include <brillo/data_encoding.h>
 
 namespace webservd {
 
@@ -24,13 +24,13 @@
  public:
   bool EncryptWithAuthentication(const std::string& plaintext,
                                  std::string* ciphertext) override {
-    *ciphertext = chromeos::data_encoding::Base64Encode(plaintext);
+    *ciphertext = brillo::data_encoding::Base64Encode(plaintext);
     return true;
   }
 
   bool DecryptWithAuthentication(const std::string& ciphertext,
                                  std::string* plaintext) override {
-    return chromeos::data_encoding::Base64Decode(ciphertext, plaintext);
+    return brillo::data_encoding::Base64Decode(ciphertext, plaintext);
   }
 };
 
diff --git a/webservd/firewall_interface.h b/webservd/firewall_interface.h
index bd333e2..68218bc 100644
--- a/webservd/firewall_interface.h
+++ b/webservd/firewall_interface.h
@@ -21,7 +21,7 @@
 
 #include <base/callback.h>
 #include <base/macros.h>
-#include <chromeos/dbus/dbus_object.h>
+#include <brillo/dbus/dbus_object.h>
 
 namespace webservd {
 
@@ -38,7 +38,7 @@
       uint16_t port,
       const std::string& interface_name,
       const base::Callback<void(bool)>& success_cb,
-      const base::Callback<void(chromeos::Error*)>& failure_cb) = 0;
+      const base::Callback<void(brillo::Error*)>& failure_cb) = 0;
 
  protected:
   FirewallInterface() = default;
diff --git a/webservd/firewalld_firewall.cc b/webservd/firewalld_firewall.cc
index 3691d4a..fe34418 100644
--- a/webservd/firewalld_firewall.cc
+++ b/webservd/firewalld_firewall.cc
@@ -33,7 +33,7 @@
     uint16_t port,
     const std::string& interface_name,
     const base::Callback<void(bool)>& success_cb,
-    const base::Callback<void(chromeos::Error*)>& failure_cb) {
+    const base::Callback<void(brillo::Error*)>& failure_cb) {
   proxy_->PunchTcpHoleAsync(port, interface_name, success_cb, failure_cb);
 }
 
diff --git a/webservd/firewalld_firewall.h b/webservd/firewalld_firewall.h
index 903beb5..49a139a 100644
--- a/webservd/firewalld_firewall.h
+++ b/webservd/firewalld_firewall.h
@@ -37,7 +37,7 @@
   void PunchTcpHoleAsync(
       uint16_t port, const std::string& interface_name,
       const base::Callback<void(bool)>& success_cb,
-      const base::Callback<void(chromeos::Error*)>& failure_cb) override;
+      const base::Callback<void(brillo::Error*)>& failure_cb) override;
 
  private:
   void OnFirewalldOnline(org::chromium::FirewalldProxy* proxy);
diff --git a/webservd/log_manager.cc b/webservd/log_manager.cc
index 861fb1e..2089e35 100644
--- a/webservd/log_manager.cc
+++ b/webservd/log_manager.cc
@@ -24,7 +24,7 @@
 #include <base/files/file_util.h>
 #include <base/lazy_instance.h>
 #include <base/strings/stringprintf.h>
-#include <chromeos/strings/string_utils.h>
+#include <brillo/strings/string_utils.h>
 
 namespace webservd {
 
@@ -143,7 +143,7 @@
   // Returns true if the file has been successfully renamed.
   bool ArchiveLogFile(const std::string& file_name) {
     char suffix = 'a';
-    auto pair = chromeos::string_utils::SplitAtFirst(file_name, ".");
+    auto pair = brillo::string_utils::SplitAtFirst(file_name, ".");
     // If we try all the suffixes from 'a' to 'z' and still can't find a name,
     // abandon this strategy and keep appending to the current file.
     while (suffix <= 'z') {
diff --git a/webservd/main.cc b/webservd/main.cc
index 0eb897c..92bb952 100644
--- a/webservd/main.cc
+++ b/webservd/main.cc
@@ -19,14 +19,14 @@
 
 #include <base/command_line.h>
 #include <base/files/file_util.h>
-#include <chromeos/dbus/async_event_sequencer.h>
-#include <chromeos/dbus/exported_object_manager.h>
-#include <chromeos/daemons/dbus_daemon.h>
-#include <chromeos/flag_helper.h>
+#include <brillo/dbus/async_event_sequencer.h>
+#include <brillo/dbus/exported_object_manager.h>
+#include <brillo/daemons/dbus_daemon.h>
+#include <brillo/flag_helper.h>
 #if !defined(__ANDROID__)
-#include <chromeos/minijail/minijail.h>
+#include <brillo/minijail/minijail.h>
 #endif  // !defined(__ANDROID__)
-#include <chromeos/syslog_logging.h>
+#include <brillo/syslog_logging.h>
 
 #include "webservd/config.h"
 #include "webservd/log_manager.h"
@@ -41,7 +41,7 @@
 using FirewallImpl = webservd::PermissionBrokerFirewall;
 #endif  // defined(__ANDROID__)
 
-using chromeos::dbus_utils::AsyncEventSequencer;
+using brillo::dbus_utils::AsyncEventSequencer;
 
 namespace {
 
@@ -51,7 +51,7 @@
 const char kWebServerUserName[] = "webservd";
 const char kWebServerGroupName[] = "webservd";
 
-class Daemon final : public chromeos::DBusServiceDaemon {
+class Daemon final : public brillo::DBusServiceDaemon {
  public:
   explicit Daemon(webservd::Config config)
       : DBusServiceDaemon{kServiceName, kRootServicePath},
@@ -87,7 +87,7 @@
   DEFINE_bool(debug, false,
               "return debug error information in web requests");
   DEFINE_bool(ipv6, true, "enable IPv6 support");
-  chromeos::FlagHelper::Init(argc, argv, "Brillo web server daemon");
+  brillo::FlagHelper::Init(argc, argv, "Brillo web server daemon");
 
   // From libmicrohttpd documentation, section 1.5 SIGPIPE:
   // ... portable code using MHD must install a SIGPIPE handler or explicitly
@@ -97,10 +97,10 @@
   // sockets/pipes correctly, so SIGPIPE is just a pest.
   signal(SIGPIPE, SIG_IGN);
 
-  int flags = chromeos::kLogToSyslog;
+  int flags = brillo::kLogToSyslog;
   if (FLAGS_log_to_stderr)
-    flags |= chromeos::kLogToStderr;
-  chromeos::InitLog(flags | chromeos::kLogHeader);
+    flags |= brillo::kLogToStderr;
+  brillo::InitLog(flags | brillo::kLogHeader);
 
   webservd::Config config;
   config.use_ipv6 = FLAGS_ipv6;
@@ -141,8 +141,8 @@
 #if !defined(__ANDROID__)
   // Drop privileges and use 'webservd' user. We need to do this after Daemon
   // object is constructed since it creates an instance of base::AtExitManager
-  // which is required for chromeos::Minijail::GetInstance() to work.
-  chromeos::Minijail* minijail_instance = chromeos::Minijail::GetInstance();
+  // which is required for brillo::Minijail::GetInstance() to work.
+  brillo::Minijail* minijail_instance = brillo::Minijail::GetInstance();
   minijail* jail = minijail_instance->New();
   minijail_instance->DropRoot(jail, kWebServerUserName, kWebServerGroupName);
   // Permissions needed for the daemon to allow it to bind to ports like TCP
diff --git a/webservd/permission_broker_firewall.cc b/webservd/permission_broker_firewall.cc
index 14570d4..a0ac929 100644
--- a/webservd/permission_broker_firewall.cc
+++ b/webservd/permission_broker_firewall.cc
@@ -50,7 +50,7 @@
     uint16_t port,
     const std::string& interface_name,
     const base::Callback<void(bool)>& success_cb,
-    const base::Callback<void(chromeos::Error*)>& failure_cb) {
+    const base::Callback<void(brillo::Error*)>& failure_cb) {
   dbus::FileDescriptor dbus_fd{lifeline_read_fd_};
   dbus_fd.CheckValidity();
   proxy_->RequestTcpPortAccessAsync(port, interface_name, dbus_fd, success_cb,
diff --git a/webservd/permission_broker_firewall.h b/webservd/permission_broker_firewall.h
index 41343c2..bb8f8df 100644
--- a/webservd/permission_broker_firewall.h
+++ b/webservd/permission_broker_firewall.h
@@ -37,7 +37,7 @@
   void PunchTcpHoleAsync(
       uint16_t port, const std::string& interface_name,
       const base::Callback<void(bool)>& success_cb,
-      const base::Callback<void(chromeos::Error*)>& failure_cb) override;
+      const base::Callback<void(brillo::Error*)>& failure_cb) override;
 
  private:
   void OnPermissionBrokerOnline(org::chromium::PermissionBrokerProxy* proxy);
diff --git a/webservd/protocol_handler.cc b/webservd/protocol_handler.cc
index 92b98a2..4ae3aef 100644
--- a/webservd/protocol_handler.cc
+++ b/webservd/protocol_handler.cc
@@ -242,8 +242,8 @@
 
   // libmicrohttpd expects both the key and certificate to be zero-terminated
   // strings. Make sure they are terminated properly.
-  chromeos::SecureBlob private_key_copy = config->private_key;
-  chromeos::Blob certificate_copy = config->certificate;
+  brillo::SecureBlob private_key_copy = config->private_key;
+  brillo::Blob certificate_copy = config->certificate;
   private_key_copy.push_back(0);
   certificate_copy.push_back(0);
 
diff --git a/webservd/protocol_handler.h b/webservd/protocol_handler.h
index db53739..2264449 100644
--- a/webservd/protocol_handler.h
+++ b/webservd/protocol_handler.h
@@ -23,7 +23,7 @@
 #include <base/macros.h>
 #include <base/memory/weak_ptr.h>
 #include <base/strings/string_piece.h>
-#include <chromeos/secure_blob.h>
+#include <brillo/secure_blob.h>
 
 #include "webservd/config.h"
 
@@ -72,7 +72,7 @@
 
   // Returns the SHA-256 fingerprint of the TLS certificate used for https
   // connection. Returns an empty byte array if this handler is serving http.
-  const chromeos::Blob& GetCertificateFingerprint() const {
+  const brillo::Blob& GetCertificateFingerprint() const {
     return certificate_fingerprint_;
   }
 
@@ -125,7 +125,7 @@
   // The protocol name ("http" or "https").
   std::string protocol_;
   // TLS certificate fingerprint (if any).
-  chromeos::Blob certificate_fingerprint_;
+  brillo::Blob certificate_fingerprint_;
   // File descriptor watchers for current active sockets.
   std::vector<std::unique_ptr<Watcher>> watchers_;
   // Set to true when a timer request is scheduled.
diff --git a/webservd/request.cc b/webservd/request.cc
index bfc6822..a3156c1 100644
--- a/webservd/request.cc
+++ b/webservd/request.cc
@@ -19,11 +19,11 @@
 #include <base/bind.h>
 #include <base/files/file.h>
 #include <base/guid.h>
-#include <chromeos/http/http_request.h>
-#include <chromeos/http/http_utils.h>
-#include <chromeos/mime_utils.h>
-#include <chromeos/streams/file_stream.h>
-#include <chromeos/strings/string_utils.h>
+#include <brillo/http/http_request.h>
+#include <brillo/http/http_utils.h>
+#include <brillo/mime_utils.h>
+#include <brillo/streams/file_stream.h>
+#include <brillo/strings/string_utils.h>
 #include "webservd/log_manager.h"
 #include "webservd/protocol_handler.h"
 #include "webservd/request_handler_interface.h"
@@ -59,7 +59,7 @@
     if (value)
       data = value;
     if (kind == MHD_HEADER_KIND) {
-      self->headers_.emplace_back(chromeos::http::GetCanonicalHeaderName(key),
+      self->headers_.emplace_back(brillo::http::GetCanonicalHeaderName(key),
                                   data);
     } else if (kind == MHD_COOKIE_KIND) {
       // TODO(avakulenko): add support for cookies...
@@ -102,7 +102,7 @@
   CHECK_EQ(0, pipe(pipe_fds));
   request_data_pipe_out_ = base::File{pipe_fds[0]};
   CHECK(request_data_pipe_out_.IsValid());
-  request_data_stream_ = chromeos::FileStream::FromFileDescriptor(
+  request_data_stream_ = brillo::FileStream::FromFileDescriptor(
       pipe_fds[1], true, nullptr);
   CHECK(request_data_stream_);
 
@@ -146,7 +146,7 @@
   CHECK_EQ(0, pipe(pipe_fds));
   file = base::File{pipe_fds[1]};
   CHECK(file.IsValid());
-  response_data_stream_ = chromeos::FileStream::FromFileDescriptor(
+  response_data_stream_ = brillo::FileStream::FromFileDescriptor(
       pipe_fds[0], true, nullptr);
   CHECK(response_data_stream_);
 
@@ -168,7 +168,7 @@
     const std::string& mime_type,
     const std::string& data) {
   std::vector<std::tuple<std::string, std::string>> headers_copy;
-  headers_copy.emplace_back(chromeos::http::response_header::kContentType,
+  headers_copy.emplace_back(brillo::http::response_header::kContentType,
                             mime_type);
   base::File file = Complete(status_code, headers_copy, data.size());
   bool success = false;
@@ -256,8 +256,8 @@
   } else {
     // There was no handler found when request was made, respond with
     // 404 Page Not Found.
-    Complete(chromeos::http::status_code::NotFound, {},
-             chromeos::mime::text::kPlain, "Not Found");
+    Complete(brillo::http::status_code::NotFound, {},
+             brillo::mime::text::kPlain, "Not Found");
   }
 }
 
@@ -305,7 +305,7 @@
   // Now, just monitor the pipe and figure out when we can resume sending data
   // over it.
   waiting_for_data_ = request_data_stream_->WaitForData(
-      chromeos::Stream::AccessMode::WRITE,
+      brillo::Stream::AccessMode::WRITE,
       base::Bind(&Request::OnPipeAvailable, weak_ptr_factory_.GetWeakPtr()),
       nullptr);
 
@@ -337,7 +337,7 @@
   MHD_suspend_connection(self->connection_);
 
   self->waiting_for_data_ = self->response_data_stream_->WaitForData(
-      chromeos::Stream::AccessMode::READ,
+      brillo::Stream::AccessMode::READ,
       base::Bind(&Request::OnPipeAvailable,
                  self->weak_ptr_factory_.GetWeakPtr()),
       nullptr);
@@ -349,7 +349,7 @@
   return 0;
 }
 
-void Request::OnPipeAvailable(chromeos::Stream::AccessMode mode) {
+void Request::OnPipeAvailable(brillo::Stream::AccessMode mode) {
   MHD_resume_connection(connection_);
   waiting_for_data_ = false;
   protocol_handler_->ScheduleWork();
@@ -366,9 +366,9 @@
         new FileInfo{key, filename, content_type ? content_type : "",
                      transfer_encoding ? transfer_encoding : ""}};
     file_info->temp_file_name = GetTempFileManager()->CreateTempFileName(id_);
-    file_info->data_stream = chromeos::FileStream::Open(
-        file_info->temp_file_name, chromeos::Stream::AccessMode::READ_WRITE,
-        chromeos::FileStream::Disposition::CREATE_ALWAYS, nullptr);
+    file_info->data_stream = brillo::FileStream::Open(
+        file_info->temp_file_name, brillo::Stream::AccessMode::READ_WRITE,
+        brillo::FileStream::Disposition::CREATE_ALWAYS, nullptr);
     if (!file_info->data_stream ||
         !file_info->data_stream->WriteAllBlocking(data, size, nullptr)) {
       return false;
diff --git a/webservd/request.h b/webservd/request.h
index b76fb73..d00fae8 100644
--- a/webservd/request.h
+++ b/webservd/request.h
@@ -25,7 +25,7 @@
 #include <base/files/file_path.h>
 #include <base/macros.h>
 #include <base/memory/weak_ptr.h>
-#include <chromeos/streams/stream.h>
+#include <brillo/streams/stream.h>
 
 struct MHD_Connection;
 struct MHD_PostProcessor;
@@ -56,7 +56,7 @@
   // was specified.
   std::string transfer_encoding;
   // The file content data.
-  chromeos::StreamPtr data_stream;
+  brillo::StreamPtr data_stream;
   // The temporary file containing the file part data.
   base::FilePath temp_file_name;
 
@@ -167,7 +167,7 @@
   bool AppendPostFieldData(const char* key, const char* data, size_t size);
 
   // Callback to be called when data can be written to the output pipe again.
-  void OnPipeAvailable(chromeos::Stream::AccessMode mode);
+  void OnPipeAvailable(brillo::Stream::AccessMode mode);
 
   // Forwards the request to the request handler.
   void ForwardRequestToHandler();
@@ -188,7 +188,7 @@
   // Data pipe for request body data (output/read end of the pipe).
   base::File request_data_pipe_out_;
   // Data stream for the input/write end of the request data pipe.
-  chromeos::StreamPtr request_data_stream_;
+  brillo::StreamPtr request_data_stream_;
 
   bool last_posted_data_was_file_{false};
   bool request_forwarded_{false};
@@ -206,7 +206,7 @@
   // Data size of response, -1 if unknown.
   int64_t response_data_size_{-1};
   // Data stream for the output/read end of the response data pipe.
-  chromeos::StreamPtr response_data_stream_;
+  brillo::StreamPtr response_data_stream_;
   std::vector<PairOfStrings> response_headers_;
   ProtocolHandler* protocol_handler_;
 
diff --git a/webservd/server.cc b/webservd/server.cc
index a8f62e1..77b9ba7 100644
--- a/webservd/server.cc
+++ b/webservd/server.cc
@@ -22,16 +22,16 @@
 #include <base/files/file_util.h>
 #include <base/rand_util.h>
 #include <base/strings/stringprintf.h>
-#include <chromeos/dbus/async_event_sequencer.h>
+#include <brillo/dbus/async_event_sequencer.h>
 
 #include "webservd/dbus_protocol_handler.h"
 #include "webservd/encryptor.h"
 #include "webservd/protocol_handler.h"
 #include "webservd/utils.h"
 
-using chromeos::dbus_utils::AsyncEventSequencer;
-using chromeos::dbus_utils::DBusObject;
-using chromeos::dbus_utils::ExportedObjectManager;
+using brillo::dbus_utils::AsyncEventSequencer;
+using brillo::dbus_utils::DBusObject;
+using brillo::dbus_utils::ExportedObjectManager;
 
 namespace {
 
@@ -55,18 +55,18 @@
   }
 }
 
-void IgnoreFirewallDBusMethodError(chromeos::Error* error) {
+void IgnoreFirewallDBusMethodError(brillo::Error* error) {
 }
 
-chromeos::SecureBlob LoadAndValidatePrivateKey(const base::FilePath& key_file,
-                                               webservd::Encryptor* encryptor) {
+brillo::SecureBlob LoadAndValidatePrivateKey(const base::FilePath& key_file,
+                                             webservd::Encryptor* encryptor) {
   std::string encrypted_key_data;
   if (!base::ReadFileToString(key_file, &encrypted_key_data))
     return {};
   std::string key_data;
   if (!encryptor->DecryptWithAuthentication(encrypted_key_data, &key_data))
     return {};
-  chromeos::SecureBlob key{key_data};
+  brillo::SecureBlob key{key_data};
   if (!webservd::ValidateRSAPrivateKey(key))
     key.clear();
   return key;
@@ -175,7 +175,7 @@
   const base::FilePath key_file{kKeyFile};
 
   auto cert = LoadAndValidateCertificate(certificate_file);
-  chromeos::SecureBlob private_key =
+  brillo::SecureBlob private_key =
       LoadAndValidatePrivateKey(key_file, encryptor_);
   if (!cert || private_key.empty()) {
     // Create the X509 certificate.
diff --git a/webservd/server.h b/webservd/server.h
index 78f30ae..443d230 100644
--- a/webservd/server.h
+++ b/webservd/server.h
@@ -22,9 +22,9 @@
 
 #include <base/macros.h>
 #include <base/memory/weak_ptr.h>
-#include <chromeos/dbus/dbus_object.h>
-#include <chromeos/dbus/exported_object_manager.h>
-#include <chromeos/secure_blob.h>
+#include <brillo/dbus/dbus_object.h>
+#include <brillo/dbus/exported_object_manager.h>
+#include <brillo/secure_blob.h>
 
 #include "dbus_bindings/org.chromium.WebServer.Server.h"
 #include "webservd/encryptor.h"
@@ -41,14 +41,14 @@
 class Server final : public org::chromium::WebServer::ServerInterface,
                      public ServerInterface {
  public:
-  Server(chromeos::dbus_utils::ExportedObjectManager* object_manager,
+  Server(brillo::dbus_utils::ExportedObjectManager* object_manager,
          const Config& config, std::unique_ptr<FirewallInterface> firewall);
   // Need to off-line the destructor to allow |protocol_handler_map_| to contain
   // a forward-declared pointer to DBusProtocolHandler.
   ~Server();
 
   void RegisterAsync(
-      const chromeos::dbus_utils::AsyncEventSequencer::CompletionAction& cb);
+      const brillo::dbus_utils::AsyncEventSequencer::CompletionAction& cb);
 
   // Overrides from org::chromium::WebServer::ServerInterface.
   std::string Ping() override;
@@ -74,15 +74,15 @@
   base::FilePath GetUploadDirectory() const;
 
   org::chromium::WebServer::ServerAdaptor dbus_adaptor_{this};
-  std::unique_ptr<chromeos::dbus_utils::DBusObject> dbus_object_;
+  std::unique_ptr<brillo::dbus_utils::DBusObject> dbus_object_;
   std::unique_ptr<Encryptor> default_encryptor_;
   Encryptor* encryptor_;
 
   Config config_;
   int last_protocol_handler_index_{0};
-  chromeos::Blob TLS_certificate_;
-  chromeos::Blob TLS_certificate_fingerprint_;
-  chromeos::SecureBlob TLS_private_key_;
+  brillo::Blob TLS_certificate_;
+  brillo::Blob TLS_certificate_fingerprint_;
+  brillo::SecureBlob TLS_private_key_;
 
   std::map<ProtocolHandler*,
            std::unique_ptr<DBusProtocolHandler>> protocol_handler_map_;
diff --git a/webservd/utils.cc b/webservd/utils.cc
index 6646be4..b93f28a 100644
--- a/webservd/utils.cc
+++ b/webservd/utils.cc
@@ -93,7 +93,7 @@
   return rsa_key_pair;
 }
 
-chromeos::SecureBlob StoreRSAPrivateKey(RSA* rsa_key_pair) {
+brillo::SecureBlob StoreRSAPrivateKey(RSA* rsa_key_pair) {
   auto bio =
       std::unique_ptr<BIO, void(*)(BIO*)>{BIO_new(BIO_s_mem()), BIO_vfree};
   CHECK(bio);
@@ -103,12 +103,12 @@
   size_t size = BIO_get_mem_data(bio.get(), reinterpret_cast<char**>(&buffer));
   CHECK_GT(size, 0u);
   CHECK(buffer);
-  chromeos::SecureBlob key_blob(buffer, buffer + size);
-  chromeos::SecureMemset(buffer, 0, size);
+  brillo::SecureBlob key_blob(buffer, buffer + size);
+  brillo::SecureMemset(buffer, 0, size);
   return key_blob;
 }
 
-bool ValidateRSAPrivateKey(const chromeos::SecureBlob& key) {
+bool ValidateRSAPrivateKey(const brillo::SecureBlob& key) {
   std::unique_ptr<BIO, void(*)(BIO*)> bio{
       BIO_new_mem_buf(const_cast<uint8_t*>(key.data()), key.size()), BIO_vfree};
   std::unique_ptr<RSA, void(*)(RSA*)> rsa_key{
@@ -117,7 +117,7 @@
   return rsa_key.get() != nullptr;
 }
 
-chromeos::Blob StoreCertificate(X509* cert) {
+brillo::Blob StoreCertificate(X509* cert) {
   auto bio =
       std::unique_ptr<BIO, void(*)(BIO*)>{BIO_new(BIO_s_mem()), BIO_vfree};
   CHECK(bio);
@@ -126,7 +126,7 @@
   size_t size = BIO_get_mem_data(bio.get(), reinterpret_cast<char**>(&buffer));
   CHECK_GT(size, 0u);
   CHECK(buffer);
-  return chromeos::Blob(buffer, buffer + size);
+  return brillo::Blob(buffer, buffer + size);
 }
 
 bool StoreCertificate(X509* cert, const base::FilePath& file) {
@@ -155,8 +155,8 @@
 }
 
 // Same as openssl x509 -fingerprint -sha256.
-chromeos::Blob GetSha256Fingerprint(X509* cert) {
-  chromeos::Blob fingerprint(256 / 8);
+brillo::Blob GetSha256Fingerprint(X509* cert) {
+  brillo::Blob fingerprint(256 / 8);
   uint32_t len = 0;
   CHECK(X509_digest(cert, EVP_sha256(), fingerprint.data(), &len));
   CHECK_EQ(len, fingerprint.size());
diff --git a/webservd/utils.h b/webservd/utils.h
index 08abaa5..7b5cd00 100644
--- a/webservd/utils.h
+++ b/webservd/utils.h
@@ -22,7 +22,7 @@
 
 #include <base/files/file_path.h>
 #include <base/time/time.h>
-#include <chromeos/secure_blob.h>
+#include <brillo/secure_blob.h>
 
 namespace webservd {
 
@@ -38,20 +38,20 @@
 
 // Serializes a private key from the key pair into a PEM string and returns
 // it as a binary blob.
-chromeos::SecureBlob StoreRSAPrivateKey(RSA* rsa_key_pair);
+brillo::SecureBlob StoreRSAPrivateKey(RSA* rsa_key_pair);
 
 // Checks if the buffer |key| contains a valid RSA private key.
-bool ValidateRSAPrivateKey(const chromeos::SecureBlob& key);
+bool ValidateRSAPrivateKey(const brillo::SecureBlob& key);
 
 // Serializes an X509 certificate using PEM format.
-chromeos::Blob StoreCertificate(X509* cert);
+brillo::Blob StoreCertificate(X509* cert);
 
 // Stores/loads an X509 certificate to/from a file (in PEM format).
 bool StoreCertificate(X509* cert, const base::FilePath& file);
 X509Ptr LoadAndValidateCertificate(const base::FilePath& file);
 
 // Same as openssl x509 -fingerprint -sha256.
-chromeos::Blob GetSha256Fingerprint(X509* cert);
+brillo::Blob GetSha256Fingerprint(X509* cert);
 
 // Creates a socket bound to a specified network interface.
 // Returns a socket file descriptor or -1 on error.