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

Side by Side Diff: chrome/renderer/content_settings_observer.h

Issue 8775005: Content settings: whitelist kExtensionScheme and kChromeInternalScheme on the renderer side. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review. Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/renderer/content_settings_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ 5 #ifndef CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_
6 #define CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ 6 #define CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 const WebKit::WebSecurityOrigin& origin); 59 const WebKit::WebSecurityOrigin& origin);
60 bool AllowPlugins(WebKit::WebFrame* frame, bool enabled_per_settings); 60 bool AllowPlugins(WebKit::WebFrame* frame, bool enabled_per_settings);
61 bool AllowScript(WebKit::WebFrame* frame, bool enabled_per_settings); 61 bool AllowScript(WebKit::WebFrame* frame, bool enabled_per_settings);
62 bool AllowScriptFromSource(WebKit::WebFrame* frame, bool enabled_per_settings, 62 bool AllowScriptFromSource(WebKit::WebFrame* frame, bool enabled_per_settings,
63 const WebKit::WebURL& script_url); 63 const WebKit::WebURL& script_url);
64 bool AllowStorage(WebKit::WebFrame* frame, bool local); 64 bool AllowStorage(WebKit::WebFrame* frame, bool local);
65 void DidNotAllowPlugins(WebKit::WebFrame* frame); 65 void DidNotAllowPlugins(WebKit::WebFrame* frame);
66 void DidNotAllowScript(WebKit::WebFrame* frame); 66 void DidNotAllowScript(WebKit::WebFrame* frame);
67 67
68 private: 68 private:
69 FRIEND_TEST_ALL_PREFIXES(ContentSettingsObserverTest, WhitelistedSchemes);
70
69 // RenderViewObserver implementation. 71 // RenderViewObserver implementation.
70 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 72 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
71 virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame, 73 virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame,
72 bool is_new_navigation) OVERRIDE; 74 bool is_new_navigation) OVERRIDE;
73 75
74 // Message handlers. 76 // Message handlers.
75 void OnLoadBlockedPlugins(); 77 void OnLoadBlockedPlugins();
76 78
77 // Resets the |content_blocked_| array. 79 // Resets the |content_blocked_| array.
78 void ClearBlockedContentSettings(); 80 void ClearBlockedContentSettings();
79 81
82 // Helpers.
83 // True if |frame| contains content that is white-listed for content settings.
84 static bool IsWhitelistedForContentSettings(WebKit::WebFrame* frame);
85 static bool IsWhitelistedForContentSettings(
86 const WebKit::WebSecurityOrigin& origin,
87 const GURL& document_url);
88
80 // A pointer to content setting rules stored by the renderer. Normally, the 89 // A pointer to content setting rules stored by the renderer. Normally, the
81 // |RendererContentSettingRules| object is owned by 90 // |RendererContentSettingRules| object is owned by
82 // |ChromeRenderProcessObserver|. In the tests it is owned by the caller of 91 // |ChromeRenderProcessObserver|. In the tests it is owned by the caller of
83 // |SetContentSettingRules|. 92 // |SetContentSettingRules|.
84 const RendererContentSettingRules* content_setting_rules_; 93 const RendererContentSettingRules* content_setting_rules_;
85 94
86 // Stores if images, scripts, and plugins have actually been blocked. 95 // Stores if images, scripts, and plugins have actually been blocked.
87 bool content_blocked_[CONTENT_SETTINGS_NUM_TYPES]; 96 bool content_blocked_[CONTENT_SETTINGS_NUM_TYPES];
88 97
89 // Caches the result of AllowStorage. 98 // Caches the result of AllowStorage.
90 typedef std::pair<GURL, bool> StoragePermissionsKey; 99 typedef std::pair<GURL, bool> StoragePermissionsKey;
91 std::map<StoragePermissionsKey, bool> cached_storage_permissions_; 100 std::map<StoragePermissionsKey, bool> cached_storage_permissions_;
92 101
93 // Caches the result of |AllowScript|. 102 // Caches the result of |AllowScript|.
94 std::map<WebKit::WebFrame*, bool> cached_script_permissions_; 103 std::map<WebKit::WebFrame*, bool> cached_script_permissions_;
95 104
96 bool plugins_temporarily_allowed_; 105 bool plugins_temporarily_allowed_;
97 106
98 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); 107 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver);
99 }; 108 };
100 109
101 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ 110 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/renderer/content_settings_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698