Move component updater artifacts into component_updater namespace.

sky@ please look at the files in chrome/browser for owner approval.

Long term, the idea is to unify several updaters in Chrome, so having a specific namespace could help avoiding name conflicts.

Short term, the change reduces some naming verbosity in the implementation but makes the call site names longer, so it is a wash.

Review URL: https://codereview.chromium.org/138553004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245596 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/component_updater/component_patcher.cc b/chrome/browser/component_updater/component_patcher.cc
index de082a7..1170dd5 100644
--- a/chrome/browser/component_updater/component_patcher.cc
+++ b/chrome/browser/component_updater/component_patcher.cc
@@ -13,6 +13,8 @@
 #include "chrome/browser/component_updater/component_patcher_operation.h"
 #include "chrome/browser/component_updater/component_updater_service.h"
 
+namespace component_updater {
+
 namespace {
 
 // Deserialize the commands file (present in delta update packages). The top
@@ -79,3 +81,5 @@
   return ComponentUnpacker::kNone;
 }
 
+}  // namespace component_updater
+
diff --git a/chrome/browser/component_updater/component_patcher.h b/chrome/browser/component_updater/component_patcher.h
index 1990922..d972d188 100644
--- a/chrome/browser/component_updater/component_patcher.h
+++ b/chrome/browser/component_updater/component_patcher.h
@@ -36,6 +36,8 @@
 class FilePath;
 }
 
+namespace component_updater {
+
 class ComponentInstaller;
 
 // Applies a delta patch to a single file. Specifically, creates a file at
@@ -83,4 +85,6 @@
     ComponentInstaller* installer,
     int* error);
 
+}  // namespace component_updater
+
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_H_
diff --git a/chrome/browser/component_updater/component_patcher_operation.cc b/chrome/browser/component_updater/component_patcher_operation.cc
index 3f81440..9880f42 100644
--- a/chrome/browser/component_updater/component_patcher_operation.cc
+++ b/chrome/browser/component_updater/component_patcher_operation.cc
@@ -24,6 +24,8 @@
 
 using crypto::SecureHash;
 
+namespace component_updater {
+
 namespace {
 
 const char kInput[] = "input";
@@ -220,3 +222,5 @@
                         error);
 }
 
+}  // namespace component_updater
+
diff --git a/chrome/browser/component_updater/component_patcher_operation.h b/chrome/browser/component_updater/component_patcher_operation.h
index 6e9fe5be..42b289d 100644
--- a/chrome/browser/component_updater/component_patcher_operation.h
+++ b/chrome/browser/component_updater/component_patcher_operation.h
@@ -11,12 +11,12 @@
 #include "chrome/browser/component_updater/component_unpacker.h"
 
 namespace base {
-
 class FilePath;
 class DictionaryValue;
-
 }  // namespace base
 
+namespace component_updater {
+
 class ComponentInstaller;
 class ComponentPatcher;
 
@@ -155,4 +155,6 @@
 // Factory function to create DeltaUpdateOp instances.
 DeltaUpdateOp* CreateDeltaUpdateOp(base::DictionaryValue* command);
 
+}  // namespace component_updater
+
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_OPERATION_H_
diff --git a/chrome/browser/component_updater/component_patcher_win.cc b/chrome/browser/component_updater/component_patcher_win.cc
index 20160b0..f4d5ac2 100644
--- a/chrome/browser/component_updater/component_patcher_win.cc
+++ b/chrome/browser/component_updater/component_patcher_win.cc
@@ -16,6 +16,8 @@
 #include "base/win/scoped_handle.h"
 #include "chrome/installer/util/util_constants.h"
 
