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

Side by Side Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 2399853003: [M54 merge] Lock down creation of blob:chrome-extension URLs from non-extension processes. (Closed)
Patch Set: Rebase Created 4 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/devtools/devtools_ui_bindings.h" 5 #include "chrome/browser/devtools/devtools_ui_bindings.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 24 matching lines...) Expand all
35 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
36 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" 36 #include "chrome/common/extensions/chrome_manifest_url_handlers.h"
37 #include "chrome/common/pref_names.h" 37 #include "chrome/common/pref_names.h"
38 #include "chrome/common/url_constants.h" 38 #include "chrome/common/url_constants.h"
39 #include "chrome/grit/generated_resources.h" 39 #include "chrome/grit/generated_resources.h"
40 #include "components/infobars/core/confirm_infobar_delegate.h" 40 #include "components/infobars/core/confirm_infobar_delegate.h"
41 #include "components/infobars/core/infobar.h" 41 #include "components/infobars/core/infobar.h"
42 #include "components/prefs/scoped_user_pref_update.h" 42 #include "components/prefs/scoped_user_pref_update.h"
43 #include "components/syncable_prefs/pref_service_syncable.h" 43 #include "components/syncable_prefs/pref_service_syncable.h"
44 #include "components/zoom/page_zoom.h" 44 #include "components/zoom/page_zoom.h"
45 #include "content/public/browser/child_process_security_policy.h"
45 #include "content/public/browser/devtools_external_agent_proxy.h" 46 #include "content/public/browser/devtools_external_agent_proxy.h"
46 #include "content/public/browser/devtools_external_agent_proxy_delegate.h" 47 #include "content/public/browser/devtools_external_agent_proxy_delegate.h"
47 #include "content/public/browser/navigation_controller.h" 48 #include "content/public/browser/navigation_controller.h"
48 #include "content/public/browser/navigation_entry.h" 49 #include "content/public/browser/navigation_entry.h"
49 #include "content/public/browser/notification_source.h" 50 #include "content/public/browser/notification_source.h"
50 #include "content/public/browser/render_frame_host.h" 51 #include "content/public/browser/render_frame_host.h"
52 #include "content/public/browser/render_process_host.h"
51 #include "content/public/browser/render_view_host.h" 53 #include "content/public/browser/render_view_host.h"
52 #include "content/public/browser/user_metrics.h" 54 #include "content/public/browser/user_metrics.h"
53 #include "content/public/browser/web_contents.h" 55 #include "content/public/browser/web_contents.h"
54 #include "content/public/browser/web_contents_observer.h" 56 #include "content/public/browser/web_contents_observer.h"
55 #include "content/public/common/renderer_preferences.h" 57 #include "content/public/common/renderer_preferences.h"
56 #include "content/public/common/url_constants.h" 58 #include "content/public/common/url_constants.h"
57 #include "extensions/browser/extension_registry.h" 59 #include "extensions/browser/extension_registry.h"
60 #include "extensions/common/constants.h"
58 #include "extensions/common/permissions/permissions_data.h" 61 #include "extensions/common/permissions/permissions_data.h"
59 #include "ipc/ipc_channel.h" 62 #include "ipc/ipc_channel.h"
60 #include "net/base/io_buffer.h" 63 #include "net/base/io_buffer.h"
61 #include "net/base/net_errors.h" 64 #include "net/base/net_errors.h"
62 #include "net/http/http_response_headers.h" 65 #include "net/http/http_response_headers.h"
63 #include "net/url_request/url_fetcher.h" 66 #include "net/url_request/url_fetcher.h"
64 #include "net/url_request/url_fetcher_response_writer.h" 67 #include "net/url_request/url_fetcher_response_writer.h"
65 #include "ui/base/l10n/l10n_util.h" 68 #include "ui/base/l10n/l10n_util.h"
66 #include "ui/base/page_transition_types.h" 69 #include "ui/base/page_transition_types.h"
67 70
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 "startPage", 1015 "startPage",
1013 new base::StringValue(extensions::chrome_manifest_urls::GetDevToolsPage( 1016 new base::StringValue(extensions::chrome_manifest_urls::GetDevToolsPage(
1014 extension.get()).spec())); 1017 extension.get()).spec()));
1015 extension_info->Set("name", new base::StringValue(extension->name())); 1018 extension_info->Set("name", new base::StringValue(extension->name()));
1016 extension_info->Set("exposeExperimentalAPIs", 1019 extension_info->Set("exposeExperimentalAPIs",
1017 new base::FundamentalValue( 1020 new base::FundamentalValue(
1018 extension->permissions_data()->HasAPIPermission( 1021 extension->permissions_data()->HasAPIPermission(
1019 extensions::APIPermission::kExperimental))); 1022 extensions::APIPermission::kExperimental)));
1020 results.Append(std::move(extension_info)); 1023 results.Append(std::move(extension_info));
1021 } 1024 }
1025 if (!results.empty()) {
1026 // At least one devtools extension exists; it will need to run in the
1027 // devtools process. Grant it permission to load documents with
1028 // chrome-extension:// origins.
1029 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme(
1030 web_contents_->GetMainFrame()->GetProcess()->GetID(),
1031 extensions::kExtensionScheme);
1032 }
1033
1022 CallClientFunction("DevToolsAPI.addExtensions", 1034 CallClientFunction("DevToolsAPI.addExtensions",
1023 &results, NULL, NULL); 1035 &results, NULL, NULL);
1024 } 1036 }
1025 1037
1026 void DevToolsUIBindings::SetDelegate(Delegate* delegate) { 1038 void DevToolsUIBindings::SetDelegate(Delegate* delegate) {
1027 delegate_.reset(delegate); 1039 delegate_.reset(delegate);
1028 } 1040 }
1029 1041
1030 void DevToolsUIBindings::AttachTo( 1042 void DevToolsUIBindings::AttachTo(
1031 const scoped_refptr<content::DevToolsAgentHost>& agent_host) { 1043 const scoped_refptr<content::DevToolsAgentHost>& agent_host) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 void DevToolsUIBindings::FrontendLoaded() { 1111 void DevToolsUIBindings::FrontendLoaded() {
1100 if (frontend_loaded_) 1112 if (frontend_loaded_)
1101 return; 1113 return;
1102 frontend_loaded_ = true; 1114 frontend_loaded_ = true;
1103 1115
1104 // Call delegate first - it seeds importants bit of information. 1116 // Call delegate first - it seeds importants bit of information.
1105 delegate_->OnLoadCompleted(); 1117 delegate_->OnLoadCompleted();
1106 1118
1107 AddDevToolsExtensionsToClient(); 1119 AddDevToolsExtensionsToClient();
1108 } 1120 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_sanity_browsertest.cc ('k') | chrome/browser/extensions/process_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698