OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 "page not served from a secure origin"; | 37 "page not served from a secure origin"; |
38 // The leading space is intentional as another string is prepended. | 38 // The leading space is intentional as another string is prepended. |
39 const char kIgnoredNotSupportedOnAndroid[] = | 39 const char kIgnoredNotSupportedOnAndroid[] = |
40 " application ignored: not supported on Android"; | 40 " application ignored: not supported on Android"; |
41 const char kIgnoredNoId[] = "play application ignored: no id provided"; | 41 const char kIgnoredNoId[] = "play application ignored: no id provided"; |
42 const char kIgnoredIdsDoNotMatch[] = | 42 const char kIgnoredIdsDoNotMatch[] = |
43 "play application ignored: app URL and id fields were specified in the " | 43 "play application ignored: app URL and id fields were specified in the " |
44 "manifest, but they do not match"; | 44 "manifest, but they do not match"; |
45 | 45 |
46 void OutputDeveloperNotShownMessage(content::WebContents* web_contents, | 46 void OutputDeveloperNotShownMessage(content::WebContents* web_contents, |
47 const std::string& message) { | 47 const std::string& message, |
48 OutputDeveloperDebugMessage(web_contents, "not shown: " + message); | 48 bool is_debug_mode) { |
| 49 OutputDeveloperDebugMessage(web_contents, "not shown: " + message, |
| 50 is_debug_mode); |
49 } | 51 } |
50 | 52 |
51 void OutputDeveloperDebugMessage(content::WebContents* web_contents, | 53 void OutputDeveloperDebugMessage(content::WebContents* web_contents, |
52 const std::string& message) { | 54 const std::string& message, |
| 55 bool is_debug_mode) { |
53 std::string log_message = "App banner " + message; | 56 std::string log_message = "App banner " + message; |
54 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 57 if ((is_debug_mode || |
55 switches::kBypassAppBannerEngagementChecks) && | 58 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 59 switches::kBypassAppBannerEngagementChecks)) && |
56 web_contents) { | 60 web_contents) { |
57 web_contents->GetMainFrame()->AddMessageToConsole( | 61 web_contents->GetMainFrame()->AddMessageToConsole( |
58 content::CONSOLE_MESSAGE_LEVEL_DEBUG, log_message); | 62 content::CONSOLE_MESSAGE_LEVEL_DEBUG, log_message); |
59 } | 63 } |
60 } | 64 } |
61 | 65 |
62 } // namespace banners | 66 } // namespace banners |
OLD | NEW |