Reland of Adding PRESUBMIT check on google::protobuf (patchset #1 id:1 of https://codereview.webrtc.org/2791583002/ )

Reason for revert:
This should be landed after https://codereview.webrtc.org/2791963003.

Original issue's description:
> Revert of Adding PRESUBMIT check on google::protobuf (patchset #2 id:20001 of https://codereview.webrtc.org/2753823003/ )
>
> Reason for revert:
> We have to revert https://codereview.webrtc.org/2747863003 and this CL depends on it.
>
> Original issue's description:
> > Adding PRESUBMIT check on google::protobuf
> >
> > The goal is to avoid direct usage of google::protobuf.
> >
> > It should only be used with a 'using' directive in the header file:
> > //webrtc/base/protobuf_utils.h.
> >
> > BUG=webrtc:7340
> > NOTRY=True
> >
> > Review-Url: https://codereview.webrtc.org/2753823003
> > Cr-Commit-Position: refs/heads/master@{#17467}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/dd27055cb78aa839659ed9e9f0656a265c285ae7
>
> TBR=kjellander@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=webrtc:7340
>
> Review-Url: https://codereview.webrtc.org/2791583002
> Cr-Commit-Position: refs/heads/master@{#17481}
> Committed: https://chromium.googlesource.com/external/webrtc/+/515dff40b711c70780612f2a4850e151a28bacde

TBR=kjellander@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7340

Review-Url: https://codereview.webrtc.org/2792103002
Cr-Commit-Position: refs/heads/master@{#17588}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 6112f74..c3f2dee 100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -488,6 +488,26 @@
   return input_api.RunTests(tests, parallel=True)
 
 
+def _CheckUsageOfGoogleProtobufNamespace(input_api, output_api):
+  """Checks that the namespace google::protobuf has not been used."""
+  files = []
+  pattern = input_api.re.compile(r'google::protobuf')
+  proto_utils_path = os.path.join('webrtc', 'base', 'protobuf_utils.h')
+  for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
+    if f.LocalPath() in [proto_utils_path, 'PRESUBMIT.py']:
+      continue
+    contents = input_api.ReadFile(f)
+    if pattern.search(contents):
+      files.append(f)
+
+  if files:
+    return [output_api.PresubmitError(
+        'Please avoid to use namespace `google::protobuf` directly.\n'
+        'Add a using directive in `%s` and include that header instead.'
+        % proto_utils_path, files)]
+  return []
+
+
 def _CommonChecks(input_api, output_api):
   """Checks common to both upload and commit."""
   results = []
@@ -556,6 +576,7 @@
   results.extend(_CheckUnwantedDependencies(input_api, output_api))
   results.extend(_CheckJSONParseErrors(input_api, output_api))
   results.extend(_RunPythonTests(input_api, output_api))
+  results.extend(_CheckUsageOfGoogleProtobufNamespace(input_api, output_api))
   return results