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/ui/webui/options/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "apps/app_window.h" | 10 #include "apps/app_window.h" |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 values->SetString("macPasswordsWarning", | 563 values->SetString("macPasswordsWarning", |
564 l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MAC_WARNING)); | 564 l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MAC_WARNING)); |
565 values->SetBoolean("multiple_profiles", | 565 values->SetBoolean("multiple_profiles", |
566 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1); | 566 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1); |
567 #endif | 567 #endif |
568 | 568 |
569 if (ShouldShowMultiProfilesUserList()) | 569 if (ShouldShowMultiProfilesUserList()) |
570 values->Set("profilesInfo", GetProfilesInfoList().release()); | 570 values->Set("profilesInfo", GetProfilesInfoList().release()); |
571 | 571 |
572 values->SetBoolean("profileIsManaged", | 572 values->SetBoolean("profileIsManaged", |
573 Profile::FromWebUI(web_ui())->IsManaged()); | 573 Profile::FromWebUI(web_ui())->IsSupervised()); |
574 | 574 |
575 #if !defined(OS_CHROMEOS) | 575 #if !defined(OS_CHROMEOS) |
576 values->SetBoolean( | 576 values->SetBoolean( |
577 "gpuEnabledAtStart", | 577 "gpuEnabledAtStart", |
578 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); | 578 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); |
579 #endif | 579 #endif |
580 | 580 |
581 #if defined(ENABLE_SERVICE_DISCOVERY) | 581 #if defined(ENABLE_SERVICE_DISCOVERY) |
582 values->SetBoolean("cloudPrintHideNotificationsCheckbox", | 582 values->SetBoolean("cloudPrintHideNotificationsCheckbox", |
583 !local_discovery::PrivetNotificationService::IsEnabled()); | 583 !local_discovery::PrivetNotificationService::IsEnabled()); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 profile_pref_registrar_.Init(prefs); | 819 profile_pref_registrar_.Init(prefs); |
820 profile_pref_registrar_.Add( | 820 profile_pref_registrar_.Add( |
821 prefs::kWebKitDefaultFontSize, | 821 prefs::kWebKitDefaultFontSize, |
822 base::Bind(&BrowserOptionsHandler::SetupFontSizeSelector, | 822 base::Bind(&BrowserOptionsHandler::SetupFontSizeSelector, |
823 base::Unretained(this))); | 823 base::Unretained(this))); |
824 profile_pref_registrar_.Add( | 824 profile_pref_registrar_.Add( |
825 prefs::kWebKitDefaultFixedFontSize, | 825 prefs::kWebKitDefaultFixedFontSize, |
826 base::Bind(&BrowserOptionsHandler::SetupFontSizeSelector, | 826 base::Bind(&BrowserOptionsHandler::SetupFontSizeSelector, |
827 base::Unretained(this))); | 827 base::Unretained(this))); |
828 profile_pref_registrar_.Add( | 828 profile_pref_registrar_.Add( |
829 prefs::kManagedUsers, | 829 prefs::kSupervisedUsers, |
830 base::Bind(&BrowserOptionsHandler::SetupManagingSupervisedUsers, | 830 base::Bind(&BrowserOptionsHandler::SetupManagingSupervisedUsers, |
831 base::Unretained(this))); | 831 base::Unretained(this))); |
832 profile_pref_registrar_.Add( | 832 profile_pref_registrar_.Add( |
833 prefs::kSigninAllowed, | 833 prefs::kSigninAllowed, |
834 base::Bind(&BrowserOptionsHandler::OnSigninAllowedPrefChange, | 834 base::Bind(&BrowserOptionsHandler::OnSigninAllowedPrefChange, |
835 base::Unretained(this))); | 835 base::Unretained(this))); |
836 profile_pref_registrar_.Add( | 836 profile_pref_registrar_.Add( |
837 prefs::kEasyUnlockPairing, | 837 prefs::kEasyUnlockPairing, |
838 base::Bind(&BrowserOptionsHandler::SetupEasyUnlock, | 838 base::Bind(&BrowserOptionsHandler::SetupEasyUnlock, |
839 base::Unretained(this))); | 839 base::Unretained(this))); |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 base::FilePath current_profile_path = | 1218 base::FilePath current_profile_path = |
1219 web_ui()->GetWebContents()->GetBrowserContext()->GetPath(); | 1219 web_ui()->GetWebContents()->GetBrowserContext()->GetPath(); |
1220 | 1220 |
1221 for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) { | 1221 for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) { |
1222 base::DictionaryValue* profile_value = new base::DictionaryValue(); | 1222 base::DictionaryValue* profile_value = new base::DictionaryValue(); |
1223 profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i)); | 1223 profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i)); |
1224 base::FilePath profile_path = cache.GetPathOfProfileAtIndex(i); | 1224 base::FilePath profile_path = cache.GetPathOfProfileAtIndex(i); |
1225 profile_value->Set("filePath", base::CreateFilePathValue(profile_path)); | 1225 profile_value->Set("filePath", base::CreateFilePathValue(profile_path)); |
1226 profile_value->SetBoolean("isCurrentProfile", | 1226 profile_value->SetBoolean("isCurrentProfile", |
1227 profile_path == current_profile_path); | 1227 profile_path == current_profile_path); |
1228 profile_value->SetBoolean("isManaged", cache.ProfileIsManagedAtIndex(i)); | 1228 profile_value->SetBoolean("isManaged", cache.ProfileIsSupervisedAtIndex(i)); |
1229 | 1229 |
1230 bool is_gaia_picture = | 1230 bool is_gaia_picture = |
1231 cache.IsUsingGAIAPictureOfProfileAtIndex(i) && | 1231 cache.IsUsingGAIAPictureOfProfileAtIndex(i) && |
1232 cache.GetGAIAPictureOfProfileAtIndex(i); | 1232 cache.GetGAIAPictureOfProfileAtIndex(i); |
1233 if (is_gaia_picture) { | 1233 if (is_gaia_picture) { |
1234 gfx::Image icon = profiles::GetAvatarIconForWebUI( | 1234 gfx::Image icon = profiles::GetAvatarIconForWebUI( |
1235 cache.GetAvatarIconOfProfileAtIndex(i), true); | 1235 cache.GetAvatarIconOfProfileAtIndex(i), true); |
1236 profile_value->SetString("iconURL", | 1236 profile_value->SetString("iconURL", |
1237 webui::GetBitmapDataUrl(icon.AsBitmap())); | 1237 webui::GetBitmapDataUrl(icon.AsBitmap())); |
1238 } else { | 1238 } else { |
(...skipping 26 matching lines...) Expand all Loading... |
1265 return; | 1265 return; |
1266 helper::DeleteProfileAtPath(file_path, web_ui()); | 1266 helper::DeleteProfileAtPath(file_path, web_ui()); |
1267 } | 1267 } |
1268 | 1268 |
1269 void BrowserOptionsHandler::ObserveThemeChanged() { | 1269 void BrowserOptionsHandler::ObserveThemeChanged() { |
1270 Profile* profile = Profile::FromWebUI(web_ui()); | 1270 Profile* profile = Profile::FromWebUI(web_ui()); |
1271 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); | 1271 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); |
1272 bool is_system_theme = false; | 1272 bool is_system_theme = false; |
1273 | 1273 |
1274 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1274 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
1275 bool profile_is_managed = profile->IsManaged(); | 1275 bool profile_is_supervised = profile->IsSupervised(); |
1276 is_system_theme = theme_service->UsingSystemTheme(); | 1276 is_system_theme = theme_service->UsingSystemTheme(); |
1277 base::FundamentalValue native_theme_enabled(!is_system_theme && | 1277 base::FundamentalValue native_theme_enabled(!is_system_theme && |
1278 !profile_is_managed); | 1278 !profile_is_supervised); |
1279 web_ui()->CallJavascriptFunction("BrowserOptions.setNativeThemeButtonEnabled", | 1279 web_ui()->CallJavascriptFunction("BrowserOptions.setNativeThemeButtonEnabled", |
1280 native_theme_enabled); | 1280 native_theme_enabled); |
1281 #endif | 1281 #endif |
1282 | 1282 |
1283 bool is_classic_theme = !is_system_theme && | 1283 bool is_classic_theme = !is_system_theme && |
1284 theme_service->UsingDefaultTheme(); | 1284 theme_service->UsingDefaultTheme(); |
1285 base::FundamentalValue enabled(!is_classic_theme); | 1285 base::FundamentalValue enabled(!is_classic_theme); |
1286 web_ui()->CallJavascriptFunction("BrowserOptions.setThemesResetButtonEnabled", | 1286 web_ui()->CallJavascriptFunction("BrowserOptions.setThemesResetButtonEnabled", |
1287 enabled); | 1287 enabled); |
1288 } | 1288 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 BrowserOptionsHandler::GetSyncStateDictionary() { | 1327 BrowserOptionsHandler::GetSyncStateDictionary() { |
1328 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); | 1328 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); |
1329 Profile* profile = Profile::FromWebUI(web_ui()); | 1329 Profile* profile = Profile::FromWebUI(web_ui()); |
1330 if (profile->IsGuestSession()) { | 1330 if (profile->IsGuestSession()) { |
1331 // Cannot display signin status when running in guest mode on chromeos | 1331 // Cannot display signin status when running in guest mode on chromeos |
1332 // because there is no SigninManager. | 1332 // because there is no SigninManager. |
1333 sync_status->SetBoolean("signinAllowed", false); | 1333 sync_status->SetBoolean("signinAllowed", false); |
1334 return sync_status.Pass(); | 1334 return sync_status.Pass(); |
1335 } | 1335 } |
1336 | 1336 |
1337 sync_status->SetBoolean("supervisedUser", profile->IsManaged()); | 1337 sync_status->SetBoolean("supervisedUser", profile->IsSupervised()); |
1338 | 1338 |
1339 bool signout_prohibited = false; | 1339 bool signout_prohibited = false; |
1340 #if !defined(OS_CHROMEOS) | 1340 #if !defined(OS_CHROMEOS) |
1341 // Signout is not allowed if the user has policy (crbug.com/172204). | 1341 // Signout is not allowed if the user has policy (crbug.com/172204). |
1342 signout_prohibited = | 1342 signout_prohibited = |
1343 SigninManagerFactory::GetForProfile(profile)->IsSignoutProhibited(); | 1343 SigninManagerFactory::GetForProfile(profile)->IsSignoutProhibited(); |
1344 #endif | 1344 #endif |
1345 | 1345 |
1346 ProfileSyncService* service = | 1346 ProfileSyncService* service = |
1347 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); | 1347 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1733 if (helper::GetDesktopType(web_ui()) == chrome::HOST_DESKTOP_TYPE_ASH) { | 1733 if (helper::GetDesktopType(web_ui()) == chrome::HOST_DESKTOP_TYPE_ASH) { |
1734 base::FundamentalValue enabled(false); | 1734 base::FundamentalValue enabled(false); |
1735 web_ui()->CallJavascriptFunction("BrowserOptions.enableCertificateButton", | 1735 web_ui()->CallJavascriptFunction("BrowserOptions.enableCertificateButton", |
1736 enabled); | 1736 enabled); |
1737 } | 1737 } |
1738 #endif // defined(OS_WIN) | 1738 #endif // defined(OS_WIN) |
1739 } | 1739 } |
1740 | 1740 |
1741 void BrowserOptionsHandler::SetupManagingSupervisedUsers() { | 1741 void BrowserOptionsHandler::SetupManagingSupervisedUsers() { |
1742 bool has_users = !Profile::FromWebUI(web_ui())-> | 1742 bool has_users = !Profile::FromWebUI(web_ui())-> |
1743 GetPrefs()->GetDictionary(prefs::kManagedUsers)->empty(); | 1743 GetPrefs()->GetDictionary(prefs::kSupervisedUsers)->empty(); |
1744 base::FundamentalValue has_users_value(has_users); | 1744 base::FundamentalValue has_users_value(has_users); |
1745 web_ui()->CallJavascriptFunction( | 1745 web_ui()->CallJavascriptFunction( |
1746 "BrowserOptions.updateManagesSupervisedUsers", | 1746 "BrowserOptions.updateManagesSupervisedUsers", |
1747 has_users_value); | 1747 has_users_value); |
1748 } | 1748 } |
1749 | 1749 |
1750 void BrowserOptionsHandler::SetupEasyUnlock() { | 1750 void BrowserOptionsHandler::SetupEasyUnlock() { |
1751 bool has_pairing = !Profile::FromWebUI(web_ui())->GetPrefs() | 1751 bool has_pairing = !Profile::FromWebUI(web_ui())->GetPrefs() |
1752 ->GetDictionary(prefs::kEasyUnlockPairing)->empty(); | 1752 ->GetDictionary(prefs::kEasyUnlockPairing)->empty(); |
1753 base::FundamentalValue has_pairing_value(has_pairing); | 1753 base::FundamentalValue has_pairing_value(has_pairing); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1797 extension = extensions::GetExtensionOverridingProxy( | 1797 extension = extensions::GetExtensionOverridingProxy( |
1798 Profile::FromWebUI(web_ui())); | 1798 Profile::FromWebUI(web_ui())); |
1799 AppendExtensionData("proxy", extension, &extension_controlled); | 1799 AppendExtensionData("proxy", extension, &extension_controlled); |
1800 | 1800 |
1801 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", | 1801 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", |
1802 extension_controlled); | 1802 extension_controlled); |
1803 #endif // defined(OS_WIN) | 1803 #endif // defined(OS_WIN) |
1804 } | 1804 } |
1805 | 1805 |
1806 } // namespace options | 1806 } // namespace options |
OLD | NEW |