Chromium Code Reviews| 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/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| 11 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
| 12 #include "chrome/common/child_process_logging.h" | 12 #include "chrome/common/child_process_logging.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "chrome/common/chrome_version_info.h" | 14 #include "chrome/common/chrome_version_info.h" |
| 15 #include "chrome/common/extensions/api/extension_api.h" | 15 #include "chrome/common/extensions/api/extension_api.h" |
| 16 #include "chrome/common/extensions/background_info.h" | 16 #include "chrome/common/extensions/background_info.h" |
| 17 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
| 18 #include "chrome/common/extensions/extension_messages.h" | 18 #include "chrome/common/extensions/extension_messages.h" |
| 19 #include "chrome/common/extensions/features/feature.h" | 19 #include "chrome/common/extensions/features/feature.h" |
| 20 #include "chrome/common/extensions/manifest.h" | 20 #include "chrome/common/extensions/manifest.h" |
| 21 #include "chrome/common/extensions/message_bundle.h" | 21 #include "chrome/common/extensions/message_bundle.h" |
| 22 #include "chrome/common/extensions/permissions/permission_set.h" | 22 #include "chrome/common/extensions/permissions/permission_set.h" |
| 23 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
| 24 #include "chrome/common/view_type.h" | |
| 25 #include "chrome/renderer/chrome_render_process_observer.h" | 24 #include "chrome/renderer/chrome_render_process_observer.h" |
| 26 #include "chrome/renderer/extensions/api_activity_logger.h" | 25 #include "chrome/renderer/extensions/api_activity_logger.h" |
| 27 #include "chrome/renderer/extensions/api_definitions_natives.h" | 26 #include "chrome/renderer/extensions/api_definitions_natives.h" |
| 28 #include "chrome/renderer/extensions/app_bindings.h" | 27 #include "chrome/renderer/extensions/app_bindings.h" |
| 29 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" | 28 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" |
| 30 #include "chrome/renderer/extensions/app_window_custom_bindings.h" | 29 #include "chrome/renderer/extensions/app_window_custom_bindings.h" |
| 31 #include "chrome/renderer/extensions/binding_generating_native_handler.h" | 30 #include "chrome/renderer/extensions/binding_generating_native_handler.h" |
| 32 #include "chrome/renderer/extensions/chrome_v8_context.h" | 31 #include "chrome/renderer/extensions/chrome_v8_context.h" |
| 33 #include "chrome/renderer/extensions/chrome_v8_extension.h" | 32 #include "chrome/renderer/extensions/chrome_v8_extension.h" |
| 34 #include "chrome/renderer/extensions/content_watcher.h" | 33 #include "chrome/renderer/extensions/content_watcher.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 55 #include "chrome/renderer/extensions/sync_file_system_custom_bindings.h" | 54 #include "chrome/renderer/extensions/sync_file_system_custom_bindings.h" |
| 56 #include "chrome/renderer/extensions/tab_finder.h" | 55 #include "chrome/renderer/extensions/tab_finder.h" |
| 57 #include "chrome/renderer/extensions/tabs_custom_bindings.h" | 56 #include "chrome/renderer/extensions/tabs_custom_bindings.h" |
| 58 #include "chrome/renderer/extensions/tts_custom_bindings.h" | 57 #include "chrome/renderer/extensions/tts_custom_bindings.h" |
| 59 #include "chrome/renderer/extensions/user_script_slave.h" | 58 #include "chrome/renderer/extensions/user_script_slave.h" |
| 60 #include "chrome/renderer/extensions/web_request_custom_bindings.h" | 59 #include "chrome/renderer/extensions/web_request_custom_bindings.h" |
| 61 #include "chrome/renderer/extensions/webstore_bindings.h" | 60 #include "chrome/renderer/extensions/webstore_bindings.h" |
| 62 #include "chrome/renderer/resource_bundle_source_map.h" | 61 #include "chrome/renderer/resource_bundle_source_map.h" |
| 63 #include "content/public/renderer/render_thread.h" | 62 #include "content/public/renderer/render_thread.h" |
| 64 #include "content/public/renderer/render_view.h" | 63 #include "content/public/renderer/render_view.h" |
| 64 #include "extensions/common/view_type.h" | |
| 65 #include "grit/renderer_resources.h" | 65 #include "grit/renderer_resources.h" |
| 66 | |
| 67 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 66 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
| 68 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" | 67 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" |
| 69 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" | 68 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" |
| 70 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 69 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 71 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 70 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 72 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedUserGesture. h" | 71 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedUserGesture. h" |
| 73 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" | 72 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" |
| 74 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 73 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 75 #include "ui/base/layout.h" | 74 #include "ui/base/layout.h" |
| 76 #include "ui/base/resource/resource_bundle.h" | 75 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 } | 245 } |
| 247 | 246 |
| 248 private: | 247 private: |
| 249 bool IsContextLazyBackgroundPage(RenderView* render_view, | 248 bool IsContextLazyBackgroundPage(RenderView* render_view, |
| 250 const Extension* extension) { | 249 const Extension* extension) { |
| 251 if (!render_view) | 250 if (!render_view) |
| 252 return false; | 251 return false; |
| 253 | 252 |
| 254 ExtensionHelper* helper = ExtensionHelper::Get(render_view); | 253 ExtensionHelper* helper = ExtensionHelper::Get(render_view); |
| 255 return (extension && BackgroundInfo::HasLazyBackgroundPage(extension) && | 254 return (extension && BackgroundInfo::HasLazyBackgroundPage(extension) && |
| 256 helper->view_type() == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE); | 255 helper->view_type() == |
| 256 extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE); | |
|
Yoyo Zhou
2013/04/01 17:36:51
in namespace extensions
| |
| 257 } | 257 } |
| 258 }; | 258 }; |
| 259 | 259 |
| 260 class ProcessInfoNativeHandler : public ChromeV8Extension { | 260 class ProcessInfoNativeHandler : public ChromeV8Extension { |
| 261 public: | 261 public: |
| 262 ProcessInfoNativeHandler(Dispatcher* dispatcher, | 262 ProcessInfoNativeHandler(Dispatcher* dispatcher, |
| 263 v8::Handle<v8::Context> context, | 263 v8::Handle<v8::Context> context, |
| 264 const std::string& extension_id, | 264 const std::string& extension_id, |
| 265 const std::string& context_type, | 265 const std::string& context_type, |
| 266 bool is_incognito_context, | 266 bool is_incognito_context, |
| (...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1369 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); | 1369 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |
| 1370 v8::ThrowException( | 1370 v8::ThrowException( |
| 1371 v8::Exception::Error(v8::String::New(error_msg.c_str()))); | 1371 v8::Exception::Error(v8::String::New(error_msg.c_str()))); |
| 1372 return false; | 1372 return false; |
| 1373 } | 1373 } |
| 1374 | 1374 |
| 1375 return true; | 1375 return true; |
| 1376 } | 1376 } |
| 1377 | 1377 |
| 1378 } // namespace extensions | 1378 } // namespace extensions |
| OLD | NEW |