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

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

Issue 11571010: fixed the DCHECK and also corrected the website setting UI for media (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed Markus' comment and consolidated |web_content_|. Created 8 years 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/website_settings/permission_menu_model.h ('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/website_settings/permission_menu_model.h" 5 #include "chrome/browser/ui/website_settings/permission_menu_model.h"
6 6
7 #include "grit/generated_resources.h" 7 #include "grit/generated_resources.h"
8 #include "ui/base/l10n/l10n_util.h" 8 #include "ui/base/l10n/l10n_util.h"
9 9
10 PermissionMenuModel::PermissionMenuModel( 10 PermissionMenuModel::PermissionMenuModel(
11 Delegate* delegate, 11 Delegate* delegate,
12 const GURL& url,
12 ContentSettingsType type, 13 ContentSettingsType type,
13 ContentSetting default_setting, 14 ContentSetting default_setting,
14 ContentSetting current_setting) 15 ContentSetting current_setting)
15 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)), 16 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)),
16 delegate_(delegate) { 17 delegate_(delegate),
18 site_url_(url) {
17 string16 label; 19 string16 label;
18 switch (default_setting) { 20 switch (default_setting) {
19 case CONTENT_SETTING_ALLOW: 21 case CONTENT_SETTING_ALLOW:
20 label = l10n_util::GetStringUTF16( 22 label = l10n_util::GetStringUTF16(
21 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ALLOW); 23 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ALLOW);
22 break; 24 break;
23 case CONTENT_SETTING_BLOCK: 25 case CONTENT_SETTING_BLOCK:
24 label = l10n_util::GetStringUTF16( 26 label = l10n_util::GetStringUTF16(
25 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_BLOCK); 27 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_BLOCK);
26 break; 28 break;
27 case CONTENT_SETTING_ASK: 29 case CONTENT_SETTING_ASK:
28 label = l10n_util::GetStringUTF16( 30 label = l10n_util::GetStringUTF16(
29 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ASK); 31 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ASK);
30 break; 32 break;
31 default: 33 default:
32 break; 34 break;
33 } 35 }
34 AddCheckItem(COMMAND_SET_TO_DEFAULT, label); 36 AddCheckItem(COMMAND_SET_TO_DEFAULT, label);
35 37
36 // TODO(xians): Media should support COMMAND_SET_TO_ALLOW for https. 38 // Media only support COMMAND_SET_TO_ALLOW for https.
37 if (type != CONTENT_SETTINGS_TYPE_MEDIASTREAM) { 39 if (type != CONTENT_SETTINGS_TYPE_MEDIASTREAM ||
40 url.SchemeIsSecure()) {
38 label = l10n_util::GetStringUTF16( 41 label = l10n_util::GetStringUTF16(
39 IDS_WEBSITE_SETTINGS_MENU_ITEM_ALLOW); 42 IDS_WEBSITE_SETTINGS_MENU_ITEM_ALLOW);
40 AddCheckItem(COMMAND_SET_TO_ALLOW, label); 43 AddCheckItem(COMMAND_SET_TO_ALLOW, label);
41 } 44 }
42 if (type != CONTENT_SETTINGS_TYPE_FULLSCREEN) { 45 if (type != CONTENT_SETTINGS_TYPE_FULLSCREEN) {
43 label = l10n_util::GetStringUTF16( 46 label = l10n_util::GetStringUTF16(
44 IDS_WEBSITE_SETTINGS_MENU_ITEM_BLOCK); 47 IDS_WEBSITE_SETTINGS_MENU_ITEM_BLOCK);
45 AddCheckItem(COMMAND_SET_TO_BLOCK, label); 48 AddCheckItem(COMMAND_SET_TO_BLOCK, label);
46 } 49 }
47 } 50 }
(...skipping 12 matching lines...) Expand all
60 int command_id, 63 int command_id,
61 ui::Accelerator* accelerator) { 64 ui::Accelerator* accelerator) {
62 // Accelerators are not supported. 65 // Accelerators are not supported.
63 return false; 66 return false;
64 } 67 }
65 68
66 void PermissionMenuModel::ExecuteCommand(int command_id) { 69 void PermissionMenuModel::ExecuteCommand(int command_id) {
67 if (delegate_) 70 if (delegate_)
68 delegate_->ExecuteCommand(command_id); 71 delegate_->ExecuteCommand(command_id);
69 } 72 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/website_settings/permission_menu_model.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698