| 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/ssl_insecure_content.h" | 7 #include "chrome/common/ssl_insecure_content.h" |
| 8 #include "components/content_settings/content/common/content_settings_messages.h
" | 8 #include "components/content_settings/content/common/content_settings_messages.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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 using content::NavigationState; | 42 using content::NavigationState; |
| 43 | 43 |
| 44 namespace { | 44 namespace { |
| 45 | 45 |
| 46 GURL GetOriginOrURL(const WebFrame* frame) { | 46 GURL GetOriginOrURL(const WebFrame* frame) { |
| 47 WebString top_origin = frame->top()->getSecurityOrigin().toString(); | 47 WebString top_origin = frame->top()->getSecurityOrigin().toString(); |
| 48 // The |top_origin| is unique ("null") e.g., for file:// URLs. Use the | 48 // The |top_origin| is unique ("null") e.g., for file:// URLs. Use the |
| 49 // document URL as the primary URL in those cases. | 49 // document URL as the primary URL in those cases. |
| 50 // TODO(alexmos): This is broken for --site-per-process, since top() can be a | 50 // TODO(alexmos): This is broken for --site-per-process, since top() can be a |
| 51 // WebRemoteFrame which does not have a document(), and the WebRemoteFrame's | 51 // WebRemoteFrame which does not have a document(), and the WebRemoteFrame's |
| 52 // URL is not replicated. | 52 // URL is not replicated. See https://crbug.com/628759. |
| 53 if (top_origin == "null") | 53 if (top_origin == "null" && frame->top()->isWebLocalFrame()) |
| 54 return frame->top()->document().url(); | 54 return frame->top()->document().url(); |
| 55 return blink::WebStringToGURL(top_origin); | 55 return blink::WebStringToGURL(top_origin); |
| 56 } | 56 } |
| 57 | 57 |
| 58 ContentSetting GetContentSettingFromRules( | 58 ContentSetting GetContentSettingFromRules( |
| 59 const ContentSettingsForOneType& rules, | 59 const ContentSettingsForOneType& rules, |
| 60 const WebFrame* frame, | 60 const WebFrame* frame, |
| 61 const GURL& secondary_url) { | 61 const GURL& secondary_url) { |
| 62 ContentSettingsForOneType::const_iterator it; | 62 ContentSettingsForOneType::const_iterator it; |
| 63 // If there is only one rule, it's the default rule and we don't need to match | 63 // If there is only one rule, it's the default rule and we don't need to match |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 | 541 |
| 542 // If the scheme is file:, an empty file name indicates a directory listing, | 542 // If the scheme is file:, an empty file name indicates a directory listing, |
| 543 // which requires JavaScript to function properly. | 543 // which requires JavaScript to function properly. |
| 544 if (base::EqualsASCII(protocol, url::kFileScheme)) { | 544 if (base::EqualsASCII(protocol, url::kFileScheme)) { |
| 545 return document_url.SchemeIs(url::kFileScheme) && | 545 return document_url.SchemeIs(url::kFileScheme) && |
| 546 document_url.ExtractFileName().empty(); | 546 document_url.ExtractFileName().empty(); |
| 547 } | 547 } |
| 548 | 548 |
| 549 return false; | 549 return false; |
| 550 } | 550 } |
| OLD | NEW |