Index: chrome/browser/profiles/profile_window.cc |
diff --git a/chrome/browser/profiles/profile_window.cc b/chrome/browser/profiles/profile_window.cc |
index 4cb2940c1a588a1bf8d2ce0543f3b742260adcda..908a7ae4b6c7f39a9353a5f41a38aa19f2469ed3 100644 |
--- a/chrome/browser/profiles/profile_window.cc |
+++ b/chrome/browser/profiles/profile_window.cc |
@@ -17,6 +17,8 @@ |
#include "chrome/browser/profiles/profile_avatar_icon_util.h" |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/browser/signin/account_reconcilor_factory.h" |
+#include "chrome/browser/sync/profile_sync_service.h" |
+#include "chrome/browser/sync/profile_sync_service_factory.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/browser_dialogs.h" |
#include "chrome/browser/ui/profile_chooser_constants.h" |
@@ -29,6 +31,14 @@ |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/user_metrics.h" |
+#if defined(ENABLE_EXTENSIONS) |
+#include "chrome/browser/extensions/extension_service.h" |
+#include "extensions/browser/extension_prefs.h" |
+#include "extensions/browser/extension_registry.h" |
+#include "extensions/browser/extension_registry_factory.h" |
+#include "extensions/browser/extension_system.h" |
+#endif // defined(ENABLE_EXTENSIONS) |
+ |
#if !defined(OS_IOS) |
#include "chrome/browser/ui/browser_finder.h" |
#include "chrome/browser/ui/browser_list.h" |
@@ -45,6 +55,20 @@ namespace { |
const char kNewProfileManagementExperimentInternalName[] = |
"enable-new-profile-management"; |
+#if defined(ENABLE_EXTENSIONS) |
+void LockExtensions(Profile* profile) { |
+ ExtensionService* extension_service = |
+ extensions::ExtensionSystem::Get(profile)->extension_service(); |
+ extension_service->LockAllExtensions(); |
noms (inactive)
2014/11/12 19:23:51
Can this ever be NULL?
Mike Lerman
2014/11/12 20:58:42
I don't think so, so long as ENABLE_EXTENSIONS is
|
+} |
+ |
+void UnlockExtensions(Profile* profile) { |
+ ExtensionService* extension_service = |
+ extensions::ExtensionSystem::Get(profile)->extension_service(); |
+ extension_service->UnlockAllLockedExtensions(); |
+} |
+#endif // defined(ENABLE_EXTENSIONS) |
+ |
// Handles running a callback when a new Browser for the given profile |
// has been completely created. |
class BrowserAddedForProfileObserver : public chrome::BrowserListObserver { |
@@ -98,6 +122,17 @@ void OpenBrowserWindowForProfile( |
is_first_run = chrome::startup::IS_FIRST_RUN; |
} |
+#if defined(ENABLE_EXTENSIONS) |
+ // Determine if there are extensions to unlock, then do so. |
+ const ProfileInfoCache& cache = |
+ g_browser_process->profile_manager()->GetProfileInfoCache(); |
+ int index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
+ if (!profile->IsGuestSession() && |
+ cache.ProfileIsSigninRequiredAtIndex(index)) { |
noms (inactive)
2014/11/12 19:23:51
I read this as "if this profile is locked, then un
Mike Lerman
2014/11/12 20:58:42
We intentionally don't unset the bit within user_m
|
+ UnlockExtensions(profile); |
+ } |
+#endif // defined(ENABLE_EXTENSIONS) |
+ |
// If |always_create| is false, and we have a |callback| to run, check |
// whether a browser already exists so that we can run the callback. We don't |
// want to rely on the observer listening to OnBrowserSetLastActive in this |
@@ -297,11 +332,16 @@ void CloseGuestProfileWindows() { |
} |
void LockBrowserCloseSuccess(const base::FilePath& profile_path) { |
- ProfileInfoCache* cache = |
- &g_browser_process->profile_manager()->GetProfileInfoCache(); |
+ ProfileManager* profile_manager = g_browser_process->profile_manager(); |
+ ProfileInfoCache* cache = &profile_manager->GetProfileInfoCache(); |
cache->SetProfileSigninRequiredAtIndex( |
cache->GetIndexOfProfileWithPath(profile_path), true); |
+ |
+#if defined(ENABLE_EXTENSIONS) |
+ LockExtensions(profile_manager->GetProfileByPath(profile_path)); |
noms (inactive)
2014/11/12 19:23:51
I would either add a comment about how this profil
Mike Lerman
2014/11/12 20:58:42
Comment written.
|
+#endif // defined(ENABLE_EXTENSIONS) |
+ |
chrome::HideTaskManager(); |
UserManager::Show(profile_path, |
profiles::USER_MANAGER_NO_TUTORIAL, |