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

Side by Side Diff: chrome/browser/ui/website_settings/website_settings_ui.cc

Issue 2702923002: Page Info: Hide default permissions with a value of Ask if the default is Ask. (Closed)
Patch Set: Page Info: Add cross-platform logic to hide permissions with default values behind a button. Created 3 years, 9 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/website_settings/website_settings_ui.h" 5 #include "chrome/browser/ui/website_settings/website_settings_ui.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
9 #include "chrome/browser/plugins/plugin_utils.h" 9 #include "chrome/browser/plugins/plugin_utils.h"
10 #include "chrome/browser/plugins/plugins_field_trial.h" 10 #include "chrome/browser/plugins/plugins_field_trial.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 default: 277 default:
278 NOTREACHED(); 278 NOTREACHED();
279 return base::string16(); 279 return base::string16();
280 } 280 }
281 int button_text_id = button_text_ids[effective_setting]; 281 int button_text_id = button_text_ids[effective_setting];
282 DCHECK_NE(button_text_id, kInvalidResourceID); 282 DCHECK_NE(button_text_id, kInvalidResourceID);
283 return l10n_util::GetStringUTF16(button_text_id); 283 return l10n_util::GetStringUTF16(button_text_id);
284 } 284 }
285 285
286 // static 286 // static
287 base::string16 WebsiteSettingsUI::GetPermissionButtonString(
288 VisiblePermissions visible_permissions) {
palmer 2017/02/24 01:55:02 Nit: I'd expect |VisiblePermissions| to be some ki
lgarron 2017/02/24 02:15:26 I was on the fence, but I need something that conv
289 switch (visible_permissions) {
290 case VISIBLE_PERMISSIONS_NONE:
291 return l10n_util::GetStringUTF16(IDS_PAGE_INFO_EDIT_PERMISSIONS_LINK);
292 case VISIBLE_PERMISSIONS_SOME_BUT_NOT_ALL:
palmer 2017/02/24 01:55:02 Nit: "Some" is vague. Maybe |PERMISSIONS_VISIBILIT
lgarron 2017/02/24 02:15:27 The problem with that is that there can be 0 non-d
293 return l10n_util::GetStringUTF16(IDS_PAGE_INFO_SHOW_ALL_PERMISSIONS_LINK);
294 case VISIBLE_PERMISSIONS_ALL:
295 return l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_SETTINGS_LINK);
296 default:
297 NOTREACHED();
298 }
299 }
300
301 // static
287 int WebsiteSettingsUI::GetPermissionIconID(ContentSettingsType type, 302 int WebsiteSettingsUI::GetPermissionIconID(ContentSettingsType type,
288 ContentSetting setting) { 303 ContentSetting setting) {
289 bool use_blocked = (setting == CONTENT_SETTING_BLOCK); 304 bool use_blocked = (setting == CONTENT_SETTING_BLOCK);
290 for (const PermissionsUIInfo& info : kPermissionsUIInfo) { 305 for (const PermissionsUIInfo& info : kPermissionsUIInfo) {
291 if (info.type == type) 306 if (info.type == type)
292 return use_blocked ? info.blocked_icon_id : info.allowed_icon_id; 307 return use_blocked ? info.blocked_icon_id : info.allowed_icon_id;
293 } 308 }
294 NOTREACHED(); 309 NOTREACHED();
295 return IDR_INFO; 310 return IDR_INFO;
296 } 311 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 } 402 }
388 return resource_id; 403 return resource_id;
389 } 404 }
390 405
391 // static 406 // static
392 const gfx::Image& WebsiteSettingsUI::GetConnectionIcon( 407 const gfx::Image& WebsiteSettingsUI::GetConnectionIcon(
393 WebsiteSettings::SiteConnectionStatus status) { 408 WebsiteSettings::SiteConnectionStatus status) {
394 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 409 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
395 return rb.GetNativeImageNamed(GetConnectionIconID(status)); 410 return rb.GetNativeImageNamed(GetConnectionIconID(status));
396 } 411 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698