summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-02 16:50:58 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-02 16:50:58 +0000
commit2290cb86f535d7babd4d84a2a08831404885e78c (patch)
tree09bca698a3e1a66c14ff50771dee24cd5751c918
parente9b3528e6a8d79f465fcdd2e44477f1eb9275539 (diff)
downloadchromium_src-2290cb86f535d7babd4d84a2a08831404885e78c.zip
chromium_src-2290cb86f535d7babd4d84a2a08831404885e78c.tar.gz
chromium_src-2290cb86f535d7babd4d84a2a08831404885e78c.tar.bz2
Make webkit_glue not depend on default_plugin.
This removes a dependency cycle and should also make life easier for DRT. Revert http://codereview.chromium.org/1658012 Review URL: http://codereview.chromium.org/2358001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48731 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/default_plugin_uitest.cc33
-rw-r--r--chrome/browser/plugin_service.cc3
-rw-r--r--chrome/chrome_common.gypi5
-rw-r--r--chrome/chrome_tests.gypi2
-rw-r--r--chrome/common/DEPS1
-rw-r--r--chrome/common/default_plugin.cc33
-rw-r--r--chrome/common/default_plugin.h15
-rw-r--r--chrome/plugin/plugin_main.cc2
-rw-r--r--chrome/test/automation/tab_proxy.h2
-rw-r--r--chrome/test/data/default_plugin.html14
-rw-r--r--chrome/test/plugin/plugin_test.cpp2
-rw-r--r--webkit/default_plugin/default_plugin.gyp8
-rw-r--r--webkit/default_plugin/plugin_main.cc19
-rw-r--r--webkit/glue/plugins/plugin_list.cc20
-rw-r--r--webkit/glue/webkit_glue.gypi5
-rw-r--r--webkit/support/default_plugin_stubs_win.cc29
-rw-r--r--webkit/support/webkit_support.gypi1
-rw-r--r--webkit/tools/test_shell/plugin_tests.cc27
18 files changed, 117 insertions, 104 deletions
diff --git a/chrome/browser/default_plugin_uitest.cc b/chrome/browser/default_plugin_uitest.cc
new file mode 100644
index 0000000..c6c5221
--- /dev/null
+++ b/chrome/browser/default_plugin_uitest.cc
@@ -0,0 +1,33 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/basictypes.h"
+#include "base/file_path.h"
+#include "build/build_config.h"
+#include "chrome/test/automation/tab_proxy.h"
+#include "chrome/test/ui/ui_test.h"
+#include "net/base/net_util.h"
+
+class DefaultPluginUITest : public UITest {
+ public:
+ DefaultPluginUITest() {
+ dom_automation_enabled_ = true;
+ }
+};
+
+TEST_F(DefaultPluginUITest, DefaultPluginLoadTest) {
+ // Open page with default plugin.
+ FilePath test_file(test_data_directory_);
+ test_file = test_file.AppendASCII("default_plugin.html");
+ NavigateToURL(net::FilePathToFileURL(test_file));
+
+ // Check that the default plugin was loaded. It executes a bit of javascript
+ // in the HTML file which replaces the innerHTML of div |result| with "DONE".
+ scoped_refptr<TabProxy> tab(GetActiveTab());
+ std::wstring out;
+ ASSERT_TRUE(tab->ExecuteAndExtractString(L"",
+ L"domAutomationController.send("
+ L"document.getElementById('result').innerHTML)", &out));
+ ASSERT_EQ(L"DONE", out);
+}
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc
index 37e3d2d..165ca52 100644
--- a/chrome/browser/plugin_service.cc
+++ b/chrome/browser/plugin_service.cc
@@ -23,6 +23,7 @@
#include "chrome/common/chrome_plugin_lib.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/default_plugin.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/gpu_plugin.h"
#include "chrome/common/logging_chrome.h"
@@ -159,6 +160,8 @@ PluginService::PluginService()
if (!path.empty())
NPAPI::PluginList::Singleton()->AddExtraPluginPath(path);
+ chrome::RegisterInternalDefaultPlugin();
+
// Register the internal Flash and PDF, if available.
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableInternalFlash) &&
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index 064775a..0a06020 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -134,6 +134,7 @@
'../third_party/sqlite/sqlite.gyp:sqlite',
'../third_party/zlib/zlib.gyp:zlib',
'../third_party/npapi/npapi.gyp:npapi',
+ '../webkit/default_plugin/default_plugin.gyp:default_plugin',
'../webkit/support/webkit_support.gyp:appcache',
'../webkit/support/webkit_support.gyp:glue',
],
@@ -191,9 +192,11 @@
'common/database_util.h',
'common/db_message_filter.cc',
'common/db_message_filter.h',
- 'common/dom_storage_common.h',
+ 'common/default_plugin.cc',
+ 'common/default_plugin.h',
'common/deprecated/event_sys-inl.h',
'common/deprecated/event_sys.h',
+ 'common/dom_storage_common.h',
'common/font_loader_mac.h',
'common/font_loader_mac.mm',
'common/gears_api.h',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index e87f53e..a741c70 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -286,6 +286,7 @@
# run time dependencies
'../third_party/ppapi/ppapi.gyp:ppapi_tests',
'../webkit/webkit.gyp:npapi_layout_test_plugin',
+ '../webkit/default_plugin/default_plugin.gyp:default_plugin',
],
'include_dirs': [
'..',
@@ -300,6 +301,7 @@
'browser/download/download_uitest.cc',
'browser/download/save_page_uitest.cc',
'browser/errorpage_uitest.cc',
+ 'browser/default_plugin_uitest.cc',
'browser/extensions/extension_uitest.cc',
'browser/history/multipart_uitest.cc',
'browser/history/redirect_uitest.cc',
diff --git a/chrome/common/DEPS b/chrome/common/DEPS
index 8a41106..c3db484 100644
--- a/chrome/common/DEPS
+++ b/chrome/common/DEPS
@@ -5,6 +5,7 @@ include_rules = [
"+media/audio",
"+sandbox/src",
"+skia/include",
+ "+webkit/default_plugin",
"+webkit/glue",
# Other libraries.
diff --git a/chrome/common/default_plugin.cc b/chrome/common/default_plugin.cc
new file mode 100644
index 0000000..2dc8488
--- /dev/null
+++ b/chrome/common/default_plugin.cc
@@ -0,0 +1,33 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/default_plugin.h"
+
+#include "webkit/glue/plugins/plugin_list.h"
+#include "webkit/default_plugin/plugin_main.h"
+
+namespace chrome {
+
+void RegisterInternalDefaultPlugin() {
+ const NPAPI::PluginVersionInfo default_plugin = {
+ FilePath(kDefaultPluginLibraryName),
+ L"Default Plug-in",
+ L"Provides functionality for installing third-party plug-ins",
+ L"1",
+ L"*",
+ L"",
+ L"",
+ {
+#if !defined(OS_POSIX) || defined(OS_MACOSX)
+ default_plugin::NP_GetEntryPoints,
+#endif
+ default_plugin::NP_Initialize,
+ default_plugin::NP_Shutdown
+ }
+ };
+
+ NPAPI::PluginList::Singleton()->RegisterInternalPlugin(default_plugin);
+}
+
+} // namespace chrome
diff --git a/chrome/common/default_plugin.h b/chrome/common/default_plugin.h
new file mode 100644
index 0000000..e3394e8
--- /dev/null
+++ b/chrome/common/default_plugin.h
@@ -0,0 +1,15 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_COMMON_DEFAULT_PLUGIN_H_
+#define CHROME_COMMON_DEFAULT_PLUGIN_H_
+
+namespace chrome {
+
+// Register the default plugin as an internal plugin in the PluginList.
+void RegisterInternalDefaultPlugin();
+
+} // namespace chrome
+
+#endif // CHROME_COMMON_DEFAULT_PLUGIN_H_
diff --git a/chrome/plugin/plugin_main.cc b/chrome/plugin/plugin_main.cc
index 070cfd5..f2da7e3 100644
--- a/chrome/plugin/plugin_main.cc
+++ b/chrome/plugin/plugin_main.cc
@@ -15,6 +15,7 @@
#include "chrome/common/child_process.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/default_plugin.h"
#include "chrome/common/gpu_plugin.h"
#include "chrome/common/logging_chrome.h"
#include "chrome/common/main_function_params.h"
@@ -128,6 +129,7 @@ int PluginMain(const MainFunctionParams& parameters) {
}
#endif
+ chrome::RegisterInternalDefaultPlugin();
chrome::RegisterInternalGPUPlugin();
MessageLoop::current()->Run();
diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h
index fbe2573..adcacf9 100644
--- a/chrome/test/automation/tab_proxy.h
+++ b/chrome/test/automation/tab_proxy.h
@@ -78,6 +78,8 @@ class TabProxy : public AutomationResourceProxy,
// will result in value = "string"
// jscript = "window.domAutomationController.send(24);"
// will result in value = 24
+ // NOTE: If this is called from a ui test, |dom_automation_enabled_| must be
+ // set to true for these functions to work.
bool ExecuteAndExtractString(const std::wstring& frame_xpath,
const std::wstring& jscript,
std::wstring* value) WARN_UNUSED_RESULT;
diff --git a/chrome/test/data/default_plugin.html b/chrome/test/data/default_plugin.html
new file mode 100644
index 0000000..aea5b8e
--- /dev/null
+++ b/chrome/test/data/default_plugin.html
@@ -0,0 +1,14 @@
+<div id='result'>Test running....</div>
+<script>
+function onSuccess() {
+ var result = document.getElementById('result');
+ result.innerHTML = 'DONE';
+}
+</script>
+<DIV ID=PluginDiv>
+<object classid="clsid:9E8BC6CE-AF35-400c-ABF6-A3F746A1871D">
+<embed type="application/chromium-test-default-plugin"
+ mode="np_embed"
+></embed>
+</object>
+</DIV>
diff --git a/chrome/test/plugin/plugin_test.cpp b/chrome/test/plugin/plugin_test.cpp
index 16addb7..d8c81a5 100644
--- a/chrome/test/plugin/plugin_test.cpp
+++ b/chrome/test/plugin/plugin_test.cpp
@@ -42,8 +42,6 @@
#if defined(OS_WIN)
#include "base/registry.h"
-// TODO(port) ?
-#include "webkit/default_plugin/plugin_impl.h"
#endif
class PluginTest : public UITest {
diff --git a/webkit/default_plugin/default_plugin.gyp b/webkit/default_plugin/default_plugin.gyp
index 3128e72..5912687 100644
--- a/webkit/default_plugin/default_plugin.gyp
+++ b/webkit/default_plugin/default_plugin.gyp
@@ -16,6 +16,8 @@
'../../third_party/icu/icu.gyp:icuuc',
'../../third_party/libxml/libxml.gyp:libxml',
'../../third_party/npapi/npapi.gyp:npapi',
+ '../support/webkit_support.gyp:webkit_resources',
+ '../support/webkit_support.gyp:webkit_strings',
],
'include_dirs': [
'../..',
@@ -36,12 +38,6 @@
],
'conditions': [
['OS=="win"', {
- 'dependencies': [
- # TODO(thakis): These throw a CircularException on mac.
- # Figure out why once they're needed.
- '../support/webkit_support.gyp:webkit_resources',
- '../support/webkit_support.gyp:webkit_strings',
- ],
'msvs_guid': '5916D37D-8C97-424F-A904-74E52594C2D6',
'link_settings': {
'libraries': ['-lurlmon.lib'],
diff --git a/webkit/default_plugin/plugin_main.cc b/webkit/default_plugin/plugin_main.cc
index f31cbd5..4d0fd5b 100644
--- a/webkit/default_plugin/plugin_main.cc
+++ b/webkit/default_plugin/plugin_main.cc
@@ -167,11 +167,6 @@ NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16 mode, int16 argc,
// 1. Test-shell
// 2. The plugin is running in the renderer process.
if (webkit_glue::IsPluginRunningInRendererProcess()) {
- if (!base::strcasecmp(plugin_type,
- "application/chromium-test-default-plugin")) {
- SignalTestResult(instance);
- return NPERR_NO_ERROR;
- }
return NPERR_GENERIC_ERROR;
}
@@ -189,6 +184,12 @@ NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16 mode, int16 argc,
argn, argv);
instance->pdata = reinterpret_cast<void*>(plugin_impl);
+
+ if (!base::strcasecmp(plugin_type,
+ "application/chromium-test-default-plugin")) {
+ SignalTestResult(instance);
+ }
+
return NPERR_NO_ERROR;
}
@@ -205,14 +206,6 @@ NPError NPP_Destroy(NPP instance, NPSavedData** save) {
}
NPError NPP_SetWindow(NPP instance, NPWindow* window_info) {
- // The default plugin only loads in in-process mode during execution of
- // PluginTest.DefaultPluginLoadTest. In that case, NPP_New() just calls
- // SignalTestResult() and doesn't set |instance->pdata|.
- // NPP_SetWindow() is called by webkit during layout of the test html. OS X
- // and linux DCHECK the result of this function, so pretend that all's well.
- if (webkit_glue::IsPluginRunningInRendererProcess())
- return NPERR_NO_ERROR;
-
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
diff --git a/webkit/glue/plugins/plugin_list.cc b/webkit/glue/plugins/plugin_list.cc
index d8651d7..487420f 100644
--- a/webkit/glue/plugins/plugin_list.cc
+++ b/webkit/glue/plugins/plugin_list.cc
@@ -12,7 +12,6 @@
#include "base/utf_string_conversions.h"
#include "base/time.h"
#include "net/base/mime_util.h"
-#include "webkit/default_plugin/plugin_main.h"
#include "webkit/glue/plugins/plugin_constants_win.h"
#include "webkit/glue/plugins/plugin_lib.h"
#include "webkit/glue/webkit_glue.h"
@@ -140,25 +139,6 @@ bool PluginList::CreateWebPluginInfo(const PluginVersionInfo& pvi,
PluginList::PluginList()
: plugins_loaded_(false), plugins_need_refresh_(false) {
PlatformInit();
-
- const PluginVersionInfo default_plugin = {
- FilePath(kDefaultPluginLibraryName),
- L"Default Plug-in",
- L"Provides functionality for installing third-party plug-ins",
- L"1",
- L"*",
- L"",
- L"",
- {
-#if !defined(OS_POSIX) || defined(OS_MACOSX)
- default_plugin::NP_GetEntryPoints,
-#endif
- default_plugin::NP_Initialize,
- default_plugin::NP_Shutdown
- }
- };
-
- internal_plugins_.push_back(default_plugin);
}
void PluginList::LoadPlugins(bool refresh) {
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index 8adcbf5..83b2a9b 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -366,11 +366,6 @@
'plugins/plugin_stubs.cc',
],
}],
- ['inside_chromium_build==1 or OS!="win"', {
- 'dependencies': [
- '<(DEPTH)/webkit/default_plugin/default_plugin.gyp:default_plugin',
- ],
- }],
['inside_chromium_build==0', {
'dependencies': [
'<(DEPTH)/webkit/support/setup_third_party.gyp:third_party_headers',
diff --git a/webkit/support/default_plugin_stubs_win.cc b/webkit/support/default_plugin_stubs_win.cc
deleted file mode 100644
index f728d1e..0000000
--- a/webkit/support/default_plugin_stubs_win.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// These are stubs for default_plugin which isn't currently built in
-// a webkit only checkout.
-
-#include "base/logging.h"
-#include "third_party/npapi/bindings/npapi.h"
-#include "third_party/npapi/bindings/nphostapi.h"
-
-namespace default_plugin {
-
-NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* funcs) {
- NOTIMPLEMENTED();
- return NPERR_GENERIC_ERROR;
-}
-
-NPError API_CALL NP_Initialize(NPNetscapeFuncs* funcs) {
- NOTIMPLEMENTED();
- return NPERR_GENERIC_ERROR;
-}
-
-NPError API_CALL NP_Shutdown(void) {
- NOTIMPLEMENTED();
- return NPERR_GENERIC_ERROR;
-}
-
-} // default_plugin
diff --git a/webkit/support/webkit_support.gypi b/webkit/support/webkit_support.gypi
index 9e5a358..50f79bf 100644
--- a/webkit/support/webkit_support.gypi
+++ b/webkit/support/webkit_support.gypi
@@ -21,7 +21,6 @@
'<(SHARED_INTERMEDIATE_DIR)/webkit', # for a header generated by grit
],
'sources': [
- 'default_plugin_stubs_win.cc',
'platform_support.h',
'platform_support_gtk.cc',
'platform_support_mac.mm',
diff --git a/webkit/tools/test_shell/plugin_tests.cc b/webkit/tools/test_shell/plugin_tests.cc
index 4b652cf..81903ac 100644
--- a/webkit/tools/test_shell/plugin_tests.cc
+++ b/webkit/tools/test_shell/plugin_tests.cc
@@ -125,33 +125,6 @@ TEST_F(PluginTest, Refresh) {
ASSERT_EQ(text, "DONE");
}
-TEST_F(PluginTest, DefaultPluginLoadTest) {
- std::string html = "\
- <div id='result'>Test running....</div>\
- <script>\
- function onSuccess() {\
- var result = document.getElementById('result');\
- result.innerHTML = 'DONE';\
- }\
- </script>\
- <DIV ID=PluginDiv>\
- <object classid=\"clsid:9E8BC6CE-AF35-400c-ABF6-A3F746A1871D\">\
- <embed type=\"application/chromium-test-default-plugin\"\
- mode=\"np_embed\"\
- ></embed>\
- </object>\
- </DIV>\
- ";
-
- test_shell_->webView()->mainFrame()->loadHTMLString(
- html, GURL("about:blank"));
- test_shell_->WaitTestFinished();
-
- std::string text =
- test_shell_->webView()->mainFrame()->contentAsText(10000).utf8();
- ASSERT_EQ(true, StartsWithASCII(text, "DONE", true));
-}
-
// Tests that if a frame is deleted as a result of calling NPP_HandleEvent, we
// don't crash.
TEST_F(PluginTest, DeleteFrameDuringEvent) {