+namespace component_updater {
+
 namespace {
 
 std::string PatchTypeToCommandLineSwitch(
@@ -112,3 +114,5 @@
                   ComponentUnpacker::kNone;
 }
 
+}  // namespace component_updater
+
diff --git a/chrome/browser/component_updater/component_patcher_win.h b/chrome/browser/component_updater/component_patcher_win.h
index d87ba54..b50aa891 100644
--- a/chrome/browser/component_updater/component_patcher_win.h
+++ b/chrome/browser/component_updater/component_patcher_win.h
@@ -9,6 +9,8 @@
 #include "base/compiler_specific.h"
 #include "chrome/browser/component_updater/component_patcher.h"
 
+namespace component_updater {
+
 class ComponentPatcherWin : public ComponentPatcher {
  public:
   ComponentPatcherWin() {}
@@ -21,4 +23,6 @@
   DISALLOW_COPY_AND_ASSIGN(ComponentPatcherWin);
 };
 
+}  // namespace component_updater
+
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_WIN_H_
diff --git a/chrome/browser/component_updater/component_unpacker.cc b/chrome/browser/component_updater/component_unpacker.cc
index ba9f658..dc9bddb 100644
--- a/chrome/browser/component_updater/component_unpacker.cc
+++ b/chrome/browser/component_updater/component_unpacker.cc
@@ -24,6 +24,8 @@
 
 using crypto::SecureHash;
 
+namespace component_updater {
+
 namespace {
 
 // This class makes sure that the CRX digital signature is valid
@@ -208,3 +210,6 @@
   if (!unpack_path_.empty())
     base::DeleteFile(unpack_path_, true);
 }
+
+}  // namespace component_updater
+
diff --git a/chrome/browser/component_updater/component_unpacker.h b/chrome/browser/component_updater/component_unpacker.h
index 903b495..c4dd8995 100644
--- a/chrome/browser/component_updater/component_unpacker.h
+++ b/chrome/browser/component_updater/component_unpacker.h
@@ -7,11 +7,14 @@
 
 #include <string>
 #include <vector>
+
 #include "base/basictypes.h"
 #include "base/files/file_path.h"
 #include "base/json/json_file_value_serializer.h"
 #include "base/memory/scoped_ptr.h"
 
+namespace component_updater {
+
 class ComponentInstaller;
 class ComponentPatcher;
 
@@ -77,4 +80,6 @@
   int extended_error_;  // Provides additional error information.
 };
 
+}  // namespace component_updater
+
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UNPACKER_H_
diff --git a/chrome/browser/component_updater/component_updater_configurator.cc b/chrome/browser/component_updater/component_updater_configurator.cc
index c7be37d6..5afda5a 100644
--- a/chrome/browser/component_updater/component_updater_configurator.cc
+++ b/chrome/browser/component_updater/component_updater_configurator.cc
@@ -21,6 +21,8 @@
 #include "chrome/browser/component_updater/component_patcher_win.h"
 #endif
 
+namespace component_updater {
+
 namespace {
 
 // Default time constants.
@@ -220,3 +222,6 @@
     const CommandLine* cmdline, net::URLRequestContextGetter* context_getter) {
   return new ChromeConfigurator(cmdline, context_getter);
 }
+
+}  // namespace component_updater
+
diff --git a/chrome/browser/component_updater/component_updater_configurator.h b/chrome/browser/component_updater/component_updater_configurator.h
index cfb77fc..8e59d1f2 100644
--- a/chrome/browser/component_updater/component_updater_configurator.h
+++ b/chrome/browser/component_updater/component_updater_configurator.h
@@ -10,13 +10,15 @@
 class CommandLine;
 
 namespace net {
-
 class URLRequestContextGetter;
+}
 
-} // namespace
+namespace component_updater {
 
 ComponentUpdateService::Configurator* MakeChromeComponentUpdaterConfigurator(
     const CommandLine* cmdline, net::URLRequestContextGetter* context_getter);
 
+}  // namespace component_updater
+
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_CONFIGURATOR_H_
 
diff --git a/chrome/browser/component_updater/component_updater_ping_manager.cc b/chrome/browser/component_updater/component_updater_ping_manager.cc
index f825c34..fb5cf30 100644
--- a/chrome/browser/component_updater/component_updater_ping_manager.cc
+++ b/chrome/browser/component_updater/component_updater_ping_manager.cc
@@ -184,7 +184,7 @@
 // Sends a fire and forget ping when the updates are complete. The ping
 // sender object self-deletes after sending the ping.
 void PingManager::OnUpdateComplete(const CrxUpdateItem* item) {
-  component_updater::PingSender* ping_sender(new PingSender);
+  PingSender* ping_sender(new PingSender);
   ping_sender->SendPing(ping_url_, url_request_context_getter_, item);
 }
 
diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc
index 690d91f..de0b90a5 100644
--- a/chrome/browser/component_updater/component_updater_service.cc
+++ b/chrome/browser/component_updater/component_updater_service.cc
@@ -36,8 +36,7 @@
 
 using content::BrowserThread;
 
-using component_updater::CrxDownloader;
-using component_updater::CrxUpdateItem;
+namespace component_updater {
 
 // The component updater is designed to live until process shutdown, so
 // base::Bind() calls are not refcounted.
@@ -54,7 +53,7 @@
 // and the configuration allows it.
 bool CanTryDiffUpdate(const CrxUpdateItem* update_item,
                       const ComponentUpdateService::Configurator& config) {
-  return component_updater::HasDiffUpdate(update_item) &&
+  return HasDiffUpdate(update_item) &&
          !update_item->diff_update_failed &&
          config.DeltasEnabled();
 }
@@ -195,12 +194,10 @@
     kStepDelayLong,
   };
 
