Automatically load newly installed plug-ins if they are missing on a page.

To enable this on Mac OS, we also enable plug-in directory watching there. There shouldn't be any false positives causing unnecessary disk hits anymore.


BUG=62079
TEST=go to http://www.corp.google.com/~bauerb/no_crawl/test/install_plugin.html, install the missing plug-in. It should automatically load.


Review URL: http://codereview.chromium.org/9015025

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116671 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc
index fd1f0bd..8cd4cbc 100644
--- a/content/browser/plugin_service_impl.cc
+++ b/content/browser/plugin_service_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -38,7 +38,7 @@
 #include "webkit/plugins/npapi/plugin_list.h"
 #include "webkit/plugins/webplugininfo.h"
 
-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
+#if defined(OS_POSIX) && !defined(OS_OPENBSD)
 using ::base::files::FilePathWatcher;
 #endif
 
@@ -89,7 +89,8 @@
     plugin->OnAppActivation();
   }
 }
-#elif defined(OS_POSIX) && !defined(OS_OPENBSD)
+#endif
+#if defined(OS_POSIX) && !defined(OS_OPENBSD)
 // Delegate class for monitoring directories.
 class PluginDirWatcherDelegate : public FilePathWatcher::Delegate {
   virtual void OnFilePathChanged(const FilePath& path) OVERRIDE {
@@ -203,9 +204,7 @@
       hklm_watcher_.StartWatching(hklm_event_.get(), this);
     }
   }
-#elif defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
-// The FilePathWatcher produces too many false positives on MacOS (access time
-// updates?) which will lead to enforcing updates of the plugins way too often.
+#elif defined(OS_POSIX) && !defined(OS_OPENBSD)
 // On ChromeOS the user can't install plugins anyway and on Windows all
 // important plugins register themselves in the registry so no need to do that.
   file_watcher_delegate_ = new PluginDirWatcherDelegate();
@@ -629,7 +628,7 @@
   return &ppapi_plugins_[ppapi_plugins_.size() - 1];
 }
 
-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
+#if defined(OS_POSIX) && !defined(OS_OPENBSD)
 // static
 void PluginServiceImpl::RegisterFilePathWatcher(
     FilePathWatcher *watcher,