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

Side by Side Diff: chrome/browser/ui/views/website_settings/permission_selector_view.cc

Issue 10855031: Add UI string for the permissions drop downs of the Website Settings UI that are easy to localize. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/website_settings_popup_gtk.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/views/website_settings/permission_selector_view.h" 5 #include "chrome/browser/ui/views/website_settings/permission_selector_view.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/ui/website_settings/website_settings_ui.h" 8 #include "chrome/browser/ui/website_settings/website_settings_ui.h"
9 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
10 #include "ui/base/l10n/l10n_util.h" 10 #include "ui/base/l10n/l10n_util.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 PermissionMenuModel::PermissionMenuModel( 121 PermissionMenuModel::PermissionMenuModel(
122 ContentSettingsType site_permission, 122 ContentSettingsType site_permission,
123 ContentSetting default_setting, 123 ContentSetting default_setting,
124 ContentSetting current_setting, 124 ContentSetting current_setting,
125 PermissionSelectorView* parent) 125 PermissionSelectorView* parent)
126 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)), 126 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)),
127 site_permission_(site_permission), 127 site_permission_(site_permission),
128 default_setting_(default_setting), 128 default_setting_(default_setting),
129 current_setting_(current_setting), 129 current_setting_(current_setting),
130 permission_selector_(parent) { 130 permission_selector_(parent) {
131 string16 label = l10n_util::GetStringFUTF16( 131 string16 label;
132 IDS_WEBSITE_SETTINGS_DEFAULT_PERMISSION_LABEL, 132 switch (default_setting_) {
133 WebsiteSettingsUI::PermissionValueToUIString(default_setting_)); 133 case CONTENT_SETTING_ALLOW:
134 label = l10n_util::GetStringUTF16(
135 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ALLOW);
136 break;
137 case CONTENT_SETTING_BLOCK:
138 label = l10n_util::GetStringUTF16(
139 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_BLOCK);
140 break;
141 case CONTENT_SETTING_ASK:
142 label = l10n_util::GetStringUTF16(
143 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ASK);
144 break;
145 default:
146 break;
147 }
134 AddCheckItem(COMMAND_SET_TO_DEFAULT, label); 148 AddCheckItem(COMMAND_SET_TO_DEFAULT, label);
135 149
136 label = l10n_util::GetStringFUTF16( 150 label = l10n_util::GetStringUTF16(
137 IDS_WEBSITE_SETTINGS_PERMISSION_LABEL, 151 IDS_WEBSITE_SETTINGS_MENU_ITEM_ALLOW);
138 WebsiteSettingsUI::PermissionValueToUIString(CONTENT_SETTING_ALLOW));
139 AddCheckItem(COMMAND_SET_TO_ALLOW, label); 152 AddCheckItem(COMMAND_SET_TO_ALLOW, label);
140 153
141 if (site_permission != CONTENT_SETTINGS_TYPE_FULLSCREEN) { 154 if (site_permission != CONTENT_SETTINGS_TYPE_FULLSCREEN) {
142 label = l10n_util::GetStringFUTF16( 155 label = l10n_util::GetStringUTF16(
143 IDS_WEBSITE_SETTINGS_PERMISSION_LABEL, 156 IDS_WEBSITE_SETTINGS_MENU_ITEM_BLOCK);
144 WebsiteSettingsUI::PermissionValueToUIString(CONTENT_SETTING_BLOCK));
145 AddCheckItem(COMMAND_SET_TO_BLOCK, label); 157 AddCheckItem(COMMAND_SET_TO_BLOCK, label);
146 } 158 }
147 } 159 }
148 160
149 bool PermissionMenuModel::IsCommandIdChecked(int command_id) const { 161 bool PermissionMenuModel::IsCommandIdChecked(int command_id) const {
150 return current_setting_ == kSettingsForCommandIDs[command_id]; 162 return current_setting_ == kSettingsForCommandIDs[command_id];
151 } 163 }
152 164
153 bool PermissionMenuModel::IsCommandIdEnabled(int command_id) const { 165 bool PermissionMenuModel::IsCommandIdEnabled(int command_id) const {
154 return true; 166 return true;
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 SizeToPreferredSize(); 342 SizeToPreferredSize();
331 // FIXME: The parent is only a plain |View| that is used as a 343 // FIXME: The parent is only a plain |View| that is used as a
332 // container/box/panel. The SizeToPreferredSize method of the parent is 344 // container/box/panel. The SizeToPreferredSize method of the parent is
333 // called here directly in order not to implement a custom |View| class with 345 // called here directly in order not to implement a custom |View| class with
334 // its own implementation of the ChildPreferredSizeChanged method. 346 // its own implementation of the ChildPreferredSizeChanged method.
335 parent()->SizeToPreferredSize(); 347 parent()->SizeToPreferredSize();
336 } 348 }
337 349
338 PermissionSelectorView::~PermissionSelectorView() { 350 PermissionSelectorView::~PermissionSelectorView() {
339 } 351 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/website_settings_popup_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698