-  void UpdateCheckComplete(
-      int error,
-      const std::string& error_message,
-      const component_updater::UpdateResponse::Results& results);
-  void OnUpdateCheckSucceeded(
-      const component_updater::UpdateResponse::Results& results);
+  void UpdateCheckComplete(int error,
+                           const std::string& error_message,
+                           const UpdateResponse::Results& results);
+  void OnUpdateCheckSucceeded(const UpdateResponse::Results& results);
   void OnUpdateCheckFailed(int error, const std::string& error_message);
 
   void DownloadComplete(
@@ -250,11 +247,11 @@
 
   scoped_ptr<ComponentPatcher> component_patcher_;
 
-  scoped_ptr<component_updater::UpdateChecker> update_checker_;
+  scoped_ptr<UpdateChecker> update_checker_;
 
-  scoped_ptr<component_updater::PingManager> ping_manager_;
+  scoped_ptr<PingManager> ping_manager_;
 
-  scoped_ptr<component_updater::CrxDownloader> crx_downloader_;
+  scoped_ptr<CrxDownloader> crx_downloader_;
 
   // A collection of every work item.
   typedef std::vector<CrxUpdateItem*> UpdateItems;
@@ -276,9 +273,8 @@
 CrxUpdateService::CrxUpdateService(ComponentUpdateService::Configurator* config)
     : config_(config),
       component_patcher_(config->CreateComponentPatcher()),
-      ping_manager_(new component_updater::PingManager(
-          config->PingUrl(),
-          config->RequestContext())),
+      ping_manager_(new PingManager(config->PingUrl(),
+                                    config->RequestContext())),
       blocking_task_runner_(BrowserThread::GetBlockingPool()->
           GetSequencedTaskRunnerWithShutdownBehavior(
               BrowserThread::GetBlockingPool()->GetSequenceToken(),
@@ -466,7 +462,7 @@
       !component.installer)
     return kError;
 
-  std::string id(component_updater::GetCrxComponentID(component));
+  std::string id(GetCrxComponentID(component));
   CrxUpdateItem* uit = FindUpdateItemById(id);
   if (uit) {
     uit->component = component;
@@ -545,7 +541,7 @@
        it != work_items_.end(); ++it) {
     const CrxUpdateItem* item = *it;
     CrxComponentInfo info;
-    info.id = component_updater::GetCrxComponentID(item->component);
+    info.id = GetCrxComponentID(item->component);
     info.version = item->component.version.GetString();
     info.name = item->component.name;
     components->push_back(info);
@@ -626,7 +622,7 @@
   if (items_to_check.empty())
     return false;
 
-  update_checker_ = component_updater::UpdateChecker::Create(
+  update_checker_ = UpdateChecker::Create(
       config_->UpdateUrl(),
       config_->RequestContext(),
       base::Bind(&CrxUpdateService::UpdateCheckComplete,
@@ -667,7 +663,7 @@
 void CrxUpdateService::UpdateCheckComplete(
     int error,
     const std::string& error_message,
-    const component_updater::UpdateResponse::Results& results) {
+    const UpdateResponse::Results& results) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
   update_checker_.reset();
   if (!error)
@@ -682,10 +678,10 @@
 // One of these components will be drafted for the upgrade next time
 // ProcessPendingItems is called.
 void CrxUpdateService::OnUpdateCheckSucceeded(
-    const component_updater::UpdateResponse::Results& results) {
+    const UpdateResponse::Results& results) {
   size_t num_updates_pending = 0;
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-  std::vector<component_updater::UpdateResponse::Result>::const_iterator it;
+  std::vector<UpdateResponse::Result>::const_iterator it;
   for (it = results.list.begin(); it != results.list.end(); ++it) {
     CrxUpdateItem* crx = FindUpdateItemById(it->extension_id);
     if (!crx)
@@ -725,8 +721,7 @@
     // Parse the members of the result and queue an upgrade for this component.
     crx->next_version = Version(it->manifest.version);
 
-    typedef component_updater::
-        UpdateResponse::Result::Manifest::Package Package;
+    typedef UpdateResponse::Result::Manifest::Package Package;
     const Package& package(it->manifest.packages[0]);
     crx->next_fp = package.fingerprint;
 
@@ -842,7 +837,7 @@
                              context->fingerprint,
                              component_patcher_.get(),
                              context->installer);
-  if (!component_updater::DeleteFileAndEmptyParentDirectory(crx_path))
+  if (!DeleteFileAndEmptyParentDirectory(crx_path))
     NOTREACHED() << crx_path.value();
 
   // Why unretained? See comment at top of file.
@@ -988,3 +983,5 @@
   return new CrxUpdateService(config);
 }
 
+}  // namespace component_updater
+
diff --git a/chrome/browser/component_updater/component_updater_service.h b/chrome/browser/component_updater/component_updater_service.h
index 0176386..551167d 100644
--- a/chrome/browser/component_updater/component_updater_service.h
+++ b/chrome/browser/component_updater/component_updater_service.h
@@ -11,6 +11,8 @@
 #include "base/version.h"
 #include "url/gurl.h"
 
+class ComponentsUI;
+
 namespace base {
 class DictionaryValue;
 class FilePath;
@@ -29,6 +31,8 @@
 class ResourceThrottle;
 }
 
+namespace component_updater {
+
 class ComponentPatcher;
 
 // Component specific installers must derive from this class and implement
@@ -205,8 +209,8 @@
 
   virtual ~ComponentUpdateService() {}
 
-  friend class ComponentsUI;
-  friend class component_updater::OnDemandTester;
+  friend class ::ComponentsUI;
+  friend class OnDemandTester;
 
  private:
   // Ask the component updater to do an update check for a previously
@@ -223,4 +227,6 @@
 ComponentUpdateService* ComponentUpdateServiceFactory(
     ComponentUpdateService::Configurator* config);
 
+}  // namespace component_updater
+
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_
diff --git a/chrome/browser/component_updater/component_updater_utils.cc b/chrome/browser/component_updater/component_updater_utils.cc
index 8dbbd26..efd6d3c 100644
--- a/chrome/browser/component_updater/component_updater_utils.cc
+++ b/chrome/browser/component_updater/component_updater_utils.cc
@@ -166,9 +166,8 @@
 }
 
 std::string GetCrxComponentID(const CrxComponent& component) {
-  return component_updater::HexStringToID(
-      StringToLowerASCII(base::HexEncode(&component.pk_hash[0],
-                         component.pk_hash.size()/2)));
+  return HexStringToID(StringToLowerASCII(base::HexEncode(&component.pk_hash[0],
+                       component.pk_hash.size()/2)));
 }
 
 }  // namespace component_updater
diff --git a/chrome/browser/component_updater/crx_update_item.h b/chrome/browser/component_updater/crx_update_item.h
index 477da9a..ff94d983 100644
--- a/chrome/browser/component_updater/crx_update_item.h
+++ b/chrome/browser/component_updater/crx_update_item.h
@@ -15,10 +15,10 @@
 #include "chrome/browser/component_updater/component_updater_service.h"
 #include "chrome/browser/component_updater/crx_downloader.h"
 
-class CUResourceThrottle;
-
 namespace component_updater {
 
+class CUResourceThrottle;
+
 // This is the one and only per-item state structure. Designed to be hosted
 // in a std::vector or a std::list. The two main members are |component|
 // which is supplied by the the component updater client and |status| which
diff --git a/chrome/browser/component_updater/default_component_installer.cc b/chrome/browser/component_updater/default_component_installer.cc
index fb478711..9743d5d 100644
--- a/chrome/browser/component_updater/default_component_installer.cc
+++ b/chrome/browser/component_updater/default_component_installer.cc
@@ -13,6 +13,8 @@
 #include "chrome/browser/component_updater/default_component_installer.h"
 #include "content/public/browser/browser_thread.h"
 
+namespace component_updater {
+
 namespace {
 // Version "0" corresponds to no installed version. By the server's conventions,
 // we represent it as a dotted quad.
@@ -208,3 +210,6 @@
         manifest_copy.Pass());
   }
 }
+
+}  // namespace component_updater
+
diff --git a/chrome/browser/component_updater/default_component_installer.h b/chrome/browser/component_updater/default_component_installer.h
index 4237f6da..1405b35 100644
--- a/chrome/browser/component_updater/default_component_installer.h
+++ b/chrome/browser/component_updater/default_component_installer.h
@@ -18,6 +18,8 @@
 class FilePath;
 }  // namespace base
 
+namespace component_updater {
+
 // Components should use a DefaultComponentInstaller by defining a class that
 // implements the members of ComponentInstallerTraits, and then registering a
 // DefaultComponentInstaller that has been constructed with an instance of that
@@ -103,4 +105,6 @@
   DISALLOW_COPY_AND_ASSIGN(DefaultComponentInstaller);
 };
 
+}  // namespace component_updater
+
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_DEFAULT_COMPONENT_INSTALLER_H_
diff --git a/chrome/browser/component_updater/flash_component_installer.h b/chrome/browser/component_updater/flash_component_installer.h
index af025ac2..0d0b424 100644
--- a/chrome/browser/component_updater/flash_component_installer.h
+++ b/chrome/browser/component_updater/flash_component_installer.h
@@ -5,13 +5,15 @@
 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_FLASH_COMPONENT_INSTALLER_H_
 #define CHROME_BROWSER_COMPONENT_UPDATER_FLASH_COMPONENT_INSTALLER_H_
 
