| 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 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1990 // Each item in the list has the following parameters: | 1990 // Each item in the list has the following parameters: |
| 1991 // 1. Title (string). | 1991 // 1. Title (string). |
| 1992 // 2. Value (double). | 1992 // 2. Value (double). |
| 1993 // 3. Is selected? (bool). | 1993 // 3. Is selected? (bool). |
| 1994 base::ListValue zoom_factors_value; | 1994 base::ListValue zoom_factors_value; |
| 1995 for (std::vector<double>::const_iterator i = zoom_factors.begin(); | 1995 for (std::vector<double>::const_iterator i = zoom_factors.begin(); |
| 1996 i != zoom_factors.end(); ++i) { | 1996 i != zoom_factors.end(); ++i) { |
| 1997 base::ListValue* option = new base::ListValue(); | 1997 base::ListValue* option = new base::ListValue(); |
| 1998 double factor = *i; | 1998 double factor = *i; |
| 1999 int percent = static_cast<int>(factor * 100 + 0.5); | 1999 int percent = static_cast<int>(factor * 100 + 0.5); |
| 2000 option->Append(new base::StringValue( | 2000 option->Append(new base::StringValue(base::FormatPercent(percent))); |
| 2001 l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, percent))); | |
| 2002 option->Append(new base::FundamentalValue(factor)); | 2001 option->Append(new base::FundamentalValue(factor)); |
| 2003 bool selected = content::ZoomValuesEqual(factor, default_zoom_factor); | 2002 bool selected = content::ZoomValuesEqual(factor, default_zoom_factor); |
| 2004 option->Append(new base::FundamentalValue(selected)); | 2003 option->Append(new base::FundamentalValue(selected)); |
| 2005 zoom_factors_value.Append(option); | 2004 zoom_factors_value.Append(option); |
| 2006 } | 2005 } |
| 2007 | 2006 |
| 2008 web_ui()->CallJavascriptFunction( | 2007 web_ui()->CallJavascriptFunction( |
| 2009 "BrowserOptions.setupPageZoomSelector", zoom_factors_value); | 2008 "BrowserOptions.setupPageZoomSelector", zoom_factors_value); |
| 2010 } | 2009 } |
| 2011 | 2010 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2176 | 2175 |
| 2177 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2176 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
| 2178 #if defined(OS_CHROMEOS) | 2177 #if defined(OS_CHROMEOS) |
| 2179 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2178 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
| 2180 #else | 2179 #else |
| 2181 return true; | 2180 return true; |
| 2182 #endif | 2181 #endif |
| 2183 } | 2182 } |
| 2184 | 2183 |
| 2185 } // namespace options | 2184 } // namespace options |
| OLD | NEW |