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/extension_dispatcher.h" | 5 #include "chrome/renderer/extensions/extension_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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 #include "chrome/renderer/extensions/webstore_bindings.h" | 44 #include "chrome/renderer/extensions/webstore_bindings.h" |
45 #include "chrome/renderer/module_system.h" | 45 #include "chrome/renderer/module_system.h" |
46 #include "chrome/renderer/native_handler.h" | 46 #include "chrome/renderer/native_handler.h" |
47 #include "chrome/renderer/resource_bundle_source_map.h" | 47 #include "chrome/renderer/resource_bundle_source_map.h" |
48 #include "content/public/renderer/render_thread.h" | 48 #include "content/public/renderer/render_thread.h" |
49 #include "content/public/renderer/render_view.h" | 49 #include "content/public/renderer/render_view.h" |
50 #include "grit/renderer_resources.h" | 50 #include "grit/renderer_resources.h" |
51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" | 51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" |
52 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 52 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
54 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" | |
54 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedUserGesture. h" | 55 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedUserGesture. h" |
55 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" | 56 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" |
56 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
57 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 58 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
58 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques t.h" | 59 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques t.h" |
59 #include "ui/base/resource/resource_bundle.h" | 60 #include "ui/base/resource/resource_bundle.h" |
60 #include "v8/include/v8.h" | 61 #include "v8/include/v8.h" |
61 | 62 |
62 using WebKit::WebDataSource; | 63 using WebKit::WebDataSource; |
63 using WebKit::WebDocument; | 64 using WebKit::WebDocument; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 return handled; | 251 return handled; |
251 } | 252 } |
252 | 253 |
253 void ExtensionDispatcher::WebKitInitialized() { | 254 void ExtensionDispatcher::WebKitInitialized() { |
254 // For extensions, we want to ensure we call the IdleHandler every so often, | 255 // For extensions, we want to ensure we call the IdleHandler every so often, |
255 // even if the extension keeps up activity. | 256 // even if the extension keeps up activity. |
256 if (is_extension_process_) { | 257 if (is_extension_process_) { |
257 forced_idle_timer_.Start(FROM_HERE, | 258 forced_idle_timer_.Start(FROM_HERE, |
258 base::TimeDelta::FromMilliseconds(kMaxExtensionIdleHandlerDelayMs), | 259 base::TimeDelta::FromMilliseconds(kMaxExtensionIdleHandlerDelayMs), |
259 RenderThread::Get(), &RenderThread::IdleHandler); | 260 RenderThread::Get(), &RenderThread::IdleHandler); |
261 // Enables shadow DOM and scoped stylesheet only for extensions. | |
262 // This allows extension developes to try thiese features without | |
Aaron Boodman
2012/05/15 18:30:56
typo: these
| |
263 // worrying about flag settings and to keep these hidden from the | |
264 // wild Web at the same time. This should be eventually removed | |
265 // once these feature is enabled by default. | |
266 WebKit::WebRuntimeFeatures::enableShadowDOM(true); | |
Aaron Boodman
2012/05/15 18:30:56
A static flag is not going to be sufficient. A sin
| |
267 WebKit::WebRuntimeFeatures::enableStyleScoped(true); | |
260 } | 268 } |
261 | 269 |
262 // Initialize host permissions for any extensions that were activated before | 270 // Initialize host permissions for any extensions that were activated before |
263 // WebKit was initialized. | 271 // WebKit was initialized. |
264 for (std::set<std::string>::iterator iter = active_extension_ids_.begin(); | 272 for (std::set<std::string>::iterator iter = active_extension_ids_.begin(); |
265 iter != active_extension_ids_.end(); ++iter) { | 273 iter != active_extension_ids_.end(); ++iter) { |
266 const Extension* extension = extensions_.GetByID(*iter); | 274 const Extension* extension = extensions_.GetByID(*iter); |
267 if (extension) | 275 if (extension) |
268 InitOriginPermissions(extension); | 276 InitOriginPermissions(extension); |
269 } | 277 } |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
899 static const char kMessage[] = | 907 static const char kMessage[] = |
900 "%s can only be used in an extension process."; | 908 "%s can only be used in an extension process."; |
901 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); | 909 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |
902 v8::ThrowException( | 910 v8::ThrowException( |
903 v8::Exception::Error(v8::String::New(error_msg.c_str()))); | 911 v8::Exception::Error(v8::String::New(error_msg.c_str()))); |
904 return false; | 912 return false; |
905 } | 913 } |
906 | 914 |
907 return true; | 915 return true; |
908 } | 916 } |
OLD | NEW |