OLD | NEW |
(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: no id provided"; |
| 42 |
| 43 void OutputDeveloperNotShownMessage(content::WebContents* web_contents, |
| 44 const std::string& message) { |
| 45 OutputDeveloperDebugMessage(web_contents, "not shown: " + message); |
| 46 } |
| 47 |
| 48 void OutputDeveloperDebugMessage(content::WebContents* web_contents, |
| 49 const std::string& message) { |
| 50 std::string log_message = "App banner " + message; |
| 51 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 52 switches::kBypassAppBannerEngagementChecks) && web_contents) { |
| 53 web_contents->GetMainFrame()->Send( |
| 54 new ChromeViewMsg_AppBannerDebugMessageRequest( |
| 55 web_contents->GetMainFrame()->GetRoutingID(), log_message)); |
| 56 } |
| 57 } |
| 58 |
| 59 } // namespace banners |
OLD | NEW |