-class ComponentUpdateService;
-
 namespace base {
 class DictionaryValue;
 class Version;
 }
 
+namespace component_updater {
+
+class ComponentUpdateService;
+
 // Our job is to 1) find what Pepper flash is installed (if any) and 2) register
 // with the component updater to download the latest version when available.
 // The first part is IO intensive so we do it asynchronously in the file thread.
@@ -22,4 +24,6 @@
 bool CheckPepperFlashManifest(const base::DictionaryValue& manifest,
                               base::Version* version_out);
 
+}  // namespace component_updater
+
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_FLASH_COMPONENT_INSTALLER_H_
diff --git a/chrome/browser/component_updater/pepper_flash_component_installer.cc b/chrome/browser/component_updater/pepper_flash_component_installer.cc
index f21234b..e442d5da7 100644
--- a/chrome/browser/component_updater/pepper_flash_component_installer.cc
+++ b/chrome/browser/component_updater/pepper_flash_component_installer.cc
@@ -43,6 +43,8 @@
 using content::BrowserThread;
 using content::PluginService;
 
+namespace component_updater {
+
 namespace {
 
 // File name of the Pepper Flash component manifest on different platforms.
@@ -407,3 +409,6 @@
                           base::Bind(&StartPepperFlashUpdateRegistration, cus));
 #endif
 }
