| OLD | NEW |
| 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 20 matching lines...) Expand all Loading... |
| 31 regular_font_(NULL), | 31 regular_font_(NULL), |
| 32 underline_font_(NULL), | 32 underline_font_(NULL), |
| 33 tooltip_(NULL), | 33 tooltip_(NULL), |
| 34 installation_job_monitor_thread_( | 34 installation_job_monitor_thread_( |
| 35 new PluginInstallationJobMonitorThread()), | 35 new PluginInstallationJobMonitorThread()), |
| 36 plugin_database_handler_(*this), | 36 plugin_database_handler_(*this), |
| 37 plugin_download_url_for_display_(false) { | 37 plugin_download_url_for_display_(false) { |
| 38 } | 38 } |
| 39 | 39 |
| 40 PluginInstallerImpl::~PluginInstallerImpl() { | 40 PluginInstallerImpl::~PluginInstallerImpl() { |
| 41 installation_job_monitor_thread_->Stop(); | 41 if (!disable_plugin_finder_) |
| 42 installation_job_monitor_thread_->Stop(); |
| 42 | 43 |
| 43 if (bold_font_) | 44 if (bold_font_) |
| 44 DeleteObject(bold_font_); | 45 DeleteObject(bold_font_); |
| 45 | 46 |
| 46 if (underline_font_) | 47 if (underline_font_) |
| 47 DeleteObject(underline_font_); | 48 DeleteObject(underline_font_); |
| 48 | 49 |
| 49 if (tooltip_) | 50 if (tooltip_) |
| 50 DestroyWindow(tooltip_); | 51 DestroyWindow(tooltip_); |
| 51 } | 52 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 65 | 66 |
| 66 instance_ = instance; | 67 instance_ = instance; |
| 67 mime_type_ = mime_type; | 68 mime_type_ = mime_type; |
| 68 | 69 |
| 69 if (!webkit_glue::GetPluginFinderURL(&plugin_finder_url_)) { | 70 if (!webkit_glue::GetPluginFinderURL(&plugin_finder_url_)) { |
| 70 NOTREACHED(); | 71 NOTREACHED(); |
| 71 DLOG(WARNING) << __FUNCTION__ << " Failed to get the plugin finder URL"; | 72 DLOG(WARNING) << __FUNCTION__ << " Failed to get the plugin finder URL"; |
| 72 return false; | 73 return false; |
| 73 } | 74 } |
| 74 | 75 |
| 75 if (!installation_job_monitor_thread_->Initialize()) { | 76 if (plugin_finder_url_.empty()) |
| 76 DLOG(ERROR) << "Failed to initialize plugin install job"; | 77 disable_plugin_finder_ = true; |
| 77 NOTREACHED(); | |
| 78 return false; | |
| 79 } | |
| 80 | 78 |
| 81 InitializeResources(module_handle); | 79 InitializeResources(module_handle); |
| 82 | 80 |
| 83 DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_NO_PLUGIN_NAME); | 81 if (!disable_plugin_finder_) { |
| 84 plugin_database_handler_.DownloadPluginsFileIfNeeded(plugin_finder_url_); | 82 if (!installation_job_monitor_thread_->Initialize()) { |
| 83 DLOG(ERROR) << "Failed to initialize plugin install job"; |
| 84 NOTREACHED(); |
| 85 return false; |
| 86 } |
| 87 |
| 88 DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_NO_PLUGIN_NAME); |
| 89 plugin_database_handler_.DownloadPluginsFileIfNeeded(plugin_finder_url_); |
| 90 } else { |
| 91 DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_PLUGIN_FINDER_DISABLED); |
| 92 } |
| 85 | 93 |
| 86 return true; | 94 return true; |
| 87 } | 95 } |
| 88 | 96 |
| 89 void PluginInstallerImpl::Shutdown() { | 97 void PluginInstallerImpl::Shutdown() { |
| 90 if (install_dialog_) { | 98 if (install_dialog_) { |
| 91 install_dialog_->RemoveInstaller(this); | 99 install_dialog_->RemoveInstaller(this); |
| 92 install_dialog_ = NULL; | 100 install_dialog_ = NULL; |
| 93 } | 101 } |
| 94 | 102 |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 return true; | 649 return true; |
| 642 } | 650 } |
| 643 | 651 |
| 644 void PluginInstallerImpl::NotifyPluginStatus(int status) { | 652 void PluginInstallerImpl::NotifyPluginStatus(int status) { |
| 645 default_plugin::g_browser->getvalue( | 653 default_plugin::g_browser->getvalue( |
| 646 instance_, | 654 instance_, |
| 647 static_cast<NPNVariable>( | 655 static_cast<NPNVariable>( |
| 648 webkit::npapi::default_plugin::kMissingPluginStatusStart + status), | 656 webkit::npapi::default_plugin::kMissingPluginStatusStart + status), |
| 649 NULL); | 657 NULL); |
| 650 } | 658 } |
| OLD | NEW |