| OLD | NEW |
| 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/page_info/permission_menu_model.h" | 5 #include "chrome/browser/ui/page_info/permission_menu_model.h" |
| 6 | 6 |
| 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 8 #include "chrome/browser/plugins/plugin_utils.h" | 8 #include "chrome/browser/plugins/plugin_utils.h" |
| 9 #include "chrome/browser/plugins/plugins_field_trial.h" | 9 #include "chrome/browser/plugins/plugins_field_trial.h" |
| 10 #include "chrome/common/chrome_features.h" | 10 #include "chrome/common/chrome_features.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // Notifications does not support CONTENT_SETTING_ALLOW in incognito. | 79 // Notifications does not support CONTENT_SETTING_ALLOW in incognito. |
| 80 bool allow_disabled_for_notifications = | 80 bool allow_disabled_for_notifications = |
| 81 permission_.is_incognito && | 81 permission_.is_incognito && |
| 82 permission_.type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS; | 82 permission_.type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS; |
| 83 // Media only supports CONTENT_SETTTING_ALLOW for secure origins. | 83 // Media only supports CONTENT_SETTTING_ALLOW for secure origins. |
| 84 bool is_media_permission = | 84 bool is_media_permission = |
| 85 permission_.type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || | 85 permission_.type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || |
| 86 permission_.type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA; | 86 permission_.type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA; |
| 87 if (!allow_disabled_for_notifications && | 87 if (!allow_disabled_for_notifications && |
| 88 (!is_media_permission || content::IsOriginSecure(url))) { | 88 (!is_media_permission || content::IsOriginSecure(url))) { |
| 89 label = l10n_util::GetStringUTF16( | 89 label = l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_MENU_ITEM_ALLOW); |
| 90 IDS_WEBSITE_SETTINGS_MENU_ITEM_ALLOW); | |
| 91 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 90 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 92 label = WebsiteSettingsUI::PermissionActionToUIString( | 91 label = WebsiteSettingsUI::PermissionActionToUIString( |
| 93 profile, permission_.type, CONTENT_SETTING_ALLOW, | 92 profile, permission_.type, CONTENT_SETTING_ALLOW, |
| 94 effective_default_setting, permission_.source); | 93 effective_default_setting, permission_.source); |
| 95 } | 94 } |
| 96 AddCheckItem(CONTENT_SETTING_ALLOW, label); | 95 AddCheckItem(CONTENT_SETTING_ALLOW, label); |
| 97 } | 96 } |
| 98 | 97 |
| 99 // TODO(tommycli): With the HTML5 by Default feature, Flash is treated the | 98 // TODO(tommycli): With the HTML5 by Default feature, Flash is treated the |
| 100 // same as any other permission with ASK, i.e. there is no ASK exception. | 99 // same as any other permission with ASK, i.e. there is no ASK exception. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 147 } |
| 149 | 148 |
| 150 bool PermissionMenuModel::IsCommandIdEnabled(int command_id) const { | 149 bool PermissionMenuModel::IsCommandIdEnabled(int command_id) const { |
| 151 return true; | 150 return true; |
| 152 } | 151 } |
| 153 | 152 |
| 154 void PermissionMenuModel::ExecuteCommand(int command_id, int event_flags) { | 153 void PermissionMenuModel::ExecuteCommand(int command_id, int event_flags) { |
| 155 permission_.setting = static_cast<ContentSetting>(command_id); | 154 permission_.setting = static_cast<ContentSetting>(command_id); |
| 156 callback_.Run(permission_); | 155 callback_.Run(permission_); |
| 157 } | 156 } |
| OLD | NEW |