| 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 #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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 bool allowMutationEvents(bool default_value) override; | 78 bool allowMutationEvents(bool default_value) override; |
| 79 void didNotAllowPlugins() override; | 79 void didNotAllowPlugins() override; |
| 80 void didNotAllowScript() override; | 80 void didNotAllowScript() override; |
| 81 void didUseKeygen() override; | 81 void didUseKeygen() override; |
| 82 bool allowDisplayingInsecureContent(bool allowed_per_settings, | 82 bool allowDisplayingInsecureContent(bool allowed_per_settings, |
| 83 const blink::WebURL& url) override; | 83 const blink::WebURL& url) override; |
| 84 bool allowRunningInsecureContent(bool allowed_per_settings, | 84 bool allowRunningInsecureContent(bool allowed_per_settings, |
| 85 const blink::WebSecurityOrigin& context, | 85 const blink::WebSecurityOrigin& context, |
| 86 const blink::WebURL& url) override; | 86 const blink::WebURL& url) override; |
| 87 | 87 |
| 88 // This is used for cases when the NPAPI plugins malfunction if used. | |
| 89 bool AreNPAPIPluginsBlocked() const; | |
| 90 | |
| 91 private: | 88 private: |
| 92 FRIEND_TEST_ALL_PREFIXES(ContentSettingsObserverTest, WhitelistedSchemes); | 89 FRIEND_TEST_ALL_PREFIXES(ContentSettingsObserverTest, WhitelistedSchemes); |
| 93 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, | 90 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, |
| 94 ContentSettingsInterstitialPages); | 91 ContentSettingsInterstitialPages); |
| 95 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, PluginsTemporarilyAllowed); | 92 FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, PluginsTemporarilyAllowed); |
| 96 | 93 |
| 97 // RenderFrameObserver implementation. | 94 // RenderFrameObserver implementation. |
| 98 bool OnMessageReceived(const IPC::Message& message) override; | 95 bool OnMessageReceived(const IPC::Message& message) override; |
| 99 void DidCommitProvisionalLoad(bool is_new_navigation, | 96 void DidCommitProvisionalLoad(bool is_new_navigation, |
| 100 bool is_same_page_navigation) override; | 97 bool is_same_page_navigation) override; |
| 101 | 98 |
| 102 // Message handlers. | 99 // Message handlers. |
| 103 void OnLoadBlockedPlugins(const std::string& identifier); | 100 void OnLoadBlockedPlugins(const std::string& identifier); |
| 104 void OnSetAsInterstitial(); | 101 void OnSetAsInterstitial(); |
| 105 void OnNPAPINotSupported(); | |
| 106 void OnSetAllowDisplayingInsecureContent(bool allow); | 102 void OnSetAllowDisplayingInsecureContent(bool allow); |
| 107 void OnSetAllowRunningInsecureContent(bool allow); | 103 void OnSetAllowRunningInsecureContent(bool allow); |
| 108 void OnReloadFrame(); | 104 void OnReloadFrame(); |
| 109 void OnRequestFileSystemAccessAsyncResponse(int request_id, bool allowed); | 105 void OnRequestFileSystemAccessAsyncResponse(int request_id, bool allowed); |
| 110 | 106 |
| 111 // Resets the |content_blocked_| array. | 107 // Resets the |content_blocked_| array. |
| 112 void ClearBlockedContentSettings(); | 108 void ClearBlockedContentSettings(); |
| 113 | 109 |
| 114 // Whether the observed RenderFrame is for a platform app. | 110 // Whether the observed RenderFrame is for a platform app. |
| 115 bool IsPlatformApp(); | 111 bool IsPlatformApp(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 145 |
| 150 // Caches the result of AllowStorage. | 146 // Caches the result of AllowStorage. |
| 151 typedef std::pair<GURL, bool> StoragePermissionsKey; | 147 typedef std::pair<GURL, bool> StoragePermissionsKey; |
| 152 std::map<StoragePermissionsKey, bool> cached_storage_permissions_; | 148 std::map<StoragePermissionsKey, bool> cached_storage_permissions_; |
| 153 | 149 |
| 154 // Caches the result of AllowScript. | 150 // Caches the result of AllowScript. |
| 155 std::map<blink::WebFrame*, bool> cached_script_permissions_; | 151 std::map<blink::WebFrame*, bool> cached_script_permissions_; |
| 156 | 152 |
| 157 std::set<std::string> temporarily_allowed_plugins_; | 153 std::set<std::string> temporarily_allowed_plugins_; |
| 158 bool is_interstitial_page_; | 154 bool is_interstitial_page_; |
| 159 bool npapi_plugins_blocked_; | |
| 160 | 155 |
| 161 int current_request_id_; | 156 int current_request_id_; |
| 162 typedef std::map<int, blink::WebContentSettingCallbacks> PermissionRequestMap; | 157 typedef std::map<int, blink::WebContentSettingCallbacks> PermissionRequestMap; |
| 163 PermissionRequestMap permission_requests_; | 158 PermissionRequestMap permission_requests_; |
| 164 | 159 |
| 165 // If true, IsWhitelistedForContentSettings will always return true. | 160 // If true, IsWhitelistedForContentSettings will always return true. |
| 166 const bool should_whitelist_; | 161 const bool should_whitelist_; |
| 167 | 162 |
| 168 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); | 163 DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver); |
| 169 }; | 164 }; |
| 170 | 165 |
| 171 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ | 166 #endif // CHROME_RENDERER_CONTENT_SETTINGS_OBSERVER_H_ |
| OLD | NEW |