Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(630)

Side by Side Diff: chrome/browser/banners/app_banner_data_fetcher.cc

Issue 1829643002: App Banner: require 'display' to be set to 'standalone' or 'fullscreen'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/banners/app_banner_data_fetcher_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/banners/app_banner_debug_log.h" 13 #include "chrome/browser/banners/app_banner_debug_log.h"
14 #include "chrome/browser/banners/app_banner_metrics.h" 14 #include "chrome/browser/banners/app_banner_metrics.h"
15 #include "chrome/browser/banners/app_banner_settings_helper.h" 15 #include "chrome/browser/banners/app_banner_settings_helper.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/manifest/manifest_icon_downloader.h" 17 #include "chrome/browser/manifest/manifest_icon_downloader.h"
18 #include "chrome/browser/manifest/manifest_icon_selector.h" 18 #include "chrome/browser/manifest/manifest_icon_selector.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/render_messages.h" 21 #include "chrome/common/render_messages.h"
22 #include "components/rappor/rappor_utils.h" 22 #include "components/rappor/rappor_utils.h"
23 #include "content/public/browser/browser_context.h" 23 #include "content/public/browser/browser_context.h"
24 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/navigation_details.h" 25 #include "content/public/browser/navigation_details.h"
26 #include "content/public/browser/render_frame_host.h" 26 #include "content/public/browser/render_frame_host.h"
27 #include "content/public/browser/service_worker_context.h" 27 #include "content/public/browser/service_worker_context.h"
28 #include "content/public/browser/storage_partition.h" 28 #include "content/public/browser/storage_partition.h"
29 #include "net/base/load_flags.h" 29 #include "net/base/load_flags.h"
30 #include "third_party/WebKit/public/platform/WebDisplayMode.h"
30 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm ptReply.h" 31 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm ptReply.h"
31 #include "ui/gfx/screen.h" 32 #include "ui/gfx/screen.h"
32 33
33 namespace { 34 namespace {
34 35
35 base::LazyInstance<base::TimeDelta> gTimeDeltaForTesting = 36 base::LazyInstance<base::TimeDelta> gTimeDeltaForTesting =
36 LAZY_INSTANCE_INITIALIZER; 37 LAZY_INSTANCE_INITIALIZER;
37 int gCurrentRequestID = -1; 38 int gCurrentRequestID = -1;
38 const char kPngExtension[] = ".png"; 39 const char kPngExtension[] = ".png";
39 40
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 bool is_debug_mode) { 454 bool is_debug_mode) {
454 if (manifest.IsEmpty()) { 455 if (manifest.IsEmpty()) {
455 OutputDeveloperNotShownMessage(web_contents, kManifestEmpty, is_debug_mode); 456 OutputDeveloperNotShownMessage(web_contents, kManifestEmpty, is_debug_mode);
456 return false; 457 return false;
457 } 458 }
458 if (!manifest.start_url.is_valid()) { 459 if (!manifest.start_url.is_valid()) {
459 OutputDeveloperNotShownMessage(web_contents, kStartURLNotValid, 460 OutputDeveloperNotShownMessage(web_contents, kStartURLNotValid,
460 is_debug_mode); 461 is_debug_mode);
461 return false; 462 return false;
462 } 463 }
463 if (manifest.name.is_null() && manifest.short_name.is_null()) { 464 if ((manifest.name.is_null() || manifest.name.string().empty()) &&
465 (manifest.short_name.is_null() || manifest.short_name.string().empty())) {
464 OutputDeveloperNotShownMessage( 466 OutputDeveloperNotShownMessage(
465 web_contents, kManifestMissingNameOrShortName, is_debug_mode); 467 web_contents, kManifestMissingNameOrShortName, is_debug_mode);
466 return false; 468 return false;
467 } 469 }
470
471 // TODO(dominickn,mlamouri): when Chrome supports "minimal-ui", it should be
472 // accepted. If we accept it today, it would fallback to "browser" and make
473 // this check moot. See https://crbug.com/604390
474 if (manifest.display != blink::WebDisplayModeStandalone &&
475 manifest.display != blink::WebDisplayModeFullscreen) {
476 OutputDeveloperNotShownMessage(
477 web_contents, kManifestDisplayStandaloneFullscreen, is_debug_mode);
478 return false;
479 }
480
468 if (!DoesManifestContainRequiredIcon(manifest)) { 481 if (!DoesManifestContainRequiredIcon(manifest)) {
469 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon, 482 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon,
470 is_debug_mode); 483 is_debug_mode);
471 return false; 484 return false;
472 } 485 }
473 return true; 486 return true;
474 } 487 }
475 488
476 } // namespace banners 489 } // namespace banners
OLDNEW
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/banners/app_banner_data_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698