+
+}  // namespace component_updater
+
diff --git a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc
index 2f9a10e36e..aba78b0 100644
--- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc
+++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc
@@ -33,6 +33,8 @@
 using chrome::OmahaQueryParams;
 using content::BrowserThread;
 
+namespace component_updater {
+
 namespace {
 
 // Name of the Pnacl component specified in the manifest.
@@ -455,11 +457,13 @@
       base::Bind(&GetProfileInformation, this));
 }
 
+}  // namespace component_updater
 
 namespace pnacl {
 
 bool NeedsOnDemandUpdate() {
-  return base::subtle::NoBarrier_Load(&needs_on_demand_update) != 0;
+  return base::subtle::NoBarrier_Load(
+      &component_updater::needs_on_demand_update) != 0;
 }
 
 }  // namespace pnacl
diff --git a/chrome/browser/component_updater/pnacl/pnacl_component_installer.h b/chrome/browser/component_updater/pnacl/pnacl_component_installer.h
index e13f26521..822b0b5 100644
--- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.h
+++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.h
@@ -31,6 +31,8 @@
 bool NeedsOnDemandUpdate();
 }
 
+namespace component_updater {
+
 // Component installer responsible for Portable Native Client files.
 // Files can be installed to a shared location, or be installed to
 // a per-user location.
@@ -95,4 +97,6 @@
   DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller);
 };
 
+}  // namespace component_updater
+
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_
diff --git a/chrome/browser/component_updater/pnacl/pnacl_profile_observer.cc b/chrome/browser/component_updater/pnacl/pnacl_profile_observer.cc
index bf959c3..12211e8 100644
--- a/chrome/browser/component_updater/pnacl/pnacl_profile_observer.cc
+++ b/chrome/browser/component_updater/pnacl/pnacl_profile_observer.cc
@@ -9,6 +9,8 @@
 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h"
 #include "content/public/browser/notification_service.h"
 
+namespace component_updater {
+
 PnaclProfileObserver::PnaclProfileObserver(
     PnaclComponentInstaller* installer) : pnacl_installer_(installer) {
   // We only need to observe NOTIFICATION_LOGIN_USER_CHANGED for ChromeOS
@@ -34,3 +36,5 @@
   NOTREACHED() << "Unexpected notification observed";
 #endif
 }
+
+}  // namespace component_updater
diff --git a/chrome/browser/component_updater/pnacl/pnacl_profile_observer.h b/chrome/browser/component_updater/pnacl/pnacl_profile_observer.h
index 18ef4e8..2b377b67 100644
--- a/chrome/browser/component_updater/pnacl/pnacl_profile_observer.h
+++ b/chrome/browser/component_updater/pnacl/pnacl_profile_observer.h
@@ -9,6 +9,8 @@
 #include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
 
