| 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/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "content/public/browser/render_frame_host.h" | 8 #include "content/public/browser/render_frame_host.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 static const char kNoMatchingServiceWorkerMessage[] = | 23 static const char kNoMatchingServiceWorkerMessage[] = |
| 24 "no matching service worker detected. You may need to reload the page, or " | 24 "no matching service worker detected. You may need to reload the page, or " |
| 25 "check that the service worker for the current page also controls the " | 25 "check that the service worker for the current page also controls the " |
| 26 "start URL from the manifest"; | 26 "start URL from the manifest"; |
| 27 static const char kNoIconAvailableMessage[] = | 27 static const char kNoIconAvailableMessage[] = |
| 28 "no icon available to display"; | 28 "no icon available to display"; |
| 29 static const char kUserNavigatedBeforeBannerShownMessage[] = | 29 static const char kUserNavigatedBeforeBannerShownMessage[] = |
| 30 "the user navigated before the banner could be shown"; | 30 "the user navigated before the banner could be shown"; |
| 31 static const char kStartURLNotValidMessage[] = | 31 static const char kStartURLNotValidMessage[] = |
| 32 "start URL in manifest is not valid"; | 32 "start URL in manifest is not valid"; |
| 33 static const char kManifestDisplayStandaloneFullscreenMessage[] = |
| 34 "manifest display property must be set to 'standalone' or 'fullscreen'"; |
| 33 static const char kManifestMissingNameOrShortNameMessage[] = | 35 static const char kManifestMissingNameOrShortNameMessage[] = |
| 34 "one of manifest name or short name must be specified"; | 36 "one of manifest name or short name must be specified"; |
| 35 static const char kManifestMissingSuitableIconMessage[] = | 37 static const char kManifestMissingSuitableIconMessage[] = |
| 36 "manifest does not contain a suitable icon - PNG format of at least " | 38 "manifest does not contain a suitable icon - PNG format of at least " |
| 37 "144x144px is required, and the sizes attribute must be set"; | 39 "144x144px is required, and the sizes attribute must be set"; |
| 38 static const char kNotLoadedInMainFrameMessage[] = | 40 static const char kNotLoadedInMainFrameMessage[] = |
| 39 "page not loaded in the main frame"; | 41 "page not loaded in the main frame"; |
| 40 static const char kNotServedFromSecureOriginMessage[] = | 42 static const char kNotServedFromSecureOriginMessage[] = |
| 41 "page not served from a secure origin"; | 43 "page not served from a secure origin"; |
| 42 // The leading space is intentional as another string is prepended. | 44 // The leading space is intentional as another string is prepended. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 case kNoIconAvailable: | 89 case kNoIconAvailable: |
| 88 pattern = kNoIconAvailableMessage; | 90 pattern = kNoIconAvailableMessage; |
| 89 break; | 91 break; |
| 90 case kUserNavigatedBeforeBannerShown: | 92 case kUserNavigatedBeforeBannerShown: |
| 91 pattern = kUserNavigatedBeforeBannerShownMessage; | 93 pattern = kUserNavigatedBeforeBannerShownMessage; |
| 92 severity = content::CONSOLE_MESSAGE_LEVEL_WARNING; | 94 severity = content::CONSOLE_MESSAGE_LEVEL_WARNING; |
| 93 break; | 95 break; |
| 94 case kStartURLNotValid: | 96 case kStartURLNotValid: |
| 95 pattern = kStartURLNotValidMessage; | 97 pattern = kStartURLNotValidMessage; |
| 96 break; | 98 break; |
| 99 case kManifestDisplayStandaloneFullscreen: |
| 100 pattern = kManifestDisplayStandaloneFullscreenMessage; |
| 101 break; |
| 97 case kManifestMissingNameOrShortName: | 102 case kManifestMissingNameOrShortName: |
| 98 pattern = kManifestMissingNameOrShortNameMessage; | 103 pattern = kManifestMissingNameOrShortNameMessage; |
| 99 break; | 104 break; |
| 100 case kManifestMissingSuitableIcon: | 105 case kManifestMissingSuitableIcon: |
| 101 pattern = kManifestMissingSuitableIconMessage; | 106 pattern = kManifestMissingSuitableIconMessage; |
| 102 break; | 107 break; |
| 103 case kNotLoadedInMainFrame: | 108 case kNotLoadedInMainFrame: |
| 104 pattern = kNotLoadedInMainFrameMessage; | 109 pattern = kNotLoadedInMainFrameMessage; |
| 105 break; | 110 break; |
| 106 case kNotServedFromSecureOrigin: | 111 case kNotServedFromSecureOrigin: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 121 return; | 126 return; |
| 122 } | 127 } |
| 123 std::string message = param.empty() ? | 128 std::string message = param.empty() ? |
| 124 pattern : base::StringPrintf(pattern, param.c_str()); | 129 pattern : base::StringPrintf(pattern, param.c_str()); |
| 125 web_contents->GetMainFrame()->AddMessageToConsole( | 130 web_contents->GetMainFrame()->AddMessageToConsole( |
| 126 severity, "App banner not shown: " + message); | 131 severity, "App banner not shown: " + message); |
| 127 | 132 |
| 128 } | 133 } |
| 129 | 134 |
| 130 } // namespace banners | 135 } // namespace banners |
| OLD | NEW |