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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
11 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
12 #include "content/public/renderer/document_state.h" | 12 #include "content/public/renderer/document_state.h" |
13 #include "content/public/renderer/navigation_state.h" | 13 #include "content/public/renderer/navigation_state.h" |
14 #include "content/public/renderer/render_frame.h" | 14 #include "content/public/renderer/render_frame.h" |
15 #include "content/public/renderer/render_view.h" | 15 #include "content/public/renderer/render_view.h" |
16 #include "extensions/common/constants.h" | 16 #include "extensions/common/constants.h" |
| 17 #include "extensions/common/extension.h" |
| 18 #include "extensions/common/permissions/permissions_data.h" |
17 #include "extensions/renderer/dispatcher.h" | 19 #include "extensions/renderer/dispatcher.h" |
18 #include "third_party/WebKit/public/platform/WebPermissionCallbacks.h" | 20 #include "third_party/WebKit/public/platform/WebPermissionCallbacks.h" |
19 #include "third_party/WebKit/public/platform/WebURL.h" | 21 #include "third_party/WebKit/public/platform/WebURL.h" |
20 #include "third_party/WebKit/public/web/WebDataSource.h" | 22 #include "third_party/WebKit/public/web/WebDataSource.h" |
21 #include "third_party/WebKit/public/web/WebDocument.h" | 23 #include "third_party/WebKit/public/web/WebDocument.h" |
22 #include "third_party/WebKit/public/web/WebFrame.h" | 24 #include "third_party/WebKit/public/web/WebFrame.h" |
23 #include "third_party/WebKit/public/web/WebFrameClient.h" | 25 #include "third_party/WebKit/public/web/WebFrameClient.h" |
24 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 26 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
25 #include "third_party/WebKit/public/web/WebView.h" | 27 #include "third_party/WebKit/public/web/WebView.h" |
26 #include "webkit/child/weburlresponse_extradata_impl.h" | 28 #include "webkit/child/weburlresponse_extradata_impl.h" |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 bool ContentSettingsObserver::allowWebComponents(bool default_value) { | 429 bool ContentSettingsObserver::allowWebComponents(bool default_value) { |
428 if (default_value) | 430 if (default_value) |
429 return true; | 431 return true; |
430 | 432 |
431 WebFrame* frame = render_frame()->GetWebFrame(); | 433 WebFrame* frame = render_frame()->GetWebFrame(); |
432 WebSecurityOrigin origin = frame->document().securityOrigin(); | 434 WebSecurityOrigin origin = frame->document().securityOrigin(); |
433 if (EqualsASCII(origin.protocol(), content::kChromeUIScheme)) | 435 if (EqualsASCII(origin.protocol(), content::kChromeUIScheme)) |
434 return true; | 436 return true; |
435 | 437 |
436 if (const extensions::Extension* extension = GetExtension(origin)) { | 438 if (const extensions::Extension* extension = GetExtension(origin)) { |
437 if (extension->HasAPIPermission(APIPermission::kExperimental)) | 439 if (extension->permissions_data()->HasAPIPermission( |
| 440 APIPermission::kExperimental)) |
438 return true; | 441 return true; |
439 } | 442 } |
440 | 443 |
441 return false; | 444 return false; |
442 } | 445 } |
443 | 446 |
444 bool ContentSettingsObserver::allowMutationEvents(bool default_value) { | 447 bool ContentSettingsObserver::allowMutationEvents(bool default_value) { |
445 WebFrame* frame = render_frame()->GetWebFrame(); | 448 WebFrame* frame = render_frame()->GetWebFrame(); |
446 WebSecurityOrigin origin = frame->document().securityOrigin(); | 449 WebSecurityOrigin origin = frame->document().securityOrigin(); |
447 const extensions::Extension* extension = GetExtension(origin); | 450 const extensions::Extension* extension = GetExtension(origin); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 | 704 |
702 // If the scheme is file:, an empty file name indicates a directory listing, | 705 // If the scheme is file:, an empty file name indicates a directory listing, |
703 // which requires JavaScript to function properly. | 706 // which requires JavaScript to function properly. |
704 if (EqualsASCII(origin.protocol(), url::kFileScheme)) { | 707 if (EqualsASCII(origin.protocol(), url::kFileScheme)) { |
705 return document_url.SchemeIs(url::kFileScheme) && | 708 return document_url.SchemeIs(url::kFileScheme) && |
706 document_url.ExtractFileName().empty(); | 709 document_url.ExtractFileName().empty(); |
707 } | 710 } |
708 | 711 |
709 return false; | 712 return false; |
710 } | 713 } |
OLD | NEW |