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 "chrome/common/render_messages.h" | |
10 #include "content/public/browser/render_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" |
11 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
12 #include "content/public/browser/web_contents_observer.h" | |
13 | 11 |
14 namespace banners { | 12 namespace banners { |
15 | 13 |
16 const char kRendererRequestCancel[] = | 14 const char kRendererRequestCancel[] = |
17 "renderer has requested the banner prompt be cancelled"; | 15 "renderer has requested the banner prompt be cancelled"; |
18 const char kManifestEmpty[] = "manifest is empty or missing"; | 16 const char kManifestEmpty[] = "manifest is empty or missing"; |
19 const char kCannotDetermineBestIcon[] = | 17 const char kCannotDetermineBestIcon[] = |
20 "could not determine the best icon to use"; | 18 "could not determine the best icon to use"; |
21 const char kNoMatchingServiceWorker[] = | 19 const char kNoMatchingServiceWorker[] = |
22 "no matching service worker detected. You may need to reload the page, or " | 20 "no matching service worker detected. You may need to reload the page, or " |
(...skipping 22 matching lines...) Expand all Loading... |
45 | 43 |
46 void OutputDeveloperNotShownMessage(content::WebContents* web_contents, | 44 void OutputDeveloperNotShownMessage(content::WebContents* web_contents, |
47 const std::string& message) { | 45 const std::string& message) { |
48 OutputDeveloperDebugMessage(web_contents, "not shown: " + message); | 46 OutputDeveloperDebugMessage(web_contents, "not shown: " + message); |
49 } | 47 } |
50 | 48 |
51 void OutputDeveloperDebugMessage(content::WebContents* web_contents, | 49 void OutputDeveloperDebugMessage(content::WebContents* web_contents, |
52 const std::string& message) { | 50 const std::string& message) { |
53 std::string log_message = "App banner " + message; | 51 std::string log_message = "App banner " + message; |
54 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 52 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
55 switches::kBypassAppBannerEngagementChecks) && web_contents) { | 53 switches::kBypassAppBannerEngagementChecks) && |
56 web_contents->GetMainFrame()->Send( | 54 web_contents) { |
57 new ChromeViewMsg_AppBannerDebugMessageRequest( | 55 web_contents->GetMainFrame()->AddMessageToConsole( |
58 web_contents->GetMainFrame()->GetRoutingID(), log_message)); | 56 content::CONSOLE_MESSAGE_LEVEL_DEBUG, log_message); |
59 } | 57 } |
60 } | 58 } |
61 | 59 |
62 } // namespace banners | 60 } // namespace banners |
OLD | NEW |