| 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_data_fetcher.h" | 5 #include "chrome/browser/banners/app_banner_data_fetcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "chrome/browser/banners/app_banner_debug_log.h" | 11 #include "chrome/browser/banners/app_banner_debug_log.h" |
| 12 #include "chrome/browser/banners/app_banner_metrics.h" | 12 #include "chrome/browser/banners/app_banner_metrics.h" |
| 13 #include "chrome/browser/banners/app_banner_settings_helper.h" | 13 #include "chrome/browser/banners/app_banner_settings_helper.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/manifest/manifest_icon_downloader.h" | 15 #include "chrome/browser/manifest/manifest_icon_downloader.h" |
| 16 #include "chrome/browser/manifest/manifest_icon_selector.h" | 16 #include "chrome/browser/manifest/manifest_icon_selector.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/common/render_messages.h" | 19 #include "chrome/common/render_messages.h" |
| 20 #include "components/rappor/rappor_utils.h" | 20 #include "components/rappor/rappor_utils.h" |
| 21 #include "content/public/browser/browser_context.h" | 21 #include "content/public/browser/browser_context.h" |
| 22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 23 #include "content/public/browser/navigation_details.h" | 23 #include "content/public/browser/navigation_details.h" |
| 24 #include "content/public/browser/render_frame_host.h" | 24 #include "content/public/browser/render_frame_host.h" |
| 25 #include "content/public/browser/service_worker_context.h" | 25 #include "content/public/browser/service_worker_context.h" |
| 26 #include "content/public/browser/storage_partition.h" | 26 #include "content/public/browser/storage_partition.h" |
| 27 #include "net/base/load_flags.h" | 27 #include "net/base/load_flags.h" |
| 28 #include "third_party/WebKit/public/platform/WebDisplayMode.h" |
| 28 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm
ptReply.h" | 29 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm
ptReply.h" |
| 29 #include "ui/gfx/screen.h" | 30 #include "ui/gfx/screen.h" |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| 33 base::TimeDelta gTimeDeltaForTesting; | 34 base::TimeDelta gTimeDeltaForTesting; |
| 34 int gCurrentRequestID = -1; | 35 int gCurrentRequestID = -1; |
| 35 const char kPngExtension[] = ".png"; | 36 const char kPngExtension[] = ".png"; |
| 36 | 37 |
| 37 // The requirement for now is an image/png that is at least 144x144. | 38 // The requirement for now is an image/png that is at least 144x144. |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 bool is_debug_mode) { | 443 bool is_debug_mode) { |
| 443 if (manifest.IsEmpty()) { | 444 if (manifest.IsEmpty()) { |
| 444 OutputDeveloperNotShownMessage(web_contents, kManifestEmpty, is_debug_mode); | 445 OutputDeveloperNotShownMessage(web_contents, kManifestEmpty, is_debug_mode); |
| 445 return false; | 446 return false; |
| 446 } | 447 } |
| 447 if (!manifest.start_url.is_valid()) { | 448 if (!manifest.start_url.is_valid()) { |
| 448 OutputDeveloperNotShownMessage(web_contents, kStartURLNotValid, | 449 OutputDeveloperNotShownMessage(web_contents, kStartURLNotValid, |
| 449 is_debug_mode); | 450 is_debug_mode); |
| 450 return false; | 451 return false; |
| 451 } | 452 } |
| 452 if (manifest.name.is_null() && manifest.short_name.is_null()) { | 453 if ((manifest.name.is_null() || manifest.name.string().empty()) && |
| 454 (manifest.short_name.is_null() || manifest.short_name.string().empty())) { |
| 453 OutputDeveloperNotShownMessage( | 455 OutputDeveloperNotShownMessage( |
| 454 web_contents, kManifestMissingNameOrShortName, is_debug_mode); | 456 web_contents, kManifestMissingNameOrShortName, is_debug_mode); |
| 455 return false; | 457 return false; |
| 456 } | 458 } |
| 459 |
| 460 if (manifest.display != blink::WebDisplayModeStandalone && |
| 461 manifest.display != blink::WebDisplayModeFullscreen) { |
| 462 OutputDeveloperNotShownMessage( |
| 463 web_contents, kManifestDisplayStandaloneFullscreen, is_debug_mode); |
| 464 return false; |
| 465 } |
| 466 |
| 457 if (!DoesManifestContainRequiredIcon(manifest)) { | 467 if (!DoesManifestContainRequiredIcon(manifest)) { |
| 458 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon, | 468 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon, |
| 459 is_debug_mode); | 469 is_debug_mode); |
| 460 return false; | 470 return false; |
| 461 } | 471 } |
| 462 return true; | 472 return true; |
| 463 } | 473 } |
| 464 | 474 |
| 465 } // namespace banners | 475 } // namespace banners |
| OLD | NEW |