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" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
15 #include "base/metrics/field_trial.h" | |
16 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
17 #include "base/path_service.h" | 16 #include "base/path_service.h" |
18 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
19 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
20 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
21 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
22 #include "base/value_conversions.h" | 21 #include "base/value_conversions.h" |
23 #include "base/values.h" | 22 #include "base/values.h" |
24 #include "chrome/browser/auto_launch_trial.h" | 23 #include "chrome/browser/auto_launch_trial.h" |
25 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 using content::BrowserThread; | 114 using content::BrowserThread; |
116 using content::DownloadManager; | 115 using content::DownloadManager; |
117 using content::OpenURLParams; | 116 using content::OpenURLParams; |
118 using content::Referrer; | 117 using content::Referrer; |
119 using content::UserMetricsAction; | 118 using content::UserMetricsAction; |
120 | 119 |
121 namespace options { | 120 namespace options { |
122 | 121 |
123 namespace { | 122 namespace { |
124 | 123 |
125 // Constants for the new tab button field trial. | |
126 const char kProfileResetTrialName[] = "ManualResetProfile"; | |
127 const char kProfileResetTrialEnableGroupName[] = "Enable"; | |
128 | |
129 bool ShouldShowMultiProfilesUserList(chrome::HostDesktopType desktop_type) { | 124 bool ShouldShowMultiProfilesUserList(chrome::HostDesktopType desktop_type) { |
130 #if defined(OS_CHROMEOS) | 125 #if defined(OS_CHROMEOS) |
131 // On Chrome OS we use different UI for multi-profiles. | 126 // On Chrome OS we use different UI for multi-profiles. |
132 return false; | 127 return false; |
133 #else | 128 #else |
134 if (desktop_type != chrome::HOST_DESKTOP_TYPE_NATIVE) | 129 if (desktop_type != chrome::HOST_DESKTOP_TYPE_NATIVE) |
135 return false; | 130 return false; |
136 return profiles::IsMultipleProfilesEnabled(); | 131 return profiles::IsMultipleProfilesEnabled(); |
137 #endif | 132 #endif |
138 } | 133 } |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 values->Set("profilesInfo", GetProfilesInfoList().release()); | 519 values->Set("profilesInfo", GetProfilesInfoList().release()); |
525 | 520 |
526 values->SetBoolean("profileIsManaged", | 521 values->SetBoolean("profileIsManaged", |
527 Profile::FromWebUI(web_ui())->IsManaged()); | 522 Profile::FromWebUI(web_ui())->IsManaged()); |
528 | 523 |
529 #if !defined(OS_CHROMEOS) | 524 #if !defined(OS_CHROMEOS) |
530 values->SetBoolean( | 525 values->SetBoolean( |
531 "gpuEnabledAtStart", | 526 "gpuEnabledAtStart", |
532 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); | 527 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); |
533 #endif | 528 #endif |
534 | |
535 bool finch_allows_button = | |
536 base::FieldTrialList::FindFullName(kProfileResetTrialName) == | |
537 kProfileResetTrialEnableGroupName; | |
538 values->SetBoolean("enableResetProfileSettingsSection", | |
539 finch_allows_button || | |
540 CommandLine::ForCurrentProcess()->HasSwitch( | |
541 switches::kEnableResetProfileSettings)); | |
542 } | 529 } |
543 | 530 |
544 #if defined(ENABLE_FULL_PRINTING) | 531 #if defined(ENABLE_FULL_PRINTING) |
545 void BrowserOptionsHandler::RegisterCloudPrintValues(DictionaryValue* values) { | 532 void BrowserOptionsHandler::RegisterCloudPrintValues(DictionaryValue* values) { |
546 #if defined(OS_CHROMEOS) | 533 #if defined(OS_CHROMEOS) |
547 values->SetString("cloudPrintChromeosOptionLabel", | 534 values->SetString("cloudPrintChromeosOptionLabel", |
548 l10n_util::GetStringFUTF16( | 535 l10n_util::GetStringFUTF16( |
549 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, | 536 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, |
550 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); | 537 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); |
551 values->SetString("cloudPrintChromeosOptionButton", | 538 values->SetString("cloudPrintChromeosOptionButton", |
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 const ProfileInfoCache& cache = | 1806 const ProfileInfoCache& cache = |
1820 g_browser_process->profile_manager()->GetProfileInfoCache(); | 1807 g_browser_process->profile_manager()->GetProfileInfoCache(); |
1821 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { | 1808 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { |
1822 if (existing_managed_user_id == cache.GetManagedUserIdOfProfileAtIndex(i)) | 1809 if (existing_managed_user_id == cache.GetManagedUserIdOfProfileAtIndex(i)) |
1823 return false; | 1810 return false; |
1824 } | 1811 } |
1825 return true; | 1812 return true; |
1826 } | 1813 } |
1827 | 1814 |
1828 } // namespace options | 1815 } // namespace options |
OLD | NEW |