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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
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/environment.h" | 14 #include "base/environment.h" |
| 15 #include "base/i18n/number_formatting.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
17 #include "base/metrics/field_trial.h" | 18 #include "base/metrics/field_trial.h" |
18 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
19 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
20 #include "base/strings/string_number_conversions.h" | |
21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
22 #include "base/value_conversions.h" | 22 #include "base/value_conversions.h" |
23 #include "base/values.h" | 23 #include "base/values.h" |
24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
25 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
26 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
27 #include "chrome/browser/custom_home_pages_table_model.h" | 27 #include "chrome/browser/custom_home_pages_table_model.h" |
28 #include "chrome/browser/download/download_prefs.h" | 28 #include "chrome/browser/download/download_prefs.h" |
29 #include "chrome/browser/gpu/gpu_mode_manager.h" | 29 #include "chrome/browser/gpu/gpu_mode_manager.h" |
30 #include "chrome/browser/lifetime/application_lifetime.h" | 30 #include "chrome/browser/lifetime/application_lifetime.h" |
(...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1992 // Each item in the list has the following parameters: | 1992 // Each item in the list has the following parameters: |
1993 // 1. Title (string). | 1993 // 1. Title (string). |
1994 // 2. Value (double). | 1994 // 2. Value (double). |
1995 // 3. Is selected? (bool). | 1995 // 3. Is selected? (bool). |
1996 base::ListValue zoom_factors_value; | 1996 base::ListValue zoom_factors_value; |
1997 for (std::vector<double>::const_iterator i = zoom_factors.begin(); | 1997 for (std::vector<double>::const_iterator i = zoom_factors.begin(); |
1998 i != zoom_factors.end(); ++i) { | 1998 i != zoom_factors.end(); ++i) { |
1999 base::ListValue* option = new base::ListValue(); | 1999 base::ListValue* option = new base::ListValue(); |
2000 double factor = *i; | 2000 double factor = *i; |
2001 int percent = static_cast<int>(factor * 100 + 0.5); | 2001 int percent = static_cast<int>(factor * 100 + 0.5); |
2002 option->Append(new base::StringValue( | 2002 option->Append(new base::StringValue(base::FormatPercent(percent))); |
2003 l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, percent))); | |
2004 option->Append(new base::FundamentalValue(factor)); | 2003 option->Append(new base::FundamentalValue(factor)); |
2005 bool selected = content::ZoomValuesEqual(factor, default_zoom_factor); | 2004 bool selected = content::ZoomValuesEqual(factor, default_zoom_factor); |
2006 option->Append(new base::FundamentalValue(selected)); | 2005 option->Append(new base::FundamentalValue(selected)); |
2007 zoom_factors_value.Append(option); | 2006 zoom_factors_value.Append(option); |
2008 } | 2007 } |
2009 | 2008 |
2010 web_ui()->CallJavascriptFunction( | 2009 web_ui()->CallJavascriptFunction( |
2011 "BrowserOptions.setupPageZoomSelector", zoom_factors_value); | 2010 "BrowserOptions.setupPageZoomSelector", zoom_factors_value); |
2012 } | 2011 } |
2013 | 2012 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2178 | 2177 |
2179 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2178 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
2180 #if defined(OS_CHROMEOS) | 2179 #if defined(OS_CHROMEOS) |
2181 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2180 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
2182 #else | 2181 #else |
2183 return true; | 2182 return true; |
2184 #endif | 2183 #endif |
2185 } | 2184 } |
2186 | 2185 |
2187 } // namespace options | 2186 } // namespace options |
OLD | NEW |