| Index: chrome/browser/plugins/chrome_plugin_service_filter_unittest.cc | 
| diff --git a/chrome/browser/plugins/chrome_plugin_service_filter_unittest.cc b/chrome/browser/plugins/chrome_plugin_service_filter_unittest.cc | 
| index edc2710ce031f8540f9889c901c349b689bba402..37ea660a4838f7e70203acc02960d0237b2a63fd 100644 | 
| --- a/chrome/browser/plugins/chrome_plugin_service_filter_unittest.cc | 
| +++ b/chrome/browser/plugins/chrome_plugin_service_filter_unittest.cc | 
| @@ -36,6 +36,7 @@ | 
| #include "content/public/browser/web_contents.h" | 
| #include "content/public/common/content_constants.h" | 
| #include "content/public/test/test_utils.h" | 
| +#include "url/origin.h" | 
|  | 
| namespace { | 
|  | 
| @@ -52,7 +53,7 @@ class ChromePluginServiceFilterTest : public ChromeRenderViewHostTestHarness { | 
| flash_plugin_path_(FILE_PATH_LITERAL("/path/to/flash")) {} | 
|  | 
| bool IsPluginAvailable(const GURL& plugin_content_url, | 
| -                         const GURL& main_url, | 
| +                         const url::Origin& main_frame_origin, | 
| const void* resource_context, | 
| const content::WebPluginInfo& plugin_info) { | 
| bool is_available = false; | 
| @@ -63,8 +64,9 @@ class ChromePluginServiceFilterTest : public ChromeRenderViewHostTestHarness { | 
| content::BrowserThread::PostTaskAndReply( | 
| content::BrowserThread::IO, FROM_HERE, | 
| base::Bind(&ChromePluginServiceFilterTest::IsPluginAvailableOnIOThread, | 
| -                   base::Unretained(this), plugin_content_url, main_url, | 
| -                   resource_context, plugin_info, &is_available), | 
| +                   base::Unretained(this), plugin_content_url, | 
| +                   main_frame_origin, resource_context, plugin_info, | 
| +                   &is_available), | 
| run_loop.QuitClosure()); | 
| run_loop.Run(); | 
|  | 
| @@ -85,14 +87,14 @@ class ChromePluginServiceFilterTest : public ChromeRenderViewHostTestHarness { | 
| } | 
|  | 
| void IsPluginAvailableOnIOThread(const GURL& plugin_content_url, | 
| -                                   const GURL& main_url, | 
| +                                   const url::Origin& main_frame_origin, | 
| const void* resource_context, | 
| content::WebPluginInfo plugin_info, | 
| bool* is_available) { | 
| *is_available = filter_->IsPluginAvailable( | 
| web_contents()->GetRenderProcessHost()->GetID(), | 
| web_contents()->GetMainFrame()->GetRoutingID(), resource_context, | 
| -        plugin_content_url, main_url, &plugin_info); | 
| +        plugin_content_url, main_frame_origin, &plugin_info); | 
| } | 
|  | 
| ChromePluginServiceFilter* filter_; | 
| @@ -103,8 +105,8 @@ TEST_F(ChromePluginServiceFilterTest, FlashAvailableByDefault) { | 
| content::WebPluginInfo flash_plugin( | 
| base::ASCIIToUTF16(content::kFlashPluginName), flash_plugin_path_, | 
| base::ASCIIToUTF16("1"), base::ASCIIToUTF16("The Flash plugin.")); | 
| -  EXPECT_TRUE(IsPluginAvailable(GURL(), GURL(), profile()->GetResourceContext(), | 
| -                                flash_plugin)); | 
| +  EXPECT_TRUE(IsPluginAvailable(GURL(), url::Origin(), | 
| +                                profile()->GetResourceContext(), flash_plugin)); | 
| } | 
|  | 
| TEST_F(ChromePluginServiceFilterTest, PreferHtmlOverPluginsDefault) { | 
| @@ -119,8 +121,9 @@ TEST_F(ChromePluginServiceFilterTest, PreferHtmlOverPluginsDefault) { | 
| // The default content setting should block Flash, as there should be 0 | 
| // engagement. | 
| GURL url("http://www.google.com"); | 
| -  EXPECT_FALSE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  url::Origin main_frame_origin(url); | 
| +  EXPECT_FALSE(IsPluginAvailable( | 
| +      url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); | 
|  | 
| // Block plugins. | 
| HostContentSettingsMap* map = | 
| @@ -128,22 +131,22 @@ TEST_F(ChromePluginServiceFilterTest, PreferHtmlOverPluginsDefault) { | 
| map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 
| CONTENT_SETTING_BLOCK); | 
|  | 
| -  EXPECT_FALSE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  EXPECT_FALSE(IsPluginAvailable( | 
| +      url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); | 
|  | 
| // Allow plugins. | 
| map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 
| CONTENT_SETTING_ALLOW); | 
|  | 
| -  EXPECT_TRUE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, | 
| +                                profile()->GetResourceContext(), flash_plugin)); | 
|  | 
| // Detect important content should block on 0 engagement. | 
| map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 
| CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); | 
|  | 
| -  EXPECT_FALSE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  EXPECT_FALSE(IsPluginAvailable( | 
| +      url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); | 
| } | 
|  | 
| TEST_F(ChromePluginServiceFilterTest, | 
| @@ -164,33 +167,34 @@ TEST_F(ChromePluginServiceFilterTest, | 
|  | 
| // This should respect the content setting and be allowed. | 
| GURL url("http://www.google.com"); | 
| -  EXPECT_TRUE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                flash_plugin)); | 
| +  url::Origin main_frame_origin(url); | 
| +  EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, | 
| +                                profile()->GetResourceContext(), flash_plugin)); | 
|  | 
| map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 
| CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); | 
|  | 
| // This should be blocked due to 0 engagement and a detect content setting. | 
| -  EXPECT_FALSE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  EXPECT_FALSE(IsPluginAvailable( | 
| +      url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); | 
|  | 
| SiteEngagementService* service = SiteEngagementService::Get(profile()); | 
| service->ResetScoreForURL(url, 0.5); | 
|  | 
| // Should still be blocked. | 
| -  EXPECT_FALSE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  EXPECT_FALSE(IsPluginAvailable( | 
| +      url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); | 
|  | 
| // Reaching 1.0 engagement should allow Flash. | 
| service->ResetScoreForURL(url, 1.0); | 
| -  EXPECT_TRUE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                flash_plugin)); | 
| +  EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, | 
| +                                profile()->GetResourceContext(), flash_plugin)); | 
|  | 
| // Blocked content setting should override engagement | 
| map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 
| CONTENT_SETTING_BLOCK); | 
| -  EXPECT_FALSE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  EXPECT_FALSE(IsPluginAvailable( | 
| +      url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); | 
| } | 
|  | 
| TEST_F(ChromePluginServiceFilterTest, PreferHtmlOverPluginsCustomEngagement) { | 
| @@ -231,23 +235,24 @@ TEST_F(ChromePluginServiceFilterTest, PreferHtmlOverPluginsCustomEngagement) { | 
|  | 
| // This should be blocked due to 0 engagement. | 
| GURL url("http://www.google.com"); | 
| -  EXPECT_FALSE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  url::Origin main_frame_origin(url); | 
| +  EXPECT_FALSE(IsPluginAvailable( | 
| +      url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); | 
|  | 
| // Should still be blocked until engagement reaches 4. | 
| SiteEngagementService* service = SiteEngagementService::Get(profile()); | 
| service->ResetScoreForURL(url, 0.5); | 
| -  EXPECT_FALSE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  EXPECT_FALSE(IsPluginAvailable( | 
| +      url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); | 
| service->ResetScoreForURL(url, 2.0); | 
| -  EXPECT_FALSE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  EXPECT_FALSE(IsPluginAvailable( | 
| +      url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); | 
| service->ResetScoreForURL(url, 3.0); | 
| -  EXPECT_FALSE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  EXPECT_FALSE(IsPluginAvailable( | 
| +      url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); | 
| service->ResetScoreForURL(url, 4.0); | 
| -  EXPECT_TRUE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, | 
| +                                profile()->GetResourceContext(), flash_plugin)); | 
|  | 
| variations::testing::ClearAllVariationParams(); | 
| } | 
| @@ -273,16 +278,17 @@ TEST_F(ChromePluginServiceFilterTest, | 
|  | 
| // We should fail the availablity check in incognito. | 
| GURL url("http://www.google.com"); | 
| -  EXPECT_FALSE(IsPluginAvailable(url, url, incognito->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  url::Origin main_frame_origin(url); | 
| +  EXPECT_FALSE(IsPluginAvailable( | 
| +      url, main_frame_origin, incognito->GetResourceContext(), flash_plugin)); | 
|  | 
| // Add sufficient engagement to allow Flash in the original profile. | 
| SiteEngagementService* service = SiteEngagementService::Get(profile()); | 
| service->ResetScoreForURL(url, 1.0); | 
|  | 
| // We should still fail the engagement check due to the block. | 
| -  EXPECT_FALSE(IsPluginAvailable(url, url, incognito->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  EXPECT_FALSE(IsPluginAvailable( | 
| +      url, main_frame_origin, incognito->GetResourceContext(), flash_plugin)); | 
|  | 
| // Change to detect important content in the original profile. | 
| map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 
| @@ -291,8 +297,8 @@ TEST_F(ChromePluginServiceFilterTest, | 
| // Ensure we pass the engagement check in the incognito profile (i.e. it falls | 
| // back to checking engagement from the original profile when nothing is found | 
| // in the incognito profile). | 
| -  EXPECT_TRUE(IsPluginAvailable(url, url, incognito->GetResourceContext(), | 
| -                                flash_plugin)); | 
| +  EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, | 
| +                                incognito->GetResourceContext(), flash_plugin)); | 
| } | 
|  | 
| TEST_F(ChromePluginServiceFilterTest, | 
| @@ -317,24 +323,25 @@ TEST_F(ChromePluginServiceFilterTest, | 
| // We pass the availablity check in incognito based on the original content | 
| // setting. | 
| GURL url("http://www.google.com"); | 
| -  EXPECT_TRUE(IsPluginAvailable(url, url, incognito->GetResourceContext(), | 
| -                                flash_plugin)); | 
| +  url::Origin main_frame_origin(url); | 
| +  EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, | 
| +                                incognito->GetResourceContext(), flash_plugin)); | 
|  | 
| map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 
| CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); | 
|  | 
| // Now we fail the availability check due to the content setting carrying | 
| // over. | 
| -  EXPECT_FALSE(IsPluginAvailable(url, url, incognito->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  EXPECT_FALSE(IsPluginAvailable( | 
| +      url, main_frame_origin, incognito->GetResourceContext(), flash_plugin)); | 
|  | 
| // Add sufficient engagement to allow Flash in the incognito profile. | 
| SiteEngagementService* service = SiteEngagementService::Get(incognito); | 
| service->ResetScoreForURL(url, 2.0); | 
|  | 
| // Ensure we pass the engagement check in the incognito profile. | 
| -  EXPECT_TRUE(IsPluginAvailable(url, url, incognito->GetResourceContext(), | 
| -                                flash_plugin)); | 
| +  EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, | 
| +                                incognito->GetResourceContext(), flash_plugin)); | 
| } | 
|  | 
| TEST_F(ChromePluginServiceFilterTest, BlockIfManagedSetting) { | 
| @@ -354,15 +361,16 @@ TEST_F(ChromePluginServiceFilterTest, BlockIfManagedSetting) { | 
| SiteEngagementService* service = SiteEngagementService::Get(profile()); | 
| // Reaching 1.0 engagement should allow Flash. | 
| GURL url("http://www.google.com"); | 
| +  url::Origin main_frame_origin(url); | 
| service->ResetScoreForURL(url, 1.0); | 
| -  EXPECT_TRUE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                flash_plugin)); | 
| +  EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, | 
| +                                profile()->GetResourceContext(), flash_plugin)); | 
|  | 
| // Enterprise ASK setting should block flash from being advertised. | 
| syncable_prefs::TestingPrefServiceSyncable* prefs = | 
| profile()->GetTestingPrefService(); | 
| prefs->SetManagedPref(prefs::kManagedDefaultPluginsSetting, | 
| new base::FundamentalValue(CONTENT_SETTING_ASK)); | 
| -  EXPECT_FALSE(IsPluginAvailable(url, url, profile()->GetResourceContext(), | 
| -                                 flash_plugin)); | 
| +  EXPECT_FALSE(IsPluginAvailable( | 
| +      url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); | 
| } | 
|  |