+namespace component_updater {
+
 class PnaclComponentInstaller;
 
 // Monitors profile switching for ChromeOS to check the per-user
@@ -29,4 +31,6 @@
   DISALLOW_COPY_AND_ASSIGN(PnaclProfileObserver);
 };
 
+}  // namespace component_updater
+
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_PROFILE_OBSERVER_H_
diff --git a/chrome/browser/component_updater/recovery_component_installer.cc b/chrome/browser/component_updater/recovery_component_installer.cc
index db620fe..bcf9aea4 100644
--- a/chrome/browser/component_updater/recovery_component_installer.cc
+++ b/chrome/browser/component_updater/recovery_component_installer.cc
@@ -24,6 +24,8 @@
 
 using content::BrowserThread;
 
+namespace component_updater {
+
 namespace {
 
 // CRX hash. The extension id is: npdjjkjlcidkjlamlmmdelcjbcpdjocm.
@@ -154,3 +156,6 @@
 void RegisterPrefsForRecoveryComponent(PrefRegistrySimple* registry) {
   registry->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0");
 }
+
+}  // namespace component_updater
+
diff --git a/chrome/browser/component_updater/recovery_component_installer.h b/chrome/browser/component_updater/recovery_component_installer.h
index 95cf6e85..81d46c9 100644
--- a/chrome/browser/component_updater/recovery_component_installer.h
+++ b/chrome/browser/component_updater/recovery_component_installer.h
@@ -5,10 +5,13 @@
 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_RECOVERY_COMPONENT_INSTALLER_H_
 #define CHROME_BROWSER_COMPONENT_UPDATER_RECOVERY_COMPONENT_INSTALLER_H_
 
-class ComponentUpdateService;
 class PrefRegistrySimple;
 class PrefService;
 
+namespace component_updater {
+
+class ComponentUpdateService;
+
 // Component update registration for the recovery component. The job of the
 // recovery component is to repair the chrome installation or repair the Google
 // update installation. This is a last resort safety mechanism.
@@ -19,5 +22,7 @@
 // Register user preferences related to the recovery component.
 void RegisterPrefsForRecoveryComponent(PrefRegistrySimple* registry);
 
+}  // namespace component_updater
+
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_RECOVERY_COMPONENT_INSTALLER_H_
 
diff --git a/chrome/browser/component_updater/swiftshader_component_installer.cc b/chrome/browser/component_updater/swiftshader_component_installer.cc
index 038c294e..9e9020f 100644
--- a/chrome/browser/component_updater/swiftshader_component_installer.cc
+++ b/chrome/browser/component_updater/swiftshader_component_installer.cc
@@ -25,6 +25,8 @@
 using content::BrowserThread;
 using content::GpuDataManager;
 
+namespace component_updater {
+
 namespace {
 
 // CRX hash. The extension id is: nhfgdggnnopgbfdlpeoalgcjdgfafocg.
@@ -244,3 +246,6 @@
       base::Bind(&RegisterSwiftShaderPath, cus));
 #endif
 }
+
+}  // namespace component_updater
+
diff --git a/chrome/browser/component_updater/swiftshader_component_installer.h b/chrome/browser/component_updater/swiftshader_component_installer.h
index a1c41ad..945e157 100644
--- a/chrome/browser/component_updater/swiftshader_component_installer.h
+++ b/chrome/browser/component_updater/swiftshader_component_installer.h
@@ -5,6 +5,8 @@
 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_SWIFTSHADER_COMPONENT_INSTALLER_H_
 #define CHROME_BROWSER_COMPONENT_UPDATER_SWIFTSHADER_COMPONENT_INSTALLER_H_
 
+namespace component_updater {
+
 class ComponentUpdateService;
 
 // Our job is to 1) find what version of SwiftShader is installed (if any)
@@ -12,5 +14,6 @@
 // component updater if the current gpu is blacklisted.
 void RegisterSwiftShaderComponent(ComponentUpdateService* cus);
 
+}  // namespace component_updater
 
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_SWIFTSHADER_COMPONENT_INSTALLER_H_
diff --git a/chrome/browser/component_updater/test/component_installers_unittest.cc b/chrome/browser/component_updater/test/component_installers_unittest.cc
index e9c86d67..2e7e794 100644
--- a/chrome/browser/component_updater/test/component_installers_unittest.cc
+++ b/chrome/browser/component_updater/test/component_installers_unittest.cc
@@ -20,6 +20,8 @@
 
 using content::BrowserThread;
 
