buffet: Remove 'chromeos' namespace and move everything to buffet NS

As discussed, moved all the classes out of chromeos namespace into
'buffet.

Also fixed a number of cpplint's warnings.

BUG=None
TEST=Everything still compiles and unit tests succeed.

Change-Id: Ide864acb2504627404966727f66d353af60e531d
Reviewed-on: https://chromium-review.googlesource.com/198971
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/buffet_client.cc b/buffet/buffet_client.cc
index 16bbbb2..cec73e1 100644
--- a/buffet/buffet_client.cc
+++ b/buffet/buffet_client.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <iostream>
+#include <iostream>  // NOLINT(readability/streams)
 #include <string>
 #include <sysexits.h>
 
@@ -130,7 +130,7 @@
     std::map<std::string, std::shared_ptr<base::Value>> params;
 
     if (!args.empty()) {
-      auto key_values = chromeos::data_encoding::WebParamsDecode(args.front());
+      auto key_values = buffet::data_encoding::WebParamsDecode(args.front());
       for (auto&& pair : key_values) {
         params.insert(std::make_pair(
           pair.first, std::shared_ptr<base::Value>(
diff --git a/buffet/data_encoding.cc b/buffet/data_encoding.cc
index 0049193..9f351de 100644
--- a/buffet/data_encoding.cc
+++ b/buffet/data_encoding.cc
@@ -23,16 +23,16 @@
   return dec;
 }
 
-} // namespace
+}  // namespace
 
 /////////////////////////////////////////////////////////////////////////
-namespace chromeos {
+namespace buffet {
 namespace data_encoding {
 
 std::string UrlEncode(const char* data, bool encodeSpaceAsPlus) {
   std::string result;
 
-  while(*data) {
+  while (*data) {
     char c = *data++;
     // According to RFC3986 (http://www.faqs.org/rfcs/rfc3986.html),
     // section 2.3. - Unreserved Characters
@@ -47,7 +47,8 @@
       // 'application/x-www-form-urlencoded'
       result += '+';
     } else {
-      base::StringAppendF(&result, "%%%02X", (unsigned char)c); // Encode as %NN
+      base::StringAppendF(&result, "%%%02X",
+                          static_cast<unsigned char>(c));  // Encode as %NN
     }
   }
   return result;
@@ -62,7 +63,7 @@
     // so it is safe to access data[0] and data[1] without overrunning the buf.
     if (c == '%' &&
         (part1 = HexToDec(data[0])) >= 0 && (part2 = HexToDec(data[1])) >= 0) {
-      c = char((part1 << 4) | part2);
+      c = static_cast<char>((part1 << 4) | part2);
       data += 2;
     } else if (c == '+') {
       c = ' ';
@@ -96,5 +97,5 @@
   return result;
 }
 
-} // namespace data_encoding
-} // namespace chromeos
+}  // namespace data_encoding
+}  // namespace buffet
diff --git a/buffet/data_encoding.h b/buffet/data_encoding.h
index b7223bd..e493e36 100644
--- a/buffet/data_encoding.h
+++ b/buffet/data_encoding.h
@@ -2,13 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef BUFFET_DATA_ENCODING__H_
-#define BUFFET_DATA_ENCODING__H_
+#ifndef BUFFET_DATA_ENCODING_H_
+#define BUFFET_DATA_ENCODING_H_
 
-#include <vector>
 #include <string>
+#include <utility>
+#include <vector>
 
-namespace chromeos {
+namespace buffet {
 namespace data_encoding {
 
 typedef std::vector<std::pair<std::string, std::string>> WebParamList;
@@ -39,7 +40,7 @@
 // content encoding.
 WebParamList WebParamsDecode(const std::string& data);
 
-} // namespace data_encoding
-} // namespace chromeos
+}  // namespace data_encoding
+}  // namespace buffet
 
-#endif // BUFFET_DATA_ENCODING__H_
+#endif  // BUFFET_DATA_ENCODING_H_
diff --git a/buffet/data_encoding_unittest.cc b/buffet/data_encoding_unittest.cc
index ae4894d..ed6295c 100644
--- a/buffet/data_encoding_unittest.cc
+++ b/buffet/data_encoding_unittest.cc
@@ -6,7 +6,7 @@
 
 #include <gtest/gtest.h>
 
-using namespace chromeos::data_encoding;
+using namespace buffet::data_encoding;  // NOLINT(build/namespaces)
 
 TEST(data_encoding, UrlEncoding) {
   std::string test = "\"http://sample/path/0014.html \"";
@@ -20,7 +20,6 @@
   EXPECT_EQ("%22http%3A%2F%2Fsample%2Fpath%2F0014.html%20%22",
             encoded);
   EXPECT_EQ(test, UrlDecode(encoded.c_str()));
-
 }
 
 TEST(data_encoding, WebParamsEncoding) {
diff --git a/buffet/dbus_utils.cc b/buffet/dbus_utils.cc
index 4924ef5..58f0b26 100644
--- a/buffet/dbus_utils.cc
+++ b/buffet/dbus_utils.cc
@@ -38,7 +38,7 @@
 }
 
 scoped_ptr<dbus::Response> GetDBusError(dbus::MethodCall* method_call,
-                                        const chromeos::Error* error) {
+                                        const Error* error) {
   std::string message;
   while (error) {
     // Format error string as "domain/code:message".
diff --git a/buffet/dbus_utils.h b/buffet/dbus_utils.h
index cc25844..6314531 100644
--- a/buffet/dbus_utils.h
+++ b/buffet/dbus_utils.h
@@ -21,7 +21,7 @@
                                            const std::string& message);
 
 scoped_ptr<dbus::Response> GetDBusError(dbus::MethodCall* method_call,
-                                        const chromeos::Error* error);
+                                        const Error* error);
 
 
 dbus::ExportedObject::MethodCallCallback GetExportableDBusMethod(
diff --git a/buffet/device_registration_info.cc b/buffet/device_registration_info.cc
index 6a7f813..4aab715 100644
--- a/buffet/device_registration_info.cc
+++ b/buffet/device_registration_info.cc
@@ -20,8 +20,6 @@
 #include "buffet/string_utils.h"
 #include "buffet/url_utils.h"
 
-using namespace chromeos;  // NOLINT(build/namespaces)
-
 const char buffet::kErrorDomainOAuth2[] = "oauth2";
 const char buffet::kErrorDomainGCD[] = "gcd";
 const char buffet::kErrorDomainGCDServer[] = "gcd_server";
@@ -66,27 +64,27 @@
 std::pair<std::string, std::string> BuildAuthHeader(
     const std::string& access_token_type,
     const std::string& access_token) {
-  std::string authorization = string_utils::Join(' ',
-                                                 access_token_type,
-                                                 access_token);
+  std::string authorization =
+      buffet::string_utils::Join(' ', access_token_type, access_token);
   // Linter doesn't like the ; after } on the following line...
-  return {http::request_header::kAuthorization, authorization};  // NOLINT
+  return {buffet::http::request_header::kAuthorization,
+          authorization};  // NOLINT
 }
 
 std::unique_ptr<base::DictionaryValue> ParseOAuthResponse(
-    const http::Response* response, ErrorPtr* error) {
+    const buffet::http::Response* response, buffet::ErrorPtr* error) {
   int code = 0;
-  auto resp = http::ParseJsonResponse(response, &code, error);
-  if (resp && code >= http::status_code::BadRequest) {
+  auto resp = buffet::http::ParseJsonResponse(response, &code, error);
+  if (resp && code >= buffet::http::status_code::BadRequest) {
     if (error) {
       std::string error_code, error_message;
       if (resp->GetString("error", &error_code) &&
           resp->GetString("error_description", &error_message)) {
-        Error::AddTo(error, buffet::kErrorDomainOAuth2, error_code,
-                     error_message);
+        buffet::Error::AddTo(error, buffet::kErrorDomainOAuth2, error_code,
+                             error_message);
       } else {
-        Error::AddTo(error, buffet::kErrorDomainOAuth2,
-                     "unexpected_response", "Unexpected OAuth error");
+        buffet::Error::AddTo(error, buffet::kErrorDomainOAuth2,
+                             "unexpected_response", "Unexpected OAuth error");
       }
     }
     return std::unique_ptr<base::DictionaryValue>();
@@ -94,12 +92,12 @@
   return resp;
 }
 
-inline void SetUnexpectedError(ErrorPtr* error) {
-  Error::AddTo(error, buffet::kErrorDomainGCD, "unexpected_response",
-               "Unexpected GCD error");
+inline void SetUnexpectedError(buffet::ErrorPtr* error) {
+  buffet::Error::AddTo(error, buffet::kErrorDomainGCD, "unexpected_response",
+                       "Unexpected GCD error");
 }
 
-void ParseGCDError(const base::DictionaryValue* json, ErrorPtr* error) {
+void ParseGCDError(const base::DictionaryValue* json, buffet::ErrorPtr* error) {
   if (!error)
     return;
 
@@ -122,8 +120,8 @@
     std::string error_code, error_message;
     if (error_object->GetString("reason", &error_code) &&
         error_object->GetString("message", &error_message)) {
-      Error::AddTo(error, buffet::kErrorDomainGCDServer,
-                    error_code, error_message);
+      buffet::Error::AddTo(error, buffet::kErrorDomainGCDServer,
+                           error_code, error_message);
     } else {
       SetUnexpectedError(error);
     }
@@ -132,9 +130,9 @@
 
 std::string BuildURL(const std::string& url,
                      const std::vector<std::string>& subpaths,
-                     const data_encoding::WebParamList& params) {
-  std::string result = url::CombineMultiple(url, subpaths);
-  return url::AppendQueryParams(result, params);
+                     const buffet::data_encoding::WebParamList& params) {
+  std::string result = buffet::url::CombineMultiple(url, subpaths);
+  return buffet::url::AppendQueryParams(result, params);
 }
 
 }  // anonymous namespace
diff --git a/buffet/device_registration_info.h b/buffet/device_registration_info.h
index 5b2b374..da0d409 100644
--- a/buffet/device_registration_info.h
+++ b/buffet/device_registration_info.h
@@ -38,7 +38,7 @@
   DeviceRegistrationInfo();
   // This constructor allows to pass in a custom HTTP transport
   // (mainly for testing).
-  DeviceRegistrationInfo(std::shared_ptr<chromeos::http::Transport> transport,
+  DeviceRegistrationInfo(std::shared_ptr<http::Transport> transport,
                          std::shared_ptr<StorageInterface> storage);
 
   // Returns the authorization HTTP header that can be used to talk
@@ -50,7 +50,7 @@
   // appended to the base URL which is normally
   //    https://www.googleapis.com/clouddevices/v1/".
   // If |params| are specified, each key-value pair is formatted using
-  // chromeos::data_encoding::WebParamsEncode() and appended to URL as a query
+  // data_encoding::WebParamsEncode() and appended to URL as a query
   // string.
   // So, calling:
   //    GetServiceURL("ticket", {{"key","apiKey"}})
@@ -58,34 +58,34 @@
   //    https://www.googleapis.com/clouddevices/v1/ticket?key=apiKey
   std::string GetServiceURL(
       const std::string& subpath = {},
-      const chromeos::data_encoding::WebParamList& params = {}) const;
+      const data_encoding::WebParamList& params = {}) const;
 
   // Returns a service URL to access the registered device on GCD server.
   // The base URL used to construct the full URL looks like this:
   //    https://www.googleapis.com/clouddevices/v1/devices/<device_id>/
   std::string GetDeviceURL(
     const std::string& subpath = {},
-    const chromeos::data_encoding::WebParamList& params = {}) const;
+    const data_encoding::WebParamList& params = {}) const;
 
   // Similar to GetServiceURL, GetOAuthURL() returns a URL of OAuth 2.0 server.
   // The base URL used is https://accounts.google.com/o/oauth2/.
   std::string GetOAuthURL(
     const std::string& subpath = {},
-    const chromeos::data_encoding::WebParamList& params = {}) const;
+    const data_encoding::WebParamList& params = {}) const;
 
   // Returns the registered device ID (GUID) or empty string if failed
-  std::string GetDeviceId(chromeos::ErrorPtr* error);
+  std::string GetDeviceId(ErrorPtr* error);
 
   // Loads the device registration information from cache.
   bool Load();
 
   // Checks for the valid device registration as well as refreshes
   // the device access token, if available.
-  bool CheckRegistration(chromeos::ErrorPtr* error);
+  bool CheckRegistration(ErrorPtr* error);
 
   // Gets the full device description JSON object, or nullptr if
   // the device is not registered or communication failure.
-  std::unique_ptr<base::Value> GetDeviceInfo(chromeos::ErrorPtr* error);
+  std::unique_ptr<base::Value> GetDeviceInfo(ErrorPtr* error);
 
   // Starts device registration procedure. |params| are a list of
   // key-value pairs of device information, such as client_id, client_secret,
@@ -93,21 +93,21 @@
   // is used when possible. Returns a device claim ID on success.
   std::string StartRegistration(
     const std::map<std::string, std::shared_ptr<base::Value>>& params,
-    chromeos::ErrorPtr* error);
+    ErrorPtr* error);
 
   // Finalizes the device registration. If |user_auth_code| is provided, then
   // the device record is populated with user email on user's behalf. Otherwise
   // the user is responsible to issue a PATCH request to provide a valid
   // email address before calling FinishRegistration.
   bool FinishRegistration(const std::string& user_auth_code,
-                          chromeos::ErrorPtr* error);
+                          ErrorPtr* error);
 
  private:
   // Saves the device registration to cache.
   bool Save() const;
 
   // Makes sure the access token is available and up-to-date.
-  bool ValidateAndRefreshAccessToken(chromeos::ErrorPtr* error);
+  bool ValidateAndRefreshAccessToken(ErrorPtr* error);
 
   // Persistent data. Some of default values for testing purposes are used.
   // TODO(avakulenko): remove these default values in the future.
@@ -133,7 +133,7 @@
   std::string display_name_ = "Coffee Pot";
 
   // HTTP transport used for communications.
-  std::shared_ptr<chromeos::http::Transport> transport_;
+  std::shared_ptr<http::Transport> transport_;
   // Serialization interface to save and load device registration info.
   std::shared_ptr<StorageInterface> storage_;
 
diff --git a/buffet/device_registration_info_unittest.cc b/buffet/device_registration_info_unittest.cc
index 5456ca0..5108e35 100644
--- a/buffet/device_registration_info_unittest.cc
+++ b/buffet/device_registration_info_unittest.cc
@@ -15,8 +15,7 @@
 #include "buffet/storage_impls.h"
 
 using namespace buffet;          // NOLINT(build/namespaces)
-using namespace chromeos;        // NOLINT(build/namespaces)
-using namespace chromeos::http;  // NOLINT(build/namespaces)
+using namespace buffet::http;    // NOLINT(build/namespaces)
 
 namespace {
 
diff --git a/buffet/error.cc b/buffet/error.cc
index b04bbb6..bccb9b8 100644
--- a/buffet/error.cc
+++ b/buffet/error.cc
@@ -6,8 +6,8 @@
 
 #include <base/logging.h>
 
-using chromeos::Error;
-using chromeos::ErrorPtr;
+using buffet::Error;
+using buffet::ErrorPtr;
 
 ErrorPtr Error::Create(const std::string& domain,
                        const std::string& code,
diff --git a/buffet/error.h b/buffet/error.h
index 97c48ee..2f5ba66 100644
--- a/buffet/error.h
+++ b/buffet/error.h
@@ -10,7 +10,7 @@
 
 #include <base/basictypes.h>
 
-namespace chromeos {
+namespace buffet {
 
 class Error;  // Forward declaration.
 
@@ -66,6 +66,6 @@
   DISALLOW_COPY_AND_ASSIGN(Error);
 };
 
-}  // namespace chromeos
+}  // namespace buffet
 
 #endif  // BUFFET_ERROR_H_
diff --git a/buffet/error_unittest.cc b/buffet/error_unittest.cc
index 3963315..cf943ad 100644
--- a/buffet/error_unittest.cc
+++ b/buffet/error_unittest.cc
@@ -7,15 +7,15 @@
 
 #include "buffet/error.h"
 
-using chromeos::Error;
+using buffet::Error;
 
 namespace {
 
-chromeos::ErrorPtr GenerateNetworkError() {
+buffet::ErrorPtr GenerateNetworkError() {
   return Error::Create("network", "not_found", "Resource not found");
 }
 
-chromeos::ErrorPtr GenerateHttpError() {
+buffet::ErrorPtr GenerateHttpError() {
   auto inner = GenerateNetworkError();
   return Error::Create("HTTP", "404", "Not found", std::move(inner));
 }
diff --git a/buffet/http_connection.h b/buffet/http_connection.h
index 5ddd2ac..ab67905 100644
--- a/buffet/http_connection.h
+++ b/buffet/http_connection.h
@@ -13,7 +13,7 @@
 #include "buffet/error.h"
 #include "buffet/http_transport.h"
 
-namespace chromeos {
+namespace buffet {
 namespace http {
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -79,6 +79,6 @@
 };
 
 }  // namespace http
-}  // namespace chromeos
+}  // namespace buffet
 
 #endif  // BUFFET_HTTP_CONNECTION_H_
diff --git a/buffet/http_connection_curl.cc b/buffet/http_connection_curl.cc
index 4e9ea94..0dae74c 100644
--- a/buffet/http_connection_curl.cc
+++ b/buffet/http_connection_curl.cc
@@ -10,7 +10,7 @@
 #include "buffet/http_transport_curl.h"
 #include "buffet/string_utils.h"
 
-namespace chromeos {
+namespace buffet {
 namespace http {
 namespace curl {
 
@@ -223,4 +223,4 @@
 
 }  // namespace curl
 }  // namespace http
-}  // namespace chromeos
+}  // namespace buffet
diff --git a/buffet/http_connection_curl.h b/buffet/http_connection_curl.h
index d588854..9a82e26 100644
--- a/buffet/http_connection_curl.h
+++ b/buffet/http_connection_curl.h
@@ -14,12 +14,12 @@
 
 #include "buffet/http_connection.h"
 
-namespace chromeos {
+namespace buffet {
 namespace http {
 namespace curl {
 
 // This is a libcurl-based implementation of http::Connection.
-class Connection : public chromeos::http::Connection {
+class Connection : public http::Connection {
  public:
   Connection(CURL* curl_handle, const std::string& method,
              std::shared_ptr<http::Transport> transport);
@@ -81,6 +81,6 @@
 
 }  // namespace curl
 }  // namespace http
-}  // namespace chromeos
+}  // namespace buffet
 
 #endif  // BUFFET_HTTP_CONNECTION_CURL_H_
diff --git a/buffet/http_connection_fake.cc b/buffet/http_connection_fake.cc
index 4372f0d..87fbf23 100644
--- a/buffet/http_connection_fake.cc
+++ b/buffet/http_connection_fake.cc
@@ -10,7 +10,7 @@
 #include "buffet/mime_utils.h"
 #include "buffet/string_utils.h"
 
-namespace chromeos {
+namespace buffet {
 namespace http {
 namespace fake {
 
@@ -91,4 +91,4 @@
 
 }  // namespace fake
 }  // namespace http
-}  // namespace chromeos
+}  // namespace buffet
diff --git a/buffet/http_connection_fake.h b/buffet/http_connection_fake.h
index b412d75..57bf016 100644
--- a/buffet/http_connection_fake.h
+++ b/buffet/http_connection_fake.h
@@ -14,12 +14,12 @@
 #include "buffet/http_connection.h"
 #include "buffet/http_transport_fake.h"
 
-namespace chromeos {
+namespace buffet {
 namespace http {
 namespace fake {
 
 // This is a fake implementation of http::Connection for unit testing.
-class Connection : public chromeos::http::Connection {
+class Connection : public http::Connection {
  public:
   Connection(const std::string& url, const std::string& method,
              std::shared_ptr<http::Transport> transport);
@@ -57,6 +57,6 @@
 
 }  // namespace fake
 }  // namespace http
-}  // namespace chromeos
+}  // namespace buffet
 
 #endif  // BUFFET_HTTP_CONNECTION_FAKE_H_
diff --git a/buffet/http_request.cc b/buffet/http_request.cc
index 05860c5..df09ca4 100644
--- a/buffet/http_request.cc
+++ b/buffet/http_request.cc
@@ -12,7 +12,7 @@
 #include "buffet/mime_utils.h"
 #include "buffet/string_utils.h"
 
-namespace chromeos {
+namespace buffet {
 namespace http {
 
 // request_type
@@ -184,7 +184,7 @@
 bool Request::SendRequestIfNeeded(ErrorPtr* error) {
   if (transport_) {
     if (!connection_) {
-      chromeos::http::HeaderList headers = MapToVector(headers_);
+      http::HeaderList headers = MapToVector(headers_);
       std::vector<std::string> ranges;
       if (method_ != request_type::kHead) {
         ranges.reserve(ranges_.size());
@@ -221,7 +221,7 @@
     if (connection_)
       return true;
   } else {
-    Error::AddTo(error, chromeos::http::curl::kErrorDomain,
+    Error::AddTo(error, http::curl::kErrorDomain,
                  "request_already_received", "HTTP response already received");
   }
   return false;
@@ -294,4 +294,4 @@
 }
 
 }  // namespace http
-}  // namespace chromeos
+}  // namespace buffet
diff --git a/buffet/http_request.h b/buffet/http_request.h
index fd84e7a..8aedc45 100644
--- a/buffet/http_request.h
+++ b/buffet/http_request.h
@@ -17,7 +17,7 @@
 #include "buffet/http_transport.h"
 #include "buffet/error.h"
 
-namespace chromeos {
+namespace buffet {
 namespace http {
 
 // HTTP request verbs
@@ -346,6 +346,6 @@
 };
 
 }  // namespace http
-}  // namespace chromeos
+}  // namespace buffet
 
 #endif  // BUFFET_HTTP_REQUEST_H_
diff --git a/buffet/http_transport.h b/buffet/http_transport.h
index e9ea581..e26ee77 100644
--- a/buffet/http_transport.h
+++ b/buffet/http_transport.h
@@ -14,7 +14,7 @@
 
 #include "buffet/error.h"
 
-namespace chromeos {
+namespace buffet {
 namespace http {
 
 typedef std::vector<std::pair<std::string, std::string>> HeaderList;
@@ -49,6 +49,6 @@
 };
 
 }  // namespace http
-}  // namespace chromeos
+}  // namespace buffet
 
 #endif  // BUFFET_HTTP_TRANSPORT_H_
diff --git a/buffet/http_transport_curl.cc b/buffet/http_transport_curl.cc
index c15baae..7ef914b 100644
--- a/buffet/http_transport_curl.cc
+++ b/buffet/http_transport_curl.cc
@@ -9,12 +9,11 @@
 #include "buffet/http_connection_curl.h"
 #include "buffet/http_request.h"
 
-using chromeos::http::curl::Transport;
-using chromeos::Error;
+namespace buffet {
+namespace http {
+namespace curl {
 
-namespace chromeos {
-
-const char http::curl::kErrorDomain[] = "http_transport";
+const char kErrorDomain[] = "http_transport";
 
 Transport::Transport() {
   VLOG(1) << "curl::Transport created";
@@ -77,4 +76,6 @@
   return connection;
 }
 
-}  // namespace chromeos
+}  // namespace curl
+}  // namespace http
+}  // namespace buffet
diff --git a/buffet/http_transport_curl.h b/buffet/http_transport_curl.h
index 5295794..ddb24ce 100644
--- a/buffet/http_transport_curl.h
+++ b/buffet/http_transport_curl.h
@@ -9,7 +9,7 @@
 
 #include "buffet/http_transport.h"
 
-namespace chromeos {
+namespace buffet {
 namespace http {
 namespace curl {
 
@@ -42,6 +42,6 @@
 
 }  // namespace curl
 }  // namespace http
-}  // namespace chromeos
+}  // namespace buffet
 
 #endif  // BUFFET_HTTP_TRANSPORT_CURL_H_
diff --git a/buffet/http_transport_fake.cc b/buffet/http_transport_fake.cc
index 782404a..0e7dfc5 100644
--- a/buffet/http_transport_fake.cc
+++ b/buffet/http_transport_fake.cc
@@ -16,7 +16,7 @@
 #include "buffet/mime_utils.h"
 #include "buffet/url_utils.h"
 
-namespace chromeos {
+namespace buffet {
 
 using http::fake::Transport;
 using http::fake::ServerRequestResponseBase;
@@ -257,4 +257,4 @@
   return std::string();
 }
 
-}  // namespace chromeos
+}  // namespace buffet
diff --git a/buffet/http_transport_fake.h b/buffet/http_transport_fake.h
index 590cc66..7905f3e 100644
--- a/buffet/http_transport_fake.h
+++ b/buffet/http_transport_fake.h
@@ -16,7 +16,7 @@
 #include "buffet/http_transport.h"
 #include "buffet/http_utils.h"
 
-namespace chromeos {
+namespace buffet {
 namespace http {
 namespace fake {
 
@@ -218,6 +218,6 @@
 
 }  // namespace fake
 }  // namespace http
-}  // namespace chromeos
+}  // namespace buffet
 
 #endif  // BUFFET_HTTP_TRANSPORT_FAKE_H_
diff --git a/buffet/http_utils.cc b/buffet/http_utils.cc
index 9aba6e5..f7f1190 100644
--- a/buffet/http_utils.cc
+++ b/buffet/http_utils.cc
@@ -13,7 +13,7 @@
 #include "buffet/mime_utils.h"
 #include "buffet/data_encoding.h"
 
-namespace chromeos {
+namespace buffet {
 namespace http {
 
 const char kErrorDomainJSON[] = "json_parser";
@@ -48,7 +48,7 @@
                                    std::shared_ptr<Transport> transport,
                                    ErrorPtr* error) {
   if (mime_type == nullptr) {
-    mime_type = chromeos::mime::application::kWwwFormUrlEncoded;
+    mime_type = mime::application::kWwwFormUrlEncoded;
   }
 
   return PostBinary(url, data, strlen(data), mime_type, headers, transport,
@@ -67,7 +67,7 @@
   request.AddHeaders(headers);
   if (data_size > 0) {
     if (mime_type == nullptr) {
-      mime_type = chromeos::mime::application::kOctet_stream;
+      mime_type = mime::application::kOctet_stream;
     }
     request.SetContentType(mime_type);
     if (!request.AddRequestBody(data, data_size, error))
@@ -90,9 +90,9 @@
                                        const HeaderList& headers,
                                        std::shared_ptr<Transport> transport,
                                        ErrorPtr* error) {
-  std::string encoded_data = chromeos::data_encoding::WebParamsEncode(data);
+  std::string encoded_data = data_encoding::WebParamsEncode(data);
   return PostBinary(url, encoded_data.c_str(), encoded_data.size(),
-                    chromeos::mime::application::kWwwFormUrlEncoded,
+                    mime::application::kWwwFormUrlEncoded,
                     headers, transport, error);
 }
 
@@ -164,4 +164,4 @@
 }
 
 }  // namespace http
-}  // namespace chromeos
+}  // namespace buffet
diff --git a/buffet/http_utils.h b/buffet/http_utils.h
index e44b378..20e255b 100644
--- a/buffet/http_utils.h
+++ b/buffet/http_utils.h
@@ -17,7 +17,7 @@
   class DictionaryValue;
 }  // namespace base
 
-namespace chromeos {
+namespace buffet {
 namespace http {
 
 extern const char kErrorDomainJSON[];
@@ -176,6 +176,6 @@
     const Response* response, int* status_code, ErrorPtr* error);
 
 }  // namespace http
-}  // namespace chromeos
+}  // namespace buffet
 
 #endif  // BUFFET_HTTP_UTILS_H_
diff --git a/buffet/http_utils_unittest.cc b/buffet/http_utils_unittest.cc
index 4a415d2..fc86d31 100644
--- a/buffet/http_utils_unittest.cc
+++ b/buffet/http_utils_unittest.cc
@@ -15,8 +15,8 @@
 #include "buffet/string_utils.h"
 #include "buffet/url_utils.h"
 
-using namespace chromeos;        // NOLINT(build/namespaces)
-using namespace chromeos::http;  // NOLINT(build/namespaces)
+using namespace buffet;        // NOLINT(build/namespaces)
+using namespace buffet::http;  // NOLINT(build/namespaces)
 
 static const char kFakeUrl[] = "http://localhost";
 static const char kEchoUrl[] = "http://localhost/echo";
diff --git a/buffet/manager.cc b/buffet/manager.cc
index 2195b83..09985b3 100644
--- a/buffet/manager.cc
+++ b/buffet/manager.cc
@@ -127,7 +127,7 @@
 
   LOG(INFO) << "Received call to Manager.CheckDeviceRegistered()";
 
-  chromeos::ErrorPtr error;
+  buffet::ErrorPtr error;
   bool registered = device_info_.CheckRegistration(&error);
   // If it fails due to any reason other than 'device not registered',
   // treat it as a real error and report it to the caller.
@@ -162,7 +162,7 @@
   LOG(INFO) << "Received call to Manager.GetDeviceInfo()";
 
   std::string device_info_str;
-  chromeos::ErrorPtr error;
+  buffet::ErrorPtr error;
   auto device_info = device_info_.GetDeviceInfo(&error);
   if (!device_info)
     return GetDBusError(method_call, error.get());
@@ -207,7 +207,7 @@
 
   LOG(INFO) << "Received call to Manager.StartRegisterDevice()";
 
-  chromeos::ErrorPtr error;
+  buffet::ErrorPtr error;
   std::string id = device_info_.StartRegistration(params, &error);
   if (id.empty())
     return GetDBusError(method_call, error.get());
@@ -238,7 +238,7 @@
   }
 
   LOG(INFO) << "Received call to Manager.FinishRegisterDevice()";
-  chromeos::ErrorPtr error;
+  buffet::ErrorPtr error;
   if (!device_info_.FinishRegistration(user_auth_code, &error))
     return GetDBusError(method_call, error.get());
 
diff --git a/buffet/map_utils.h b/buffet/map_utils.h
index c67fa3e..87d8d37 100644
--- a/buffet/map_utils.h
+++ b/buffet/map_utils.h
@@ -6,9 +6,10 @@
 #define BUFFET_MAP_UTILS_H_
 
 #include <map>
+#include <utility>
 #include <vector>
 
-namespace chromeos {
+namespace buffet {
 
 // Given an STL map returns a vector containing all keys from the map
 template<typename T>
@@ -41,6 +42,6 @@
   return vector;
 }
 
-} // namespace chromeos
+}  // namespace buffet
 
-#endif // BUFFET_MAP_UTILS_H_
+#endif  // BUFFET_MAP_UTILS_H_
diff --git a/buffet/mime_utils.cc b/buffet/mime_utils.cc
index c35d3c0..ca221dc 100644
--- a/buffet/mime_utils.cc
+++ b/buffet/mime_utils.cc
@@ -9,11 +9,11 @@
 
 #include "buffet/string_utils.h"
 
-using namespace chromeos;
+namespace buffet {
 
-//***************************************************************************
-//******************************* MIME types ********************************
-//***************************************************************************
+// ***************************************************************************
+// ******************************* MIME types ********************************
+// ***************************************************************************
 const char mime::types::kApplication[]             = "application";
 const char mime::types::kAudio[]                   = "audio";
 const char mime::types::kImage[]                   = "image";
@@ -39,9 +39,9 @@
 const char mime::application::kWwwFormUrlEncoded[] =
     "application/x-www-form-urlencoded";
 
-//***************************************************************************
-//**************************** Utility Functions ****************************
-//***************************************************************************
+// ***************************************************************************
+// **************************** Utility Functions ****************************
+// ***************************************************************************
 static std::string EncodeParam(const std::string& param) {
   // If the string contains one of "tspecials" characters as
   // specified in RFC 1521, enclose it in quotes.
@@ -58,9 +58,9 @@
   return param;
 }
 
-//***************************************************************************
-//******************** Main MIME manipulation functions *********************
-//***************************************************************************
+// ***************************************************************************
+// ******************** Main MIME manipulation functions *********************
+// ***************************************************************************
 
 bool mime::Split(const std::string& mime_string,
                  std::string* type, std::string* subtype,
@@ -72,7 +72,7 @@
   if (!mime::Split(parts.front(), type, subtype))
     return false;
 
-  if(parameters) {
+  if (parameters) {
     parameters->clear();
     parameters->reserve(parts.size() - 1);
     for (size_t i = 1; i < parts.size(); i++) {
@@ -89,10 +89,10 @@
   std::string mime = mime::RemoveParameters(mime_string);
   auto types = string_utils::SplitAtFirst(mime, '/');
 
-  if(type)
+  if (type)
     *type = types.first;
 
-  if(subtype)
+  if (subtype)
     *subtype = types.second;
 
   return !types.first.empty() && !types.second.empty();
@@ -146,9 +146,11 @@
 std::string mime::GetParameterValue(const std::string& mime_string,
                                     const std::string& paramName) {
   mime::Parameters params = mime::GetParameters(mime_string);
-  for(auto&& pair : params) {
+  for (auto&& pair : params) {
     if (base::strcasecmp(pair.first.c_str(), paramName.c_str()) == 0)
       return pair.second;
   }
   return std::string();
 }
+
+}  // namespace buffet
diff --git a/buffet/mime_utils.h b/buffet/mime_utils.h
index 44f65c8..999b677 100644
--- a/buffet/mime_utils.h
+++ b/buffet/mime_utils.h
@@ -5,51 +5,53 @@
 #ifndef BUFFET_MIME_UTILS_H_
 #define BUFFET_MIME_UTILS_H_
 
-#include <base/basictypes.h>
 #include <string>
+#include <utility>
 #include <vector>
 
-namespace chromeos {
+#include <base/basictypes.h>
+
+namespace buffet {
 
 namespace mime {
 
 namespace types {
   // Main MIME type categories
-  extern const char kApplication[];       // application
-  extern const char kAudio[];             // audio
-  extern const char kImage[];             // image
-  extern const char kMessage[];           // message
-  extern const char kMultipart[];         // multipart
-  extern const char kText[];              // test
-  extern const char kVideo[];             // video
+  extern const char kApplication[];        // application
+  extern const char kAudio[];              // audio
+  extern const char kImage[];              // image
+  extern const char kMessage[];            // message
+  extern const char kMultipart[];          // multipart
+  extern const char kText[];               // test
+  extern const char kVideo[];              // video
 }
 
 namespace parameters {
   // Common MIME parameters
-  extern const char kCharset[];           // charset=...
+  extern const char kCharset[];            // charset=...
 }
 
 namespace image {
   // Common image MIME types
-  extern const char kJpeg[];              // image/jpeg
-  extern const char kPng[];               // image/png
-  extern const char kBmp[];               // image/bmp
-  extern const char kTiff[];              // image/tiff
-  extern const char kGif[];               // image/gif
+  extern const char kJpeg[];               // image/jpeg
+  extern const char kPng[];                // image/png
+  extern const char kBmp[];                // image/bmp
+  extern const char kTiff[];               // image/tiff
+  extern const char kGif[];                // image/gif
 }
 
 namespace text {
   // Common text MIME types
-  extern const char kPlain[];             // text/plain
-  extern const char kHtml[];              // text/html
-  extern const char kXml[];               // text/xml
+  extern const char kPlain[];              // text/plain
+  extern const char kHtml[];               // text/html
+  extern const char kXml[];                // text/xml
 }
 
 namespace application {
   // Common application MIME types
-  extern const char kOctet_stream[];      // application/octet-stream
-  extern const char kJson[];              // application/json
-  extern const char kWwwFormUrlEncoded[]; // application/x-www-form-urlencoded
+  extern const char kOctet_stream[];       // application/octet-stream
+  extern const char kJson[];               // application/json
+  extern const char kWwwFormUrlEncoded[];  // application/x-www-form-urlencoded
 }
 
 typedef std::vector<std::pair<std::string, std::string>> Parameters;
@@ -97,7 +99,7 @@
 std::string GetParameterValue(const std::string& mime_string,
                               const std::string& paramName);
 
-} // namespace mime
-} // namespace chromeos
+}  // namespace mime
+}  // namespace buffet
 
-#endif // BUFFET_MIME_UTILS_H_
+#endif  // BUFFET_MIME_UTILS_H_
diff --git a/buffet/mime_utils_unittest.cc b/buffet/mime_utils_unittest.cc
index 893976a..a705dfa 100644
--- a/buffet/mime_utils_unittest.cc
+++ b/buffet/mime_utils_unittest.cc
@@ -6,7 +6,7 @@
 
 #include <gtest/gtest.h>
 
-using namespace chromeos;
+using namespace buffet;  // NOLINT(build/namespaces)
 
 TEST(MimeUtils, Combine) {
   std::string mime_string = mime::Combine(mime::types::kText, "xml");
diff --git a/buffet/string_utils.cc b/buffet/string_utils.cc
index c5d06eb..e122355 100644
--- a/buffet/string_utils.cc
+++ b/buffet/string_utils.cc
@@ -6,9 +6,11 @@
 
 #include <algorithm>
 #include <string.h>
+#include <utility>
+
 #include <base/strings/string_util.h>
 
-namespace chromeos {
+namespace buffet {
 namespace string_utils {
 
 std::vector<std::string> Split(const std::string& str,
@@ -33,7 +35,8 @@
   }
 
   if (trim_whitespaces) {
-    std::for_each(tokens.begin(), tokens.end(), [](std::string& str) {
+    std::for_each(tokens.begin(), tokens.end(),
+                  [](std::string& str) {  // NOLINT(runtime/references)
       TrimWhitespaceASCII(str, TRIM_ALL, &str); });
   }
 
@@ -83,5 +86,5 @@
   return str1 + delimiter + str2;
 }
 
-} // namespace string_utils
-} // namespace chromeos
+}  // namespace string_utils
+}  // namespace buffet
diff --git a/buffet/string_utils.h b/buffet/string_utils.h
index 3fad204..95da72d 100644
--- a/buffet/string_utils.h
+++ b/buffet/string_utils.h
@@ -6,9 +6,10 @@
 #define BUFFET_STRING_UTILS_H_
 
 #include <string>
+#include <utility>
 #include <vector>
 
-namespace chromeos {
+namespace buffet {
 namespace string_utils {
 
 // Treats the string as a delimited list of substrings and returns the array
@@ -35,7 +36,7 @@
 std::string Join(const std::string& delimiter,
                  const std::string& str1, const std::string& str2);
 
-} // namespace string_utils
-} // namespace chromeos
+}  // namespace string_utils
+}  // namespace buffet
 
-#endif // BUFFET_STRING_UTILS_H_
+#endif  // BUFFET_STRING_UTILS_H_
diff --git a/buffet/string_utils_unittest.cc b/buffet/string_utils_unittest.cc
index 23bcef1..4a021f4 100644
--- a/buffet/string_utils_unittest.cc
+++ b/buffet/string_utils_unittest.cc
@@ -6,7 +6,7 @@
 
 #include <gtest/gtest.h>
 
-using namespace chromeos;
+using namespace buffet;  // NOLINT(build/namespaces)
 
 TEST(StringUtils, Split) {
   std::vector<std::string> parts;
diff --git a/buffet/url_utils.cc b/buffet/url_utils.cc
index aea0d9d..0395094 100644
--- a/buffet/url_utils.cc
+++ b/buffet/url_utils.cc
@@ -17,7 +17,7 @@
 // Here:
 //    http://server.com/path/to/object - is the URL of the object,
 //    ?k=v&foo=bar                     - URL query string
-//    #fragment                        - URL framgment string
+//    #fragment                        - URL fragment string
 // If |exclude_fragment| is true, the function returns the start character and
 // the length of the query string alone. If it is false, the query string length
 // will include both the query string and the fragment.
@@ -50,7 +50,9 @@
 }
 }  // anonymous namespace
 
-std::string chromeos::url::TrimOffQueryString(std::string* url) {
+namespace buffet {
+
+std::string url::TrimOffQueryString(std::string* url) {
   size_t query_pos;
   if (!GetQueryStringPos(*url, false, &query_pos, nullptr))
     return std::string();
@@ -59,12 +61,12 @@
   return query_string;
 }
 
-std::string chromeos::url::Combine(
+std::string url::Combine(
     const std::string& url, const std::string& subpath) {
   return CombineMultiple(url, {subpath});
 }
 
-std::string chromeos::url::CombineMultiple(
+std::string url::CombineMultiple(
     const std::string& url, const std::vector<std::string>& parts) {
   std::string result = url;
   if (!parts.empty()) {
@@ -83,7 +85,7 @@
   return result;
 }
 
-std::string chromeos::url::GetQueryString(
+std::string url::GetQueryString(
     const std::string& url, bool remove_fragment) {
   std::string query_string;
   size_t query_pos, query_len;
@@ -93,22 +95,22 @@
   return query_string;
 }
 
-chromeos::data_encoding::WebParamList chromeos::url::GetQueryStringParameters(
+data_encoding::WebParamList url::GetQueryStringParameters(
     const std::string& url) {
   // Extract the query string and remove the leading '?'.
   std::string query_string = GetQueryString(url, true);
   if (!query_string.empty() && query_string.front() == '?')
     query_string.erase(query_string.begin());
-  return chromeos::data_encoding::WebParamsDecode(query_string);
+  return data_encoding::WebParamsDecode(query_string);
 }
 
-std::string chromeos::url::GetQueryStringValue(
+std::string url::GetQueryStringValue(
     const std::string& url, const std::string& name) {
   return GetQueryStringValue(GetQueryStringParameters(url), name);
 }
 
-std::string chromeos::url::GetQueryStringValue(
-    const chromeos::data_encoding::WebParamList& params,
+std::string url::GetQueryStringValue(
+    const data_encoding::WebParamList& params,
     const std::string& name) {
   for (auto&& pair : params) {
     if (name.compare(pair.first) == 0)
@@ -117,7 +119,7 @@
   return std::string();
 }
 
-std::string chromeos::url::RemoveQueryString(
+std::string url::RemoveQueryString(
     const std::string& url, bool remove_fragment_too) {
   size_t query_pos, query_len;
   if (!GetQueryStringPos(url, !remove_fragment_too, &query_pos, &query_len))
@@ -130,14 +132,14 @@
   return result;
 }
 
-std::string chromeos::url::AppendQueryParam(
+std::string url::AppendQueryParam(
     const std::string& url, const std::string& name, const std::string& value) {
   return AppendQueryParams(url, {{name, value}});
 }
 
-std::string chromeos::url::AppendQueryParams(
+std::string url::AppendQueryParams(
     const std::string& url,
-    const chromeos::data_encoding::WebParamList& params) {
+    const data_encoding::WebParamList& params) {
   if (params.empty())
     return url;
   size_t query_pos, query_len;
@@ -149,16 +151,17 @@
   } else if (query_len > 1) {
     result += '&';
   }
-  result += chromeos::data_encoding::WebParamsEncode(params);
+  result += data_encoding::WebParamsEncode(params);
   if (fragment_pos < url.size()) {
     result += url.substr(fragment_pos);
   }
   return result;
 }
 
-bool chromeos::url::HasQueryString(const std::string& url) {
+bool url::HasQueryString(const std::string& url) {
   size_t query_pos, query_len;
   GetQueryStringPos(url, true, &query_pos, &query_len);
   return (query_len > 0);
 }
 
+}  // namespace buffet
diff --git a/buffet/url_utils.h b/buffet/url_utils.h
index f08cf45..d9bce25 100644
--- a/buffet/url_utils.h
+++ b/buffet/url_utils.h
@@ -5,12 +5,14 @@
 #ifndef BUFFET_URL_UTILS_H_
 #define BUFFET_URL_UTILS_H_
 
-#include <base/basictypes.h>
 #include <string>
 #include <vector>
+
+#include <base/basictypes.h>
+
 #include "buffet/data_encoding.h"
 
-namespace chromeos {
+namespace buffet {
 
 namespace url {
 
@@ -23,7 +25,7 @@
     const std::vector<std::string>& parts) WARN_UNUSED_RESULT;
 
 // Removes the query string/fragment from |url| and returns the query string.
-// This method actiually modifies |url|. So, if you call it on this:
+// This method actually modifies |url|. So, if you call it on this:
 //    http://www.test.org/?foo=bar
 // it will modify |url| to "http://www.test.org/" and return "?foo=bar"
 std::string TrimOffQueryString(std::string* url);
@@ -34,7 +36,7 @@
 // Here:
 //    http://server.com/path/to/object - is the URL of the object,
 //    ?k=v&foo=bar                     - URL query string
-//    #fragment                        - URL framgment string
+//    #fragment                        - URL fragment string
 // If |remove_fragment| is true, the function returns the query string without
 // the fragment. Otherwise the fragment is included as part of the result.
 std::string GetQueryString(const std::string& url, bool remove_fragment);
@@ -69,7 +71,7 @@
 // Checks if the URL has query parameters.
 bool HasQueryString(const std::string& url);
 
-} // namespace url
-} // namespace chromeos
+}  // namespace url
+}  // namespace buffet
 
-#endif // BUFFET_URL_UTILS_H_
+#endif  // BUFFET_URL_UTILS_H_
diff --git a/buffet/url_utils_unittest.cc b/buffet/url_utils_unittest.cc
index 3407d60..7f4826d 100644
--- a/buffet/url_utils_unittest.cc
+++ b/buffet/url_utils_unittest.cc
@@ -6,7 +6,7 @@
 
 #include <gtest/gtest.h>
 
-using namespace chromeos;
+using namespace buffet;  // NOLINT(build/namespaces)
 
 TEST(UrlUtils, Combine) {
   EXPECT_EQ("http://sample.org/path",