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

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

Issue 903683005: Always prompt for permission on fullscreen and mouse lock on file:// URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak unit test Created 5 years, 10 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/permission_menu_model.h" 5 #include "chrome/browser/ui/website_settings/permission_menu_model.h"
6 6
7 #include "chrome/grit/generated_resources.h" 7 #include "chrome/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(
(...skipping 23 matching lines...) Expand all
34 label = l10n_util::GetStringUTF16( 34 label = l10n_util::GetStringUTF16(
35 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_DETECT_IMPORTANT_CONTENT); 35 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_DETECT_IMPORTANT_CONTENT);
36 break; 36 break;
37 case CONTENT_SETTING_NUM_SETTINGS: 37 case CONTENT_SETTING_NUM_SETTINGS:
38 NOTREACHED(); 38 NOTREACHED();
39 default: 39 default:
40 break; 40 break;
41 } 41 }
42 AddCheckItem(CONTENT_SETTING_DEFAULT, label); 42 AddCheckItem(CONTENT_SETTING_DEFAULT, label);
43 43
44 // Media only support CONTENTE_SETTTING_ALLOW for https. 44 // CONTENT_SETTING_ALLOW and CONTENT_SETTING_BLOCK are not allowed for
45 if (permission_.type != CONTENT_SETTINGS_TYPE_MEDIASTREAM || 45 // fullscreen or mouse lock on file:// URLs, because there wouldn't be
46 url.SchemeIsSecure()) { 46 // a reasonable origin with which to associate the preference.
47 // TODO(estark): Revisit this when crbug.com/455882 is fixed.
48 bool is_exclusive_access_on_file =
49 (permission_.type == CONTENT_SETTINGS_TYPE_FULLSCREEN ||
50 permission_.type == CONTENT_SETTINGS_TYPE_MOUSELOCK) &&
51 url.SchemeIsFile();
52
53 // Media only support CONTENT_SETTTING_ALLOW for https.
54 if ((permission_.type != CONTENT_SETTINGS_TYPE_MEDIASTREAM ||
55 url.SchemeIsSecure()) &&
56 !is_exclusive_access_on_file) {
47 label = l10n_util::GetStringUTF16( 57 label = l10n_util::GetStringUTF16(
48 IDS_WEBSITE_SETTINGS_MENU_ITEM_ALLOW); 58 IDS_WEBSITE_SETTINGS_MENU_ITEM_ALLOW);
49 AddCheckItem(CONTENT_SETTING_ALLOW, label); 59 AddCheckItem(CONTENT_SETTING_ALLOW, label);
50 } 60 }
51 61
52 if (permission_.type == CONTENT_SETTINGS_TYPE_PLUGINS) { 62 if (permission_.type == CONTENT_SETTINGS_TYPE_PLUGINS) {
53 label = l10n_util::GetStringUTF16( 63 label = l10n_util::GetStringUTF16(
54 IDS_WEBSITE_SETTINGS_MENU_ITEM_DETECT_IMPORTANT_CONTENT); 64 IDS_WEBSITE_SETTINGS_MENU_ITEM_DETECT_IMPORTANT_CONTENT);
55 AddCheckItem(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, label); 65 AddCheckItem(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, label);
56 } 66 }
57 67
58 if (permission_.type != CONTENT_SETTINGS_TYPE_FULLSCREEN) { 68 if (permission_.type != CONTENT_SETTINGS_TYPE_FULLSCREEN &&
69 !is_exclusive_access_on_file) {
59 label = l10n_util::GetStringUTF16( 70 label = l10n_util::GetStringUTF16(
60 IDS_WEBSITE_SETTINGS_MENU_ITEM_BLOCK); 71 IDS_WEBSITE_SETTINGS_MENU_ITEM_BLOCK);
61 AddCheckItem(CONTENT_SETTING_BLOCK, label); 72 AddCheckItem(CONTENT_SETTING_BLOCK, label);
62 } 73 }
63 } 74 }
64 75
65 PermissionMenuModel::PermissionMenuModel(const GURL& url, 76 PermissionMenuModel::PermissionMenuModel(const GURL& url,
66 ContentSetting setting, 77 ContentSetting setting,
67 const ChangeCallback& callback) 78 const ChangeCallback& callback)
68 : ui::SimpleMenuModel(this), callback_(callback) { 79 : ui::SimpleMenuModel(this), callback_(callback) {
(...skipping 27 matching lines...) Expand all
96 int command_id, 107 int command_id,
97 ui::Accelerator* accelerator) { 108 ui::Accelerator* accelerator) {
98 // Accelerators are not supported. 109 // Accelerators are not supported.
99 return false; 110 return false;
100 } 111 }
101 112
102 void PermissionMenuModel::ExecuteCommand(int command_id, int event_flags) { 113 void PermissionMenuModel::ExecuteCommand(int command_id, int event_flags) {
103 permission_.setting = static_cast<ContentSetting>(command_id); 114 permission_.setting = static_cast<ContentSetting>(command_id);
104 callback_.Run(permission_); 115 callback_.Run(permission_);
105 } 116 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698