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/extensions/dispatcher.h" | 5 #include "chrome/renderer/extensions/dispatcher.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/sha1.h" | 12 #include "base/sha1.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/chrome_version_info.h" | 18 #include "chrome/common/chrome_version_info.h" |
19 #include "chrome/common/crash_keys.h" | 19 #include "chrome/common/crash_keys.h" |
20 #include "chrome/common/extensions/api/messaging/message.h" | 20 #include "chrome/common/extensions/api/messaging/message.h" |
21 #include "chrome/common/extensions/extension_messages.h" | 21 #include "chrome/common/extensions/extension_messages.h" |
22 #include "chrome/common/extensions/features/feature_channel.h" | 22 #include "chrome/common/extensions/features/feature_channel.h" |
23 #include "chrome/common/extensions/manifest_handlers/externally_connectable.h" | 23 #include "chrome/common/extensions/manifest_handlers/externally_connectable.h" |
24 #include "chrome/common/extensions/manifest_handlers/sandboxed_page_info.h" | |
25 #include "chrome/common/extensions/message_bundle.h" | 24 #include "chrome/common/extensions/message_bundle.h" |
26 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
27 #include "chrome/renderer/chrome_render_process_observer.h" | 26 #include "chrome/renderer/chrome_render_process_observer.h" |
28 #include "chrome/renderer/extensions/api_activity_logger.h" | 27 #include "chrome/renderer/extensions/api_activity_logger.h" |
29 #include "chrome/renderer/extensions/api_definitions_natives.h" | 28 #include "chrome/renderer/extensions/api_definitions_natives.h" |
30 #include "chrome/renderer/extensions/app_bindings.h" | 29 #include "chrome/renderer/extensions/app_bindings.h" |
31 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" | 30 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" |
32 #include "chrome/renderer/extensions/app_window_custom_bindings.h" | 31 #include "chrome/renderer/extensions/app_window_custom_bindings.h" |
33 #include "chrome/renderer/extensions/binding_generating_native_handler.h" | 32 #include "chrome/renderer/extensions/binding_generating_native_handler.h" |
34 #include "chrome/renderer/extensions/blob_native_handler.h" | 33 #include "chrome/renderer/extensions/blob_native_handler.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 #include "content/public/renderer/v8_value_converter.h" | 70 #include "content/public/renderer/v8_value_converter.h" |
72 #include "extensions/common/constants.h" | 71 #include "extensions/common/constants.h" |
73 #include "extensions/common/extension.h" | 72 #include "extensions/common/extension.h" |
74 #include "extensions/common/extension_api.h" | 73 #include "extensions/common/extension_api.h" |
75 #include "extensions/common/extension_urls.h" | 74 #include "extensions/common/extension_urls.h" |
76 #include "extensions/common/features/feature.h" | 75 #include "extensions/common/features/feature.h" |
77 #include "extensions/common/features/feature_provider.h" | 76 #include "extensions/common/features/feature_provider.h" |
78 #include "extensions/common/manifest.h" | 77 #include "extensions/common/manifest.h" |
79 #include "extensions/common/manifest_constants.h" | 78 #include "extensions/common/manifest_constants.h" |
80 #include "extensions/common/manifest_handlers/background_info.h" | 79 #include "extensions/common/manifest_handlers/background_info.h" |
| 80 #include "extensions/common/manifest_handlers/sandboxed_page_info.h" |
81 #include "extensions/common/permissions/permission_set.h" | 81 #include "extensions/common/permissions/permission_set.h" |
82 #include "extensions/common/permissions/permissions_data.h" | 82 #include "extensions/common/permissions/permissions_data.h" |
83 #include "extensions/common/view_type.h" | 83 #include "extensions/common/view_type.h" |
84 #include "grit/common_resources.h" | 84 #include "grit/common_resources.h" |
85 #include "grit/renderer_resources.h" | 85 #include "grit/renderer_resources.h" |
86 #include "third_party/WebKit/public/platform/WebString.h" | 86 #include "third_party/WebKit/public/platform/WebString.h" |
87 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 87 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
88 #include "third_party/WebKit/public/web/WebCustomElement.h" | 88 #include "third_party/WebKit/public/web/WebCustomElement.h" |
89 #include "third_party/WebKit/public/web/WebDataSource.h" | 89 #include "third_party/WebKit/public/web/WebDataSource.h" |
90 #include "third_party/WebKit/public/web/WebDocument.h" | 90 #include "third_party/WebKit/public/web/WebDocument.h" |
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1489 DispatchEvent(extension_id, kOnSuspendEvent); | 1489 DispatchEvent(extension_id, kOnSuspendEvent); |
1490 RenderThread::Get()->Send(new ExtensionHostMsg_SuspendAck(extension_id)); | 1490 RenderThread::Get()->Send(new ExtensionHostMsg_SuspendAck(extension_id)); |
1491 } | 1491 } |
1492 | 1492 |
1493 void Dispatcher::OnCancelSuspend(const std::string& extension_id) { | 1493 void Dispatcher::OnCancelSuspend(const std::string& extension_id) { |
1494 DispatchEvent(extension_id, kOnSuspendCanceledEvent); | 1494 DispatchEvent(extension_id, kOnSuspendCanceledEvent); |
1495 } | 1495 } |
1496 | 1496 |
1497 // TODO(kalman): This is checking for the wrong thing, it should be checking if | 1497 // TODO(kalman): This is checking for the wrong thing, it should be checking if |
1498 // the frame's security origin is unique. The extension sandbox directive is | 1498 // the frame's security origin is unique. The extension sandbox directive is |
1499 // checked for in chrome/common/extensions/csp_handler.cc. | 1499 // checked for in extensions/common/manifest_handlers/csp_info.cc. |
1500 bool Dispatcher::IsSandboxedPage(const GURL& url) const { | 1500 bool Dispatcher::IsSandboxedPage(const GURL& url) const { |
1501 if (url.SchemeIs(kExtensionScheme)) { | 1501 if (url.SchemeIs(kExtensionScheme)) { |
1502 const Extension* extension = extensions_.GetByID(url.host()); | 1502 const Extension* extension = extensions_.GetByID(url.host()); |
1503 if (extension) { | 1503 if (extension) { |
1504 return SandboxedPageInfo::IsSandboxedPage(extension, url.path()); | 1504 return SandboxedPageInfo::IsSandboxedPage(extension, url.path()); |
1505 } | 1505 } |
1506 } | 1506 } |
1507 return false; | 1507 return false; |
1508 } | 1508 } |
1509 | 1509 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1635 RenderView* background_view = | 1635 RenderView* background_view = |
1636 ExtensionHelper::GetBackgroundPage(extension_id); | 1636 ExtensionHelper::GetBackgroundPage(extension_id); |
1637 if (background_view) { | 1637 if (background_view) { |
1638 background_view->Send(new ExtensionHostMsg_EventAck( | 1638 background_view->Send(new ExtensionHostMsg_EventAck( |
1639 background_view->GetRoutingID())); | 1639 background_view->GetRoutingID())); |
1640 } | 1640 } |
1641 } | 1641 } |
1642 } | 1642 } |
1643 | 1643 |
1644 } // namespace extensions | 1644 } // namespace extensions |
OLD | NEW |