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

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

Issue 6475011: Implemented policy to disable plugin finder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased on ToT. Created 9 years, 10 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
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"
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/plugins/npapi/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 disable_plugin_finder_(false),
25 plugin_install_stream_(NULL), 26 plugin_install_stream_(NULL),
26 plugin_installer_state_(PluginInstallerStateUndefined), 27 plugin_installer_state_(PluginInstallerStateUndefined),
27 install_dialog_(NULL), 28 install_dialog_(NULL),
28 enable_click_(false), 29 enable_click_(false),
29 icon_(NULL), 30 icon_(NULL),
30 bold_font_(NULL), 31 bold_font_(NULL),
31 regular_font_(NULL), 32 regular_font_(NULL),
32 underline_font_(NULL), 33 underline_font_(NULL),
33 tooltip_(NULL), 34 tooltip_(NULL),
34 installation_job_monitor_thread_( 35 installation_job_monitor_thread_(
35 new PluginInstallationJobMonitorThread()), 36 new PluginInstallationJobMonitorThread()),
36 plugin_database_handler_(*this), 37 plugin_database_handler_(*this),
37 plugin_download_url_for_display_(false) { 38 plugin_download_url_for_display_(false) {
38 } 39 }
39 40
40 PluginInstallerImpl::~PluginInstallerImpl() { 41 PluginInstallerImpl::~PluginInstallerImpl() {
41 installation_job_monitor_thread_->Stop(); 42 if (!disable_plugin_finder_)
43 installation_job_monitor_thread_->Stop();
42 44
43 if (bold_font_) 45 if (bold_font_)
44 DeleteObject(bold_font_); 46 DeleteObject(bold_font_);
45 47
46 if (underline_font_) 48 if (underline_font_)
47 DeleteObject(underline_font_); 49 DeleteObject(underline_font_);
48 50
49 if (tooltip_) 51 if (tooltip_)
50 DestroyWindow(tooltip_); 52 DestroyWindow(tooltip_);
51 } 53 }
(...skipping 13 matching lines...) Expand all
65 67
66 instance_ = instance; 68 instance_ = instance;
67 mime_type_ = mime_type; 69 mime_type_ = mime_type;
68 70
69 if (!webkit_glue::GetPluginFinderURL(&plugin_finder_url_)) { 71 if (!webkit_glue::GetPluginFinderURL(&plugin_finder_url_)) {
70 NOTREACHED(); 72 NOTREACHED();
71 DLOG(WARNING) << __FUNCTION__ << " Failed to get the plugin finder URL"; 73 DLOG(WARNING) << __FUNCTION__ << " Failed to get the plugin finder URL";
72 return false; 74 return false;
73 } 75 }
74 76
75 if (!installation_job_monitor_thread_->Initialize()) { 77 if (plugin_finder_url_.empty())
76 DLOG(ERROR) << "Failed to initialize plugin install job"; 78 disable_plugin_finder_ = true;
77 NOTREACHED();
78 return false;
79 }
80 79
81 InitializeResources(module_handle); 80 InitializeResources(module_handle);
82 81
83 DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_NO_PLUGIN_NAME); 82 if (!disable_plugin_finder_) {
84 plugin_database_handler_.DownloadPluginsFileIfNeeded(plugin_finder_url_); 83 if (!installation_job_monitor_thread_->Initialize()) {
84 DLOG(ERROR) << "Failed to initialize plugin install job";
Bernhard Bauer 2011/02/24 10:37:07 You can just |DLOG(FATAL)| here, or even simpler j
pastarmovj 2011/02/24 16:02:20 Actually I only moved this piece of code but i wil
Bernhard Bauer 2011/02/24 16:25:18 Please do. Even if you're not the original author
pastarmovj 2011/02/25 09:56:37 Yep sure. :)
85 NOTREACHED();
86 return false;
87 }
88
89 DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_NO_PLUGIN_NAME);
90 plugin_database_handler_.DownloadPluginsFileIfNeeded(plugin_finder_url_);
91 } else {
92 DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_PLUGIN_FINDER_DISABLED);
93 }
85 94
86 return true; 95 return true;
87 } 96 }
88 97
89 void PluginInstallerImpl::Shutdown() { 98 void PluginInstallerImpl::Shutdown() {
90 if (install_dialog_) { 99 if (install_dialog_) {
91 install_dialog_->RemoveInstaller(this); 100 install_dialog_->RemoveInstaller(this);
92 install_dialog_ = NULL; 101 install_dialog_ = NULL;
93 } 102 }
94 103
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 return true; 650 return true;
642 } 651 }
643 652
644 void PluginInstallerImpl::NotifyPluginStatus(int status) { 653 void PluginInstallerImpl::NotifyPluginStatus(int status) {
645 default_plugin::g_browser->getvalue( 654 default_plugin::g_browser->getvalue(
646 instance_, 655 instance_,
647 static_cast<NPNVariable>( 656 static_cast<NPNVariable>(
648 webkit::npapi::default_plugin::kMissingPluginStatusStart + status), 657 webkit::npapi::default_plugin::kMissingPluginStatusStart + status),
649 NULL); 658 NULL);
650 } 659 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698