+namespace component_updater {
+
 namespace {
 // File name of the Pepper Flash plugin on different platforms.
 const base::FilePath::CharType kDataPath[] =
@@ -82,3 +84,6 @@
   EXPECT_TRUE(CheckPepperFlashManifest(*root, &version));
   EXPECT_TRUE(version.IsValid());
 }
+
+}  // namespace component_updater
+
diff --git a/chrome/browser/component_updater/test/component_patcher_mock.h b/chrome/browser/component_updater/test/component_patcher_mock.h
index 1843b29..48c7901 100644
--- a/chrome/browser/component_updater/test/component_patcher_mock.h
+++ b/chrome/browser/component_updater/test/component_patcher_mock.h
@@ -13,6 +13,8 @@
 class FilePath;
 }
 
+namespace component_updater {
+
 class MockComponentPatcher : public ComponentPatcher {
  public:
   MockComponentPatcher() {}
@@ -25,4 +27,6 @@
   DISALLOW_COPY_AND_ASSIGN(MockComponentPatcher);
 };
 
+}  // namespace component_updater
+
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_TEST_COMPONENT_PATCHER_MOCK_H_
diff --git a/chrome/browser/component_updater/test/component_patcher_unittest.cc b/chrome/browser/component_updater/test/component_patcher_unittest.cc
index 67256f9e..b7ad966 100644
--- a/chrome/browser/component_updater/test/component_patcher_unittest.cc
+++ b/chrome/browser/component_updater/test/component_patcher_unittest.cc
@@ -19,12 +19,18 @@
 #include "courgette/third_party/bsdiff.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+namespace component_updater {
+
+namespace {
+
 base::FilePath test_file(const char* file) {
   base::FilePath path;
   PathService::Get(chrome::DIR_TEST_DATA, &path);
   return path.AppendASCII("components").AppendASCII(file);
 }
 
+}  // namespace
+
 ComponentPatcherOperationTest::ComponentPatcherOperationTest() {
   EXPECT_TRUE(unpack_dir_.CreateUniqueTempDir());
   EXPECT_TRUE(input_dir_.CreateUniqueTempDir());
@@ -179,3 +185,6 @@
       unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")),
       test_file("binary_output.bin")));
 }
+
+}  // namespace component_updater
+
diff --git a/chrome/browser/component_updater/test/component_patcher_unittest.h b/chrome/browser/component_updater/test/component_patcher_unittest.h
index ee30308..ac30f35a 100644
--- a/chrome/browser/component_updater/test/component_patcher_unittest.h
+++ b/chrome/browser/component_updater/test/component_patcher_unittest.h
@@ -13,6 +13,8 @@
 #include "courgette/third_party/bsdiff.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+namespace component_updater {
+
 class MockComponentPatcher;
 class ReadOnlyTestInstaller;
 
@@ -24,8 +26,6 @@
 const int kCourgetteErrorOffset = 300;
 const int kBsdiffErrorOffset = 600;
 
-base::FilePath test_file(const char* file);
-
 class ComponentPatcherOperationTest : public testing::Test {
  public:
   explicit ComponentPatcherOperationTest();
@@ -39,4 +39,6 @@
   scoped_ptr<ReadOnlyTestInstaller> installer_;
 };
 
+}  // namespace component_updater
+
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_TEST_COMPONENT_PATCHER_UNITTEST_H_
diff --git a/chrome/browser/component_updater/test/component_updater_service_unittest.h b/chrome/browser/component_updater/test/component_updater_service_unittest.h
index 62919dc1..435510b 100644
--- a/chrome/browser/component_updater/test/component_updater_service_unittest.h
+++ b/chrome/browser/component_updater/test/component_updater_service_unittest.h
@@ -25,10 +25,10 @@
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-class TestInstaller;
-
 namespace component_updater {
 
+class TestInstaller;
+
 // Intercepts HTTP GET requests sent to "localhost".
 typedef content::URLLocalHostRequestPrepackagedInterceptor GetInterceptor;
 
diff --git a/chrome/browser/component_updater/test/test_installer.cc b/chrome/browser/component_updater/test/test_installer.cc
index 62ae494..400edca 100644
--- a/chrome/browser/component_updater/test/test_installer.cc
+++ b/chrome/browser/component_updater/test/test_installer.cc
@@ -8,6 +8,8 @@
 #include "base/files/file_path.h"
 #include "base/values.h"
 
+namespace component_updater {
+
 TestInstaller::TestInstaller()
     : error_(0), install_count_(0) {
 }
@@ -78,3 +80,6 @@
   *installed_file = path.Append(base::FilePath::FromUTF8Unsafe(file));
   return true;
 }
+
+}  // namespace component_updater
+
diff --git a/chrome/browser/component_updater/test/test_installer.h b/chrome/browser/component_updater/test/test_installer.h
index 2233d88..e93eeba9 100644
--- a/chrome/browser/component_updater/test/test_installer.h
+++ b/chrome/browser/component_updater/test/test_installer.h
@@ -13,6 +13,8 @@
 class DictionaryValue;
 }
 
