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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/common/view_type.h" | 21 #include "chrome/common/view_type.h" |
22 #include "chrome/renderer/chrome_render_process_observer.h" | 22 #include "chrome/renderer/chrome_render_process_observer.h" |
23 #include "chrome/renderer/extensions/api_definitions_natives.h" | 23 #include "chrome/renderer/extensions/api_definitions_natives.h" |
24 #include "chrome/renderer/extensions/app_bindings.h" | 24 #include "chrome/renderer/extensions/app_bindings.h" |
25 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" | 25 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" |
26 #include "chrome/renderer/extensions/app_window_custom_bindings.h" | 26 #include "chrome/renderer/extensions/app_window_custom_bindings.h" |
27 #include "chrome/renderer/extensions/chrome_v8_context.h" | 27 #include "chrome/renderer/extensions/chrome_v8_context.h" |
28 #include "chrome/renderer/extensions/chrome_v8_extension.h" | 28 #include "chrome/renderer/extensions/chrome_v8_extension.h" |
29 #include "chrome/renderer/extensions/content_watcher.h" | 29 #include "chrome/renderer/extensions/content_watcher.h" |
30 #include "chrome/renderer/extensions/context_menus_custom_bindings.h" | 30 #include "chrome/renderer/extensions/context_menus_custom_bindings.h" |
| 31 #include "chrome/renderer/extensions/dom_activity_logger.h" |
31 #include "chrome/renderer/extensions/event_bindings.h" | 32 #include "chrome/renderer/extensions/event_bindings.h" |
32 #include "chrome/renderer/extensions/extension_custom_bindings.h" | 33 #include "chrome/renderer/extensions/extension_custom_bindings.h" |
33 #include "chrome/renderer/extensions/extension_groups.h" | 34 #include "chrome/renderer/extensions/extension_groups.h" |
34 #include "chrome/renderer/extensions/extension_helper.h" | 35 #include "chrome/renderer/extensions/extension_helper.h" |
35 #include "chrome/renderer/extensions/file_browser_handler_custom_bindings.h" | 36 #include "chrome/renderer/extensions/file_browser_handler_custom_bindings.h" |
36 #include "chrome/renderer/extensions/file_browser_private_custom_bindings.h" | 37 #include "chrome/renderer/extensions/file_browser_private_custom_bindings.h" |
37 #include "chrome/renderer/extensions/file_system_natives.h" | 38 #include "chrome/renderer/extensions/file_system_natives.h" |
38 #include "chrome/renderer/extensions/i18n_custom_bindings.h" | 39 #include "chrome/renderer/extensions/i18n_custom_bindings.h" |
39 #include "chrome/renderer/extensions/media_galleries_custom_bindings.h" | 40 #include "chrome/renderer/extensions/media_galleries_custom_bindings.h" |
40 #include "chrome/renderer/extensions/miscellaneous_bindings.h" | 41 #include "chrome/renderer/extensions/miscellaneous_bindings.h" |
41 #include "chrome/renderer/extensions/module_system.h" | 42 #include "chrome/renderer/extensions/module_system.h" |
42 #include "chrome/renderer/extensions/native_handler.h" | 43 #include "chrome/renderer/extensions/native_handler.h" |
43 #include "chrome/renderer/extensions/page_actions_custom_bindings.h" | 44 #include "chrome/renderer/extensions/page_actions_custom_bindings.h" |
44 #include "chrome/renderer/extensions/page_capture_custom_bindings.h" | 45 #include "chrome/renderer/extensions/page_capture_custom_bindings.h" |
45 #include "chrome/renderer/extensions/request_sender.h" | 46 #include "chrome/renderer/extensions/request_sender.h" |
46 #include "chrome/renderer/extensions/runtime_custom_bindings.h" | 47 #include "chrome/renderer/extensions/runtime_custom_bindings.h" |
47 #include "chrome/renderer/extensions/send_request_natives.h" | 48 #include "chrome/renderer/extensions/send_request_natives.h" |
48 #include "chrome/renderer/extensions/set_icon_natives.h" | 49 #include "chrome/renderer/extensions/set_icon_natives.h" |
49 #include "chrome/renderer/extensions/sync_file_system_custom_bindings.h" | 50 #include "chrome/renderer/extensions/sync_file_system_custom_bindings.h" |
50 #include "chrome/renderer/extensions/tab_finder.h" | 51 #include "chrome/renderer/extensions/tab_finder.h" |
51 #include "chrome/renderer/extensions/tabs_custom_bindings.h" | 52 #include "chrome/renderer/extensions/tabs_custom_bindings.h" |
52 #include "chrome/renderer/extensions/tts_custom_bindings.h" | 53 #include "chrome/renderer/extensions/tts_custom_bindings.h" |
53 #include "chrome/renderer/extensions/user_script_slave.h" | 54 #include "chrome/renderer/extensions/user_script_slave.h" |
54 #include "chrome/renderer/extensions/web_request_custom_bindings.h" | 55 #include "chrome/renderer/extensions/web_request_custom_bindings.h" |
55 #include "chrome/renderer/extensions/webstore_bindings.h" | 56 #include "chrome/renderer/extensions/webstore_bindings.h" |
56 #include "chrome/renderer/resource_bundle_source_map.h" | 57 #include "chrome/renderer/resource_bundle_source_map.h" |
57 #include "content/public/renderer/render_thread.h" | 58 #include "content/public/renderer/render_thread.h" |
58 #include "content/public/renderer/render_view.h" | 59 #include "content/public/renderer/render_view.h" |
59 #include "grit/renderer_resources.h" | 60 #include "grit/renderer_resources.h" |
| 61 |
60 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 62 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
61 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" | 63 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" |
62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" | 64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" |
63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedUserGesture.
h" | 67 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedUserGesture.
h" |
66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" | 68 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" |
67 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 69 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
68 #include "ui/base/layout.h" | 70 #include "ui/base/layout.h" |
69 #include "ui/base/resource/resource_bundle.h" | 71 #include "ui/base/resource/resource_bundle.h" |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 active_extension_ids_.insert(extension_id); | 907 active_extension_ids_.insert(extension_id); |
906 const Extension* extension = extensions_.GetByID(extension_id); | 908 const Extension* extension = extensions_.GetByID(extension_id); |
907 CHECK(extension); | 909 CHECK(extension); |
908 | 910 |
909 // This is called when starting a new extension page, so start the idle | 911 // This is called when starting a new extension page, so start the idle |
910 // handler ticking. | 912 // handler ticking. |
911 RenderThread::Get()->ScheduleIdleHandler(kInitialExtensionIdleHandlerDelayMs); | 913 RenderThread::Get()->ScheduleIdleHandler(kInitialExtensionIdleHandlerDelayMs); |
912 | 914 |
913 UpdateActiveExtensions(); | 915 UpdateActiveExtensions(); |
914 | 916 |
915 if (is_webkit_initialized_) | 917 if (is_webkit_initialized_) { |
916 InitOriginPermissions(extension); | 918 InitOriginPermissions(extension); |
| 919 // DOMActivity logger for a main world controlled by an extension (as in |
| 920 // the case of an extension background page, options page, popup etc.) |
| 921 // gets an empty title. |
| 922 DOMActivityLogger::AttachToWorld(DOMActivityLogger::kMainWorldId, |
| 923 extension_id, |
| 924 extension->url(), |
| 925 string16()); |
| 926 } |
917 } | 927 } |
918 | 928 |
919 void Dispatcher::InitOriginPermissions(const Extension* extension) { | 929 void Dispatcher::InitOriginPermissions(const Extension* extension) { |
920 // TODO(jstritar): We should try to remove this special case. Also, these | 930 // TODO(jstritar): We should try to remove this special case. Also, these |
921 // whitelist entries need to be updated when the kManagement permission | 931 // whitelist entries need to be updated when the kManagement permission |
922 // changes. | 932 // changes. |
923 if (extension->HasAPIPermission(APIPermission::kManagement)) { | 933 if (extension->HasAPIPermission(APIPermission::kManagement)) { |
924 WebSecurityPolicy::addOriginAccessWhitelistEntry( | 934 WebSecurityPolicy::addOriginAccessWhitelistEntry( |
925 extension->url(), | 935 extension->url(), |
926 WebString::fromUTF8(chrome::kChromeUIScheme), | 936 WebString::fromUTF8(chrome::kChromeUIScheme), |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); | 1173 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |
1164 v8::ThrowException( | 1174 v8::ThrowException( |
1165 v8::Exception::Error(v8::String::New(error_msg.c_str()))); | 1175 v8::Exception::Error(v8::String::New(error_msg.c_str()))); |
1166 return false; | 1176 return false; |
1167 } | 1177 } |
1168 | 1178 |
1169 return true; | 1179 return true; |
1170 } | 1180 } |
1171 | 1181 |
1172 } // namespace extensions | 1182 } // namespace extensions |
OLD | NEW |