OLD | NEW |
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 "extensions/renderer/dispatcher.h" | 5 #include "extensions/renderer/dispatcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 }; | 178 }; |
179 | 179 |
180 } // namespace | 180 } // namespace |
181 | 181 |
182 Dispatcher::Dispatcher(DispatcherDelegate* delegate) | 182 Dispatcher::Dispatcher(DispatcherDelegate* delegate) |
183 : delegate_(delegate), | 183 : delegate_(delegate), |
184 content_watcher_(new ContentWatcher()), | 184 content_watcher_(new ContentWatcher()), |
185 source_map_(&ResourceBundle::GetSharedInstance()), | 185 source_map_(&ResourceBundle::GetSharedInstance()), |
186 v8_schema_registry_(new V8SchemaRegistry), | 186 v8_schema_registry_(new V8SchemaRegistry), |
187 is_webkit_initialized_(false), | 187 is_webkit_initialized_(false), |
188 user_script_set_manager_observer_(this) { | 188 user_script_set_manager_observer_(this), |
| 189 webrequest_used_(false) { |
189 const CommandLine& command_line = *(CommandLine::ForCurrentProcess()); | 190 const CommandLine& command_line = *(CommandLine::ForCurrentProcess()); |
190 is_extension_process_ = | 191 is_extension_process_ = |
191 command_line.HasSwitch(extensions::switches::kExtensionProcess) || | 192 command_line.HasSwitch(extensions::switches::kExtensionProcess) || |
192 command_line.HasSwitch(::switches::kSingleProcess); | 193 command_line.HasSwitch(::switches::kSingleProcess); |
193 | 194 |
194 if (is_extension_process_) { | 195 if (is_extension_process_) { |
195 RenderThread::Get()->SetIdleNotificationDelayInMs( | 196 RenderThread::Get()->SetIdleNotificationDelayInMs( |
196 kInitialExtensionIdleHandlerDelayMs); | 197 kInitialExtensionIdleHandlerDelayMs); |
197 } | 198 } |
198 | 199 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 resources.push_back(std::make_pair("sendRequest", IDR_SEND_REQUEST_JS)); | 525 resources.push_back(std::make_pair("sendRequest", IDR_SEND_REQUEST_JS)); |
525 resources.push_back(std::make_pair("setIcon", IDR_SET_ICON_JS)); | 526 resources.push_back(std::make_pair("setIcon", IDR_SET_ICON_JS)); |
526 resources.push_back(std::make_pair("test", IDR_TEST_CUSTOM_BINDINGS_JS)); | 527 resources.push_back(std::make_pair("test", IDR_TEST_CUSTOM_BINDINGS_JS)); |
527 resources.push_back( | 528 resources.push_back( |
528 std::make_pair("test_environment_specific_bindings", | 529 std::make_pair("test_environment_specific_bindings", |
529 IDR_BROWSER_TEST_ENVIRONMENT_SPECIFIC_BINDINGS_JS)); | 530 IDR_BROWSER_TEST_ENVIRONMENT_SPECIFIC_BINDINGS_JS)); |
530 resources.push_back(std::make_pair("uncaught_exception_handler", | 531 resources.push_back(std::make_pair("uncaught_exception_handler", |
531 IDR_UNCAUGHT_EXCEPTION_HANDLER_JS)); | 532 IDR_UNCAUGHT_EXCEPTION_HANDLER_JS)); |
532 resources.push_back(std::make_pair("unload_event", IDR_UNLOAD_EVENT_JS)); | 533 resources.push_back(std::make_pair("unload_event", IDR_UNLOAD_EVENT_JS)); |
533 resources.push_back(std::make_pair("utils", IDR_UTILS_JS)); | 534 resources.push_back(std::make_pair("utils", IDR_UTILS_JS)); |
| 535 resources.push_back(std::make_pair("webRequest", |
| 536 IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS)); |
| 537 resources.push_back( |
| 538 std::make_pair("webRequestInternal", |
| 539 IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS)); |
534 // Note: webView not webview so that this doesn't interfere with the | 540 // Note: webView not webview so that this doesn't interfere with the |
535 // chrome.webview API bindings. | 541 // chrome.webview API bindings. |
536 resources.push_back(std::make_pair("webView", IDR_WEB_VIEW_JS)); | 542 resources.push_back(std::make_pair("webView", IDR_WEB_VIEW_JS)); |
537 resources.push_back(std::make_pair("webViewEvents", IDR_WEB_VIEW_EVENTS_JS)); | 543 resources.push_back(std::make_pair("webViewEvents", IDR_WEB_VIEW_EVENTS_JS)); |
538 resources.push_back( | 544 resources.push_back( |
539 std::make_pair("webViewExperimental", IDR_WEB_VIEW_EXPERIMENTAL_JS)); | 545 std::make_pair("webViewExperimental", IDR_WEB_VIEW_EXPERIMENTAL_JS)); |
540 resources.push_back(std::make_pair("webViewInternal", | 546 resources.push_back(std::make_pair("webViewInternal", |
541 IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS)); | 547 IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS)); |
542 resources.push_back(std::make_pair("denyWebView", IDR_WEB_VIEW_DENY_JS)); | 548 resources.push_back(std::make_pair("denyWebView", IDR_WEB_VIEW_DENY_JS)); |
543 resources.push_back( | 549 resources.push_back( |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 void Dispatcher::OnUpdateTabSpecificPermissions( | 981 void Dispatcher::OnUpdateTabSpecificPermissions( |
976 const GURL& url, | 982 const GURL& url, |
977 int tab_id, | 983 int tab_id, |
978 const std::string& extension_id, | 984 const std::string& extension_id, |
979 const URLPatternSet& origin_set) { | 985 const URLPatternSet& origin_set) { |
980 delegate_->UpdateTabSpecificPermissions( | 986 delegate_->UpdateTabSpecificPermissions( |
981 this, url, tab_id, extension_id, origin_set); | 987 this, url, tab_id, extension_id, origin_set); |
982 } | 988 } |
983 | 989 |
984 void Dispatcher::OnUsingWebRequestAPI(bool webrequest_used) { | 990 void Dispatcher::OnUsingWebRequestAPI(bool webrequest_used) { |
985 delegate_->HandleWebRequestAPIUsage(webrequest_used); | 991 webrequest_used_ = webrequest_used; |
986 } | 992 } |
987 | 993 |
988 void Dispatcher::OnUserScriptsUpdated( | 994 void Dispatcher::OnUserScriptsUpdated( |
989 const std::set<std::string>& changed_extensions, | 995 const std::set<std::string>& changed_extensions, |
990 const std::vector<UserScript*>& scripts) { | 996 const std::vector<UserScript*>& scripts) { |
991 UpdateActiveExtensions(); | 997 UpdateActiveExtensions(); |
992 } | 998 } |
993 | 999 |
994 void Dispatcher::UpdateActiveExtensions() { | 1000 void Dispatcher::UpdateActiveExtensions() { |
995 std::set<std::string> active_extensions = active_extension_ids_; | 1001 std::set<std::string> active_extensions = active_extension_ids_; |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 return v8::Handle<v8::Object>(); | 1370 return v8::Handle<v8::Object>(); |
1365 | 1371 |
1366 if (bind_name) | 1372 if (bind_name) |
1367 *bind_name = split.back(); | 1373 *bind_name = split.back(); |
1368 | 1374 |
1369 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) | 1375 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) |
1370 : bind_object; | 1376 : bind_object; |
1371 } | 1377 } |
1372 | 1378 |
1373 } // namespace extensions | 1379 } // namespace extensions |
OLD | NEW |