+namespace component_updater {
+
 // A TestInstaller is an installer that does nothing for installation except
 // increment a counter.
 class TestInstaller : public ComponentInstaller {
@@ -70,4 +72,6 @@
   Version current_version_;
 };
 
+}  // namespace component_updater
+
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_TEST_TEST_INSTALLER_H_
diff --git a/chrome/browser/component_updater/test/update_checker_unittest.cc b/chrome/browser/component_updater/test/update_checker_unittest.cc
index 9ec39e2..c031488 100644
--- a/chrome/browser/component_updater/test/update_checker_unittest.cc
+++ b/chrome/browser/component_updater/test/update_checker_unittest.cc
@@ -25,12 +25,16 @@
 
 namespace component_updater {
 
+namespace {
+
 base::FilePath test_file(const char* file) {
   base::FilePath path;
   PathService::Get(chrome::DIR_TEST_DATA, &path);
   return path.AppendASCII("components").AppendASCII(file);
 }
 
+}  // namespace
+
 class UpdateCheckerTest : public testing::Test {
  public:
   UpdateCheckerTest();
diff --git a/chrome/browser/component_updater/update_checker.cc b/chrome/browser/component_updater/update_checker.cc
index 92d91d3..f1800cd 100644
--- a/chrome/browser/component_updater/update_checker.cc
+++ b/chrome/browser/component_updater/update_checker.cc
@@ -132,9 +132,9 @@
 
   int error = 0;
   std::string error_message;
-  component_updater::UpdateResponse update_response;
+  UpdateResponse update_response;
 
-  if (component_updater::FetchSuccess(*source)) {
+  if (FetchSuccess(*source)) {
     std::string xml;
     source->GetResponseAsString(&xml);
     if (!update_response.Parse(xml)) {
@@ -142,7 +142,7 @@
       error_message = update_response.errors();
     }
   } else {
-    error = component_updater::GetFetchError(*source);
+    error = GetFetchError(*source);
     error_message.assign("network error");
   }
 
diff --git a/chrome/browser/component_updater/widevine_cdm_component_installer.cc b/chrome/browser/component_updater/widevine_cdm_component_installer.cc
index 18abd461..03375e0 100644
--- a/chrome/browser/component_updater/widevine_cdm_component_installer.cc
+++ b/chrome/browser/component_updater/widevine_cdm_component_installer.cc
@@ -38,6 +38,8 @@
 using content::BrowserThread;
 using content::PluginService;
 
+namespace component_updater {
+
 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
 
 namespace {
@@ -335,3 +337,6 @@
   return;
 #endif  // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
 }
+
+}  // namespace component_updater
+
diff --git a/chrome/browser/component_updater/widevine_cdm_component_installer.h b/chrome/browser/component_updater/widevine_cdm_component_installer.h
index 144ca90..a52decee 100644
--- a/chrome/browser/component_updater/widevine_cdm_component_installer.h
+++ b/chrome/browser/component_updater/widevine_cdm_component_installer.h
@@ -5,6 +5,8 @@
 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_WIDEVINE_CDM_COMPONENT_INSTALLER_H_
 #define CHROME_BROWSER_COMPONENT_UPDATER_WIDEVINE_CDM_COMPONENT_INSTALLER_H_
 
+namespace component_updater {
+
 class ComponentUpdateService;
 
 // Our job is to:
@@ -16,4 +18,6 @@
 // The first part is IO intensive so we do it asynchronously in the file thread.
 void RegisterWidevineCdmComponent(ComponentUpdateService* cus);
 
+}  // namespace component_updater
+
 #endif  // CHROME_BROWSER_COMPONENT_UPDATER_WIDEVINE_CDM_COMPONENT_INSTALLER_H_