Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(379)

Side by Side Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 1989563002: i18n of Zoom % to use locally correct numeric glyphs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/content_settings_handler.h" 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/bind_helpers.h" 14 #include "base/bind_helpers.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/i18n/number_formatting.h"
16 #include "base/logging.h" 17 #include "base/logging.h"
17 #include "base/macros.h" 18 #include "base/macros.h"
18 #include "base/memory/ptr_util.h" 19 #include "base/memory/ptr_util.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/values.h" 22 #include "base/values.h"
23 #include "build/build_config.h" 23 #include "build/build_config.h"
24 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
25 #include "chrome/browser/chrome_notification_types.h" 25 #include "chrome/browser/chrome_notification_types.h"
26 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 26 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
27 #include "chrome/browser/content_settings/web_site_settings_uma_util.h" 27 #include "chrome/browser/content_settings/web_site_settings_uma_util.h"
28 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 28 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
29 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 29 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
30 #include "chrome/browser/extensions/extension_special_storage_policy.h" 30 #include "chrome/browser/extensions/extension_special_storage_policy.h"
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 std::string setting_string = 1181 std::string setting_string =
1182 content_settings::ContentSettingToString(CONTENT_SETTING_DEFAULT); 1182 content_settings::ContentSettingToString(CONTENT_SETTING_DEFAULT);
1183 DCHECK(!setting_string.empty()); 1183 DCHECK(!setting_string.empty());
1184 1184
1185 exception->SetString(site_settings::kSetting, setting_string); 1185 exception->SetString(site_settings::kSetting, setting_string);
1186 1186
1187 // Calculate the zoom percent from the factor. Round up to the nearest whole 1187 // Calculate the zoom percent from the factor. Round up to the nearest whole
1188 // number. 1188 // number.
1189 int zoom_percent = static_cast<int>( 1189 int zoom_percent = static_cast<int>(
1190 content::ZoomLevelToZoomFactor(i->zoom_level) * 100 + 0.5); 1190 content::ZoomLevelToZoomFactor(i->zoom_level) * 100 + 0.5);
1191 exception->SetString( 1191 exception->SetString(kZoom, base::FormatPercent(zoom_percent));
1192 kZoom,
1193 l10n_util::GetStringFUTF16(IDS_ZOOM_PERCENT,
1194 base::IntToString16(zoom_percent)));
1195 exception->SetString( 1192 exception->SetString(
1196 site_settings::kSource, site_settings::kPreferencesSource); 1193 site_settings::kSource, site_settings::kPreferencesSource);
1197 // Append the new entry to the list and map. 1194 // Append the new entry to the list and map.
1198 zoom_levels_exceptions.Append(exception.release()); 1195 zoom_levels_exceptions.Append(exception.release());
1199 } 1196 }
1200 1197
1201 base::StringValue type_string(kZoomContentType); 1198 base::StringValue type_string(kZoomContentType);
1202 web_ui()->CallJavascriptFunction("ContentSettings.setExceptions", 1199 web_ui()->CallJavascriptFunction("ContentSettings.setExceptions",
1203 type_string, zoom_levels_exceptions); 1200 type_string, zoom_levels_exceptions);
1204 } 1201 }
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 1702
1706 // Exceptions apply only when the feature is enabled. 1703 // Exceptions apply only when the feature is enabled.
1707 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1704 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1708 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1705 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1709 web_ui()->CallJavascriptFunction( 1706 web_ui()->CallJavascriptFunction(
1710 "ContentSettings.enableProtectedContentExceptions", 1707 "ContentSettings.enableProtectedContentExceptions",
1711 base::FundamentalValue(enable_exceptions)); 1708 base::FundamentalValue(enable_exceptions));
1712 } 1709 }
1713 1710
1714 } // namespace options 1711 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698