Make PolicyService per-profile.

At the moment, all the policy services are identical, but this will allow us to add different policies per profile.

BUG=128318
TEST=none


Review URL: https://chromiumcodereview.appspot.com/10444008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139783 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 7fa16cc..19b4da1 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -43,8 +43,7 @@
 #include "chrome/browser/net/sdch_dictionary_fetcher.h"
 #include "chrome/browser/notifications/notification_ui_manager.h"
 #include "chrome/browser/policy/browser_policy_connector.h"
-#include "chrome/browser/policy/policy_service_impl.h"
-#include "chrome/browser/policy/policy_service_stub.h"
+#include "chrome/browser/policy/policy_service.h"
 #include "chrome/browser/prefs/browser_prefs.h"
 #include "chrome/browser/prefs/pref_service.h"
 #include "chrome/browser/prerender/prerender_tracker.h"
@@ -83,6 +82,10 @@
 #include "ui/base/clipboard/clipboard.h"
 #include "ui/base/l10n/l10n_util.h"
 
+#if !defined(ENABLE_CONFIGURATION_POLICY)
+#include "chrome/browser/policy/policy_service_stub.h"
+#endif  // defined(ENABLE_CONFIGURATION_POLICY)
+
 #if defined(OS_WIN)
 #include "ui/views/focus/view_storage.h"
 #elif defined(OS_MACOSX)
@@ -448,7 +451,8 @@
 policy::PolicyService* BrowserProcessImpl::policy_service() {
   if (!policy_service_.get()) {
 #if defined(ENABLE_CONFIGURATION_POLICY)
-    policy_service_.reset(browser_policy_connector()->CreatePolicyService());
+    policy_service_.reset(
+        browser_policy_connector()->CreatePolicyService(NULL));
 #else
     policy_service_.reset(new policy::PolicyServiceStub());
 #endif
@@ -710,7 +714,8 @@
   FilePath local_state_path;
   PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
   local_state_.reset(
-      PrefService::CreatePrefService(local_state_path, NULL, false));
+      PrefService::CreatePrefService(local_state_path, policy_service(), NULL,
+                                     false));
 
   // Initialize the prefs of the local state.
   browser::RegisterLocalState(local_state_.get());