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 |
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1994 // Each item in the list has the following parameters: | 1994 // Each item in the list has the following parameters: |
1995 // 1. Title (string). | 1995 // 1. Title (string). |
1996 // 2. Value (double). | 1996 // 2. Value (double). |
1997 // 3. Is selected? (bool). | 1997 // 3. Is selected? (bool). |
1998 base::ListValue zoom_factors_value; | 1998 base::ListValue zoom_factors_value; |
1999 for (std::vector<double>::const_iterator i = zoom_factors.begin(); | 1999 for (std::vector<double>::const_iterator i = zoom_factors.begin(); |
2000 i != zoom_factors.end(); ++i) { | 2000 i != zoom_factors.end(); ++i) { |
2001 base::ListValue* option = new base::ListValue(); | 2001 base::ListValue* option = new base::ListValue(); |
2002 double factor = *i; | 2002 double factor = *i; |
2003 int percent = static_cast<int>(factor * 100 + 0.5); | 2003 int percent = static_cast<int>(factor * 100 + 0.5); |
2004 option->Append(new base::StringValue(base::FormatPercent(percent))); | 2004 option->AppendString(base::FormatPercent(percent)); |
2005 option->Append(new base::FundamentalValue(factor)); | 2005 option->AppendDouble(factor); |
2006 bool selected = content::ZoomValuesEqual(factor, default_zoom_factor); | 2006 bool selected = content::ZoomValuesEqual(factor, default_zoom_factor); |
2007 option->Append(new base::FundamentalValue(selected)); | 2007 option->AppendBoolean(selected); |
2008 zoom_factors_value.Append(option); | 2008 zoom_factors_value.Append(option); |
2009 } | 2009 } |
2010 | 2010 |
2011 web_ui()->CallJavascriptFunction( | 2011 web_ui()->CallJavascriptFunction( |
2012 "BrowserOptions.setupPageZoomSelector", zoom_factors_value); | 2012 "BrowserOptions.setupPageZoomSelector", zoom_factors_value); |
2013 } | 2013 } |
2014 | 2014 |
2015 void BrowserOptionsHandler::SetupAutoOpenFileTypes() { | 2015 void BrowserOptionsHandler::SetupAutoOpenFileTypes() { |
2016 // Set the hidden state for the AutoOpenFileTypesResetToDefault button. | 2016 // Set the hidden state for the AutoOpenFileTypesResetToDefault button. |
2017 // We show the button if the user has any auto-open file types registered. | 2017 // We show the button if the user has any auto-open file types registered. |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2179 | 2179 |
2180 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2180 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
2181 #if defined(OS_CHROMEOS) | 2181 #if defined(OS_CHROMEOS) |
2182 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2182 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
2183 #else | 2183 #else |
2184 return true; | 2184 return true; |
2185 #endif | 2185 #endif |
2186 } | 2186 } |
2187 | 2187 |
2188 } // namespace options | 2188 } // namespace options |
OLD | NEW |