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

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

Issue 179051: Fix two issues with the plugin installer.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/default_plugin/plugin_impl_win.h ('k') | no next file » | 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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "webkit/default_plugin/plugin_impl_win.h" 5 #include "webkit/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 "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 #include "grit/webkit_strings.h" 13 #include "grit/webkit_strings.h"
14 #include "unicode/locid.h" 14 #include "unicode/locid.h"
15 #include "webkit/default_plugin/activex_installer.h" 15 #include "webkit/default_plugin/activex_installer.h"
16 #include "webkit/activex_shim/activex_shared.h" 16 #include "webkit/activex_shim/activex_shared.h"
17 #include "webkit/activex_shim/npn_scripting.h" 17 #include "webkit/activex_shim/npn_scripting.h"
18 #include "webkit/default_plugin/default_plugin_shared.h" 18 #include "webkit/default_plugin/default_plugin_shared.h"
19 #include "webkit/default_plugin/plugin_main.h" 19 #include "webkit/default_plugin/plugin_main.h"
20 #include "webkit/glue/webkit_glue.h" 20 #include "webkit/glue/webkit_glue.h"
21 21
22 static const int TOOLTIP_MAX_WIDTH = 500; 22 static const int TOOLTIP_MAX_WIDTH = 500;
23 23
24 PluginInstallerImpl::PluginInstallerImpl(int16 mode) 24 PluginInstallerImpl::PluginInstallerImpl(int16 mode)
25 : instance_(NULL), 25 : instance_(NULL),
26 is_activex_(false), 26 is_activex_(false),
27 mode_(mode), 27 mode_(mode),
28 plugin_install_stream_(NULL), 28 plugin_install_stream_(NULL),
29 plugin_installer_state_(PluginInstallerStateUndefined), 29 plugin_installer_state_(PluginInstallerStateUndefined),
30 install_dialog_(PluginInstallDialog::AddInstaller(this, plugin_name_)),
30 enable_click_(false), 31 enable_click_(false),
31 icon_(NULL), 32 icon_(NULL),
32 bold_font_(NULL), 33 bold_font_(NULL),
33 regular_font_(NULL), 34 regular_font_(NULL),
34 underline_font_(NULL), 35 underline_font_(NULL),
35 tooltip_(NULL), 36 tooltip_(NULL),
36 activex_installer_(NULL), 37 activex_installer_(NULL),
37 installation_job_monitor_thread_( 38 installation_job_monitor_thread_(
38 new PluginInstallationJobMonitorThread()), 39 new PluginInstallationJobMonitorThread()),
39 plugin_database_handler_(*this), 40 plugin_database_handler_(*this),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 109 }
109 } else { 110 } else {
110 DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_NO_PLUGIN_NAME); 111 DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_NO_PLUGIN_NAME);
111 plugin_database_handler_.DownloadPluginsFileIfNeeded(plugin_finder_url_); 112 plugin_database_handler_.DownloadPluginsFileIfNeeded(plugin_finder_url_);
112 } 113 }
113 114
114 return true; 115 return true;
115 } 116 }
116 117
117 void PluginInstallerImpl::Shutdown() { 118 void PluginInstallerImpl::Shutdown() {
118 if (install_dialog_.IsWindow()) { 119 if (install_dialog_) {
119 install_dialog_.DestroyWindow(); 120 install_dialog_->RemoveInstaller(this);
121 install_dialog_ = NULL;
120 } 122 }
123
121 if (IsWindow(hwnd())) { 124 if (IsWindow(hwnd())) {
122 DestroyWindow(hwnd()); 125 DestroyWindow(hwnd());
123 } 126 }
124 } 127 }
125 128
126 void PluginInstallerImpl::NewStream(NPStream* stream) { 129 void PluginInstallerImpl::NewStream(NPStream* stream) {
127 plugin_install_stream_ = stream; 130 plugin_install_stream_ = stream;
128 } 131 }
129 132
130 void PluginInstallerImpl::DestroyStream(NPStream* stream, NPError reason) { 133 void PluginInstallerImpl::DestroyStream(NPStream* stream, NPError reason) {
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 return 1; 399 return 1;
397 } 400 }
398 401
399 // Use ICU in order to determine whether the locale is right-to-left. 402 // Use ICU in order to determine whether the locale is right-to-left.
400 // 403 //
401 // TODO(idana) bug# 1246452: there is already code in 404 // TODO(idana) bug# 1246452: there is already code in
402 // app/l10n_util.h/cc that uses ICU to determine the locale direction. We don't 405 // app/l10n_util.h/cc that uses ICU to determine the locale direction. We don't
403 // currently use this code since code in WebKit should not depend on code in 406 // currently use this code since code in WebKit should not depend on code in
404 // Chrome. We can fix this by pulling (at least part of) the l10n_util 407 // Chrome. We can fix this by pulling (at least part of) the l10n_util
405 // functionality up into the Base module. 408 // functionality up into the Base module.
406 bool PluginInstallerImpl::IsRTLLayout() const { 409 bool PluginInstallerImpl::IsRTLLayout() {
407 const icu::Locale& locale = icu::Locale::getDefault(); 410 const icu::Locale& locale = icu::Locale::getDefault();
408 const char* lang = locale.getLanguage(); 411 const char* lang = locale.getLanguage();
409 412
410 // Check only for Arabic and Hebrew languages for now. 413 // Check only for Arabic and Hebrew languages for now.
411 if (strcmp(lang, "ar") == 0 || strcmp(lang, "he") == 0) { 414 if (strcmp(lang, "ar") == 0 || strcmp(lang, "he") == 0) {
412 return true; 415 return true;
413 } 416 }
414 return false; 417 return false;
415 } 418 }
416 419
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 text_rect.bottom = text_rect.top + device_point.y; 549 text_rect.bottom = text_rect.top + device_point.y;
547 550
548 DrawText(paint_dc, optional_additional_message_.c_str(), 551 DrawText(paint_dc, optional_additional_message_.c_str(),
549 static_cast<int>(optional_additional_message_.length()), 552 static_cast<int>(optional_additional_message_.length()),
550 &text_rect, DT_CENTER | DT_VCENTER | additional_dt_flags); 553 &text_rect, DT_CENTER | DT_VCENTER | additional_dt_flags);
551 } 554 }
552 } 555 }
553 556
554 void PluginInstallerImpl::ShowInstallDialog() { 557 void PluginInstallerImpl::ShowInstallDialog() {
555 enable_click_ = false; 558 enable_click_ = false;
556 install_dialog_.Initialize(this, plugin_name_); 559 install_dialog_->ShowInstallDialog();
557 install_dialog_.Create(hwnd(), NULL);
558 install_dialog_.ShowWindow(SW_SHOW);
559 } 560 }
560 561
561 LRESULT PluginInstallerImpl::OnLButtonDown(UINT message, WPARAM wparam, 562 LRESULT PluginInstallerImpl::OnLButtonDown(UINT message, WPARAM wparam,
562 LPARAM lparam, BOOL& handled) { 563 LPARAM lparam, BOOL& handled) {
563 if (!enable_click_) 564 if (!enable_click_)
564 return 0; 565 return 0;
565 if (plugin_installer_state() == PluginListDownloaded) { 566 if (plugin_installer_state() == PluginListDownloaded) {
566 ShowInstallDialog(); 567 ShowInstallDialog();
567 NotifyPluginStatus(default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD); 568 NotifyPluginStatus(default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD);
568 } else if (plugin_installer_state_ == PluginInstallerLaunchSuccess) { 569 } else if (plugin_installer_state_ == PluginInstallerLaunchSuccess) {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 return true; 776 return true;
776 } 777 }
777 778
778 void PluginInstallerImpl::NotifyPluginStatus(int status) { 779 void PluginInstallerImpl::NotifyPluginStatus(int status) {
779 default_plugin::g_browser->getvalue( 780 default_plugin::g_browser->getvalue(
780 instance_, 781 instance_,
781 static_cast<NPNVariable>( 782 static_cast<NPNVariable>(
782 default_plugin::kMissingPluginStatusStart + status), 783 default_plugin::kMissingPluginStatusStart + status),
783 NULL); 784 NULL);
784 } 785 }
OLDNEW
« no previous file with comments | « webkit/default_plugin/plugin_impl_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698