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

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: Merged ToT and addressed comments. Created 9 years, 9 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 | « chrome/default_plugin/plugin_impl_win.h ('k') | chrome/plugin/plugin_thread.cc » ('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"
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 }
52 54
53 bool PluginInstallerImpl::Initialize(HINSTANCE module_handle, NPP instance, 55 bool PluginInstallerImpl::Initialize(HINSTANCE module_handle, NPP instance,
54 NPMIMEType mime_type, int16 argc, 56 NPMIMEType mime_type, int16 argc,
55 char* argn[], char* argv[]) { 57 char* argn[], char* argv[]) {
56 DVLOG(1) << __FUNCTION__ << " MIME Type : " << mime_type; 58 DVLOG(1) << __FUNCTION__ << " MIME Type : " << mime_type;
57 DCHECK(instance != NULL); 59 DCHECK(instance != NULL);
58 DCHECK(module_handle != NULL); 60 DCHECK(module_handle != NULL);
59 61
60 if (mime_type == NULL || strlen(mime_type) == 0) { 62 if (mime_type == NULL || strlen(mime_type) == 0) {
61 DLOG(WARNING) << __FUNCTION__ << " Invalid parameters passed in"; 63 NOTREACHED() << __FUNCTION__ << " Invalid parameters passed in";
62 NOTREACHED();
63 return false; 64 return false;
64 } 65 }
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() << __FUNCTION__ << " Failed to get the plugin finder URL";
71 DLOG(WARNING) << __FUNCTION__ << " Failed to get the plugin finder URL";
72 return false; 72 return false;
73 } 73 }
74 74
75 if (!installation_job_monitor_thread_->Initialize()) { 75 if (plugin_finder_url_.empty())
76 DLOG(ERROR) << "Failed to initialize plugin install job"; 76 disable_plugin_finder_ = true;
77 NOTREACHED();
78 return false;
79 }
80 77
81 InitializeResources(module_handle); 78 InitializeResources(module_handle);
82 79
83 DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_NO_PLUGIN_NAME); 80 if (!disable_plugin_finder_) {
84 plugin_database_handler_.DownloadPluginsFileIfNeeded(plugin_finder_url_); 81 if (!installation_job_monitor_thread_->Initialize()) {
82 NOTREACHED() << "Failed to initialize plugin install job";
83 return false;
84 }
85
86 DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_NO_PLUGIN_NAME);
87 plugin_database_handler_.DownloadPluginsFileIfNeeded(plugin_finder_url_);
88 } else {
89 DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_PLUGIN_FINDER_DISABLED);
90 }
85 91
86 return true; 92 return true;
87 } 93 }
88 94
89 void PluginInstallerImpl::Shutdown() { 95 void PluginInstallerImpl::Shutdown() {
90 if (install_dialog_) { 96 if (install_dialog_) {
91 install_dialog_->RemoveInstaller(this); 97 install_dialog_->RemoveInstaller(this);
92 install_dialog_ = NULL; 98 install_dialog_ = NULL;
93 } 99 }
94 100
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 return true; 647 return true;
642 } 648 }
643 649
644 void PluginInstallerImpl::NotifyPluginStatus(int status) { 650 void PluginInstallerImpl::NotifyPluginStatus(int status) {
645 default_plugin::g_browser->getvalue( 651 default_plugin::g_browser->getvalue(
646 instance_, 652 instance_,
647 static_cast<NPNVariable>( 653 static_cast<NPNVariable>(
648 webkit::npapi::default_plugin::kMissingPluginStatusStart + status), 654 webkit::npapi::default_plugin::kMissingPluginStatusStart + status),
649 NULL); 655 NULL);
650 } 656 }
OLDNEW
« no previous file with comments | « chrome/default_plugin/plugin_impl_win.h ('k') | chrome/plugin/plugin_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698