OLD | NEW |
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 #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/navigation_state.h" | 9 #include "content/public/renderer/navigation_state.h" |
10 #include "content/public/renderer/render_view.h" | 10 #include "content/public/renderer/render_view.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // True if |frame| contains content that is white-listed for content settings. | 30 // True if |frame| contains content that is white-listed for content settings. |
31 static bool IsWhitelistedForContentSettings(WebFrame* frame) { | 31 static bool IsWhitelistedForContentSettings(WebFrame* frame) { |
32 WebSecurityOrigin origin = frame->document().securityOrigin(); | 32 WebSecurityOrigin origin = frame->document().securityOrigin(); |
33 if (origin.isEmpty()) | 33 if (origin.isEmpty()) |
34 return false; // Uninitialized document? | 34 return false; // Uninitialized document? |
35 | 35 |
36 if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme)) | 36 if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme)) |
37 return true; // Browser UI elements should still work. | 37 return true; // Browser UI elements should still work. |
38 | 38 |
| 39 if (EqualsASCII(origin.protocol(), chrome::kChromeDevToolsScheme)) |
| 40 return true; // DevTools UI elements should still work. |
| 41 |
39 // If the scheme is ftp: or file:, an empty file name indicates a directory | 42 // If the scheme is ftp: or file:, an empty file name indicates a directory |
40 // listing, which requires JavaScript to function properly. | 43 // listing, which requires JavaScript to function properly. |
41 GURL document_url = frame->document().url(); | 44 GURL document_url = frame->document().url(); |
42 const char* kDirProtocols[] = { chrome::kFtpScheme, chrome::kFileScheme }; | 45 const char* kDirProtocols[] = { chrome::kFtpScheme, chrome::kFileScheme }; |
43 for (size_t i = 0; i < arraysize(kDirProtocols); ++i) { | 46 for (size_t i = 0; i < arraysize(kDirProtocols); ++i) { |
44 if (EqualsASCII(origin.protocol(), kDirProtocols[i])) { | 47 if (EqualsASCII(origin.protocol(), kDirProtocols[i])) { |
45 return document_url.SchemeIs(kDirProtocols[i]) && | 48 return document_url.SchemeIs(kDirProtocols[i]) && |
46 document_url.ExtractFileName().empty(); | 49 document_url.ExtractFileName().empty(); |
47 } | 50 } |
48 } | 51 } |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 // CONTENT_SETTING_ASK is only valid for cookies. | 318 // CONTENT_SETTING_ASK is only valid for cookies. |
316 return current_content_settings_.settings[settings_type] != | 319 return current_content_settings_.settings[settings_type] != |
317 CONTENT_SETTING_BLOCK; | 320 CONTENT_SETTING_BLOCK; |
318 } | 321 } |
319 | 322 |
320 void ContentSettingsObserver::ClearBlockedContentSettings() { | 323 void ContentSettingsObserver::ClearBlockedContentSettings() { |
321 for (size_t i = 0; i < arraysize(content_blocked_); ++i) | 324 for (size_t i = 0; i < arraysize(content_blocked_); ++i) |
322 content_blocked_[i] = false; | 325 content_blocked_[i] = false; |
323 cached_storage_permissions_.clear(); | 326 cached_storage_permissions_.clear(); |
324 } | 327 } |
OLD | NEW |