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" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/default_plugin/plugin_main.h" | 13 #include "chrome/default_plugin/plugin_main.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 #include "grit/webkit_strings.h" | 15 #include "grit/webkit_strings.h" |
16 #include "unicode/locid.h" | 16 #include "unicode/locid.h" |
17 #include "webkit/glue/webkit_glue.h" | 17 #include "webkit/glue/webkit_glue.h" |
18 #include "webkit/glue/plugins/default_plugin_shared.h" | 18 #include "webkit/plugins/npapi/default_plugin_shared.h" |
19 | 19 |
20 static const int TOOLTIP_MAX_WIDTH = 500; | 20 static const int TOOLTIP_MAX_WIDTH = 500; |
21 | 21 |
22 PluginInstallerImpl::PluginInstallerImpl(int16 mode) | 22 PluginInstallerImpl::PluginInstallerImpl(int16 mode) |
23 : instance_(NULL), | 23 : instance_(NULL), |
24 mode_(mode), | 24 mode_(mode), |
25 plugin_install_stream_(NULL), | 25 plugin_install_stream_(NULL), |
26 plugin_installer_state_(PluginInstallerStateUndefined), | 26 plugin_installer_state_(PluginInstallerStateUndefined), |
27 install_dialog_(NULL), | 27 install_dialog_(NULL), |
28 enable_click_(false), | 28 enable_click_(false), |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } else { | 243 } else { |
244 DLOG(WARNING) << "Failed to download plugin list"; | 244 DLOG(WARNING) << "Failed to download plugin list"; |
245 set_plugin_installer_state(PluginListDownloadFailed); | 245 set_plugin_installer_state(PluginListDownloadFailed); |
246 | 246 |
247 plugin_database_handler_.Close(true); | 247 plugin_database_handler_.Close(true); |
248 } | 248 } |
249 | 249 |
250 if (plugin_available) { | 250 if (plugin_available) { |
251 DVLOG(1) << "Plugin available for mime type " << mime_type_; | 251 DVLOG(1) << "Plugin available for mime type " << mime_type_; |
252 DisplayAvailablePluginStatus(); | 252 DisplayAvailablePluginStatus(); |
253 NotifyPluginStatus(default_plugin::MISSING_PLUGIN_AVAILABLE); | 253 NotifyPluginStatus( |
| 254 webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE); |
254 } else { | 255 } else { |
255 DLOG(WARNING) << "No plugin available for mime type " << mime_type_; | 256 DLOG(WARNING) << "No plugin available for mime type " << mime_type_; |
256 DisplayStatus(IDS_DEFAULT_PLUGIN_NO_PLUGIN_AVAILABLE_MSG); | 257 DisplayStatus(IDS_DEFAULT_PLUGIN_NO_PLUGIN_AVAILABLE_MSG); |
257 } | 258 } |
258 } | 259 } |
259 } | 260 } |
260 | 261 |
261 int16 PluginInstallerImpl::NPP_HandleEvent(void* event) { | 262 int16 PluginInstallerImpl::NPP_HandleEvent(void* event) { |
262 NPEvent* npp_event = static_cast<NPEvent*>(event); | 263 NPEvent* npp_event = static_cast<NPEvent*>(event); |
263 if (npp_event->event == default_plugin::kInstallMissingPluginMessage) { | 264 if (npp_event->event == |
| 265 webkit::npapi::default_plugin::kInstallMissingPluginMessage) { |
264 // We could get this message because InfoBar may not be in sync with our | 266 // We could get this message because InfoBar may not be in sync with our |
265 // internal processing. So we need to check the status. | 267 // internal processing. So we need to check the status. |
266 if (plugin_installer_state() == PluginListDownloaded) { | 268 if (plugin_installer_state() == PluginListDownloaded) { |
267 ShowInstallDialog(); | 269 ShowInstallDialog(); |
268 } | 270 } |
269 } | 271 } |
270 return 0; | 272 return 0; |
271 } | 273 } |
272 | 274 |
273 std::wstring PluginInstallerImpl::ReplaceStringForPossibleEmptyReplacement( | 275 std::wstring PluginInstallerImpl::ReplaceStringForPossibleEmptyReplacement( |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 enable_click_ = false; | 522 enable_click_ = false; |
521 install_dialog_->ShowInstallDialog(hwnd()); | 523 install_dialog_->ShowInstallDialog(hwnd()); |
522 } | 524 } |
523 | 525 |
524 LRESULT PluginInstallerImpl::OnLButtonDown(UINT message, WPARAM wparam, | 526 LRESULT PluginInstallerImpl::OnLButtonDown(UINT message, WPARAM wparam, |
525 LPARAM lparam, BOOL& handled) { | 527 LPARAM lparam, BOOL& handled) { |
526 if (!enable_click_) | 528 if (!enable_click_) |
527 return 0; | 529 return 0; |
528 if (plugin_installer_state() == PluginListDownloaded) { | 530 if (plugin_installer_state() == PluginListDownloaded) { |
529 ShowInstallDialog(); | 531 ShowInstallDialog(); |
530 NotifyPluginStatus(default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD); | 532 NotifyPluginStatus( |
| 533 webkit::npapi::default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD); |
531 } else if (plugin_installer_state_ == PluginInstallerLaunchSuccess) { | 534 } else if (plugin_installer_state_ == PluginInstallerLaunchSuccess) { |
532 DCHECK(default_plugin::g_browser); | 535 DCHECK(default_plugin::g_browser); |
533 DCHECK(default_plugin::g_browser->geturl); | 536 DCHECK(default_plugin::g_browser->geturl); |
534 default_plugin::g_browser->geturl( | 537 default_plugin::g_browser->geturl( |
535 instance_, | 538 instance_, |
536 "javascript:navigator.plugins.refresh(true)", | 539 "javascript:navigator.plugins.refresh(true)", |
537 "_self"); | 540 "_self"); |
538 default_plugin::g_browser->geturl( | 541 default_plugin::g_browser->geturl( |
539 instance_, | 542 instance_, |
540 "javascript:window.location.reload(true)", | 543 "javascript:window.location.reload(true)", |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 font_info.lfUnderline = TRUE; | 638 font_info.lfUnderline = TRUE; |
636 underline_font_ = CreateFontIndirect(&font_info); | 639 underline_font_ = CreateFontIndirect(&font_info); |
637 DCHECK(underline_font_ != NULL); | 640 DCHECK(underline_font_ != NULL); |
638 return true; | 641 return true; |
639 } | 642 } |
640 | 643 |
641 void PluginInstallerImpl::NotifyPluginStatus(int status) { | 644 void PluginInstallerImpl::NotifyPluginStatus(int status) { |
642 default_plugin::g_browser->getvalue( | 645 default_plugin::g_browser->getvalue( |
643 instance_, | 646 instance_, |
644 static_cast<NPNVariable>( | 647 static_cast<NPNVariable>( |
645 default_plugin::kMissingPluginStatusStart + status), | 648 webkit::npapi::default_plugin::kMissingPluginStatusStart + status), |
646 NULL); | 649 NULL); |
647 } | 650 } |
OLD | NEW |