Index: chrome/browser/installable/installable_logging.h |
diff --git a/chrome/browser/installable/installable_logging.h b/chrome/browser/installable/installable_logging.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..97aecc412595e6af7b8c8391a02ed9681e2d9a50 |
--- /dev/null |
+++ b/chrome/browser/installable/installable_logging.h |
@@ -0,0 +1,54 @@ |
+// Copyright 2016 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. |
+ |
+#ifndef CHROME_BROWSER_INSTALLABLE_INSTALLABLE_LOGGING_H_ |
+#define CHROME_BROWSER_INSTALLABLE_INSTALLABLE_LOGGING_H_ |
+ |
+#include <string> |
+ |
+namespace content { |
+class WebContents; |
+} |
+ |
+namespace installable { |
+ |
+// These values are a central reference for installability errors. The |
+// InstallableChecker will specify an ErrorCode (or NoErrorDetected) in its |
+// result. Clients of the InstallableChecker may also add their own error codes |
+// to this list, and utilise the LogErrorToConsole method to write a message to |
+// the devtools console informing users of any issues. |
+// TODO(dominickn) add an UMA metric for this enum. |
+enum ErrorCode { |
gone
2016/07/20 22:21:35
I think enums are generally easier to read when de
dominickn
2016/07/21 00:24:47
Made CAPS_WITH_UNDERSCORES.
|
+ NoErrorDetected, |
+ RendererExiting, |
+ RendererRequestCancel, |
+ UserNavigatedBeforeBannerShown, |
+ NotLoadedInMainFrame, |
+ NotServedFromSecureOrigin, |
+ NoManifest, |
+ ManifestEmpty, |
+ StartUrlNotValid, |
+ ManifestMissingNameOrShortName, |
+ ManifestDisplayIsNotStandaloneOrFullscreen, |
+ ManifestMissingSuitableIcon, |
+ NoMatchingServiceWorker, |
+ NoIconMatchingRequirements, |
+ CannotDownloadIcon, |
+ NoIconAvailable, |
+ IgnoredNotSupportedOnAndroid, |
+ IgnoredNoId, |
+ IgnoredIdsDoNotMatch, |
+ MaxErrorCode, |
+}; |
+ |
+// Logs a message associated with |code| with a parameter |param| to the |
+// devtools console attached to |web_contents|. Does nothing if |web_contents| |
+// is nullptr. |
+void LogErrorToConsole(content::WebContents* web_contents, |
+ ErrorCode code, |
+ const std::string& param); |
+ |
+} // namespace installable |
+ |
+#endif // CHROME_BROWSER_INSTALLABLE_INSTALLABLE_LOGGING_H_ |