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

Side by Side 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: Factoring out log messages into constants 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/banners/app_banner_debug_log.h"
6
7 #include "base/command_line.h"
8 #include "chrome/common/chrome_switches.h"
9 #include "chrome/common/render_messages.h"
10 #include "content/public/browser/render_frame_host.h"
11 #include "content/public/browser/web_contents.h"
12 #include "content/public/browser/web_contents_observer.h"
13
14 namespace banners {
15
16 const char kRendererRequestCancel[] =
17 "renderer has requested the banner prompt be cancelled";
18 const char kManifestEmpty[] = "manifest is empty";
19 const char kCannotDetermineBestIcon[] =
20 "could not determine the best icon to use";
21 const char kNoMatchingServiceWorker[] =
22 "no matching service worker detected. You may need to reload the page, or "
23 "check that the service worker for the current page also controls the "
24 "start URL from the manifest";
25 const char kNoIconAvailable[] = "no icon available to display";
26 const char kBannerAlreadyAdded[] =
27 "the banner has already been added to the homescreen";
28 const char kUserNavigatedBeforeBannerShown[] =
29 "the user navigated before the banner could be shown";
30 const char kStartURLNotValid[] = "start URL in manifest is not valid";
31 const char kManifestMissingNameOrShortName[] =
32 "one of manifest name or short name must be specified";
33 const char kManifestMissingSuitableIcon[] =
34 "manifest does not contain a suitable icon - PNG format of at least "
35 "144x144px is required";
36 const char kNotServedFromSecureOrigin[] =
37 "page not served from a secure origin";
38 // The leading space is intentional as another string is prepended.
39 const char kIgnoredNotSupportedOnAndroid[] =
40 " application ignored: not supported on Android";
41 const char kIgnoredNoId[] = "Play application ignored as there is no id";
benwells 2015/05/13 02:55:20 I think this one will end up coming out as "App ba
dominickn (DO NOT USE) 2015/05/13 03:08:06 Done.
42
benwells 2015/05/13 02:55:20 Nit: only one blank line here please.
dominickn (DO NOT USE) 2015/05/13 03:08:06 Done.
43
44 void OutputDeveloperNotShownMessage(content::WebContents* web_contents,
45 const std::string& message) {
46 OutputDeveloperDebugMessage(web_contents, "not shown: " + message);
47 }
48
49 void OutputDeveloperDebugMessage(content::WebContents* web_contents,
50 const std::string& message) {
51 std::string log_message = "App banner " + message;
52 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
53 switches::kBypassAppBannerEngagementChecks) && web_contents) {
54 web_contents->GetMainFrame()->Send(
55 new ChromeViewMsg_AppBannerDebugMessageRequest(
56 web_contents->GetMainFrame()->GetRoutingID(), log_message));
57 }
58 }
59
60 } // namespace banners
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698