OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/managed_mode/managed_mode.h" | 5 #include "chrome/browser/managed_mode/managed_mode.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/public/pref_change_registrar.h" | 8 #include "base/prefs/public/pref_change_registrar.h" |
9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/managed_mode/managed_mode_site_list.h" | 11 #include "chrome/browser/managed_mode/managed_mode_site_list.h" |
12 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" | 12 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" |
13 #include "chrome/browser/policy/url_blacklist_manager.h" | 13 #include "chrome/browser/policy/url_blacklist_manager.h" |
| 14 #include "chrome/browser/prefs/pref_registry_simple.h" |
14 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_list.h" | 18 #include "chrome/browser/ui/browser_list.h" |
18 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
19 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
23 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
24 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
25 | 26 |
26 using content::BrowserThread; | 27 using content::BrowserThread; |
27 | 28 |
28 // static | 29 // static |
29 ManagedMode* ManagedMode::GetInstance() { | 30 ManagedMode* ManagedMode::GetInstance() { |
30 return Singleton<ManagedMode, LeakySingletonTraits<ManagedMode> >::get(); | 31 return Singleton<ManagedMode, LeakySingletonTraits<ManagedMode> >::get(); |
31 } | 32 } |
32 | 33 |
33 // static | 34 // static |
34 void ManagedMode::RegisterPrefs(PrefServiceSimple* prefs) { | 35 void ManagedMode::RegisterPrefs(PrefRegistrySimple* prefs) { |
35 prefs->RegisterBooleanPref(prefs::kInManagedMode, false); | 36 prefs->RegisterBooleanPref(prefs::kInManagedMode, false); |
36 } | 37 } |
37 | 38 |
38 // static | 39 // static |
39 void ManagedMode::Init(Profile* profile) { | 40 void ManagedMode::Init(Profile* profile) { |
40 GetInstance()->InitImpl(profile); | 41 GetInstance()->InitImpl(profile); |
41 } | 42 } |
42 | 43 |
43 void ManagedMode::InitImpl(Profile* profile) { | 44 void ManagedMode::InitImpl(Profile* profile) { |
44 DCHECK(g_browser_process); | 45 DCHECK(g_browser_process); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 managed_profile_ = newly_managed_profile; | 226 managed_profile_ = newly_managed_profile; |
226 g_browser_process->local_state()->SetBoolean(prefs::kInManagedMode, | 227 g_browser_process->local_state()->SetBoolean(prefs::kInManagedMode, |
227 !!newly_managed_profile); | 228 !!newly_managed_profile); |
228 | 229 |
229 // This causes the avatar and the profile menu to get updated. | 230 // This causes the avatar and the profile menu to get updated. |
230 content::NotificationService::current()->Notify( | 231 content::NotificationService::current()->Notify( |
231 chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, | 232 chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, |
232 content::NotificationService::AllBrowserContextsAndSources(), | 233 content::NotificationService::AllBrowserContextsAndSources(), |
233 content::NotificationService::NoDetails()); | 234 content::NotificationService::NoDetails()); |
234 } | 235 } |
OLD | NEW |