diff options
author | alicet@chromium.org <alicet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-10 22:23:45 +0000 |
---|---|---|
committer | alicet@chromium.org <alicet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-10 22:23:45 +0000 |
commit | 00475c046ebe17b9df0cf55d14afbebcb7f67437 (patch) | |
tree | 7785576854c5ac4571b522a3092d953954391009 | |
parent | 0ab098d8b5063a76bdb59479d4c4ac79d5f49370 (diff) | |
download | chromium_src-00475c046ebe17b9df0cf55d14afbebcb7f67437.zip chromium_src-00475c046ebe17b9df0cf55d14afbebcb7f67437.tar.gz chromium_src-00475c046ebe17b9df0cf55d14afbebcb7f67437.tar.bz2 |
add default plugin stub for aura to get ui_tests to compile.
BUG=99362
TEST=None
Review URL: http://codereview.chromium.org/8226001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104805 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/default_plugin/default_plugin.gyp | 2 | ||||
-rw-r--r-- | chrome/default_plugin/plugin_impl.h | 6 | ||||
-rw-r--r-- | chrome/default_plugin/plugin_impl_aura.cc | 74 | ||||
-rw-r--r-- | chrome/default_plugin/plugin_impl_aura.h | 119 |
4 files changed, 199 insertions, 2 deletions
diff --git a/chrome/default_plugin/default_plugin.gyp b/chrome/default_plugin/default_plugin.gyp index eb385ce..4d3f600 100644 --- a/chrome/default_plugin/default_plugin.gyp +++ b/chrome/default_plugin/default_plugin.gyp @@ -29,6 +29,8 @@ '<(DEPTH)/third_party/wtl/include', ], 'sources': [ + 'plugin_impl_aura.cc', + 'plugin_impl_aura.h', 'plugin_impl_gtk.cc', 'plugin_impl_gtk.h', 'plugin_impl_mac.h', diff --git a/chrome/default_plugin/plugin_impl.h b/chrome/default_plugin/plugin_impl.h index 45e0af3..ac57490 100644 --- a/chrome/default_plugin/plugin_impl.h +++ b/chrome/default_plugin/plugin_impl.h @@ -1,8 +1,10 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. -#if defined(OS_WIN) +#if defined(USE_AURA) +#include "chrome/default_plugin/plugin_impl_aura.h" +#elif defined(OS_WIN) #include "chrome/default_plugin/plugin_impl_win.h" #elif defined(OS_MACOSX) #include "chrome/default_plugin/plugin_impl_mac.h" diff --git a/chrome/default_plugin/plugin_impl_aura.cc b/chrome/default_plugin/plugin_impl_aura.cc new file mode 100644 index 0000000..aabb3c7 --- /dev/null +++ b/chrome/default_plugin/plugin_impl_aura.cc @@ -0,0 +1,74 @@ +// Copyright (c) 2011 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/default_plugin/plugin_impl_aura.h" + +#include "base/file_util.h" +#include "base/path_service.h" +#include "base/string_util.h" +#include "chrome/common/chrome_plugin_messages.h" +#include "chrome/default_plugin/plugin_main.h" +#include "content/common/child_thread.h" +#include "content/common/content_constants.h" +#include "googleurl/src/gurl.h" +#include "grit/webkit_strings.h" +#include "unicode/locid.h" +#include "webkit/plugins/npapi/default_plugin_shared.h" + +PluginInstallerImpl::PluginInstallerImpl(int16 mode) {} + +PluginInstallerImpl::~PluginInstallerImpl() { +} + +bool PluginInstallerImpl::Initialize(void* module_handle, + NPP instance, + NPMIMEType mime_type, + int16 argc, + char* argn[], + char* argv[]) { + DVLOG(1) << __FUNCTION__ << " MIME Type : " << mime_type; + DCHECK(instance != NULL); + + if (mime_type == NULL || strlen(mime_type) == 0) { + DLOG(WARNING) << __FUNCTION__ << " Invalid parameters passed in"; + NOTREACHED(); + return false; + } + + return PluginInstallerBase::Initialize(module_handle, instance, mime_type, + argc, argn, argv); +} + +bool PluginInstallerImpl::NPP_SetWindow(NPWindow* window_info) { + NOTIMPLEMENTED(); + return true; +} + +void PluginInstallerImpl::Shutdown() { +} + +void PluginInstallerImpl::NewStream(NPStream* stream) { + NOTIMPLEMENTED(); +} + +void PluginInstallerImpl::DestroyStream(NPStream* stream, NPError reason) { + NOTIMPLEMENTED(); +} + +bool PluginInstallerImpl::WriteReady(NPStream* stream) { + NOTIMPLEMENTED(); + return false; +} + +int32 PluginInstallerImpl::Write(NPStream* stream, int32 offset, + int32 buffer_length, void* buffer) { + return true; +} + +void PluginInstallerImpl::URLNotify(const char* url, NPReason reason) { +} + +int16 PluginInstallerImpl::NPP_HandleEvent(void* event) { + return 0; +} diff --git a/chrome/default_plugin/plugin_impl_aura.h b/chrome/default_plugin/plugin_impl_aura.h new file mode 100644 index 0000000..ed65932b --- /dev/null +++ b/chrome/default_plugin/plugin_impl_aura.h @@ -0,0 +1,119 @@ +// Copyright (c) 2011 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_DEFAULT_PLUGIN_PLUGIN_IMPL_AURA_H_ +#define CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_AURA_H_ +#pragma once + +#include <string> + +#include "chrome/default_plugin/plugin_installer_base.h" +#include "third_party/npapi/bindings/npapi.h" +#include "ui/gfx/native_widget_types.h" + +// Provides the plugin installation functionality. This class is +// instantiated with the information like the mime type of the +// target plugin, the display mode, etc. +class PluginInstallerImpl : public PluginInstallerBase { + public: + // mode is the plugin instantiation mode, i.e. whether it is a full + // page plugin (NP_FULL) or an embedded plugin (NP_EMBED) + explicit PluginInstallerImpl(int16 mode); + virtual ~PluginInstallerImpl(); + + // Initializes the plugin with the instance information, mime type + // and the list of parameters passed down to the plugin from the webpage. + // + // Parameters: + // module_handle + // The handle to the dll in which this object is instantiated. + // instance + // The plugins opaque instance handle. + // mime_type + // Identifies the third party plugin which would be eventually installed. + // argc + // Indicates the count of arguments passed in from the webpage. + // argv + // Pointer to the arguments. + // Returns true on success. + bool Initialize(void* module_handle, NPP instance, NPMIMEType mime_type, + int16 argc, char* argn[], char* argv[]); + + // Informs the plugin of its window information. + // + // Parameters: + // window_info + // The window info passed to npapi. + bool NPP_SetWindow(NPWindow* window_info); + + // Destroys the install dialog. + void Shutdown(); + + // Starts plugin download. Spawns the plugin installer after it is + // downloaded. + void DownloadPlugin(); + + // Indicates that the plugin download was cancelled. + void DownloadCancelled(); + + // Initializes the plugin download stream. + // + // Parameters: + // stream + // Pointer to the new stream being created. + void NewStream(NPStream* stream); + + // Uninitializes the plugin download stream. + // + // Parameters: + // stream + // Pointer to the stream being destroyed. + // reason + // Indicates why the stream is being destroyed. + // + void DestroyStream(NPStream* stream, NPError reason); + + // Determines whether the plugin is ready to accept data. + // We only accept data when we have initiated a download for the plugin + // database. + // + // Parameters: + // stream + // Pointer to the stream being destroyed. + // Returns true if the plugin is ready to accept data. + bool WriteReady(NPStream* stream); + + // Delivers data to the plugin instance. + // + // Parameters: + // stream + // Pointer to the stream being destroyed. + // offset + // Indicates the data offset. + // buffer_length + // Indicates the length of the data buffer. + // buffer + // Pointer to the actual buffer. + // Returns the number of bytes actually written, 0 on error. + int32 Write(NPStream* stream, int32 offset, int32 buffer_length, + void* buffer); + + // Handles notifications received in response to GetURLNotify calls issued + // by the plugin. + // + // Parameters: + // url + // Pointer to the URL. + // reason + // Describes why the notification was sent. + void URLNotify(const char* url, NPReason reason); + + // Used by the renderer to pass events (for e.g. input events) to the plugin. + int16 NPP_HandleEvent(void* event); + + private: + DISALLOW_COPY_AND_ASSIGN(PluginInstallerImpl); +}; + +#endif // CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_AURA_H_ |