Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / banners / app_banner_debug_log.cc
blob0f56dd56223c8f529866506c78984ff20a7bc55b
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.
5 #include "chrome/browser/banners/app_banner_debug_log.h"
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"
14 namespace banners {
16 const char kRendererRequestCancel[] =
17 "renderer has requested the banner prompt be cancelled";
18 const char kManifestEmpty[] = "manifest is empty or missing";
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 "site requesting the banner has already been added";
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 const char kIgnoredIdsDoNotMatch[] =
43 "play application ignored: app URL and id fields were specified in the "
44 "manifest, but they do not match";
46 void OutputDeveloperNotShownMessage(content::WebContents* web_contents,
47 const std::string& message) {
48 OutputDeveloperDebugMessage(web_contents, "not shown: " + message);
51 void OutputDeveloperDebugMessage(content::WebContents* web_contents,
52 const std::string& message) {
53 std::string log_message = "App banner " + message;
54 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
55 switches::kBypassAppBannerEngagementChecks) && web_contents) {
56 web_contents->GetMainFrame()->Send(
57 new ChromeViewMsg_AppBannerDebugMessageRequest(
58 web_contents->GetMainFrame()->GetRoutingID(), log_message));
62 } // namespace banners