Load the bookmark manager extension at Chrome startup.

Review URL: http://codereview.chromium.org/660232

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40683 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 6a3bd8c..1e248e2 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -4,6 +4,7 @@
 
 #include "chrome/browser/profile.h"
 
+#include "app/resource_bundle.h"
 #include "app/theme_provider.h"
 #include "base/command_line.h"
 #include "base/file_path.h"
@@ -60,6 +61,7 @@
 #include "chrome/common/notification_service.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/common/render_messages.h"
+#include "grit/browser_resources.h"
 #include "grit/locale_settings.h"
 #include "net/base/transport_security_state.h"
 #include "webkit/database/database_tracker.h"
@@ -660,6 +662,23 @@
       GetPath().AppendASCII(ExtensionsService::kInstallDirectoryName),
       true);
 
+  // Register the bookmark manager extension.
+  if (CommandLine::ForCurrentProcess()->HasSwitch(
+          switches::kEnableTabbedBookmarkManager)) {
+    FilePath bookmark_manager_path;
+    if (PathService::Get(chrome::DIR_BOOKMARK_MANAGER,
+                         &bookmark_manager_path)) {
+      std::string manifest =
+          ResourceBundle::GetSharedInstance().GetRawDataResource(
+              IDR_BOOKMARKS_MANIFEST).as_string();
+      extensions_service_->register_component_extension(
+          ExtensionsService::ComponentExtensionInfo(manifest,
+                                                    bookmark_manager_path));
+    } else {
+      NOTREACHED();
+    }
+  }
+
   extensions_service_->Init();
 
   // Load any extensions specified with --load-extension.