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/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
9 #include "content/public/renderer/document_state.h" | 9 #include "content/public/renderer/document_state.h" |
10 #include "content/public/renderer/navigation_state.h" | 10 #include "content/public/renderer/navigation_state.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 IPC_BEGIN_MESSAGE_MAP(ContentSettingsObserver, message) | 120 IPC_BEGIN_MESSAGE_MAP(ContentSettingsObserver, message) |
121 IPC_MESSAGE_HANDLER(ChromeViewMsg_LoadBlockedPlugins, OnLoadBlockedPlugins) | 121 IPC_MESSAGE_HANDLER(ChromeViewMsg_LoadBlockedPlugins, OnLoadBlockedPlugins) |
122 IPC_END_MESSAGE_MAP() | 122 IPC_END_MESSAGE_MAP() |
123 | 123 |
124 return false; | 124 return false; |
125 } | 125 } |
126 | 126 |
127 void ContentSettingsObserver::DidCommitProvisionalLoad( | 127 void ContentSettingsObserver::DidCommitProvisionalLoad( |
128 WebFrame* frame, bool is_new_navigation) { | 128 WebFrame* frame, bool is_new_navigation) { |
129 if (frame->parent()) | 129 if (frame->parent()) |
130 return; // Not a top-level navigation. | 130 return; // Not a top-level navigation. |
131 | 131 |
132 DocumentState* document_state = DocumentState::FromDataSource( | 132 DocumentState* document_state = DocumentState::FromDataSource( |
133 frame->dataSource()); | 133 frame->dataSource()); |
134 NavigationState* navigation_state = document_state->navigation_state(); | 134 NavigationState* navigation_state = document_state->navigation_state(); |
135 if (!navigation_state->was_within_same_page()) { | 135 if (!navigation_state->was_within_same_page()) { |
136 // Clear "block" flags for the new page. This needs to happen before any of | 136 // Clear "block" flags for the new page. This needs to happen before any of |
137 // |AllowScript()|, |AllowScriptFromSource()|, |AllowImage()|, or | 137 // |AllowScript()|, |AllowScriptFromSource()|, |AllowImage()|, or |
138 // |AllowPlugins()| is called for the new page so that these functions can | 138 // |AllowPlugins()| is called for the new page so that these functions can |
139 // correctly detect that a piece of content flipped from "not blocked" to | 139 // correctly detect that a piece of content flipped from "not blocked" to |
140 // "blocked". | 140 // "blocked". |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 352 |
353 // If the scheme is file:, an empty file name indicates a directory listing, | 353 // If the scheme is file:, an empty file name indicates a directory listing, |
354 // which requires JavaScript to function properly. | 354 // which requires JavaScript to function properly. |
355 if (EqualsASCII(origin.protocol(), chrome::kFileScheme)) { | 355 if (EqualsASCII(origin.protocol(), chrome::kFileScheme)) { |
356 return document_url.SchemeIs(chrome::kFileScheme) && | 356 return document_url.SchemeIs(chrome::kFileScheme) && |
357 document_url.ExtractFileName().empty(); | 357 document_url.ExtractFileName().empty(); |
358 } | 358 } |
359 | 359 |
360 return false; | 360 return false; |
361 } | 361 } |
OLD | NEW |