Page Info Desktop: Always show the Flash permission.
Show the Flash permission always on desktop Page Info.
Bug: 791142
Change-Id: I42dd4e856ce0818cea9905e36669a74cc54a6f98
Reviewed-on: https://chromium-review.googlesource.com/809987
Commit-Queue: Patti <[email protected]>
Reviewed-by: Raymes Khoury <[email protected]>
Cr-Commit-Position: refs/heads/master@{#522281}
diff --git a/chrome/browser/ui/page_info/page_info.cc b/chrome/browser/ui/page_info/page_info.cc
index 216301a..36818182 100644
--- a/chrome/browser/ui/page_info/page_info.cc
+++ b/chrome/browser/ui/page_info/page_info.cc
@@ -181,6 +181,10 @@
// gets checked there regardless of default setting on Desktop.
if (info.type == CONTENT_SETTINGS_TYPE_GEOLOCATION)
return true;
+#else
+ // Flash will always be shown. See https://crbug.com/791142.
+ if (info.type == CONTENT_SETTINGS_TYPE_PLUGINS)
+ return true;
#endif
#if !defined(OS_ANDROID)
diff --git a/chrome/browser/ui/page_info/page_info_unittest.cc b/chrome/browser/ui/page_info/page_info_unittest.cc
index 40b39a0..f393964a 100644
--- a/chrome/browser/ui/page_info/page_info_unittest.cc
+++ b/chrome/browser/ui/page_info/page_info_unittest.cc
@@ -213,25 +213,34 @@
TEST_F(PageInfoTest, NonFactoryDefaultAndRecentlyChangedPermissionsShown) {
page_info()->PresentSitePermissions();
-// By default, the number of permissions shown should be 0, except on Android,
-// where Geolocation needs to be checked for DSE settings.
+ std::vector<ContentSettingsType> expected_visible_permissions;
+
#if defined(OS_ANDROID)
+ // Geolocation is always allowed to pass through to Android-specific logic to
+ // check for DSE settings (so expect 1 item), but isn't actually shown later
+ // on because this test isn't testing with a default search engine origin.
EXPECT_EQ(1uL, last_permission_info_list().size());
+ EXPECT_EQ(CONTENT_SETTINGS_TYPE_GEOLOCATION,
+ last_permission_info_list().back().type);
#else
- EXPECT_EQ(0uL, last_permission_info_list().size());
+ expected_visible_permissions.push_back(CONTENT_SETTINGS_TYPE_PLUGINS);
+ // Flash is always visible on desktop - see https://crbug.com/791142.
+ EXPECT_EQ(expected_visible_permissions.size(),
+ last_permission_info_list().size());
+ EXPECT_EQ(CONTENT_SETTINGS_TYPE_PLUGINS,
+ last_permission_info_list().back().type);
#endif
- std::vector<ContentSettingsType> expected_visible_permissions = {
- CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
- CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
- };
// Change some default-ask settings away from the default.
page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_GEOLOCATION,
CONTENT_SETTING_ALLOW);
+ expected_visible_permissions.push_back(CONTENT_SETTINGS_TYPE_GEOLOCATION);
page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
CONTENT_SETTING_ALLOW);
+ expected_visible_permissions.push_back(CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
CONTENT_SETTING_ALLOW);
+ expected_visible_permissions.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
EXPECT_EQ(expected_visible_permissions.size(),
last_permission_info_list().size());
diff --git a/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc b/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc
index 0ad3a32..2f4b9c2 100644
--- a/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc
+++ b/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc
@@ -221,11 +221,12 @@
list.back().is_incognito = false;
list.back().setting = CONTENT_SETTING_BLOCK;
- // Initially, no permissions are shown because they are all set to default.
- int num_expected_children = 0;
+ // Initially, no permissions are shown because they are all set to default,
+ // except for Flash.
+ int num_expected_children = 3;
EXPECT_EQ(num_expected_children, api_->permissions_view()->child_count());
- num_expected_children = kViewsPerPermissionRow * list.size();
+ num_expected_children += kViewsPerPermissionRow * list.size();
list.back().setting = CONTENT_SETTING_ALLOW;
api_->SetPermissionInfo(list);
EXPECT_EQ(num_expected_children, api_->permissions_view()->child_count());
@@ -279,7 +280,8 @@
// Test UI construction and reconstruction with USB devices.
TEST_F(PageInfoBubbleViewTest, SetPermissionInfoWithUsbDevice) {
- const int kExpectedChildren = 0;
+ // One permission row is always shown here (Flash). https://crbug.com/791142
+ const int kExpectedChildren = kViewsPerPermissionRow;
EXPECT_EQ(kExpectedChildren, api_->permissions_view()->child_count());
const GURL origin = GURL(kUrl).GetOrigin();