| 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 "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 values->SetBoolean("enableStickyKeys", | 507 values->SetBoolean("enableStickyKeys", |
| 508 !command_line.HasSwitch(switches::kDisableStickyKeys)); | 508 !command_line.HasSwitch(switches::kDisableStickyKeys)); |
| 509 #endif | 509 #endif |
| 510 | 510 |
| 511 #if defined(OS_MACOSX) | 511 #if defined(OS_MACOSX) |
| 512 values->SetString("macPasswordsWarning", | 512 values->SetString("macPasswordsWarning", |
| 513 l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MAC_WARNING)); | 513 l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MAC_WARNING)); |
| 514 values->SetBoolean("multiple_profiles", | 514 values->SetBoolean("multiple_profiles", |
| 515 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1); | 515 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1); |
| 516 #endif | 516 #endif |
| 517 | 517 values->SetBoolean("showProfilesSection", |
| 518 if (ShouldShowMultiProfilesUserList(GetDesktopType())) | 518 ShouldShowMultiProfilesUserList(GetDesktopType())); |
| 519 values->Set("profilesInfo", GetProfilesInfoList().release()); | |
| 520 | 519 |
| 521 values->SetBoolean("profileIsManaged", | 520 values->SetBoolean("profileIsManaged", |
| 522 Profile::FromWebUI(web_ui())->IsManaged()); | 521 Profile::FromWebUI(web_ui())->IsManaged()); |
| 523 | 522 |
| 524 #if !defined(OS_CHROMEOS) | 523 #if !defined(OS_CHROMEOS) |
| 525 values->SetBoolean( | 524 values->SetBoolean( |
| 526 "gpuEnabledAtStart", | 525 "gpuEnabledAtStart", |
| 527 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); | 526 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); |
| 528 #endif | 527 #endif |
| 529 | 528 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 base::Bind(&BrowserOptionsHandler::DeleteProfile, | 577 base::Bind(&BrowserOptionsHandler::DeleteProfile, |
| 579 base::Unretained(this))); | 578 base::Unretained(this))); |
| 580 web_ui()->RegisterMessageCallback( | 579 web_ui()->RegisterMessageCallback( |
| 581 "cancelCreateProfile", | 580 "cancelCreateProfile", |
| 582 base::Bind(&BrowserOptionsHandler::HandleCancelProfileCreation, | 581 base::Bind(&BrowserOptionsHandler::HandleCancelProfileCreation, |
| 583 base::Unretained(this))); | 582 base::Unretained(this))); |
| 584 web_ui()->RegisterMessageCallback( | 583 web_ui()->RegisterMessageCallback( |
| 585 "themesReset", | 584 "themesReset", |
| 586 base::Bind(&BrowserOptionsHandler::ThemesReset, | 585 base::Bind(&BrowserOptionsHandler::ThemesReset, |
| 587 base::Unretained(this))); | 586 base::Unretained(this))); |
| 587 web_ui()->RegisterMessageCallback( |
| 588 "requestProfilesInfo", |
| 589 base::Bind(&BrowserOptionsHandler::RequestProfilesInfo, |
| 590 base::Unretained(this))); |
| 588 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 591 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 589 web_ui()->RegisterMessageCallback( | 592 web_ui()->RegisterMessageCallback( |
| 590 "themesSetNative", | 593 "themesSetNative", |
| 591 base::Bind(&BrowserOptionsHandler::ThemesSetNative, | 594 base::Bind(&BrowserOptionsHandler::ThemesSetNative, |
| 592 base::Unretained(this))); | 595 base::Unretained(this))); |
| 593 #endif | 596 #endif |
| 594 web_ui()->RegisterMessageCallback( | 597 web_ui()->RegisterMessageCallback( |
| 595 "selectDownloadLocation", | 598 "selectDownloadLocation", |
| 596 base::Bind(&BrowserOptionsHandler::HandleSelectDownloadLocation, | 599 base::Bind(&BrowserOptionsHandler::HandleSelectDownloadLocation, |
| 597 base::Unretained(this))); | 600 base::Unretained(this))); |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 double zoom_factor; | 1480 double zoom_factor; |
| 1478 if (ExtractDoubleValue(args, &zoom_factor)) { | 1481 if (ExtractDoubleValue(args, &zoom_factor)) { |
| 1479 default_zoom_level_.SetValue(content::ZoomFactorToZoomLevel(zoom_factor)); | 1482 default_zoom_level_.SetValue(content::ZoomFactorToZoomLevel(zoom_factor)); |
| 1480 } | 1483 } |
| 1481 } | 1484 } |
| 1482 | 1485 |
| 1483 void BrowserOptionsHandler::HandleRestartBrowser(const ListValue* args) { | 1486 void BrowserOptionsHandler::HandleRestartBrowser(const ListValue* args) { |
| 1484 chrome::AttemptRestart(); | 1487 chrome::AttemptRestart(); |
| 1485 } | 1488 } |
| 1486 | 1489 |
| 1490 void BrowserOptionsHandler::RequestProfilesInfo(const ListValue* args) { |
| 1491 SendProfilesInfo(); |
| 1492 } |
| 1493 |
| 1487 #if !defined(OS_CHROMEOS) | 1494 #if !defined(OS_CHROMEOS) |
| 1488 void BrowserOptionsHandler::ShowNetworkProxySettings(const ListValue* args) { | 1495 void BrowserOptionsHandler::ShowNetworkProxySettings(const ListValue* args) { |
| 1489 content::RecordAction(UserMetricsAction("Options_ShowProxySettings")); | 1496 content::RecordAction(UserMetricsAction("Options_ShowProxySettings")); |
| 1490 AdvancedOptionsUtilities::ShowNetworkProxySettings( | 1497 AdvancedOptionsUtilities::ShowNetworkProxySettings( |
| 1491 web_ui()->GetWebContents()); | 1498 web_ui()->GetWebContents()); |
| 1492 } | 1499 } |
| 1493 #endif | 1500 #endif |
| 1494 | 1501 |
| 1495 #if !defined(USE_NSS) && !defined(USE_OPENSSL) | 1502 #if !defined(USE_NSS) && !defined(USE_OPENSSL) |
| 1496 void BrowserOptionsHandler::ShowManageSSLCertificates(const ListValue* args) { | 1503 void BrowserOptionsHandler::ShowManageSSLCertificates(const ListValue* args) { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1759 const ProfileInfoCache& cache = | 1766 const ProfileInfoCache& cache = |
| 1760 g_browser_process->profile_manager()->GetProfileInfoCache(); | 1767 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 1761 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { | 1768 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { |
| 1762 if (existing_managed_user_id == cache.GetManagedUserIdOfProfileAtIndex(i)) | 1769 if (existing_managed_user_id == cache.GetManagedUserIdOfProfileAtIndex(i)) |
| 1763 return false; | 1770 return false; |
| 1764 } | 1771 } |
| 1765 return true; | 1772 return true; |
| 1766 } | 1773 } |
| 1767 | 1774 |
| 1768 } // namespace options | 1775 } // namespace options |
| OLD | NEW |