Added a base::Callback interface to FilePathWatcher.

BUG=130980
TEST=browser_tests:FilePathWatcher* are green

Review URL: https://chromiumcodereview.appspot.com/10519003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140285 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 0bb8ac8b6..71342f19 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -200,6 +200,23 @@
       'instead.\n' + '\n'.join(problems))]
 
 
+def _CheckNoFilePathWatcherDelegate(input_api, output_api):
+  """Make sure that FilePathWatcher::Delegate is not used."""
+  problems = []
+
+  file_filter = lambda f: f.LocalPath().endswith(('.cc', '.h'))
+  for f in input_api.AffectedFiles(file_filter=file_filter):
+    for line_num, line in f.ChangedContents():
+      if 'FilePathWatcher::Delegate' in line:
+        problems.append('    %s:%d' % (f.LocalPath(), line_num))
+
+  if not problems:
+    return []
+  return [output_api.PresubmitPromptWarning('New code should not use '
+      'FilePathWatcher::Delegate. Use the callback interface instead.\n' +
+      '\n'.join(problems))]
+
+
 def _CommonChecks(input_api, output_api):
   """Checks common to both upload and commit."""
   results = []
@@ -214,6 +231,7 @@
   results.extend(_CheckNoDEPSGIT(input_api, output_api))
   results.extend(_CheckNoFRIEND_TEST(input_api, output_api))
   results.extend(_CheckNoScopedAllowIO(input_api, output_api))
+  results.extend(_CheckNoFilePathWatcherDelegate(input_api, output_api))
   return results