Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: chrome/renderer/content_settings_observer.cc

Issue 1293673002: Create thread-safe RendererExtensionRegistry from ExtensionSet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "components/content_settings/content/common/content_settings_messages.h " 9 #include "components/content_settings/content/common/content_settings_messages.h "
10 #include "content/public/common/url_constants.h" 10 #include "content/public/common/url_constants.h"
11 #include "content/public/renderer/document_state.h" 11 #include "content/public/renderer/document_state.h"
12 #include "content/public/renderer/render_frame.h" 12 #include "content/public/renderer/render_frame.h"
13 #include "content/public/renderer/render_view.h" 13 #include "content/public/renderer/render_view.h"
14 #include "third_party/WebKit/public/platform/WebContentSettingCallbacks.h" 14 #include "third_party/WebKit/public/platform/WebContentSettingCallbacks.h"
15 #include "third_party/WebKit/public/platform/WebURL.h" 15 #include "third_party/WebKit/public/platform/WebURL.h"
16 #include "third_party/WebKit/public/web/WebDataSource.h" 16 #include "third_party/WebKit/public/web/WebDataSource.h"
17 #include "third_party/WebKit/public/web/WebDocument.h" 17 #include "third_party/WebKit/public/web/WebDocument.h"
18 #include "third_party/WebKit/public/web/WebFrameClient.h" 18 #include "third_party/WebKit/public/web/WebFrameClient.h"
19 #include "third_party/WebKit/public/web/WebLocalFrame.h" 19 #include "third_party/WebKit/public/web/WebLocalFrame.h"
20 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" 20 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
21 #include "third_party/WebKit/public/web/WebView.h" 21 #include "third_party/WebKit/public/web/WebView.h"
22 #include "url/url_constants.h" 22 #include "url/url_constants.h"
23 23
24 #if defined(ENABLE_EXTENSIONS) 24 #if defined(ENABLE_EXTENSIONS)
25 #include "extensions/common/constants.h" 25 #include "extensions/common/constants.h"
26 #include "extensions/common/extension.h" 26 #include "extensions/common/extension.h"
27 #include "extensions/common/permissions/api_permission.h" 27 #include "extensions/common/permissions/api_permission.h"
28 #include "extensions/common/permissions/permissions_data.h" 28 #include "extensions/common/permissions/permissions_data.h"
29 #include "extensions/renderer/dispatcher.h" 29 #include "extensions/renderer/dispatcher.h"
30 #include "extensions/renderer/renderer_extension_registry.h"
30 #endif 31 #endif
31 32
32 using blink::WebContentSettingCallbacks; 33 using blink::WebContentSettingCallbacks;
33 using blink::WebDataSource; 34 using blink::WebDataSource;
34 using blink::WebDocument; 35 using blink::WebDocument;
35 using blink::WebFrame; 36 using blink::WebFrame;
36 using blink::WebSecurityOrigin; 37 using blink::WebSecurityOrigin;
37 using blink::WebString; 38 using blink::WebString;
38 using blink::WebURL; 39 using blink::WebURL;
39 using blink::WebView; 40 using blink::WebView;
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 const extensions::Extension* ContentSettingsObserver::GetExtension( 671 const extensions::Extension* ContentSettingsObserver::GetExtension(
671 const WebSecurityOrigin& origin) const { 672 const WebSecurityOrigin& origin) const {
672 if (!base::EqualsASCII(base::StringPiece16(origin.protocol()), 673 if (!base::EqualsASCII(base::StringPiece16(origin.protocol()),
673 extensions::kExtensionScheme)) 674 extensions::kExtensionScheme))
674 return NULL; 675 return NULL;
675 676
676 const std::string extension_id = origin.host().utf8().data(); 677 const std::string extension_id = origin.host().utf8().data();
677 if (!extension_dispatcher_->IsExtensionActive(extension_id)) 678 if (!extension_dispatcher_->IsExtensionActive(extension_id))
678 return NULL; 679 return NULL;
679 680
680 return extension_dispatcher_->extensions()->GetByID(extension_id); 681 return extensions::RendererExtensionRegistry::Get()->GetByID(extension_id);
681 } 682 }
682 #endif 683 #endif
683 684
684 bool ContentSettingsObserver::IsWhitelistedForContentSettings() const { 685 bool ContentSettingsObserver::IsWhitelistedForContentSettings() const {
685 if (should_whitelist_) 686 if (should_whitelist_)
686 return true; 687 return true;
687 688
688 // Whitelist ftp directory listings, as they require JavaScript to function 689 // Whitelist ftp directory listings, as they require JavaScript to function
689 // properly. 690 // properly.
690 if (render_frame()->IsFTPDirectoryListing()) 691 if (render_frame()->IsFTPDirectoryListing())
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 724
724 // If the scheme is file:, an empty file name indicates a directory listing, 725 // If the scheme is file:, an empty file name indicates a directory listing,
725 // which requires JavaScript to function properly. 726 // which requires JavaScript to function properly.
726 if (base::EqualsASCII(protocol, url::kFileScheme)) { 727 if (base::EqualsASCII(protocol, url::kFileScheme)) {
727 return document_url.SchemeIs(url::kFileScheme) && 728 return document_url.SchemeIs(url::kFileScheme) &&
728 document_url.ExtractFileName().empty(); 729 document_url.ExtractFileName().empty();
729 } 730 }
730 731
731 return false; 732 return false;
732 } 733 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.cc ('k') | chrome/renderer/extensions/app_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698