| 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 #include "chrome/renderer/content_settings_observer.h" | 5 #include "chrome/renderer/content_settings_observer.h" |
| 6 | 6 |
| 7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
| 8 #include "chrome/common/ssl_insecure_content.h" | 8 #include "chrome/common/ssl_insecure_content.h" |
| 9 #include "content/public/common/url_constants.h" | 9 #include "content/public/common/url_constants.h" |
| 10 #include "content/public/renderer/document_state.h" | 10 #include "content/public/renderer/document_state.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // blocked plugin. | 174 // blocked plugin. |
| 175 IPC_BEGIN_MESSAGE_MAP(ContentSettingsObserver, message) | 175 IPC_BEGIN_MESSAGE_MAP(ContentSettingsObserver, message) |
| 176 IPC_MESSAGE_HANDLER(ChromeViewMsg_LoadBlockedPlugins, OnLoadBlockedPlugins) | 176 IPC_MESSAGE_HANDLER(ChromeViewMsg_LoadBlockedPlugins, OnLoadBlockedPlugins) |
| 177 IPC_END_MESSAGE_MAP() | 177 IPC_END_MESSAGE_MAP() |
| 178 | 178 |
| 179 return false; | 179 return false; |
| 180 } | 180 } |
| 181 | 181 |
| 182 void ContentSettingsObserver::DidCommitProvisionalLoad( | 182 void ContentSettingsObserver::DidCommitProvisionalLoad( |
| 183 bool is_new_navigation, | 183 bool is_new_navigation, |
| 184 bool is_same_page_navigation) { | 184 bool is_same_document_navigation) { |
| 185 WebFrame* frame = render_frame()->GetWebFrame(); | 185 WebFrame* frame = render_frame()->GetWebFrame(); |
| 186 if (frame->parent()) | 186 if (frame->parent()) |
| 187 return; // Not a top-level navigation. | 187 return; // Not a top-level navigation. |
| 188 | 188 |
| 189 if (!is_same_page_navigation) { | 189 if (!is_same_document_navigation) { |
| 190 // Clear "block" flags for the new page. This needs to happen before any of | 190 // Clear "block" flags for the new page. This needs to happen before any of |
| 191 // |allowScript()|, |allowScriptFromSource()|, |allowImage()|, or | 191 // |allowScript()|, |allowScriptFromSource()|, |allowImage()|, or |
| 192 // |allowPlugins()| is called for the new page so that these functions can | 192 // |allowPlugins()| is called for the new page so that these functions can |
| 193 // correctly detect that a piece of content flipped from "not blocked" to | 193 // correctly detect that a piece of content flipped from "not blocked" to |
| 194 // "blocked". | 194 // "blocked". |
| 195 ClearBlockedContentSettings(); | 195 ClearBlockedContentSettings(); |
| 196 temporarily_allowed_plugins_.clear(); | 196 temporarily_allowed_plugins_.clear(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 GURL url = frame->document().url(); | 199 GURL url = frame->document().url(); |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 #endif | 539 #endif |
| 540 | 540 |
| 541 // If the scheme is file:, an empty file name indicates a directory listing, | 541 // If the scheme is file:, an empty file name indicates a directory listing, |
| 542 // which requires JavaScript to function properly. | 542 // which requires JavaScript to function properly. |
| 543 if (protocol == url::kFileScheme && | 543 if (protocol == url::kFileScheme && |
| 544 document_url.protocolIs(url::kFileScheme)) { | 544 document_url.protocolIs(url::kFileScheme)) { |
| 545 return GURL(document_url).ExtractFileName().empty(); | 545 return GURL(document_url).ExtractFileName().empty(); |
| 546 } | 546 } |
| 547 return false; | 547 return false; |
| 548 } | 548 } |
| OLD | NEW |