Introduce ExtensionsService. Load extensions on startup from a directory in
the profile if a command-line flag is present.

Please carefully scrutinize the threading/ref-counting schenanigans.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6403 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index fb3508a4..76f2f16 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -17,6 +17,7 @@
 #include "chrome/browser/browser_list.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/download/download_manager.h"
+#include "chrome/browser/extensions/extensions_service.h"
 #include "chrome/browser/greasemonkey_master.h"
 #include "chrome/browser/history/history.h"
 #include "chrome/browser/navigation_controller.h"
@@ -384,6 +385,10 @@
     return profile_->GetVisitedLinkMaster();
   }
 
+  virtual ExtensionsService* GetExtensionsService() {
+    return profile_->GetExtensionsService();
+  }
+
   virtual GreasemonkeyMaster* GetGreasemonkeyMaster() {
     return profile_->GetGreasemonkeyMaster();
   }
@@ -547,6 +552,7 @@
 ProfileImpl::ProfileImpl(const std::wstring& path)
     : path_(path),
       off_the_record_(false),
+      extensions_service_(new ExtensionsService(FilePath(path))),
       history_service_created_(false),
       created_web_data_service_(false),
       created_download_manager_(false),
@@ -688,6 +694,10 @@
   return visited_link_master_.get();
 }
 
+ExtensionsService* ProfileImpl::GetExtensionsService() {
+  return extensions_service_.get();
+}
+
 GreasemonkeyMaster* ProfileImpl::GetGreasemonkeyMaster() {
   if (!greasemonkey_master_.get()) {
     std::wstring script_dir_str;