diff options
-rw-r--r-- | chrome/app/policy/policy_templates.json | 13 | ||||
-rw-r--r-- | chrome/browser/browser_process.h | 4 | ||||
-rw-r--r-- | chrome/browser/browser_process_impl.cc | 11 | ||||
-rw-r--r-- | chrome/browser/browser_process_impl.h | 5 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store.cc | 4 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 3 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 1 | ||||
-rw-r--r-- | chrome/default_plugin/plugin_impl_win.cc | 30 | ||||
-rw-r--r-- | chrome/default_plugin/plugin_impl_win.h | 2 | ||||
-rw-r--r-- | chrome/plugin/plugin_thread.cc | 3 | ||||
-rw-r--r-- | chrome/test/testing_browser_process.cc | 4 | ||||
-rw-r--r-- | chrome/test/testing_browser_process.h | 2 | ||||
-rw-r--r-- | content/browser/plugin_process_host.cc | 12 | ||||
-rw-r--r-- | webkit/glue/webkit_strings.grd | 10 |
14 files changed, 84 insertions, 20 deletions
diff --git a/chrome/app/policy/policy_templates.json b/chrome/app/policy/policy_templates.json index 691b2ba..a832000 100644 --- a/chrome/app/policy/policy_templates.json +++ b/chrome/app/policy/policy_templates.json @@ -91,7 +91,7 @@ # persistent IDs for all fields (but not for groups!) are needed. These are # specified by the 'id' keys of each policy. NEVER CHANGE EXISTING IDs, # because doing so would break the deployed wire format! -# For your editing convenience: highest ID currently used: 65 +# For your editing convenience: highest ID currently used: 66 # 'policy_definitions': [ { @@ -394,6 +394,17 @@ 'label': '''List of disabled plugins''', }, { + 'name': 'DisablePluginFinder', + 'type': 'main', + 'supported_on': ['chrome.*:11-'], + 'features': {'dynamic_refresh': 1}, + 'example_value': True, + 'id': 66, + 'caption': '''Specify whether the plugin finder should be disabled''', + 'desc': '''If you set this setting to True the automatic search and installation of missing plugins will be disabled in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>.''', + 'label': '''Disable plugin finder''', + }, + { 'name': 'SyncDisabled', 'type': 'main', 'supported_on': ['chrome.*:8-'], diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h index 28cc716..c1275db 100644 --- a/chrome/browser/browser_process.h +++ b/chrome/browser/browser_process.h @@ -165,6 +165,10 @@ class BrowserProcess { virtual safe_browsing::ClientSideDetectionService* safe_browsing_detection_service() = 0; + // Returns the state of the disable plugin finder policy. Callable only on + // the IO thread. + virtual bool plugin_finder_disabled() const = 0; + // Trigger an asynchronous check to see if we have the inspector's files on // disk. virtual void CheckForInspectorFiles() = 0; diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index ae2b209..f65c65b 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -546,6 +546,10 @@ safe_browsing::ClientSideDetectionService* return safe_browsing_detection_service_.get(); } +bool BrowserProcessImpl::plugin_finder_disabled() const { + return *plugin_finder_disabled_pref_; +} + void BrowserProcessImpl::CheckForInspectorFiles() { file_thread()->message_loop()->PostTask (FROM_HERE, @@ -762,6 +766,13 @@ void BrowserProcessImpl::CreateLocalState() { ShellIntegration::SetAsDefaultBrowser(); } pref_change_registrar_.Add(prefs::kDefaultBrowserSettingEnabled, this); + + // Initialize the preference for the plugin finder policy. + // This preference is only needed on the IO thread so make it available there. + local_state_->RegisterBooleanPref(prefs::kDisablePluginFinder, false); + plugin_finder_disabled_pref_.Init(prefs::kDisablePluginFinder, + local_state_.get(), NULL); + plugin_finder_disabled_pref_.MoveToThread(BrowserThread::IO); } void BrowserProcessImpl::CreateIconManager() { diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h index 781db34..4926812 100644 --- a/chrome/browser/browser_process_impl.h +++ b/chrome/browser/browser_process_impl.h @@ -21,6 +21,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/download/download_status_updater.h" #include "chrome/browser/prefs/pref_change_registrar.h" +#include "chrome/browser/prefs/pref_member.h" #include "chrome/browser/tab_contents/thumbnail_generator.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" @@ -85,6 +86,7 @@ class BrowserProcessImpl : public BrowserProcess, virtual TabCloseableStateWatcher* tab_closeable_state_watcher(); virtual safe_browsing::ClientSideDetectionService* safe_browsing_detection_service(); + virtual bool plugin_finder_disabled() const; virtual void CheckForInspectorFiles(); // NotificationObserver methods @@ -251,6 +253,9 @@ class BrowserProcessImpl : public BrowserProcess, NotificationRegistrar notification_registrar_; scoped_refptr<PluginDataRemover> plugin_data_remover_; + // Monitors the state of the 'DisablePluginFinder' policy. + BooleanPrefMember plugin_finder_disabled_pref_; + #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) base::RepeatingTimer<BrowserProcessImpl> autoupdate_timer_; diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc index a60b45d..769a944 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.cc +++ b/chrome/browser/policy/configuration_policy_pref_store.cc @@ -226,6 +226,8 @@ const ConfigurationPolicyPrefKeeper::PolicyToPreferenceMapEntry prefs::kGSSAPILibraryName }, { Value::TYPE_BOOLEAN, kPolicyDisable3DAPIs, prefs::kDisable3DAPIs }, + { Value::TYPE_BOOLEAN, kPolicyDisablePluginFinder, + prefs::kDisablePluginFinder }, { Value::TYPE_INTEGER, kPolicyPolicyRefreshRate, prefs::kPolicyUserPolicyRefreshRate }, { Value::TYPE_BOOLEAN, kPolicyInstantEnabled, prefs::kInstantEnabled }, @@ -882,6 +884,8 @@ ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() { key::kGSSAPILibraryName }, { kPolicyDisable3DAPIs, Value::TYPE_BOOLEAN, key::kDisable3DAPIs }, + { kPolicyDisablePluginFinder, Value::TYPE_BOOLEAN, + key::kDisablePluginFinder }, { kPolicyPolicyRefreshRate, Value::TYPE_INTEGER, key::kPolicyRefreshRate }, { kPolicyInstantEnabled, Value::TYPE_BOOLEAN, key::kInstantEnabled }, diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 19b74330..c6dcce6 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -1000,6 +1000,9 @@ const char kDisableVideoAndChat[] = "disable_video_chat"; // Whether Extensions are enabled. const char kDisableExtensions[] = "extensions.disabled"; +// Whether the plugin finder in the default plugin is enabled. +const char kDisablePluginFinder[] = "plugins.disable_plugin_finder"; + // Integer boolean representing the width (in pixels) of the container for // browser actions. const char kBrowserActionContainerWidth[] = diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 14364d9..6e05d71 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -346,6 +346,7 @@ extern const char kNumKeywords[]; extern const char kDisableVideoAndChat[]; extern const char kDisableExtensions[]; +extern const char kDisablePluginFinder[]; extern const char kBrowserActionContainerWidth[]; extern const char kLastExtensionsUpdateCheck[]; diff --git a/chrome/default_plugin/plugin_impl_win.cc b/chrome/default_plugin/plugin_impl_win.cc index cb767b0..c6ef4c6 100644 --- a/chrome/default_plugin/plugin_impl_win.cc +++ b/chrome/default_plugin/plugin_impl_win.cc @@ -22,6 +22,7 @@ static const int TOOLTIP_MAX_WIDTH = 500; PluginInstallerImpl::PluginInstallerImpl(int16 mode) : instance_(NULL), mode_(mode), + disable_plugin_finder_(false), plugin_install_stream_(NULL), plugin_installer_state_(PluginInstallerStateUndefined), install_dialog_(NULL), @@ -38,7 +39,8 @@ PluginInstallerImpl::PluginInstallerImpl(int16 mode) } PluginInstallerImpl::~PluginInstallerImpl() { - installation_job_monitor_thread_->Stop(); + if (!disable_plugin_finder_) + installation_job_monitor_thread_->Stop(); if (bold_font_) DeleteObject(bold_font_); @@ -58,8 +60,7 @@ bool PluginInstallerImpl::Initialize(HINSTANCE module_handle, NPP instance, DCHECK(module_handle != NULL); if (mime_type == NULL || strlen(mime_type) == 0) { - DLOG(WARNING) << __FUNCTION__ << " Invalid parameters passed in"; - NOTREACHED(); + NOTREACHED() << __FUNCTION__ << " Invalid parameters passed in"; return false; } @@ -67,21 +68,26 @@ bool PluginInstallerImpl::Initialize(HINSTANCE module_handle, NPP instance, mime_type_ = mime_type; if (!webkit_glue::GetPluginFinderURL(&plugin_finder_url_)) { - NOTREACHED(); - DLOG(WARNING) << __FUNCTION__ << " Failed to get the plugin finder URL"; + NOTREACHED() << __FUNCTION__ << " Failed to get the plugin finder URL"; return false; } - if (!installation_job_monitor_thread_->Initialize()) { - DLOG(ERROR) << "Failed to initialize plugin install job"; - NOTREACHED(); - return false; - } + if (plugin_finder_url_.empty()) + disable_plugin_finder_ = true; InitializeResources(module_handle); - DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_NO_PLUGIN_NAME); - plugin_database_handler_.DownloadPluginsFileIfNeeded(plugin_finder_url_); + if (!disable_plugin_finder_) { + if (!installation_job_monitor_thread_->Initialize()) { + NOTREACHED() << "Failed to initialize plugin install job"; + return false; + } + + DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_NO_PLUGIN_NAME); + plugin_database_handler_.DownloadPluginsFileIfNeeded(plugin_finder_url_); + } else { + DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_PLUGIN_FINDER_DISABLED); + } return true; } diff --git a/chrome/default_plugin/plugin_impl_win.h b/chrome/default_plugin/plugin_impl_win.h index 242d9f0..78bcbbf 100644 --- a/chrome/default_plugin/plugin_impl_win.h +++ b/chrome/default_plugin/plugin_impl_win.h @@ -271,6 +271,8 @@ class PluginInstallerImpl : public ui::WindowImpl { std::wstring command_; // An additional message displayed at times by the plugin. std::wstring optional_additional_message_; + // Set to true if plugin finder has been disabled. + bool disable_plugin_finder_; // The current stream. NPStream* plugin_install_stream_; // The plugin finder URL. diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc index 76f3a69..491feb0 100644 --- a/chrome/plugin/plugin_thread.cc +++ b/chrome/plugin/plugin_thread.cc @@ -204,7 +204,8 @@ bool GetPluginFinderURL(std::string* plugin_finder_url) { plugin_thread->Send( new PluginProcessHostMsg_GetPluginFinderUrl(plugin_finder_url)); - DCHECK(!plugin_finder_url->empty()); + // If we get an empty string back this means the plugin finder has been + // disabled. return true; } diff --git a/chrome/test/testing_browser_process.cc b/chrome/test/testing_browser_process.cc index b3ed441..f6af58f 100644 --- a/chrome/test/testing_browser_process.cc +++ b/chrome/test/testing_browser_process.cc @@ -181,6 +181,10 @@ base::WaitableEvent* TestingBrowserProcess::shutdown_event() { return shutdown_event_.get(); } +bool TestingBrowserProcess::plugin_finder_disabled() const { + return false; +} + bool TestingBrowserProcess::have_inspector_files() const { return true; } diff --git a/chrome/test/testing_browser_process.h b/chrome/test/testing_browser_process.h index 2cc07ae..d544f82 100644 --- a/chrome/test/testing_browser_process.h +++ b/chrome/test/testing_browser_process.h @@ -111,6 +111,8 @@ class TestingBrowserProcess : public BrowserProcess { virtual base::WaitableEvent* shutdown_event(); + virtual bool plugin_finder_disabled() const; + virtual void CheckForInspectorFiles() {} #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc index 215f653..6c42164 100644 --- a/content/browser/plugin_process_host.cc +++ b/content/browser/plugin_process_host.cc @@ -20,6 +20,7 @@ #include "base/path_service.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_plugin_browsing_context.h" #include "chrome/browser/net/url_request_tracking.h" #include "chrome/browser/plugin_download_helper.h" @@ -455,14 +456,19 @@ void PluginProcessHost::OnChannelCreated( } void PluginProcessHost::OnGetPluginFinderUrl(std::string* plugin_finder_url) { + // TODO(bauerb): Move this method to MessageFilter. if (!plugin_finder_url) { NOTREACHED(); return; } - // TODO(iyengar) Add the plumbing to retrieve the default - // plugin finder URL. - *plugin_finder_url = kDefaultPluginFinderURL; + if (!g_browser_process->plugin_finder_disabled()) { + // TODO(iyengar): Add the plumbing to retrieve the default + // plugin finder URL. + *plugin_finder_url = kDefaultPluginFinderURL; + } else { + plugin_finder_url->clear(); + } } void PluginProcessHost::OnPluginMessage( diff --git a/webkit/glue/webkit_strings.grd b/webkit/glue/webkit_strings.grd index ae88dc9..7611062 100644 --- a/webkit/glue/webkit_strings.grd +++ b/webkit/glue/webkit_strings.grd @@ -408,11 +408,15 @@ below: </message> <message name="IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG" desc="Message displayed by the default plugin in its main window"> - <ph name="PLUGIN">$1<ex>Realplayer</ex></ph> plug-in is not installed + <ph name="PLUGIN">$1<ex>Realplayer</ex></ph> plug-in is not installed. </message> <message name="IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_NO_PLUGIN_NAME" desc="Message displayed by the default plugin in its main window when we don't know the plugin name"> - The required plug-in is not installed + The required plug-in is not installed. + </message> + + <message name="IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_PLUGIN_FINDER_DISABLED" desc="Message displayed by the default plugin in its main window when the plugin finder has been disabled by a policy."> + Installing plug-ins has been disabled. </message> <message name="IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_2" desc="Second Message displayed by the default plugin in its main window"> @@ -424,7 +428,7 @@ below: </message> <message name="IDS_DEFAULT_PLUGIN_NO_PLUGIN_AVAILABLE_MSG" desc="Message displayed by the default plugin when no plugin was found for the page."> - No plug-in available to display this content + No plug-in available to display this content. </message> <message name="IDS_DEFAULT_PLUGIN_DOWNLOADING_PLUGIN_MSG" desc="Message displayed by the default plugin when a download has been initiated for the third party plugin."> |