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

Side by Side Diff: chrome/browser/banners/app_banner_debug_log.cc

Issue 1569893003: Add "Request app banner" context menu in DevTools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated dominickn's comment Created 4 years, 11 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/banners/app_banner_debug_log.h" 5 #include "chrome/browser/banners/app_banner_debug_log.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/common/chrome_switches.h" 8 #include "chrome/common/chrome_switches.h"
9 #include "content/public/browser/render_frame_host.h" 9 #include "content/public/browser/render_frame_host.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 15 matching lines...) Expand all
26 const char kBannerAlreadyAdded[] = 26 const char kBannerAlreadyAdded[] =
27 "site requesting the banner has already been added"; 27 "site requesting the banner has already been added";
28 const char kUserNavigatedBeforeBannerShown[] = 28 const char kUserNavigatedBeforeBannerShown[] =
29 "the user navigated before the banner could be shown"; 29 "the user navigated before the banner could be shown";
30 const char kStartURLNotValid[] = "start URL in manifest is not valid"; 30 const char kStartURLNotValid[] = "start URL in manifest is not valid";
31 const char kManifestMissingNameOrShortName[] = 31 const char kManifestMissingNameOrShortName[] =
32 "one of manifest name or short name must be specified"; 32 "one of manifest name or short name must be specified";
33 const char kManifestMissingSuitableIcon[] = 33 const char kManifestMissingSuitableIcon[] =
34 "manifest does not contain a suitable icon - PNG format of at least " 34 "manifest does not contain a suitable icon - PNG format of at least "
35 "144x144px is required, and the sizes attribute must be set"; 35 "144x144px is required, and the sizes attribute must be set";
36 const char kNotLoadedInMainFrame[] = "page not loaded in the main frame";
36 const char kNotServedFromSecureOrigin[] = 37 const char kNotServedFromSecureOrigin[] =
37 "page not served from a secure origin"; 38 "page not served from a secure origin";
38 // The leading space is intentional as another string is prepended. 39 // The leading space is intentional as another string is prepended.
39 const char kIgnoredNotSupportedOnAndroid[] = 40 const char kIgnoredNotSupportedOnAndroid[] =
40 " application ignored: not supported on Android"; 41 " application ignored: not supported on Android";
41 const char kIgnoredNoId[] = "play application ignored: no id provided"; 42 const char kIgnoredNoId[] = "play application ignored: no id provided";
42 const char kIgnoredIdsDoNotMatch[] = 43 const char kIgnoredIdsDoNotMatch[] =
43 "play application ignored: app URL and id fields were specified in the " 44 "play application ignored: app URL and id fields were specified in the "
44 "manifest, but they do not match"; 45 "manifest, but they do not match";
45 46
46 void OutputDeveloperNotShownMessage(content::WebContents* web_contents, 47 void OutputDeveloperNotShownMessage(content::WebContents* web_contents,
47 const std::string& message) { 48 const std::string& message,
48 OutputDeveloperDebugMessage(web_contents, "not shown: " + message); 49 bool is_debug_mode) {
50 OutputDeveloperDebugMessage(web_contents, "not shown: " + message,
51 is_debug_mode);
49 } 52 }
50 53
51 void OutputDeveloperDebugMessage(content::WebContents* web_contents, 54 void OutputDeveloperDebugMessage(content::WebContents* web_contents,
52 const std::string& message) { 55 const std::string& message,
56 bool is_debug_mode) {
53 std::string log_message = "App banner " + message; 57 std::string log_message = "App banner " + message;
54 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 58 if ((is_debug_mode ||
55 switches::kBypassAppBannerEngagementChecks) && 59 base::CommandLine::ForCurrentProcess()->HasSwitch(
60 switches::kBypassAppBannerEngagementChecks)) &&
dominickn 2016/01/18 23:20:41 With is_debug_mode incorporating the CommandLine c
horo 2016/01/19 01:45:43 Done.
56 web_contents) { 61 web_contents) {
57 web_contents->GetMainFrame()->AddMessageToConsole( 62 web_contents->GetMainFrame()->AddMessageToConsole(
58 content::CONSOLE_MESSAGE_LEVEL_DEBUG, log_message); 63 content::CONSOLE_MESSAGE_LEVEL_DEBUG, log_message);
59 } 64 }
60 } 65 }
61 66
62 } // namespace banners 67 } // namespace banners
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698