diff options
-rw-r--r-- | chrome/browser/tab_contents/chrome_interstitial_page.cc | 4 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 3 | ||||
-rw-r--r-- | chrome/renderer/chrome_render_view_observer.cc | 5 | ||||
-rw-r--r-- | chrome/renderer/chrome_render_view_observer.h | 1 | ||||
-rw-r--r-- | chrome/renderer/content_settings_observer.cc | 13 | ||||
-rw-r--r-- | chrome/renderer/content_settings_observer.h | 5 | ||||
-rw-r--r-- | chrome/renderer/content_settings_observer_browsertest.cc | 52 |
7 files changed, 1 insertions, 82 deletions
diff --git a/chrome/browser/tab_contents/chrome_interstitial_page.cc b/chrome/browser/tab_contents/chrome_interstitial_page.cc index 9c9940c..ce07ed9 100644 --- a/chrome/browser/tab_contents/chrome_interstitial_page.cc +++ b/chrome/browser/tab_contents/chrome_interstitial_page.cc @@ -8,8 +8,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_preferences_util.h" #include "chrome/common/chrome_notification_types.h" -#include "chrome/common/render_messages.h" -#include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" @@ -33,8 +31,6 @@ void ChromeInterstitialPage::Show() { notification_registrar_.Add( this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, content::Source<RenderViewHost>(render_view_host())); - render_view_host()->Send( - new ChromeViewMsg_SetAsInterstitial(render_view_host()->routing_id())); } void ChromeInterstitialPage::Observe( diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index eacfc6b..deb84a2 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -347,9 +347,6 @@ IPC_MESSAGE_ROUTED2(ChromeViewMsg_JavaScriptStressTestControl, // Asks the renderer to send back FPS. IPC_MESSAGE_ROUTED0(ChromeViewMsg_GetFPS) -// Tells the view it is displaying an interstitial page. -IPC_MESSAGE_ROUTED0(ChromeViewMsg_SetAsInterstitial) - //----------------------------------------------------------------------------- // TabContents messages // These are messages sent from the renderer to the browser process. diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc index 98e28e8..8367a83 100644 --- a/chrome/renderer/chrome_render_view_observer.cc +++ b/chrome/renderer/chrome_render_view_observer.cc @@ -269,7 +269,6 @@ bool ChromeRenderViewObserver::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(ChromeViewMsg_GetFPS, OnGetFPS) IPC_MESSAGE_HANDLER(ChromeViewMsg_AddStrictSecurityHost, OnAddStrictSecurityHost) - IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAsInterstitial, OnSetAsInterstitial) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -367,10 +366,6 @@ void ChromeRenderViewObserver::OnAddStrictSecurityHost( strict_security_hosts_.insert(host); } -void ChromeRenderViewObserver::OnSetAsInterstitial() { - content_settings_->SetAsInterstitial(); -} - void ChromeRenderViewObserver::Navigate(const GURL& url) { // Execute cache clear operations that were postponed until a navigation // event (including tab reload). diff --git a/chrome/renderer/chrome_render_view_observer.h b/chrome/renderer/chrome_render_view_observer.h index 4cb21e0..bbaa13e 100644 --- a/chrome/renderer/chrome_render_view_observer.h +++ b/chrome/renderer/chrome_render_view_observer.h @@ -133,7 +133,6 @@ class ChromeRenderViewObserver : public content::RenderViewObserver, void OnStartFrameSniffer(const string16& frame_name); void OnGetFPS(); void OnAddStrictSecurityHost(const std::string& host); - void OnSetAsInterstitial(); // Captures the thumbnail and text contents for indexing for the given load // ID. If the view's load ID is different than the parameter, this call is diff --git a/chrome/renderer/content_settings_observer.cc b/chrome/renderer/content_settings_observer.cc index 246d831b..beabcd7 100644 --- a/chrome/renderer/content_settings_observer.cc +++ b/chrome/renderer/content_settings_observer.cc @@ -68,8 +68,7 @@ ContentSettingsObserver::ContentSettingsObserver( : content::RenderViewObserver(render_view), content::RenderViewObserverTracker<ContentSettingsObserver>(render_view), content_setting_rules_(NULL), - plugins_temporarily_allowed_(false), - is_interstitial_page_(false) { + plugins_temporarily_allowed_(false) { ClearBlockedContentSettings(); } @@ -163,8 +162,6 @@ bool ContentSettingsObserver::AllowFileSystem(WebFrame* frame) { bool ContentSettingsObserver::AllowImage(WebFrame* frame, bool enabled_per_settings, const WebURL& image_url) { - if (is_interstitial_page_) - return true; if (IsWhitelistedForContentSettings(frame)) return true; @@ -203,8 +200,6 @@ bool ContentSettingsObserver::AllowPlugins(WebFrame* frame, bool ContentSettingsObserver::AllowScript(WebFrame* frame, bool enabled_per_settings) { - if (is_interstitial_page_) - return true; if (!enabled_per_settings) return false; @@ -234,8 +229,6 @@ bool ContentSettingsObserver::AllowScriptFromSource( WebFrame* frame, bool enabled_per_settings, const WebKit::WebURL& script_url) { - if (is_interstitial_page_) - return true; if (!enabled_per_settings) return false; @@ -279,10 +272,6 @@ void ContentSettingsObserver::DidNotAllowScript(WebFrame* frame) { DidBlockContentType(CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()); } -void ContentSettingsObserver::SetAsInterstitial() { - is_interstitial_page_ = true; -} - void ContentSettingsObserver::OnLoadBlockedPlugins() { plugins_temporarily_allowed_ = true; } diff --git a/chrome/renderer/content_settings_observer.h b/chrome/renderer/content_settings_observer.h index 689a77d..027867c 100644 --- a/chrome/renderer/content_settings_observer.h +++ b/chrome/renderer/content_settings_observer.h @@ -65,10 +65,6 @@ class ContentSettingsObserver void DidNotAllowPlugins(WebKit::WebFrame* frame); void DidNotAllowScript(WebKit::WebFrame* frame); - // Used for allowing scripts and images on views displaying interstitial - // pages. - void SetAsInterstitial(); - private: FRIEND_TEST_ALL_PREFIXES(ContentSettingsObserverTest, WhitelistedSchemes); @@ -107,7 +103,6 @@ class ContentSettingsObserver std::map<WebKit::WebFrame*, bool> cached_script_permissions_; bool plugins_temporarily_allowed_; - bool is_interstitial_page_; DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); }; diff --git a/chrome/renderer/content_settings_observer_browsertest.cc b/chrome/renderer/content_settings_observer_browsertest.cc index db720f5..d05df62 100644 --- a/chrome/renderer/content_settings_observer_browsertest.cc +++ b/chrome/renderer/content_settings_observer_browsertest.cc @@ -322,55 +322,3 @@ TEST_F(ChromeRenderViewTest, ContentSettingsAllowScripts) { } EXPECT_FALSE(was_blocked); } - -TEST_F(ChromeRenderViewTest, ContentSettingsInterstitialPages) { - MockContentSettingsObserver mock_observer(view_); - // Block scripts. - RendererContentSettingRules content_setting_rules; - ContentSettingsForOneType& script_setting_rules = - content_setting_rules.script_rules; - script_setting_rules.push_back( - ContentSettingPatternSource( - ContentSettingsPattern::Wildcard(), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTING_BLOCK, "", false)); - // Block images. - ContentSettingsForOneType& image_setting_rules = - content_setting_rules.image_rules; - image_setting_rules.push_back( - ContentSettingPatternSource( - ContentSettingsPattern::Wildcard(), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTING_BLOCK, "", false)); - - ContentSettingsObserver* observer = ContentSettingsObserver::Get(view_); - observer->SetContentSettingRules(&content_setting_rules); - observer->SetAsInterstitial(); - - // Load a page which contains a script. - std::string html = "<html>" - "<head>" - "<script src='data:foo'></script>" - "</head>" - "<body>" - "</body>" - "</html>"; - LoadHTML(html.c_str()); - - // Verify that the script was allowed. - bool was_blocked = false; - for (size_t i = 0; i < render_thread_->sink().message_count(); ++i) { - const IPC::Message* msg = render_thread_->sink().GetMessageAt(i); - if (msg->type() == ChromeViewHostMsg_ContentBlocked::ID) - was_blocked = true; - } - EXPECT_FALSE(was_blocked); - - // Verify that images are allowed. - EXPECT_CALL( - mock_observer, - OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES, std::string())).Times(0); - EXPECT_TRUE(observer->AllowImage(GetMainFrame(), true, - mock_observer.image_url_)); - ::testing::Mock::VerifyAndClearExpectations(&observer); -} |