| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } // namespace | 182 } // namespace |
| 183 | 183 |
| 184 Dispatcher::Dispatcher(DispatcherDelegate* delegate) | 184 Dispatcher::Dispatcher(DispatcherDelegate* delegate) |
| 185 : delegate_(delegate), | 185 : delegate_(delegate), |
| 186 content_watcher_(new ContentWatcher()), | 186 content_watcher_(new ContentWatcher()), |
| 187 source_map_(&ResourceBundle::GetSharedInstance()), | 187 source_map_(&ResourceBundle::GetSharedInstance()), |
| 188 v8_schema_registry_(new V8SchemaRegistry), | 188 v8_schema_registry_(new V8SchemaRegistry), |
| 189 is_webkit_initialized_(false), | 189 is_webkit_initialized_(false), |
| 190 user_script_set_manager_observer_(this), | 190 user_script_set_manager_observer_(this), |
| 191 webrequest_used_(false) { | 191 webrequest_used_(false) { |
| 192 const CommandLine& command_line = *(CommandLine::ForCurrentProcess()); | 192 const base::CommandLine& command_line = |
| 193 *(base::CommandLine::ForCurrentProcess()); |
| 193 is_extension_process_ = | 194 is_extension_process_ = |
| 194 command_line.HasSwitch(switches::kExtensionProcess) || | 195 command_line.HasSwitch(switches::kExtensionProcess) || |
| 195 command_line.HasSwitch(::switches::kSingleProcess); | 196 command_line.HasSwitch(::switches::kSingleProcess); |
| 196 | 197 |
| 197 if (is_extension_process_) { | 198 if (is_extension_process_) { |
| 198 RenderThread::Get()->SetIdleNotificationDelayInMs( | 199 RenderThread::Get()->SetIdleNotificationDelayInMs( |
| 199 kInitialExtensionIdleHandlerDelayMs); | 200 kInitialExtensionIdleHandlerDelayMs); |
| 200 } | 201 } |
| 201 | 202 |
| 202 RenderThread::Get()->RegisterExtension(SafeBuiltins::CreateV8Extension()); | 203 RenderThread::Get()->RegisterExtension(SafeBuiltins::CreateV8Extension()); |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 if (feature->IsInternal()) | 1142 if (feature->IsInternal()) |
| 1142 continue; | 1143 continue; |
| 1143 | 1144 |
| 1144 // If this API has a parent feature (and isn't marked 'noparent'), | 1145 // If this API has a parent feature (and isn't marked 'noparent'), |
| 1145 // then this must be a function or event, so we should not register. | 1146 // then this must be a function or event, so we should not register. |
| 1146 if (api_feature_provider->GetParent(feature) != NULL) | 1147 if (api_feature_provider->GetParent(feature) != NULL) |
| 1147 continue; | 1148 continue; |
| 1148 | 1149 |
| 1149 // Skip chrome.test if this isn't a test. | 1150 // Skip chrome.test if this isn't a test. |
| 1150 if (api_name == "test" && | 1151 if (api_name == "test" && |
| 1151 !CommandLine::ForCurrentProcess()->HasSwitch( | 1152 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1152 ::switches::kTestType)) { | 1153 ::switches::kTestType)) { |
| 1153 continue; | 1154 continue; |
| 1154 } | 1155 } |
| 1155 | 1156 |
| 1156 if (context->IsAnyFeatureAvailableToContext(*feature)) | 1157 if (context->IsAnyFeatureAvailableToContext(*feature)) |
| 1157 RegisterBinding(api_name, context); | 1158 RegisterBinding(api_name, context); |
| 1158 } | 1159 } |
| 1159 break; | 1160 break; |
| 1160 } | 1161 } |
| 1161 } | 1162 } |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1414 return v8::Handle<v8::Object>(); | 1415 return v8::Handle<v8::Object>(); |
| 1415 | 1416 |
| 1416 if (bind_name) | 1417 if (bind_name) |
| 1417 *bind_name = split.back(); | 1418 *bind_name = split.back(); |
| 1418 | 1419 |
| 1419 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) | 1420 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) |
| 1420 : bind_object; | 1421 : bind_object; |
| 1421 } | 1422 } |
| 1422 | 1423 |
| 1423 } // namespace extensions | 1424 } // namespace extensions |
| OLD | NEW |