Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4444)

Unified Diff: chrome/browser/banners/app_banner_debug_log.cc

Issue 1129103003: Log messages regarding why app banners aren't displayed to the console (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding a full stop to the end of a comment Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/banners/app_banner_debug_log.h ('k') | chrome/browser/banners/app_banner_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/banners/app_banner_debug_log.cc
diff --git a/chrome/browser/banners/app_banner_debug_log.cc b/chrome/browser/banners/app_banner_debug_log.cc
new file mode 100644
index 0000000000000000000000000000000000000000..36818b0b6ade365ccece596be18304a58e9c7375
--- /dev/null
+++ b/chrome/browser/banners/app_banner_debug_log.cc
@@ -0,0 +1,59 @@
+// Copyright 2015 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.
+
+#include "chrome/browser/banners/app_banner_debug_log.h"
+
+#include "base/command_line.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/render_messages.h"
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_contents_observer.h"
+
+namespace banners {
+
+const char kRendererRequestCancel[] =
+ "renderer has requested the banner prompt be cancelled";
+const char kManifestEmpty[] = "manifest is empty";
+const char kCannotDetermineBestIcon[] =
+ "could not determine the best icon to use";
+const char kNoMatchingServiceWorker[] =
+ "no matching service worker detected. You may need to reload the page, or "
+ "check that the service worker for the current page also controls the "
+ "start URL from the manifest";
+const char kNoIconAvailable[] = "no icon available to display";
+const char kBannerAlreadyAdded[] =
+ "the banner has already been added to the homescreen";
+const char kUserNavigatedBeforeBannerShown[] =
+ "the user navigated before the banner could be shown";
+const char kStartURLNotValid[] = "start URL in manifest is not valid";
+const char kManifestMissingNameOrShortName[] =
+ "one of manifest name or short name must be specified";
+const char kManifestMissingSuitableIcon[] =
+ "manifest does not contain a suitable icon - PNG format of at least "
+ "144x144px is required";
+const char kNotServedFromSecureOrigin[] =
+ "page not served from a secure origin";
+// The leading space is intentional as another string is prepended.
+const char kIgnoredNotSupportedOnAndroid[] =
+ " application ignored: not supported on Android";
+const char kIgnoredNoId[] = "play application ignored: no id provided";
+
+void OutputDeveloperNotShownMessage(content::WebContents* web_contents,
+ const std::string& message) {
+ OutputDeveloperDebugMessage(web_contents, "not shown: " + message);
+}
+
+void OutputDeveloperDebugMessage(content::WebContents* web_contents,
+ const std::string& message) {
+ std::string log_message = "App banner " + message;
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kBypassAppBannerEngagementChecks) && web_contents) {
+ web_contents->GetMainFrame()->Send(
+ new ChromeViewMsg_AppBannerDebugMessageRequest(
+ web_contents->GetMainFrame()->GetRoutingID(), log_message));
+ }
+}
+
+} // namespace banners
« no previous file with comments | « chrome/browser/banners/app_banner_debug_log.h ('k') | chrome/browser/banners/app_banner_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698