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

Side by Side Diff: chrome/default_plugin/plugin_impl_win.cc

Issue 8473001: Show missing plug-in infobar only if a plug-in is available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/default_plugin/plugin_impl_mac.mm ('k') | chrome/default_plugin/plugin_installer_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/default_plugin/plugin_impl_win.h" 5 #include "chrome/default_plugin/plugin_impl_win.h"
6 6
7 #include <shellapi.h> 7 #include <shellapi.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 instance_ = instance; 80 instance_ = instance;
81 mime_type_ = mime_type; 81 mime_type_ = mime_type;
82 82
83 ChildThread::current()->Send( 83 ChildThread::current()->Send(
84 new ChromePluginProcessHostMsg_GetPluginFinderUrl(&plugin_finder_url_)); 84 new ChromePluginProcessHostMsg_GetPluginFinderUrl(&plugin_finder_url_));
85 if (plugin_finder_url_.empty()) 85 if (plugin_finder_url_.empty())
86 disable_plugin_finder_ = true; 86 disable_plugin_finder_ = true;
87 87
88 InitializeResources(module_handle); 88 InitializeResources(module_handle);
89 89
90 // Set the routing IDs before downloading the plug-in file, so we can
91 // immediately notify the browser if a plug-in is available.
92 PluginInstallerBase::SetRoutingIds(argc, argn, argv);
90 if (!disable_plugin_finder_) { 93 if (!disable_plugin_finder_) {
91 if (!installation_job_monitor_thread_->Initialize()) { 94 if (!installation_job_monitor_thread_->Initialize()) {
92 NOTREACHED() << "Failed to initialize plugin install job"; 95 NOTREACHED() << "Failed to initialize plugin install job";
93 return false; 96 return false;
94 } 97 }
95 98
96 DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_NO_PLUGIN_NAME); 99 DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_NO_PLUGIN_NAME);
97 plugin_database_handler_.DownloadPluginsFileIfNeeded(plugin_finder_url_); 100 plugin_database_handler_.DownloadPluginsFileIfNeeded(plugin_finder_url_);
98 } else { 101 } else {
99 DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_PLUGIN_FINDER_DISABLED); 102 DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_PLUGIN_FINDER_DISABLED);
100 } 103 }
101 return PluginInstallerBase::Initialize(module_handle, instance, mime_type, 104 return true;
102 argc, argn, argv);
103 } 105 }
104 106
105 void PluginInstallerImpl::Shutdown() { 107 void PluginInstallerImpl::Shutdown() {
106 if (install_dialog_) { 108 if (install_dialog_) {
107 install_dialog_->RemoveInstaller(this); 109 install_dialog_->RemoveInstaller(this);
108 install_dialog_ = NULL; 110 install_dialog_ = NULL;
109 } 111 }
110 112
111 if (IsWindow(hwnd())) { 113 if (IsWindow(hwnd())) {
112 DestroyWindow(hwnd()); 114 DestroyWindow(hwnd());
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 plugin_database_handler_.Close(false); 260 plugin_database_handler_.Close(false);
259 } else { 261 } else {
260 DLOG(WARNING) << "Failed to download plugin list"; 262 DLOG(WARNING) << "Failed to download plugin list";
261 set_plugin_installer_state(PluginListDownloadFailed); 263 set_plugin_installer_state(PluginListDownloadFailed);
262 264
263 plugin_database_handler_.Close(true); 265 plugin_database_handler_.Close(true);
264 } 266 }
265 267
266 if (plugin_available) { 268 if (plugin_available) {
267 DVLOG(1) << "Plugin available for mime type " << mime_type_; 269 DVLOG(1) << "Plugin available for mime type " << mime_type_;
270 // Show the infobar only once.
271 if (show_install_infobar_) {
272 show_install_infobar_ = false;
273 NotifyPluginStatus(
274 webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE);
275 }
268 DisplayAvailablePluginStatus(); 276 DisplayAvailablePluginStatus();
269 } else { 277 } else {
270 DLOG(WARNING) << "No plugin available for mime type " << mime_type_; 278 DLOG(WARNING) << "No plugin available for mime type " << mime_type_;
271 DisplayStatus(IDS_DEFAULT_PLUGIN_NO_PLUGIN_AVAILABLE_MSG); 279 DisplayStatus(IDS_DEFAULT_PLUGIN_NO_PLUGIN_AVAILABLE_MSG);
272 } 280 }
273 } 281 }
274 } 282 }
275 283
276 int16 PluginInstallerImpl::NPP_HandleEvent(void* event) { 284 int16 PluginInstallerImpl::NPP_HandleEvent(void* event) {
277 return 0; 285 return 0;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 Init(parent_window, gfx::Rect(parent_rect)); 329 Init(parent_window, gfx::Rect(parent_rect));
322 DCHECK(IsWindow(hwnd())); 330 DCHECK(IsWindow(hwnd()));
323 installation_job_monitor_thread_->set_plugin_window(hwnd()); 331 installation_job_monitor_thread_->set_plugin_window(hwnd());
324 332
325 CreateToolTip(); 333 CreateToolTip();
326 UpdateToolTip(); 334 UpdateToolTip();
327 335
328 UpdateWindow(hwnd()); 336 UpdateWindow(hwnd());
329 ShowWindow(hwnd(), SW_SHOW); 337 ShowWindow(hwnd(), SW_SHOW);
330 338
331 // Show the infobar only once.
332 if (show_install_infobar_) {
333 show_install_infobar_ = false;
334 NotifyPluginStatus(
335 webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE);
336 }
337 return true; 339 return true;
338 } 340 }
339 341
340 void PluginInstallerImpl::DownloadPlugin() { 342 void PluginInstallerImpl::DownloadPlugin() {
341 set_plugin_installer_state(PluginDownloadInitiated); 343 set_plugin_installer_state(PluginDownloadInitiated);
342 344
343 DVLOG(1) << "Initiating download for plugin URL " 345 DVLOG(1) << "Initiating download for plugin URL "
344 << plugin_download_url_.c_str(); 346 << plugin_download_url_.c_str();
345 347
346 DisplayStatus(IDS_DEFAULT_PLUGIN_DOWNLOADING_PLUGIN_MSG); 348 DisplayStatus(IDS_DEFAULT_PLUGIN_DOWNLOADING_PLUGIN_MSG);
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 void PluginInstallerImpl::NotifyPluginStatus(int status) { 672 void PluginInstallerImpl::NotifyPluginStatus(int status) {
671 #if !defined(USE_AURA) 673 #if !defined(USE_AURA)
672 ChildThread::current()->Send( 674 ChildThread::current()->Send(
673 new ChromePluginProcessHostMsg_MissingPluginStatus( 675 new ChromePluginProcessHostMsg_MissingPluginStatus(
674 status, 676 status,
675 renderer_process_id(), 677 renderer_process_id(),
676 render_view_id(), 678 render_view_id(),
677 hwnd())); 679 hwnd()));
678 #endif 680 #endif
679 } 681 }
OLDNEW
« no previous file with comments | « chrome/default_plugin/plugin_impl_mac.mm ('k') | chrome/default_plugin/plugin_installer_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698