Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Unified Diff: chrome/browser/chrome_plugin_message_filter.cc

Issue 7812020: Moved the following IPC messages used by the chrome NPAPI plugin installer out of content (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chrome_plugin_message_filter.h ('k') | chrome/browser/plugin_installer_infobar_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_plugin_message_filter.cc
===================================================================
--- chrome/browser/chrome_plugin_message_filter.cc (revision 98657)
+++ chrome/browser/chrome_plugin_message_filter.cc (working copy)
@@ -5,12 +5,18 @@
#include "chrome/browser/chrome_plugin_message_filter.h"
#include "chrome/browser/browser_process.h"
-#include "content/browser/browser_thread.h"
#include "chrome/browser/plugin_download_helper.h"
+#include "chrome/browser/plugin_installer_infobar_delegate.h"
+#include "chrome/browser/plugin_observer.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/common/chrome_plugin_messages.h"
+#include "content/browser/browser_thread.h"
#include "content/browser/plugin_process_host.h"
-#include "content/common/plugin_messages.h"
+#include "content/browser/renderer_host/render_view_host.h"
+#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "net/url_request/url_request_context_getter.h"
+#include "webkit/plugins/npapi/default_plugin_shared.h"
static const char kDefaultPluginFinderURL[] =
"https://dl-ssl.google.com/edgedl/chrome/plugins/plugins2.xml";
@@ -26,10 +32,12 @@
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ChromePluginMessageFilter, message)
#if defined(OS_WIN)
- IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl)
+ IPC_MESSAGE_HANDLER(ChromePluginProcessHostMsg_DownloadUrl, OnDownloadUrl)
#endif
- IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginFinderUrl,
+ IPC_MESSAGE_HANDLER(ChromePluginProcessHostMsg_GetPluginFinderUrl,
OnGetPluginFinderUrl)
+ IPC_MESSAGE_HANDLER(ChromePluginProcessHostMsg_MissingPluginStatus,
+ OnMissingPluginStatus)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -71,3 +79,54 @@
plugin_finder_url->clear();
}
}
+
+void ChromePluginMessageFilter::OnMissingPluginStatus(
+ int status, int render_process_id, int render_view_id,
+ gfx::NativeWindow window) {
+ BrowserThread::PostTask(
+ BrowserThread::UI,
+ FROM_HERE,
+ NewRunnableFunction(
+ &ChromePluginMessageFilter::HandleMissingPluginStatus,
+ status, render_process_id, render_view_id, window));
+}
+
+// static
+void ChromePluginMessageFilter::HandleMissingPluginStatus(
+ int status, int render_process_id, int render_view_id,
+ gfx::NativeWindow window) {
+// TODO(PORT): pull in when plug-ins work
+#if defined(OS_WIN)
+ RenderViewHost* host = RenderViewHost::FromID(render_process_id,
+ render_view_id);
+ if (!host || !host->delegate() || !host->delegate()->GetAsTabContents())
+ return;
+
+ TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents(
+ host->delegate()->GetAsTabContents());
+ if (!tcw)
+ return;
+
+ if (status == webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE) {
+ tcw->AddInfoBar(
+ new PluginInstallerInfoBarDelegate(
+ host->delegate()->GetAsTabContents(), window));
+ return;
+ }
+
+ DCHECK_EQ(webkit::npapi::default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD,
+ status);
+ for (size_t i = 0; i < tcw->infobar_count(); ++i) {
+ InfoBarDelegate* delegate = tcw->GetInfoBarDelegateAt(i);
+ if (delegate->AsPluginInstallerInfoBarDelegate() != NULL) {
+ tcw->RemoveInfoBar(delegate);
+ return;
+ }
+ }
+#else
+ // TODO(port): Implement the infobar that accompanies the default plugin.
+ // Linux: http://crbug.com/10952
+ // Mac: http://crbug.com/17392
+ NOTIMPLEMENTED();
+#endif // OS_WIN}
+}
« no previous file with comments | « chrome/browser/chrome_plugin_message_filter.h ('k') | chrome/browser/plugin_installer_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698