From c5f1009cd42d24d77fb811042815cf5d94c770fb Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Sat, 5 May 2018 02:12:12 +0000 Subject: [PATCH] Reland #2 "Move manifest.mojom and content::Manifest to blink" This is a reland of c07726e17cf5280456e8e118a7775bc60c2f2e6d Original change's description: > Move manifest.mojom and content::Manifest to blink > > ... as a part of Onion Soup project. > > This also required moving WebDisplayMode from public/platform > to public/common since it's referenced both in manifest itself > and, more generally, browser code. > > mojom::blink::Manifest is typemapped to blink::Manifest, which uses > stl types and should be used by blink's embedder, not blink > implementation. > > Bug: 704441 > Change-Id: I94d07bb028278f17d215f64c14552793d5f916ae > Reviewed-on: https://chromium-review.googlesource.com/1006188 > Commit-Queue: Dmitry Gozman > Reviewed-by: Daniel Cheng > Reviewed-by: Reilly Grant > Reviewed-by: Kentaro Hara > Reviewed-by: Mathieu Perreault > Reviewed-by: Mounir Lamouri > Reviewed-by: Mikel Astiz > Reviewed-by: Scott Violet > Reviewed-by: David Trainor > Cr-Commit-Position: refs/heads/master@{#554953} TBR=dgozman NOPRESUBMIT=true Bug: 704441 Change-Id: I3f2138335ea98710d2e8f6f06ab9fe9f3d561b96 Reviewed-on: https://chromium-review.googlesource.com/1040686 Commit-Queue: Dmitry Gozman Reviewed-by: Daniel Cheng Reviewed-by: Mounir Lamouri Reviewed-by: Dmitry Gozman Reviewed-by: Kentaro Hara Cr-Commit-Position: refs/heads/master@{#556292} --- .../chrome/browser/ShortcutHelper.java | 2 +- chrome/browser/DEPS | 1 - .../browser/android/metrics/launch_metrics.cc | 2 +- chrome/browser/android/shortcut_helper.cc | 6 +- chrome/browser/android/shortcut_helper.h | 2 +- chrome/browser/android/shortcut_info.cc | 12 +- chrome/browser/android/shortcut_info.h | 4 +- .../browser/android/shortcut_info_unittest.cc | 6 +- chrome/browser/android/webapk/webapk_info.h | 2 +- .../android/webapk/webapk_installer.cc | 4 +- .../webapk/webapk_update_data_fetcher.cc | 2 +- .../webapk/webapk_update_data_fetcher.h | 1 - .../webapk/webapk_web_manifest_checker.cc | 6 +- .../webapk/webapk_web_manifest_checker.h | 4 +- .../webapk_web_manifest_checker_unittest.cc | 14 +- .../webapps/add_to_homescreen_data_fetcher.cc | 4 +- ...add_to_homescreen_data_fetcher_unittest.cc | 30 +- .../app_banner_infobar_delegate_desktop.cc | 4 +- .../app_banner_infobar_delegate_desktop.h | 8 +- chrome/browser/banners/app_banner_manager.cc | 2 +- chrome/browser/banners/app_banner_manager.h | 4 +- chrome/browser/banners/app_banner_metrics.h | 2 +- .../chrome_service_worker_browsertest.cc | 2 +- .../browser/extensions/bookmark_app_helper.cc | 6 +- .../browser/extensions/bookmark_app_helper.h | 4 +- .../bookmark_app_helper_unittest.cc | 26 +- .../browser/infobars/infobars_browsertest.cc | 2 +- .../browser/installable/installable_data.cc | 2 +- chrome/browser/installable/installable_data.h | 6 +- .../installable/installable_manager.cc | 12 +- .../browser/installable/installable_manager.h | 12 +- .../installable_manager_browsertest.cc | 8 +- .../installable_manager_unittest.cc | 30 +- .../installable_task_queue_unittest.cc | 2 +- chrome/browser/ui/webui/webapks_handler.cc | 4 +- .../webshare/share_target_pref_helper.cc | 2 +- .../webshare/share_target_pref_helper.h | 4 +- .../share_target_pref_helper_unittest.cc | 28 +- components/favicon/content/DEPS | 1 + .../favicon/content/content_favicon_driver.cc | 6 +- components/payments/content/DEPS | 1 + .../installable_payment_app_crawler.cc | 10 +- content/browser/DEPS | 2 - .../browser/devtools/protocol/page_handler.h | 2 +- .../browser/manifest/manifest_browsertest.cc | 13 +- .../manifest/manifest_icon_selector.cc | 4 +- .../manifest_icon_selector_unittest.cc | 52 +- .../browser/manifest/manifest_manager_host.cc | 11 +- .../browser/manifest/manifest_manager_host.h | 11 +- .../browser/net/accept_header_browsertest.cc | 2 +- .../browser/payments/payment_app_database.cc | 6 +- .../payments/payment_app_info_fetcher.cc | 4 +- .../payments/payment_app_info_fetcher.h | 4 +- .../payment_instrument_icon_fetcher.cc | 14 +- .../payment_instrument_icon_fetcher.h | 4 +- .../render_widget_host_delegate.h | 2 +- .../renderer_host/render_widget_host_impl.h | 2 +- content/common/DEPS | 1 - content/common/frame_visual_properties.h | 1 - content/common/view_messages.h | 2 +- content/common/visual_properties.h | 2 +- .../public/browser/manifest_icon_selector.h | 7 +- content/public/browser/web_contents.h | 7 +- .../public/browser/web_contents_delegate.h | 2 +- content/public/common/BUILD.gn | 2 - content/public/common/manifest.typemap | 27 - .../public/common/manifest_struct_traits.h | 183 ------ content/public/common/manifest_util.h | 2 +- content/public/common/typemaps.gni | 1 - content/public/test/layouttest_support.h | 4 +- .../installedapp/related_apps_fetcher.cc | 8 +- .../installedapp/related_apps_fetcher.h | 4 +- content/renderer/manifest/manifest_manager.cc | 8 +- content/renderer/manifest/manifest_manager.h | 8 +- content/renderer/manifest/manifest_parser.cc | 39 +- content/renderer/manifest/manifest_parser.h | 16 +- .../manifest/manifest_parser_unittest.cc | 569 ++++++++++-------- .../renderer/manifest/manifest_uma_util.cc | 4 +- content/renderer/manifest/manifest_uma_util.h | 8 +- .../push_messaging/push_messaging_client.cc | 4 +- .../push_messaging/push_messaging_client.h | 6 +- content/renderer/render_frame_impl.h | 2 +- content/renderer/render_widget.h | 2 +- .../renderer/layout_test/blink_test_runner.cc | 2 +- .../renderer/layout_test/blink_test_runner.h | 3 +- .../test_runner_for_specific_view.cc | 2 +- .../test_runner_for_specific_view.h | 7 +- content/shell/test_runner/web_test_delegate.h | 7 +- services/device/public/mojom/BUILD.gn | 1 + third_party/blink/common/BUILD.gn | 1 + third_party/blink/common/DEPS | 1 + third_party/blink/common/manifest/OWNERS | 6 + .../blink/common/manifest}/manifest.cc | 6 +- .../common/manifest/manifest_mojom_traits.cc | 24 +- third_party/blink/public/BUILD.gn | 6 +- third_party/blink/public/common/BUILD.gn | 2 + third_party/blink/public/common/DEPS | 1 + .../blink/public/common/manifest/OWNERS | 9 + .../common/manifest/display_mode.typemap | 11 + .../blink/public/common/manifest}/manifest.h | 22 +- .../public/common/manifest/manifest.typemap | 23 + .../common/manifest/manifest_mojom_traits.h | 199 ++++++ .../manifest}/web_display_mode.h | 7 +- .../manifest/web_display_mode_mojom_traits.h} | 10 +- third_party/blink/public/mojom/BUILD.gn | 4 + .../modules => mojom}/manifest/OWNERS | 0 .../manifest}/display_mode.mojom | 0 .../modules => mojom}/manifest/manifest.mojom | 3 +- .../manifest/manifest_manager.mojom | 2 +- .../public/platform/display_mode.typemap | 9 - .../modules/payments/payment_app.mojom | 2 +- third_party/blink/public/public_typemaps.gni | 3 +- third_party/blink/public/web/web_view.h | 2 +- .../core/css/media_query_evaluator.cc | 2 +- .../blink/renderer/core/css/media_values.h | 2 +- .../renderer/core/exported/web_view_impl.h | 2 +- .../renderer/core/exported/web_view_test.cc | 2 +- .../renderer/core/frame/local_frame_view.h | 2 +- .../blink/renderer/core/frame/settings.h | 2 +- .../renderer/core/testing/internal_settings.h | 2 +- .../modules/payments/payment_instruments.cc | 2 +- .../renderer/platform/mojo/blink_typemaps.gni | 2 +- 122 files changed, 923 insertions(+), 812 deletions(-) delete mode 100644 content/public/common/manifest.typemap delete mode 100644 content/public/common/manifest_struct_traits.h create mode 100644 third_party/blink/common/manifest/OWNERS rename {content/public/common => third_party/blink/common/manifest}/manifest.cc (95%) rename content/public/common/manifest_struct_traits.cc => third_party/blink/common/manifest/manifest_mojom_traits.cc (84%) create mode 100644 third_party/blink/public/common/manifest/OWNERS create mode 100644 third_party/blink/public/common/manifest/display_mode.typemap rename {content/public/common => third_party/blink/public/common/manifest}/manifest.h (92%) create mode 100644 third_party/blink/public/common/manifest/manifest.typemap create mode 100644 third_party/blink/public/common/manifest/manifest_mojom_traits.h rename third_party/blink/public/{platform => common/manifest}/web_display_mode.h (72%) rename third_party/blink/public/{platform/web_display_mode_struct_traits.h => common/manifest/web_display_mode_mojom_traits.h} (81%) rename third_party/blink/public/{platform/modules => mojom}/manifest/OWNERS (100%) rename third_party/blink/public/{platform => mojom/manifest}/display_mode.mojom (100%) rename third_party/blink/public/{platform/modules => mojom}/manifest/manifest.mojom (97%) rename third_party/blink/public/{platform/modules => mojom}/manifest/manifest_manager.mojom (92%) delete mode 100644 third_party/blink/public/platform/display_mode.typemap diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java index 9eccb3456c490f..07f917c46e1918 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java @@ -93,7 +93,7 @@ public class ShortcutHelper { // be correctly populated into the WebappRegistry/WebappDataStorage. public static final int WEBAPP_SHORTCUT_VERSION = 2; - // This value is equal to kInvalidOrMissingColor in the C++ content::Manifest struct. + // This value is equal to kInvalidOrMissingColor in the C++ blink::Manifest struct. public static final long MANIFEST_COLOR_INVALID_OR_MISSING = ((long) Integer.MAX_VALUE) + 1; private static final String TAG = "ShortcutHelper"; diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index db2bd6ae9da680..da1da3d3506f50 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -144,7 +144,6 @@ include_rules = [ "+third_party/blink/public/common", "+third_party/blink/public/mojom", "+third_party/blink/public/platform/web_cache.h", - "+third_party/blink/public/platform/web_display_mode.h", "+third_party/blink/public/platform/web_loading_behavior_flag.h", "+third_party/blink/public/platform/web_gesture_event.h", "+third_party/blink/public/platform/web_input_event.h", diff --git a/chrome/browser/android/metrics/launch_metrics.cc b/chrome/browser/android/metrics/launch_metrics.cc index 9e04bcf6a83296..106d74f8240eaa 100644 --- a/chrome/browser/android/metrics/launch_metrics.cc +++ b/chrome/browser/android/metrics/launch_metrics.cc @@ -15,7 +15,7 @@ #include "components/rappor/rappor_service_impl.h" #include "content/public/browser/web_contents.h" #include "jni/LaunchMetrics_jni.h" -#include "third_party/blink/public/platform/web_display_mode.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "url/gurl.h" using base::android::JavaParamRef; diff --git a/chrome/browser/android/shortcut_helper.cc b/chrome/browser/android/shortcut_helper.cc index e923fc54da4eb0..3a2611cbd91f4d 100644 --- a/chrome/browser/android/shortcut_helper.cc +++ b/chrome/browser/android/shortcut_helper.cc @@ -24,8 +24,8 @@ #include "content/public/browser/manifest_icon_downloader.h" #include "content/public/browser/manifest_icon_selector.h" #include "content/public/browser/web_contents.h" -#include "content/public/common/manifest.h" #include "jni/ShortcutHelper_jni.h" +#include "third_party/blink/public/common/manifest/manifest.h" #include "ui/gfx/android/java_bitmap.h" #include "ui/gfx/color_analysis.h" #include "url/gurl.h" @@ -138,7 +138,7 @@ void AddShortcutWithSkBitmap(const ShortcutInfo& info, // static std::unique_ptr ShortcutHelper::CreateShortcutInfo( const GURL& manifest_url, - const content::Manifest& manifest, + const blink::Manifest& manifest, const GURL& primary_icon_url, const GURL& badge_icon_url) { auto shortcut_info = std::make_unique(GURL()); @@ -156,7 +156,7 @@ std::unique_ptr ShortcutHelper::CreateShortcutInfo( content::ManifestIconSelector::FindBestMatchingIcon( manifest.icons, shortcut_info->ideal_splash_image_size_in_px, shortcut_info->minimum_splash_image_size_in_px, - content::Manifest::Icon::IconPurpose::ANY); + blink::Manifest::Icon::IconPurpose::ANY); return shortcut_info; } diff --git a/chrome/browser/android/shortcut_helper.h b/chrome/browser/android/shortcut_helper.h index 6fc036f3276bfc..857dca2342e72a 100644 --- a/chrome/browser/android/shortcut_helper.h +++ b/chrome/browser/android/shortcut_helper.h @@ -34,7 +34,7 @@ class ShortcutHelper { // screen. static std::unique_ptr CreateShortcutInfo( const GURL& manifest_url, - const content::Manifest& manifest, + const blink::Manifest& manifest, const GURL& primary_icon_url, const GURL& badge_icon_url); diff --git a/chrome/browser/android/shortcut_info.cc b/chrome/browser/android/shortcut_info.cc index 8ad91bc3ff7bec..1060167738eb7d 100644 --- a/chrome/browser/android/shortcut_info.cc +++ b/chrome/browser/android/shortcut_info.cc @@ -10,8 +10,8 @@ ShortcutInfo::ShortcutInfo(const GURL& shortcut_url) display(blink::kWebDisplayModeBrowser), orientation(blink::kWebScreenOrientationLockDefault), source(SOURCE_ADD_TO_HOMESCREEN_SHORTCUT), - theme_color(content::Manifest::kInvalidOrMissingColor), - background_color(content::Manifest::kInvalidOrMissingColor), + theme_color(blink::Manifest::kInvalidOrMissingColor), + background_color(blink::Manifest::kInvalidOrMissingColor), ideal_splash_image_size_in_px(0), minimum_splash_image_size_in_px(0) {} @@ -20,7 +20,7 @@ ShortcutInfo::ShortcutInfo(const ShortcutInfo& other) = default; ShortcutInfo::~ShortcutInfo() { } -void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) { +void ShortcutInfo::UpdateFromManifest(const blink::Manifest& manifest) { if (!manifest.short_name.string().empty() || !manifest.name.string().empty()) { short_name = manifest.short_name.string(); @@ -57,11 +57,11 @@ void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) { } // Set the theme color based on the manifest value, if any. - if (manifest.theme_color != content::Manifest::kInvalidOrMissingColor) + if (manifest.theme_color != blink::Manifest::kInvalidOrMissingColor) theme_color = manifest.theme_color; // Set the background color based on the manifest value, if any. - if (manifest.background_color != content::Manifest::kInvalidOrMissingColor) + if (manifest.background_color != blink::Manifest::kInvalidOrMissingColor) background_color = manifest.background_color; // Sets the URL of the HTML splash screen, if any. @@ -70,7 +70,7 @@ void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) { // Set the icon urls based on the icons in the manifest, if any. icon_urls.clear(); - for (const content::Manifest::Icon& icon : manifest.icons) + for (const blink::Manifest::Icon& icon : manifest.icons) icon_urls.push_back(icon.src.spec()); if (manifest.share_target) diff --git a/chrome/browser/android/shortcut_info.h b/chrome/browser/android/shortcut_info.h index a6a819814c0256..8e4acab9c34265 100644 --- a/chrome/browser/android/shortcut_info.h +++ b/chrome/browser/android/shortcut_info.h @@ -10,7 +10,7 @@ #include #include "base/strings/string16.h" -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" #include "third_party/blink/public/common/screen_orientation/web_screen_orientation_lock_type.h" #include "url/gurl.h" @@ -71,7 +71,7 @@ struct ShortcutInfo { ~ShortcutInfo(); // Updates the info based on the given |manifest|. - void UpdateFromManifest(const content::Manifest& manifest); + void UpdateFromManifest(const blink::Manifest& manifest); // Updates the source of the shortcut. void UpdateSource(const Source source); diff --git a/chrome/browser/android/shortcut_info_unittest.cc b/chrome/browser/android/shortcut_info_unittest.cc index ca616b594559e8..cadc1780332ffc 100644 --- a/chrome/browser/android/shortcut_info_unittest.cc +++ b/chrome/browser/android/shortcut_info_unittest.cc @@ -7,8 +7,8 @@ #include "base/macros.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" -#include "content/public/common/manifest.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/manifest/manifest.h" #include "url/gurl.h" class ShortcutInfoTest : public testing::Test { @@ -17,7 +17,7 @@ class ShortcutInfoTest : public testing::Test { protected: ShortcutInfo info_; - content::Manifest manifest_; + blink::Manifest manifest_; DISALLOW_COPY_AND_ASSIGN(ShortcutInfoTest); }; @@ -50,7 +50,7 @@ TEST_F(ShortcutInfoTest, AllAttributesUpdate) { manifest_.splash_screen_url = GURL("https://new.com/splash.html"); info_.icon_urls.push_back("https://old.com/icon.png"); - content::Manifest::Icon icon; + blink::Manifest::Icon icon; icon.src = GURL("https://new.com/icon.png"); manifest_.icons.push_back(icon); diff --git a/chrome/browser/android/webapk/webapk_info.h b/chrome/browser/android/webapk/webapk_info.h index a929db4f68069d..a9772c40fffa62 100644 --- a/chrome/browser/android/webapk/webapk_info.h +++ b/chrome/browser/android/webapk/webapk_info.h @@ -9,7 +9,7 @@ #include "base/macros.h" #include "base/time/time.h" -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" #include "third_party/blink/public/common/screen_orientation/web_screen_orientation_lock_type.h" // Structure with information about a WebAPK. diff --git a/chrome/browser/android/webapk/webapk_installer.cc b/chrome/browser/android/webapk/webapk_installer.cc index bdb282a33d12fe..b59ad10b06383f 100644 --- a/chrome/browser/android/webapk/webapk_installer.cc +++ b/chrome/browser/android/webapk/webapk_installer.cc @@ -118,10 +118,10 @@ GURL GetScope(const ShortcutInfo& info) { : ShortcutHelper::GetScopeFromURL(info.url); } -// Converts a color from the format specified in content::Manifest to a CSS +// Converts a color from the format specified in blink::Manifest to a CSS // string. std::string ColorToString(int64_t color) { - if (color == content::Manifest::kInvalidOrMissingColor) + if (color == blink::Manifest::kInvalidOrMissingColor) return ""; SkColor sk_color = reinterpret_cast(color); return color_utils::SkColorToRgbaString(sk_color); diff --git a/chrome/browser/android/webapk/webapk_update_data_fetcher.cc b/chrome/browser/android/webapk/webapk_update_data_fetcher.cc index 66947e43b98305..cba0df99b13ad9 100644 --- a/chrome/browser/android/webapk/webapk_update_data_fetcher.cc +++ b/chrome/browser/android/webapk/webapk_update_data_fetcher.cc @@ -17,8 +17,8 @@ #include "content/public/browser/browser_context.h" #include "content/public/browser/storage_partition.h" #include "content/public/browser/web_contents.h" -#include "content/public/common/manifest.h" #include "jni/WebApkUpdateDataFetcher_jni.h" +#include "third_party/blink/public/common/manifest/manifest.h" #include "third_party/smhasher/src/MurmurHash2.h" #include "ui/gfx/android/java_bitmap.h" #include "ui/gfx/codec/png_codec.h" diff --git a/chrome/browser/android/webapk/webapk_update_data_fetcher.h b/chrome/browser/android/webapk/webapk_update_data_fetcher.h index 1b9d4d2dc81663..c69ec782a8deba 100644 --- a/chrome/browser/android/webapk/webapk_update_data_fetcher.h +++ b/chrome/browser/android/webapk/webapk_update_data_fetcher.h @@ -14,7 +14,6 @@ #include "third_party/skia/include/core/SkBitmap.h" namespace content { -struct Manifest; class WebContents; } diff --git a/chrome/browser/android/webapk/webapk_web_manifest_checker.cc b/chrome/browser/android/webapk/webapk_web_manifest_checker.cc index 6aad70b467088a..6d3a8e4accd510 100644 --- a/chrome/browser/android/webapk/webapk_web_manifest_checker.cc +++ b/chrome/browser/android/webapk/webapk_web_manifest_checker.cc @@ -4,7 +4,7 @@ #include "chrome/browser/android/webapk/webapk_web_manifest_checker.h" -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" #include "url/gurl.h" namespace { @@ -19,8 +19,8 @@ bool IsUrlWebApkCompatible(const GURL& url) { } // anonymous namespace -bool AreWebManifestUrlsWebApkCompatible(const content::Manifest& manifest) { - for (const content::Manifest::Icon& icon : manifest.icons) { +bool AreWebManifestUrlsWebApkCompatible(const blink::Manifest& manifest) { + for (const blink::Manifest::Icon& icon : manifest.icons) { if (!IsUrlWebApkCompatible(icon.src)) return false; } diff --git a/chrome/browser/android/webapk/webapk_web_manifest_checker.h b/chrome/browser/android/webapk/webapk_web_manifest_checker.h index 49b98d83d06201..8feafe6f602cdd 100644 --- a/chrome/browser/android/webapk/webapk_web_manifest_checker.h +++ b/chrome/browser/android/webapk/webapk_web_manifest_checker.h @@ -5,12 +5,12 @@ #ifndef CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_WEB_MANIFEST_CHECKER_H_ #define CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_WEB_MANIFEST_CHECKER_H_ -namespace content { +namespace blink { struct Manifest; } // Returns whether the format of the URLs in the Web Manifest is WebAPK // compatible. -bool AreWebManifestUrlsWebApkCompatible(const content::Manifest& manifest); +bool AreWebManifestUrlsWebApkCompatible(const blink::Manifest& manifest); #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_WEB_MANIFEST_CHECKER_H_ diff --git a/chrome/browser/android/webapk/webapk_web_manifest_checker_unittest.cc b/chrome/browser/android/webapk/webapk_web_manifest_checker_unittest.cc index ddbe456489113f..5a60a637accd34 100644 --- a/chrome/browser/android/webapk/webapk_web_manifest_checker_unittest.cc +++ b/chrome/browser/android/webapk/webapk_web_manifest_checker_unittest.cc @@ -5,9 +5,9 @@ #include "chrome/browser/android/webapk/webapk_web_manifest_checker.h" #include "base/strings/utf_string_conversions.h" -#include "content/public/common/manifest.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/platform/web_display_mode.h" +#include "third_party/blink/public/common/manifest/manifest.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "url/gurl.h" namespace { @@ -16,14 +16,14 @@ base::NullableString16 ToNullableUTF16(const std::string& str) { return base::NullableString16(base::UTF8ToUTF16(str), false); } -content::Manifest GetValidManifest() { - content::Manifest manifest; +blink::Manifest GetValidManifest() { + blink::Manifest manifest; manifest.name = ToNullableUTF16("foo"); manifest.short_name = ToNullableUTF16("bar"); manifest.start_url = GURL("http://example.com"); manifest.display = blink::kWebDisplayModeStandalone; - content::Manifest::Icon icon; + blink::Manifest::Icon icon; icon.type = base::ASCIIToUTF16("image/png"); icon.sizes.push_back(gfx::Size(144, 144)); manifest.icons.push_back(icon); @@ -34,14 +34,14 @@ content::Manifest GetValidManifest() { } // anonymous namespace TEST(WebApkWebManifestCheckerTest, Compatible) { - content::Manifest manifest = GetValidManifest(); + blink::Manifest manifest = GetValidManifest(); EXPECT_TRUE(AreWebManifestUrlsWebApkCompatible(manifest)); } TEST(WebApkWebManifestCheckerTest, CompatibleURLHasNoPassword) { const GURL kUrlWithPassword("http://answer:42@life/universe/and/everything"); - content::Manifest manifest = GetValidManifest(); + blink::Manifest manifest = GetValidManifest(); manifest.start_url = kUrlWithPassword; EXPECT_FALSE(AreWebManifestUrlsWebApkCompatible(manifest)); diff --git a/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc b/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc index 310c90804e523a..295f3dd8f6adb4 100644 --- a/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc +++ b/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc @@ -26,8 +26,8 @@ #include "content/public/browser/manifest_icon_selector.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" -#include "content/public/common/manifest.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" +#include "third_party/blink/public/common/manifest/manifest.h" #include "third_party/blink/public/common/screen_orientation/web_screen_orientation_lock_type.h" #include "ui/gfx/codec/png_codec.h" #include "ui/gfx/favicon_size.h" @@ -241,7 +241,7 @@ void AddToHomescreenDataFetcher::OnDidGetManifestAndIcons( content::ManifestIconSelector::FindBestMatchingIcon( data.manifest->icons, shortcut_info_.ideal_splash_image_size_in_px, shortcut_info_.minimum_splash_image_size_in_px, - content::Manifest::Icon::IconPurpose::ANY); + blink::Manifest::Icon::IconPurpose::ANY); if (data.badge_icon) { shortcut_info_.best_badge_icon_url = data.badge_icon_url; badge_icon_ = *data.badge_icon; diff --git a/chrome/browser/android/webapps/add_to_homescreen_data_fetcher_unittest.cc b/chrome/browser/android/webapps/add_to_homescreen_data_fetcher_unittest.cc index 272f9d0546cd2e..81fb4ff447e3df 100644 --- a/chrome/browser/android/webapps/add_to_homescreen_data_fetcher_unittest.cc +++ b/chrome/browser/android/webapps/add_to_homescreen_data_fetcher_unittest.cc @@ -25,8 +25,8 @@ #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_profile.h" #include "content/public/browser/web_contents.h" -#include "content/public/common/manifest.h" -#include "third_party/blink/public/platform/web_display_mode.h" +#include "third_party/blink/public/common/manifest/manifest.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "ui/gfx/image/image_unittest_util.h" #include "url/gurl.h" @@ -103,18 +103,18 @@ base::NullableString16 NullableStringFromUTF8(const std::string& value) { return base::NullableString16(base::UTF8ToUTF16(value), false); } -// Builds WebAPK compatible content::Manifest. -content::Manifest BuildDefaultManifest() { - content::Manifest manifest; +// Builds WebAPK compatible blink::Manifest. +blink::Manifest BuildDefaultManifest() { + blink::Manifest manifest; manifest.name = NullableStringFromUTF8(kDefaultManifestName); manifest.short_name = NullableStringFromUTF8(kDefaultManifestShortName); manifest.start_url = GURL(kDefaultStartUrl); manifest.display = kDefaultManifestDisplayMode; - content::Manifest::Icon primary_icon; + blink::Manifest::Icon primary_icon; primary_icon.type = base::ASCIIToUTF16("image/png"); primary_icon.sizes.push_back(gfx::Size(144, 144)); - primary_icon.purpose.push_back(content::Manifest::Icon::IconPurpose::ANY); + primary_icon.purpose.push_back(blink::Manifest::Icon::IconPurpose::ANY); primary_icon.src = GURL(kDefaultIconUrl); manifest.icons.push_back(primary_icon); @@ -177,7 +177,7 @@ class TestInstallableManager : public InstallableManager { void SetInstallable(bool is_installable) { is_installable_ = is_installable; } - void SetManifest(const content::Manifest& manifest) { + void SetManifest(const blink::Manifest& manifest) { manifest_ = manifest; if (!manifest.icons.empty()) { @@ -202,7 +202,7 @@ class TestInstallableManager : public InstallableManager { void ResolveQueuedMetrics() { std::move(queued_metrics_callback_).Run(); } private: - content::Manifest manifest_; + blink::Manifest manifest_; GURL primary_icon_url_; GURL badge_icon_url_; std::unique_ptr primary_icon_; @@ -290,7 +290,7 @@ class AddToHomescreenDataFetcherTest : public ChromeRenderViewHostTestHarness { histograms.ExpectTotalCount("Webapp.AddToHomescreenDialog.Timeout", 1); } - void SetManifest(const content::Manifest& manifest) { + void SetManifest(const blink::Manifest& manifest) { installable_manager_->SetManifest(manifest); } @@ -329,7 +329,7 @@ TEST_F(AddToHomescreenDataFetcherTest, EmptyManifest) { TEST_F(AddToHomescreenDataFetcherTest, NoIconManifest) { // Test a manifest with no icons. This should use the short name and have // a generated icon (empty icon url). - content::Manifest manifest = BuildDefaultManifest(); + blink::Manifest manifest = BuildDefaultManifest(); manifest.icons.clear(); SetManifest(manifest); @@ -486,7 +486,7 @@ TEST_F(AddToHomescreenDataFetcherTest, ServiceWorkerCheckTimesOutUnknown) { TEST_F(AddToHomescreenDataFetcherTest, InstallableManifest) { // Test a site that has an offline-capable service worker. - content::Manifest manifest(BuildDefaultManifest()); + blink::Manifest manifest(BuildDefaultManifest()); SetManifest(manifest); base::HistogramTester histograms; @@ -513,7 +513,7 @@ TEST_F(AddToHomescreenDataFetcherTest, ManifestNameClobbersWebApplicationName) { // Manifest::short_name that Manifest::name is used as the title. { // Check the case where we have no icons. - content::Manifest manifest = BuildDefaultManifest(); + blink::Manifest manifest = BuildDefaultManifest(); manifest.icons.clear(); manifest.short_name = base::NullableString16(); SetManifest(manifest); @@ -528,7 +528,7 @@ TEST_F(AddToHomescreenDataFetcherTest, ManifestNameClobbersWebApplicationName) { kDefaultManifestName)); } - content::Manifest manifest(BuildDefaultManifest()); + blink::Manifest manifest(BuildDefaultManifest()); manifest.short_name = base::NullableString16(); SetManifest(manifest); @@ -585,7 +585,7 @@ TEST_F(AddToHomescreenDataFetcherTest, ManifestNoNameNoShortName) { // - The page is not WebAPK compatible. // - WebApplicationInfo::title is used as the "name". // - We still use the icons from the manifest. - content::Manifest manifest(BuildDefaultManifest()); + blink::Manifest manifest(BuildDefaultManifest()); manifest.name = base::NullableString16(); manifest.short_name = base::NullableString16(); diff --git a/chrome/browser/banners/app_banner_infobar_delegate_desktop.cc b/chrome/browser/banners/app_banner_infobar_delegate_desktop.cc index 8acfa20a6cb6f5..152cc051504dec 100644 --- a/chrome/browser/banners/app_banner_infobar_delegate_desktop.cc +++ b/chrome/browser/banners/app_banner_infobar_delegate_desktop.cc @@ -26,7 +26,7 @@ infobars::InfoBar* AppBannerInfoBarDelegateDesktop::Create( content::WebContents* web_contents, base::WeakPtr weak_manager, extensions::BookmarkAppHelper* bookmark_app_helper, - const content::Manifest& manifest) { + const blink::Manifest& manifest) { InfoBarService* infobar_service = InfoBarService::FromWebContents(web_contents); return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( @@ -38,7 +38,7 @@ infobars::InfoBar* AppBannerInfoBarDelegateDesktop::Create( AppBannerInfoBarDelegateDesktop::AppBannerInfoBarDelegateDesktop( base::WeakPtr weak_manager, extensions::BookmarkAppHelper* bookmark_app_helper, - const content::Manifest& manifest) + const blink::Manifest& manifest) : ConfirmInfoBarDelegate(), weak_manager_(weak_manager), bookmark_app_helper_(bookmark_app_helper), diff --git a/chrome/browser/banners/app_banner_infobar_delegate_desktop.h b/chrome/browser/banners/app_banner_infobar_delegate_desktop.h index 85ef5058b4d3ab..b9b8dde91f22ae 100644 --- a/chrome/browser/banners/app_banner_infobar_delegate_desktop.h +++ b/chrome/browser/banners/app_banner_infobar_delegate_desktop.h @@ -9,7 +9,7 @@ #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" #include "components/infobars/core/confirm_infobar_delegate.h" -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" namespace content { class WebContents; @@ -34,13 +34,13 @@ class AppBannerInfoBarDelegateDesktop : public ConfirmInfoBarDelegate { content::WebContents* web_contents, base::WeakPtr weak_manager, extensions::BookmarkAppHelper* bookmark_app_helper, - const content::Manifest& manifest); + const blink::Manifest& manifest); private: AppBannerInfoBarDelegateDesktop( base::WeakPtr weak_manager, extensions::BookmarkAppHelper* bookmark_app_helper, - const content::Manifest& manifest); + const blink::Manifest& manifest); ~AppBannerInfoBarDelegateDesktop() override; // ConfirmInfoBarDelegate: @@ -54,7 +54,7 @@ class AppBannerInfoBarDelegateDesktop : public ConfirmInfoBarDelegate { base::WeakPtr weak_manager_; extensions::BookmarkAppHelper* bookmark_app_helper_; - content::Manifest manifest_; + blink::Manifest manifest_; bool has_user_interaction_; DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateDesktop); diff --git a/chrome/browser/banners/app_banner_manager.cc b/chrome/browser/banners/app_banner_manager.cc index 9cc9f164ce9e9f..295b9dac4b4be2 100644 --- a/chrome/browser/banners/app_banner_manager.cc +++ b/chrome/browser/banners/app_banner_manager.cc @@ -400,7 +400,7 @@ void AppBannerManager::ResetBindings() { void AppBannerManager::ResetCurrentPageData() { active_media_players_.clear(); - manifest_ = content::Manifest(); + manifest_ = blink::Manifest(); manifest_url_ = GURL(); validated_url_ = GURL(); referrer_.erase(); diff --git a/chrome/browser/banners/app_banner_manager.h b/chrome/browser/banners/app_banner_manager.h index 14d5cea7331f91..4b350c3a40caf0 100644 --- a/chrome/browser/banners/app_banner_manager.h +++ b/chrome/browser/banners/app_banner_manager.h @@ -19,8 +19,8 @@ #include "chrome/browser/installable/installable_metrics.h" #include "content/public/browser/web_contents_observer.h" #include "mojo/public/cpp/bindings/binding.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/platform/modules/app_banner/app_banner.mojom.h" -#include "third_party/blink/public/platform/web_display_mode.h" class InstallableManager; class SkBitmap; @@ -281,7 +281,7 @@ class AppBannerManager : public content::WebContentsObserver, GURL manifest_url_; // The manifest object. - content::Manifest manifest_; + blink::Manifest manifest_; // The URL of the primary icon. GURL primary_icon_url_; diff --git a/chrome/browser/banners/app_banner_metrics.h b/chrome/browser/banners/app_banner_metrics.h index d0febc3183616c..4f5e01ced6cdb2 100644 --- a/chrome/browser/banners/app_banner_metrics.h +++ b/chrome/browser/banners/app_banner_metrics.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_BANNERS_APP_BANNER_METRICS_H_ #include "chrome/browser/installable/installable_logging.h" -#include "third_party/blink/public/platform/web_display_mode.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" namespace banners { diff --git a/chrome/browser/chrome_service_worker_browsertest.cc b/chrome/browser/chrome_service_worker_browsertest.cc index 0ec1028c3c5572..a459646c391be1 100644 --- a/chrome/browser/chrome_service_worker_browsertest.cc +++ b/chrome/browser/chrome_service_worker_browsertest.cc @@ -353,7 +353,7 @@ class ChromeServiceWorkerManifestFetchTest static void ManifestCallbackAndRun(const base::Closure& continuation, const GURL&, - const content::Manifest&) { + const blink::Manifest&) { continuation.Run(); } diff --git a/chrome/browser/extensions/bookmark_app_helper.cc b/chrome/browser/extensions/bookmark_app_helper.cc index 2e4a39acec310b..d6ed42006ba1e5 100644 --- a/chrome/browser/extensions/bookmark_app_helper.cc +++ b/chrome/browser/extensions/bookmark_app_helper.cc @@ -65,7 +65,7 @@ #include "net/url_request/url_request.h" #include "skia/ext/image_operations.h" #include "skia/ext/platform_canvas.h" -#include "third_party/blink/public/platform/web_display_mode.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/canvas.h" @@ -338,7 +338,7 @@ namespace extensions { // static void BookmarkAppHelper::UpdateWebAppInfoFromManifest( - const content::Manifest& manifest, + const blink::Manifest& manifest, WebApplicationInfo* web_app_info, ForInstallableSite for_installable_site) { if (!manifest.short_name.is_null()) @@ -362,7 +362,7 @@ void BookmarkAppHelper::UpdateWebAppInfoFromManifest( web_app_info->scope = manifest.start_url.Resolve("."); } - if (manifest.theme_color != content::Manifest::kInvalidOrMissingColor) + if (manifest.theme_color != blink::Manifest::kInvalidOrMissingColor) web_app_info->theme_color = static_cast(manifest.theme_color); // If any icons are specified in the manifest, they take precedence over any diff --git a/chrome/browser/extensions/bookmark_app_helper.h b/chrome/browser/extensions/bookmark_app_helper.h index e792f4c4d7a216..5ac3d4bc826d23 100644 --- a/chrome/browser/extensions/bookmark_app_helper.h +++ b/chrome/browser/extensions/bookmark_app_helper.h @@ -18,7 +18,7 @@ #include "chrome/common/web_application_info.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" class ExtensionService; class FaviconDownloader; @@ -71,7 +71,7 @@ class BookmarkAppHelper : public content::NotificationObserver { ~BookmarkAppHelper() override; // Update the given WebApplicationInfo with information from the manifest. - static void UpdateWebAppInfoFromManifest(const content::Manifest& manifest, + static void UpdateWebAppInfoFromManifest(const blink::Manifest& manifest, WebApplicationInfo* web_app_info, ForInstallableSite installable_site); diff --git a/chrome/browser/extensions/bookmark_app_helper_unittest.cc b/chrome/browser/extensions/bookmark_app_helper_unittest.cc index da8ccc21aa5ca2..03e590b87d1e18 100644 --- a/chrome/browser/extensions/bookmark_app_helper_unittest.cc +++ b/chrome/browser/extensions/bookmark_app_helper_unittest.cc @@ -299,7 +299,7 @@ class TestBookmarkAppHelper : public BookmarkAppHelper { } void CompleteInstallableCheck(const char* manifest_url, - const content::Manifest& manifest, + const blink::Manifest& manifest, ForInstallableSite for_installable_site) { bool installable = for_installable_site == ForInstallableSite::kYes; InstallableData data = { @@ -349,7 +349,7 @@ TEST_F(BookmarkAppHelperExtensionServiceTest, CreateBookmarkApp) { helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete, base::Unretained(&helper))); - helper.CompleteInstallableCheck(kManifestUrl, content::Manifest(), + helper.CompleteInstallableCheck(kManifestUrl, blink::Manifest(), ForInstallableSite::kNo); std::map > icon_map; @@ -399,7 +399,7 @@ TEST_P(BookmarkAppHelperExtensionServiceInstallableSiteTest, helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete, base::Unretained(&helper))); - content::Manifest manifest; + blink::Manifest manifest; manifest.start_url = GURL(kAppUrl); manifest.name = base::NullableString16(base::UTF8ToUTF16(kAppTitle), false); manifest.scope = GURL(kAppScope); @@ -441,11 +441,11 @@ TEST_P(BookmarkAppHelperExtensionServiceInstallableSiteTest, helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete, base::Unretained(&helper))); - content::Manifest manifest; + blink::Manifest manifest; manifest.start_url = GURL(kAppUrl); manifest.name = base::NullableString16(base::UTF8ToUTF16(kAppTitle), false); manifest.scope = GURL(kAppScope); - content::Manifest::Icon icon; + blink::Manifest::Icon icon; icon.src = GURL(kAppIconURL1); manifest.icons.push_back(icon); icon.src = GURL(kAppIconURL2); @@ -491,7 +491,7 @@ TEST_P(BookmarkAppHelperExtensionServiceInstallableSiteTest, helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete, base::Unretained(&helper))); - content::Manifest manifest; + blink::Manifest manifest; manifest.start_url = GURL(kAppUrl); manifest.name = base::NullableString16(base::UTF8ToUTF16(kAppTitle), false); helper.CompleteInstallableCheck(kManifestUrl, manifest, GetParam()); @@ -525,7 +525,7 @@ TEST_F(BookmarkAppHelperExtensionServiceTest, std::unique_ptr contents( content::WebContentsTester::CreateTestWebContents(profile(), nullptr)); - content::Manifest manifest; + blink::Manifest manifest; manifest.start_url = GURL(kAppUrl); manifest.name = base::NullableString16(base::UTF8ToUTF16(kAppTitle), false); manifest.scope = GURL(kAppScope); @@ -578,7 +578,7 @@ TEST_F(BookmarkAppHelperExtensionServiceTest, helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete, base::Unretained(&helper))); - helper.CompleteInstallableCheck(kManifestUrl, content::Manifest(), + helper.CompleteInstallableCheck(kManifestUrl, blink::Manifest(), ForInstallableSite::kNo); std::map> icon_map; helper.CompleteIconDownload(true, icon_map); @@ -746,7 +746,7 @@ TEST_F(BookmarkAppHelperTest, UpdateWebAppInfoFromManifest) { info.url = GURL(kAppIcon1); web_app_info.icons.push_back(info); - content::Manifest manifest; + blink::Manifest manifest; manifest.start_url = GURL(kAppUrl); manifest.short_name = base::NullableString16(base::UTF8ToUTF16(kAppShortName), false); @@ -765,7 +765,7 @@ TEST_F(BookmarkAppHelperTest, UpdateWebAppInfoFromManifest) { // that icons provided by the manifest replace icons in |web_app_info|. manifest.name = base::NullableString16(base::UTF8ToUTF16(kAppTitle), false); - content::Manifest::Icon icon; + blink::Manifest::Icon icon; icon.src = GURL(kAppIcon2); manifest.icons.push_back(icon); icon.src = GURL(kAppIcon3); @@ -783,7 +783,7 @@ TEST_F(BookmarkAppHelperTest, UpdateWebAppInfoFromManifest) { // Tests "scope" is only set for installable sites. TEST_F(BookmarkAppHelperTest, UpdateWebAppInfoFromManifestInstallableSite) { { - content::Manifest manifest; + blink::Manifest manifest; manifest.start_url = GURL(kAppUrl); WebApplicationInfo web_app_info; BookmarkAppHelper::UpdateWebAppInfoFromManifest( @@ -793,7 +793,7 @@ TEST_F(BookmarkAppHelperTest, UpdateWebAppInfoFromManifestInstallableSite) { } { - content::Manifest manifest; + blink::Manifest manifest; manifest.start_url = GURL(kAppUrl); WebApplicationInfo web_app_info; BookmarkAppHelper::UpdateWebAppInfoFromManifest( @@ -802,7 +802,7 @@ TEST_F(BookmarkAppHelperTest, UpdateWebAppInfoFromManifestInstallableSite) { } { - content::Manifest manifest; + blink::Manifest manifest; manifest.start_url = GURL(kAppUrl); WebApplicationInfo web_app_info; BookmarkAppHelper::UpdateWebAppInfoFromManifest( diff --git a/chrome/browser/infobars/infobars_browsertest.cc b/chrome/browser/infobars/infobars_browsertest.cc index ce42cc0c3ad897..636b1f67949a9a 100644 --- a/chrome/browser/infobars/infobars_browsertest.cc +++ b/chrome/browser/infobars/infobars_browsertest.cc @@ -241,7 +241,7 @@ void InfoBarUiTest::ShowUi(const std::string& name) { switch (expected_identifiers_.back()) { case IBD::APP_BANNER_INFOBAR_DELEGATE: banners::AppBannerInfoBarDelegateDesktop::Create( - GetWebContents(), nullptr, nullptr, content::Manifest()); + GetWebContents(), nullptr, nullptr, blink::Manifest()); break; case IBD::HUNG_PLUGIN_INFOBAR_DELEGATE: diff --git a/chrome/browser/installable/installable_data.cc b/chrome/browser/installable/installable_data.cc index e7bf139108d7f7..9cff73c464fa38 100644 --- a/chrome/browser/installable/installable_data.cc +++ b/chrome/browser/installable/installable_data.cc @@ -6,7 +6,7 @@ InstallableData::InstallableData(InstallableStatusCode error_code, GURL manifest_url, - const content::Manifest* manifest, + const blink::Manifest* manifest, GURL primary_icon_url, const SkBitmap* primary_icon, GURL badge_icon_url, diff --git a/chrome/browser/installable/installable_data.h b/chrome/browser/installable/installable_data.h index fbec50e59caba0..395d4bb8091337 100644 --- a/chrome/browser/installable/installable_data.h +++ b/chrome/browser/installable/installable_data.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_INSTALLABLE_INSTALLABLE_DATA_H_ #include "chrome/browser/installable/installable_logging.h" -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" #include "third_party/skia/include/core/SkBitmap.h" #include "url/gurl.h" @@ -17,7 +17,7 @@ struct InstallableData { InstallableData(InstallableStatusCode error_code, GURL manifest_url, - const content::Manifest* manifest, + const blink::Manifest* manifest, GURL primary_icon_url, const SkBitmap* primary_icon, GURL badge_icon_url, @@ -33,7 +33,7 @@ struct InstallableData { const GURL manifest_url; // Empty if the site has an unparseable manifest. - const content::Manifest* manifest; + const blink::Manifest* manifest; // Empty if no primary_icon was requested. const GURL primary_icon_url; diff --git a/chrome/browser/installable/installable_manager.cc b/chrome/browser/installable/installable_manager.cc index 1f4a89956689c9..cbdcae81ce75c7 100644 --- a/chrome/browser/installable/installable_manager.cc +++ b/chrome/browser/installable/installable_manager.cc @@ -19,7 +19,7 @@ #include "content/public/browser/render_frame_host.h" #include "content/public/browser/storage_partition.h" #include "net/base/url_util.h" -#include "third_party/blink/public/platform/web_display_mode.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #if defined(OS_ANDROID) #include "chrome/browser/android/shortcut_helper.h" @@ -81,7 +81,7 @@ bool IsContentSecure(content::WebContents* web_contents) { // Returns true if |manifest| specifies a PNG icon with IconPurpose::ANY and of // height and width >= kMinimumPrimaryIconSizeInPx (or size "any"). -bool DoesManifestContainRequiredIcon(const content::Manifest& manifest) { +bool DoesManifestContainRequiredIcon(const blink::Manifest& manifest) { for (const auto& icon : manifest.icons) { // The type field is optional. If it isn't present, fall back on checking // the src extension, and allow the icon if the extension ends with png. @@ -92,7 +92,7 @@ bool DoesManifestContainRequiredIcon(const content::Manifest& manifest) { continue; if (!base::ContainsValue(icon.purpose, - content::Manifest::Icon::IconPurpose::ANY)) { + blink::Manifest::Icon::IconPurpose::ANY)) { continue; } @@ -443,7 +443,7 @@ void InstallableManager::FetchManifest() { } void InstallableManager::OnDidGetManifest(const GURL& manifest_url, - const content::Manifest& manifest) { + const blink::Manifest& manifest) { if (!GetWebContents()) return; @@ -471,7 +471,7 @@ void InstallableManager::CheckManifestValid() { } bool InstallableManager::IsManifestValidForWebApp( - const content::Manifest& manifest) { + const blink::Manifest& manifest) { if (manifest.IsEmpty()) { valid_manifest_->error = MANIFEST_EMPTY; return false; @@ -644,7 +644,7 @@ const GURL& InstallableManager::manifest_url() const { return manifest_->url; } -const content::Manifest& InstallableManager::manifest() const { +const blink::Manifest& InstallableManager::manifest() const { return manifest_->manifest; } diff --git a/chrome/browser/installable/installable_manager.h b/chrome/browser/installable/installable_manager.h index 1d9a74da93e6b7..10eda85d5c9ac2 100644 --- a/chrome/browser/installable/installable_manager.h +++ b/chrome/browser/installable/installable_manager.h @@ -22,7 +22,7 @@ #include "content/public/browser/service_worker_context_observer.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" #include "third_party/skia/include/core/SkBitmap.h" #include "url/gurl.h" @@ -87,7 +87,7 @@ class InstallableManager FRIEND_TEST_ALL_PREFIXES(InstallableManagerBrowserTest, ManifestUrlChangeFlushesState); - using IconPurpose = content::Manifest::Icon::IconPurpose; + using IconPurpose = blink::Manifest::Icon::IconPurpose; struct EligiblityProperty { InstallableStatusCode error = NO_ERROR_DETECTED; @@ -97,7 +97,7 @@ class InstallableManager struct ManifestProperty { InstallableStatusCode error = NO_ERROR_DETECTED; GURL url; - content::Manifest manifest; + blink::Manifest manifest; bool fetched = false; }; @@ -177,10 +177,10 @@ class InstallableManager void CheckEligiblity(); void FetchManifest(); void OnDidGetManifest(const GURL& manifest_url, - const content::Manifest& manifest); + const blink::Manifest& manifest); void CheckManifestValid(); - bool IsManifestValidForWebApp(const content::Manifest& manifest); + bool IsManifestValidForWebApp(const blink::Manifest& manifest); void CheckServiceWorker(); void OnDidCheckHasServiceWorker(content::ServiceWorkerCapability capability); @@ -201,7 +201,7 @@ class InstallableManager void WebContentsDestroyed() override; const GURL& manifest_url() const; - const content::Manifest& manifest() const; + const blink::Manifest& manifest() const; bool valid_manifest(); bool has_worker(); diff --git a/chrome/browser/installable/installable_manager_browsertest.cc b/chrome/browser/installable/installable_manager_browsertest.cc index 0c595bbb0f9196..6a598141230fde 100644 --- a/chrome/browser/installable/installable_manager_browsertest.cc +++ b/chrome/browser/installable/installable_manager_browsertest.cc @@ -18,7 +18,7 @@ #include "content/public/test/browser_test_utils.h" #include "net/test/embedded_test_server/embedded_test_server.h" -using IconPurpose = content::Manifest::Icon::IconPurpose; +using IconPurpose = blink::Manifest::Icon::IconPurpose; namespace { @@ -116,7 +116,7 @@ class CallbackTester { InstallableStatusCode error_code() const { return error_code_; } const GURL& manifest_url() const { return manifest_url_; } - const content::Manifest& manifest() const { return manifest_; } + const blink::Manifest& manifest() const { return manifest_; } const GURL& primary_icon_url() const { return primary_icon_url_; } const SkBitmap* primary_icon() const { return primary_icon_.get(); } const GURL& badge_icon_url() const { return badge_icon_url_; } @@ -128,7 +128,7 @@ class CallbackTester { base::Closure quit_closure_; InstallableStatusCode error_code_; GURL manifest_url_; - content::Manifest manifest_; + blink::Manifest manifest_; GURL primary_icon_url_; std::unique_ptr primary_icon_; GURL badge_icon_url_; @@ -187,7 +187,7 @@ class NestedCallbackTester { base::Closure quit_closure_; InstallableStatusCode error_code_; GURL manifest_url_; - content::Manifest manifest_; + blink::Manifest manifest_; GURL primary_icon_url_; std::unique_ptr primary_icon_; bool valid_manifest_; diff --git a/chrome/browser/installable/installable_manager_unittest.cc b/chrome/browser/installable/installable_manager_unittest.cc index 7c4cc06c3b5c03..7fcc74f0784b3b 100644 --- a/chrome/browser/installable/installable_manager_unittest.cc +++ b/chrome/browser/installable/installable_manager_unittest.cc @@ -6,9 +6,9 @@ #include "base/strings/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/platform/web_display_mode.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" -using IconPurpose = content::Manifest::Icon::IconPurpose; +using IconPurpose = blink::Manifest::Icon::IconPurpose; class InstallableManagerUnitTest : public testing::Test { public: @@ -20,14 +20,14 @@ class InstallableManagerUnitTest : public testing::Test { return base::NullableString16(base::UTF8ToUTF16(str), false); } - static content::Manifest GetValidManifest() { - content::Manifest manifest; + static blink::Manifest GetValidManifest() { + blink::Manifest manifest; manifest.name = ToNullableUTF16("foo"); manifest.short_name = ToNullableUTF16("bar"); manifest.start_url = GURL("http://example.com"); manifest.display = blink::kWebDisplayModeStandalone; - content::Manifest::Icon primary_icon; + blink::Manifest::Icon primary_icon; primary_icon.type = base::ASCIIToUTF16("image/png"); primary_icon.sizes.push_back(gfx::Size(144, 144)); primary_icon.purpose.push_back(IconPurpose::ANY); @@ -38,7 +38,7 @@ class InstallableManagerUnitTest : public testing::Test { return manifest; } - bool IsManifestValid(const content::Manifest& manifest) { + bool IsManifestValid(const blink::Manifest& manifest) { // Explicitly reset the error code before running the method. manager_->set_valid_manifest_error(NO_ERROR_DETECTED); return manager_->IsManifestValidForWebApp(manifest); @@ -53,19 +53,19 @@ class InstallableManagerUnitTest : public testing::Test { }; TEST_F(InstallableManagerUnitTest, EmptyManifestIsInvalid) { - content::Manifest manifest; + blink::Manifest manifest; EXPECT_FALSE(IsManifestValid(manifest)); EXPECT_EQ(MANIFEST_EMPTY, GetErrorCode()); } TEST_F(InstallableManagerUnitTest, CheckMinimalValidManifest) { - content::Manifest manifest = GetValidManifest(); + blink::Manifest manifest = GetValidManifest(); EXPECT_TRUE(IsManifestValid(manifest)); EXPECT_EQ(NO_ERROR_DETECTED, GetErrorCode()); } TEST_F(InstallableManagerUnitTest, ManifestRequiresNameOrShortName) { - content::Manifest manifest = GetValidManifest(); + blink::Manifest manifest = GetValidManifest(); manifest.name = base::NullableString16(); EXPECT_TRUE(IsManifestValid(manifest)); @@ -82,7 +82,7 @@ TEST_F(InstallableManagerUnitTest, ManifestRequiresNameOrShortName) { } TEST_F(InstallableManagerUnitTest, ManifestRequiresNonEmptyNameORShortName) { - content::Manifest manifest = GetValidManifest(); + blink::Manifest manifest = GetValidManifest(); manifest.name = ToNullableUTF16(""); EXPECT_TRUE(IsManifestValid(manifest)); @@ -99,7 +99,7 @@ TEST_F(InstallableManagerUnitTest, ManifestRequiresNonEmptyNameORShortName) { } TEST_F(InstallableManagerUnitTest, ManifestRequiresValidStartURL) { - content::Manifest manifest = GetValidManifest(); + blink::Manifest manifest = GetValidManifest(); manifest.start_url = GURL(); EXPECT_FALSE(IsManifestValid(manifest)); @@ -111,7 +111,7 @@ TEST_F(InstallableManagerUnitTest, ManifestRequiresValidStartURL) { } TEST_F(InstallableManagerUnitTest, ManifestRequiresImagePNG) { - content::Manifest manifest = GetValidManifest(); + blink::Manifest manifest = GetValidManifest(); manifest.icons[0].type = base::ASCIIToUTF16("image/gif"); EXPECT_FALSE(IsManifestValid(manifest)); @@ -138,7 +138,7 @@ TEST_F(InstallableManagerUnitTest, ManifestRequiresImagePNG) { } TEST_F(InstallableManagerUnitTest, ManifestRequiresPurposeAny) { - content::Manifest manifest = GetValidManifest(); + blink::Manifest manifest = GetValidManifest(); // The icon MUST have IconPurpose::ANY at least. manifest.icons[0].purpose[0] = IconPurpose::BADGE; @@ -152,7 +152,7 @@ TEST_F(InstallableManagerUnitTest, ManifestRequiresPurposeAny) { } TEST_F(InstallableManagerUnitTest, ManifestRequiresMinimalSize) { - content::Manifest manifest = GetValidManifest(); + blink::Manifest manifest = GetValidManifest(); // The icon MUST be 144x144 size at least. manifest.icons[0].sizes[0] = gfx::Size(1, 1); @@ -185,7 +185,7 @@ TEST_F(InstallableManagerUnitTest, ManifestRequiresMinimalSize) { } TEST_F(InstallableManagerUnitTest, ManifestDisplayModes) { - content::Manifest manifest = GetValidManifest(); + blink::Manifest manifest = GetValidManifest(); manifest.display = blink::kWebDisplayModeUndefined; EXPECT_FALSE(IsManifestValid(manifest)); diff --git a/chrome/browser/installable/installable_task_queue_unittest.cc b/chrome/browser/installable/installable_task_queue_unittest.cc index 1d7262f1958925..c032ae570b394e 100644 --- a/chrome/browser/installable/installable_task_queue_unittest.cc +++ b/chrome/browser/installable/installable_task_queue_unittest.cc @@ -5,7 +5,7 @@ #include "testing/gtest/include/gtest/gtest.h" -using IconPurpose = content::Manifest::Icon::IconPurpose; +using IconPurpose = blink::Manifest::Icon::IconPurpose; class InstallableTaskQueueUnitTest : public testing::Test {}; diff --git a/chrome/browser/ui/webui/webapks_handler.cc b/chrome/browser/ui/webui/webapks_handler.cc index 8a4f948778b5a4..7ba65f19faa5a7 100644 --- a/chrome/browser/ui/webui/webapks_handler.cc +++ b/chrome/browser/ui/webui/webapks_handler.cc @@ -15,10 +15,10 @@ #include "ui/gfx/color_utils.h" namespace { -// Converts a color from the format documented in content::Manifest to a +// Converts a color from the format documented in blink::Manifest to a // rgba() CSS string. std::string ColorToString(int64_t color) { - if (color == content::Manifest::kInvalidOrMissingColor) + if (color == blink::Manifest::kInvalidOrMissingColor) return std::string(); return color_utils::SkColorToRgbaString(reinterpret_cast(color)); } diff --git a/chrome/browser/webshare/share_target_pref_helper.cc b/chrome/browser/webshare/share_target_pref_helper.cc index f849ef44820706..92237b470d0fad 100644 --- a/chrome/browser/webshare/share_target_pref_helper.cc +++ b/chrome/browser/webshare/share_target_pref_helper.cc @@ -11,7 +11,7 @@ #include "components/prefs/scoped_user_pref_update.h" void UpdateShareTargetInPrefs(const GURL& manifest_url, - const content::Manifest& manifest, + const blink::Manifest& manifest, PrefService* pref_service) { DictionaryPrefUpdate update(pref_service, prefs::kWebShareVisitedTargets); base::DictionaryValue* share_target_dict = update.Get(); diff --git a/chrome/browser/webshare/share_target_pref_helper.h b/chrome/browser/webshare/share_target_pref_helper.h index 55ed0424d9a065..407bdeb128f8ae 100644 --- a/chrome/browser/webshare/share_target_pref_helper.h +++ b/chrome/browser/webshare/share_target_pref_helper.h @@ -7,7 +7,7 @@ #include "base/optional.h" #include "base/strings/string_piece.h" -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" class GURL; class PrefService; @@ -19,7 +19,7 @@ class PrefService; // share_target field, or it does but there is no url_template field, this will // remove |manifest_url| from kWebShareVisitedTargets, if it is there. void UpdateShareTargetInPrefs(const GURL& manifest_url, - const content::Manifest& manifest, + const blink::Manifest& manifest, PrefService* pref_service); #endif // CHROME_BROWSER_WEBSHARE_SHARE_TARGET_PREF_HELPER_H_ diff --git a/chrome/browser/webshare/share_target_pref_helper_unittest.cc b/chrome/browser/webshare/share_target_pref_helper_unittest.cc index 7d367792884942..714c6613b3d5ac 100644 --- a/chrome/browser/webshare/share_target_pref_helper_unittest.cc +++ b/chrome/browser/webshare/share_target_pref_helper_unittest.cc @@ -40,12 +40,12 @@ constexpr char kUrlTemplateKey[] = "url_template"; TEST_F(ShareTargetPrefHelperUnittest, AddMultipleShareTargets) { // Add a share target to prefs that wasn't previously stored. GURL manifest_url("https://www.sharetarget.com/manifest.json"); - content::Manifest::ShareTarget share_target; + blink::Manifest::ShareTarget share_target; std::string url_template = "https://www.sharetarget.com/share?title={title}"; share_target.url_template = GURL(url_template); - content::Manifest manifest; + blink::Manifest manifest; manifest.share_target = - base::Optional(share_target); + base::Optional(share_target); UpdateShareTargetInPrefs(manifest_url, manifest, pref_service()); @@ -89,11 +89,11 @@ TEST_F(ShareTargetPrefHelperUnittest, AddShareTargetTwice) { // Add a share target to prefs that wasn't previously stored. GURL manifest_url(kManifestUrl); - content::Manifest::ShareTarget share_target; + blink::Manifest::ShareTarget share_target; share_target.url_template = GURL(kUrlTemplate); - content::Manifest manifest; + blink::Manifest manifest; manifest.share_target = - base::Optional(share_target); + base::Optional(share_target); UpdateShareTargetInPrefs(manifest_url, manifest, pref_service()); @@ -127,12 +127,12 @@ TEST_F(ShareTargetPrefHelperUnittest, AddShareTargetTwice) { TEST_F(ShareTargetPrefHelperUnittest, UpdateShareTarget) { // Add a share target to prefs that wasn't previously stored. GURL manifest_url("https://www.sharetarget.com/manifest.json"); - content::Manifest::ShareTarget share_target; + blink::Manifest::ShareTarget share_target; std::string url_template = "https://www.sharetarget.com/share/?title={title}"; share_target.url_template = GURL(url_template); - content::Manifest manifest; + blink::Manifest manifest; manifest.share_target = - base::Optional(share_target); + base::Optional(share_target); UpdateShareTargetInPrefs(manifest_url, manifest, pref_service()); @@ -171,7 +171,7 @@ TEST_F(ShareTargetPrefHelperUnittest, DontAddNonShareTarget) { const base::Optional kUrlTemplate; // Don't add a site that has a null template. - UpdateShareTargetInPrefs(GURL(kManifestUrl), content::Manifest(), + UpdateShareTargetInPrefs(GURL(kManifestUrl), blink::Manifest(), pref_service()); const base::DictionaryValue* share_target_dict = @@ -185,12 +185,12 @@ TEST_F(ShareTargetPrefHelperUnittest, DontAddNonShareTarget) { TEST_F(ShareTargetPrefHelperUnittest, RemoveShareTarget) { // Add a share target to prefs that wasn't previously stored. GURL manifest_url("https://www.sharetarget.com/manifest.json"); - content::Manifest::ShareTarget share_target; + blink::Manifest::ShareTarget share_target; std::string url_template = "https://www.sharetarget.com/share/?title={title}"; share_target.url_template = GURL(url_template); - content::Manifest manifest; + blink::Manifest manifest; manifest.share_target = - base::Optional(share_target); + base::Optional(share_target); UpdateShareTargetInPrefs(manifest_url, manifest, pref_service()); @@ -209,7 +209,7 @@ TEST_F(ShareTargetPrefHelperUnittest, RemoveShareTarget) { // Share target already added now has null template. Remove from prefs. manifest_url = GURL("https://www.sharetarget.com/manifest.json"); - UpdateShareTargetInPrefs(manifest_url, content::Manifest(), pref_service()); + UpdateShareTargetInPrefs(manifest_url, blink::Manifest(), pref_service()); share_target_dict = pref_service()->GetDictionary(prefs::kWebShareVisitedTargets); diff --git a/components/favicon/content/DEPS b/components/favicon/content/DEPS index 5bb1fc1368fc89..ce45cc00b202b8 100644 --- a/components/favicon/content/DEPS +++ b/components/favicon/content/DEPS @@ -1,5 +1,6 @@ include_rules = [ "+components/history/core/browser", "+content/public", + "+third_party/blink/public/common", "+third_party/skia/include", ] diff --git a/components/favicon/content/content_favicon_driver.cc b/components/favicon/content/content_favicon_driver.cc index a4d2fbc77345c4..08260fda1b8ecf 100644 --- a/components/favicon/content/content_favicon_driver.cc +++ b/components/favicon/content/content_favicon_driver.cc @@ -17,7 +17,7 @@ #include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_handle.h" #include "content/public/common/favicon_url.h" -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" #include "ui/gfx/image/image.h" DEFINE_WEB_CONTENTS_USER_DATA_KEY(favicon::ContentFaviconDriver); @@ -28,9 +28,9 @@ namespace { void ExtractManifestIcons( ContentFaviconDriver::ManifestDownloadCallback callback, const GURL& manifest_url, - const content::Manifest& manifest) { + const blink::Manifest& manifest) { std::vector candidates; - for (const content::Manifest::Icon& icon : manifest.icons) { + for (const blink::Manifest::Icon& icon : manifest.icons) { candidates.emplace_back(icon.src, favicon_base::IconType::kWebManifestIcon, icon.sizes); } diff --git a/components/payments/content/DEPS b/components/payments/content/DEPS index dea6d3ef61029b..a1853f1bc1042a 100644 --- a/components/payments/content/DEPS +++ b/components/payments/content/DEPS @@ -12,6 +12,7 @@ include_rules = [ "+net", "+services/data_decoder/public/cpp", "+sql", + "+third_party/blink/public/common", "+third_party/blink/public/platform/modules/payments", "+third_party/skia/include/core/SkBitmap.h", "+ui/base", diff --git a/components/payments/content/installable_payment_app_crawler.cc b/components/payments/content/installable_payment_app_crawler.cc index dba2b202b31b82..94fa58ca5a8c98 100644 --- a/components/payments/content/installable_payment_app_crawler.cc +++ b/components/payments/content/installable_payment_app_crawler.cc @@ -15,7 +15,7 @@ #include "content/public/browser/permission_type.h" #include "content/public/browser/web_contents.h" #include "content/public/common/console_message_level.h" -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" #include "ui/gfx/geometry/size.h" #include "url/gurl.h" #include "url/origin.h" @@ -228,7 +228,7 @@ void InstallablePaymentAppCrawler::DownloadAndDecodeWebAppIcon( if (icons == nullptr || icons->empty()) return; - std::vector manifest_icons; + std::vector manifest_icons; for (const auto& icon : *icons) { if (icon.src.empty() || !base::IsStringUTF8(icon.src)) { WarnIfPossible( @@ -248,10 +248,10 @@ void InstallablePaymentAppCrawler::DownloadAndDecodeWebAppIcon( } } - content::Manifest::Icon manifest_icon; + blink::Manifest::Icon manifest_icon; manifest_icon.src = icon_src; manifest_icon.type = base::UTF8ToUTF16(icon.type); - manifest_icon.purpose.emplace_back(content::Manifest::Icon::ANY); + manifest_icon.purpose.emplace_back(blink::Manifest::Icon::ANY); // TODO(crbug.com/782270): Parse icon sizes. manifest_icon.sizes.emplace_back(gfx::Size()); manifest_icons.emplace_back(manifest_icon); @@ -268,7 +268,7 @@ void InstallablePaymentAppCrawler::DownloadAndDecodeWebAppIcon( const int kPaymentAppMinimumIconSize = 0; GURL best_icon_url = content::ManifestIconSelector::FindBestMatchingIcon( manifest_icons, kPaymentAppIdealIconSize, kPaymentAppMinimumIconSize, - content::Manifest::Icon::ANY); + blink::Manifest::Icon::ANY); if (!best_icon_url.is_valid()) { WarnIfPossible( "No suitable icon found in the installabble payment app's manifest (" + diff --git a/content/browser/DEPS b/content/browser/DEPS index 4630296bd40b1f..01550ad4a62fd7 100644 --- a/content/browser/DEPS +++ b/content/browser/DEPS @@ -70,7 +70,6 @@ include_rules = [ "+third_party/blink/public/platform/WebAddressSpace.h", "+third_party/blink/public/platform/web_content_security_policy.h", "+third_party/blink/public/platform/web_cursor_info.h", - "+third_party/blink/public/platform/web_display_mode.h", "+third_party/blink/public/platform/web_drag_operation.h", "+third_party/blink/public/platform/web_focus_type.h", "+third_party/blink/public/platform/web_fullscreen_video_status.h", @@ -131,7 +130,6 @@ include_rules = [ "+third_party/blink/public/platform/modules/installedapp/installed_app_provider.mojom.h", "+third_party/blink/public/platform/modules/installedapp/related_application.mojom.h", "+third_party/blink/public/platform/modules/keyboard_lock/keyboard_lock.mojom.h", - "+third_party/blink/public/platform/modules/manifest/manifest_manager.mojom.h", "+third_party/blink/public/platform/modules/mediasession/media_session.mojom.h", "+third_party/blink/public/platform/modules/mediastream/media_devices.mojom.h", "+third_party/blink/public/platform/modules/notifications/notification_service.mojom.h", diff --git a/content/browser/devtools/protocol/page_handler.h b/content/browser/devtools/protocol/page_handler.h index 8f46f1b2d626a9..c9c0b1f1ed4954 100644 --- a/content/browser/devtools/protocol/page_handler.h +++ b/content/browser/devtools/protocol/page_handler.h @@ -25,7 +25,7 @@ #include "content/public/browser/javascript_dialog_manager.h" #include "content/public/browser/render_widget_host_observer.h" #include "content/public/common/javascript_dialog_type.h" -#include "third_party/blink/public/platform/modules/manifest/manifest_manager.mojom.h" +#include "third_party/blink/public/mojom/manifest/manifest_manager.mojom.h" #include "url/gurl.h" #if !defined(OS_ANDROID) diff --git a/content/browser/manifest/manifest_browsertest.cc b/content/browser/manifest/manifest_browsertest.cc index d8b4b2d615e030..ba1a288479d210 100644 --- a/content/browser/manifest/manifest_browsertest.cc +++ b/content/browser/manifest/manifest_browsertest.cc @@ -13,7 +13,6 @@ #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" -#include "content/public/common/manifest.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/content_browser_test.h" #include "content/public/test/content_browser_test_utils.h" @@ -23,7 +22,8 @@ #include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_response.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" -#include "third_party/blink/public/platform/modules/manifest/manifest_manager.mojom.h" +#include "third_party/blink/public/common/manifest/manifest.h" +#include "third_party/blink/public/mojom/manifest/manifest_manager.mojom.h" namespace content { @@ -80,15 +80,14 @@ class ManifestBrowserTest : public ContentBrowserTest, message_loop_runner_->Run(); } - void OnGetManifest(const GURL& manifest_url, const Manifest& manifest) { + void OnGetManifest(const GURL& manifest_url, + const blink::Manifest& manifest) { manifest_url_ = manifest_url; manifest_ = manifest; message_loop_runner_->Quit(); } - const Manifest& manifest() const { - return manifest_; - } + const blink::Manifest& manifest() const { return manifest_; } const GURL& manifest_url() const { return manifest_url_; @@ -148,7 +147,7 @@ class ManifestBrowserTest : public ContentBrowserTest, std::unique_ptr mock_web_contents_delegate_; std::unique_ptr cors_embedded_test_server_; GURL manifest_url_; - Manifest manifest_; + blink::Manifest manifest_; int console_error_count_; std::vector reported_manifest_urls_; std::vector manifests_reported_when_favicon_url_updated_; diff --git a/content/browser/manifest/manifest_icon_selector.cc b/content/browser/manifest/manifest_icon_selector.cc index 90d9bb53200cec..02afadb3709170 100644 --- a/content/browser/manifest/manifest_icon_selector.cc +++ b/content/browser/manifest/manifest_icon_selector.cc @@ -14,10 +14,10 @@ namespace content { // static GURL ManifestIconSelector::FindBestMatchingIcon( - const std::vector& icons, + const std::vector& icons, int ideal_icon_size_in_px, int minimum_icon_size_in_px, - Manifest::Icon::IconPurpose purpose) { + blink::Manifest::Icon::IconPurpose purpose) { DCHECK(minimum_icon_size_in_px <= ideal_icon_size_in_px); // Icon with exact matching size has priority over icon with size "any", which diff --git a/content/browser/manifest/manifest_icon_selector_unittest.cc b/content/browser/manifest/manifest_icon_selector_unittest.cc index aa602a92846e4c..467a91a0864f5f 100644 --- a/content/browser/manifest/manifest_icon_selector_unittest.cc +++ b/content/browser/manifest/manifest_icon_selector_unittest.cc @@ -13,18 +13,18 @@ namespace content { -using IconPurpose = Manifest::Icon::IconPurpose; +using IconPurpose = blink::Manifest::Icon::IconPurpose; namespace { const int kIdealIconSize = 144; const int kMinimumIconSize = 0; -static Manifest::Icon CreateIcon(const std::string& url, - const std::string& type, - const std::vector sizes, - IconPurpose purpose) { - Manifest::Icon icon; +static blink::Manifest::Icon CreateIcon(const std::string& url, + const std::string& type, + const std::vector sizes, + IconPurpose purpose) { + blink::Manifest::Icon icon; icon.src = GURL(url); icon.type = base::UTF8ToUTF16(type); icon.sizes = sizes; @@ -37,7 +37,7 @@ static Manifest::Icon CreateIcon(const std::string& url, TEST(ManifestIconSelector, NoIcons) { // No icons should return the empty URL. - std::vector icons; + std::vector icons; GURL url = ManifestIconSelector::FindBestMatchingIcon( icons, kIdealIconSize, kMinimumIconSize, IconPurpose::ANY); EXPECT_TRUE(url.is_empty()); @@ -45,7 +45,7 @@ TEST(ManifestIconSelector, NoIcons) { TEST(ManifestIconSelector, NoSizes) { // Icon with no sizes are ignored. - std::vector icons; + std::vector icons; icons.push_back(CreateIcon("http://foo.com/icon.png", "", std::vector(), IconPurpose::ANY)); @@ -60,7 +60,7 @@ TEST(ManifestIconSelector, MIMETypeFiltering) { std::vector sizes; sizes.push_back(gfx::Size(1024, 1024)); - std::vector icons; + std::vector icons; icons.push_back(CreateIcon("http://foo.com/icon.png", "image/foo_bar", sizes, IconPurpose::ANY)); icons.push_back( @@ -107,7 +107,7 @@ TEST(ManifestIconSelector, PurposeFiltering) { std::vector sizes_144; sizes_144.push_back(gfx::Size(144, 144)); - std::vector icons; + std::vector icons; icons.push_back(CreateIcon("http://foo.com/icon_48.png", "", sizes_48, IconPurpose::BADGE)); icons.push_back( @@ -147,7 +147,7 @@ TEST(ManifestIconSelector, IdealSizeIsUsedFirst) { std::vector sizes_144; sizes_144.push_back(gfx::Size(144, 144)); - std::vector icons; + std::vector icons; icons.push_back( CreateIcon("http://foo.com/icon_48.png", "", sizes_48, IconPurpose::ANY)); icons.push_back( @@ -182,7 +182,7 @@ TEST(ManifestIconSelector, FirstIconWithIdealSizeIsUsedFirst) { std::vector sizes_3; sizes_3.push_back(gfx::Size(1024, 1024)); - std::vector icons; + std::vector icons; icons.push_back( CreateIcon("http://foo.com/icon_x1.png", "", sizes_1, IconPurpose::ANY)); icons.push_back( @@ -214,7 +214,7 @@ TEST(ManifestIconSelector, FallbackToSmallestLargerIcon) { std::vector sizes_3; sizes_3.push_back(gfx::Size(192, 192)); - std::vector icons; + std::vector icons; icons.push_back( CreateIcon("http://foo.com/icon_x1.png", "", sizes_1, IconPurpose::ANY)); icons.push_back( @@ -244,7 +244,7 @@ TEST(ManifestIconSelector, FallbackToLargestIconLargerThanMinimum) { sizes_1_2.push_back(gfx::Size(47, 47)); sizes_3.push_back(gfx::Size(95, 95)); - std::vector icons; + std::vector icons; icons.push_back(CreateIcon("http://foo.com/icon_x1.png", "", sizes_1_2, IconPurpose::ANY)); icons.push_back(CreateIcon("http://foo.com/icon_x2.png", "", sizes_1_2, @@ -267,7 +267,7 @@ TEST(ManifestIconSelector, IdealVeryCloseToMinimumMatches) { std::vector sizes; sizes.push_back(gfx::Size(2, 2)); - std::vector icons; + std::vector icons; icons.push_back( CreateIcon("http://foo.com/icon_x1.png", "", sizes, IconPurpose::ANY)); @@ -280,7 +280,7 @@ TEST(ManifestIconSelector, SizeVeryCloseToMinimumMatches) { std::vector sizes; sizes.push_back(gfx::Size(2, 2)); - std::vector icons; + std::vector icons; icons.push_back( CreateIcon("http://foo.com/icon_x1.png", "", sizes, IconPurpose::ANY)); @@ -293,7 +293,7 @@ TEST(ManifestIconSelector, NotSquareIconsAreIgnored) { std::vector sizes; sizes.push_back(gfx::Size(1024, 1023)); - std::vector icons; + std::vector icons; icons.push_back( CreateIcon("http://foo.com/icon.png", "", sizes, IconPurpose::ANY)); @@ -320,7 +320,7 @@ TEST(ManifestIconSelector, ClosestIconToIdeal) { std::vector sizes_2; sizes_2.push_back(gfx::Size(bit_small, bit_small)); - std::vector icons; + std::vector icons; icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1, IconPurpose::ANY)); icons.push_back( @@ -342,7 +342,7 @@ TEST(ManifestIconSelector, ClosestIconToIdeal) { std::vector sizes_3; sizes_3.push_back(gfx::Size(small_size, small_size)); - std::vector icons; + std::vector icons; icons.push_back(CreateIcon("http://foo.com/icon_no_1.png", "", sizes_1, IconPurpose::ANY)); icons.push_back( @@ -363,7 +363,7 @@ TEST(ManifestIconSelector, ClosestIconToIdeal) { std::vector sizes_2; sizes_2.push_back(gfx::Size(big, big)); - std::vector icons; + std::vector icons; icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1, IconPurpose::ANY)); icons.push_back( @@ -385,7 +385,7 @@ TEST(ManifestIconSelector, ClosestIconToIdeal) { std::vector sizes_3; sizes_3.push_back(gfx::Size(bit_big, bit_big)); - std::vector icons; + std::vector icons; icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1, IconPurpose::ANY)); icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_2, @@ -406,7 +406,7 @@ TEST(ManifestIconSelector, ClosestIconToIdeal) { std::vector sizes_2; sizes_2.push_back(gfx::Size(very_big, very_big)); - std::vector icons; + std::vector icons; icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1, IconPurpose::ANY)); icons.push_back( @@ -425,7 +425,7 @@ TEST(ManifestIconSelector, ClosestIconToIdeal) { std::vector sizes_2; sizes_2.push_back(gfx::Size(bit_big, bit_big)); - std::vector icons; + std::vector icons; icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1, IconPurpose::ANY)); icons.push_back( @@ -448,7 +448,7 @@ TEST(ManifestIconSelector, UseAnyIfNoIdealSize) { std::vector sizes_2; sizes_2.push_back(gfx::Size(0, 0)); - std::vector icons; + std::vector icons; icons.push_back( CreateIcon("http://foo.com/icon.png", "", sizes_1, IconPurpose::ANY)); icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_2, @@ -466,7 +466,7 @@ TEST(ManifestIconSelector, UseAnyIfNoIdealSize) { std::vector sizes_2; sizes_2.push_back(gfx::Size(0, 0)); - std::vector icons; + std::vector icons; icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1, IconPurpose::ANY)); icons.push_back( @@ -482,7 +482,7 @@ TEST(ManifestIconSelector, UseAnyIfNoIdealSize) { std::vector sizes; sizes.push_back(gfx::Size(0, 0)); - std::vector icons; + std::vector icons; icons.push_back( CreateIcon("http://foo.com/icon_no1.png", "", sizes, IconPurpose::ANY)); icons.push_back( diff --git a/content/browser/manifest/manifest_manager_host.cc b/content/browser/manifest/manifest_manager_host.cc index 0269f2c144634d..2d58368b2e03fd 100644 --- a/content/browser/manifest/manifest_manager_host.cc +++ b/content/browser/manifest/manifest_manager_host.cc @@ -9,9 +9,9 @@ #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" -#include "content/public/common/manifest.h" #include "services/service_manager/public/cpp/interface_provider.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" +#include "third_party/blink/public/common/manifest/manifest.h" namespace content { @@ -66,12 +66,13 @@ void ManifestManagerHost::OnConnectionError() { } callbacks_.Clear(); for (auto& callback : callbacks) - std::move(callback).Run(GURL(), Manifest()); + std::move(callback).Run(GURL(), blink::Manifest()); } -void ManifestManagerHost::OnRequestManifestResponse(int request_id, - const GURL& url, - const Manifest& manifest) { +void ManifestManagerHost::OnRequestManifestResponse( + int request_id, + const GURL& url, + const blink::Manifest& manifest) { auto callback = std::move(*callbacks_.Lookup(request_id)); callbacks_.Remove(request_id); std::move(callback).Run(url, manifest); diff --git a/content/browser/manifest/manifest_manager_host.h b/content/browser/manifest/manifest_manager_host.h index 40c5c86e0025b1..a49af365284c75 100644 --- a/content/browser/manifest/manifest_manager_host.h +++ b/content/browser/manifest/manifest_manager_host.h @@ -11,13 +11,16 @@ #include "content/common/manifest_observer.mojom.h" #include "content/public/browser/web_contents_binding_set.h" #include "content/public/browser/web_contents_observer.h" -#include "third_party/blink/public/platform/modules/manifest/manifest_manager.mojom.h" +#include "third_party/blink/public/mojom/manifest/manifest_manager.mojom.h" + +namespace blink { +struct Manifest; +} namespace content { class RenderFrameHost; class WebContents; -struct Manifest; // ManifestManagerHost is a helper class that allows callers to get the Manifest // associated with the main frame of the observed WebContents. It handles the @@ -30,7 +33,7 @@ class ManifestManagerHost : public WebContentsObserver, ~ManifestManagerHost() override; using GetManifestCallback = - base::OnceCallback; + base::OnceCallback; // Calls the given callback with the manifest associated with the main frame. // If the main frame has no manifest or if getting it failed the callback will @@ -51,7 +54,7 @@ class ManifestManagerHost : public WebContentsObserver, void OnRequestManifestResponse(int request_id, const GURL& url, - const Manifest& manifest); + const blink::Manifest& manifest); // mojom::ManifestUrlChangeObserver: void ManifestUrlChanged(const base::Optional& manifest_url) override; diff --git a/content/browser/net/accept_header_browsertest.cc b/content/browser/net/accept_header_browsertest.cc index d3a6a676497e8a..54bcbf5ea3319c 100644 --- a/content/browser/net/accept_header_browsertest.cc +++ b/content/browser/net/accept_header_browsertest.cc @@ -149,7 +149,7 @@ IN_PROC_BROWSER_TEST_F(AcceptHeaderTest, Check) { EXPECT_EQ("custom/type", GetFor("/xhr_with_accept_header")); shell()->web_contents()->GetManifest( - base::BindOnce([](const GURL&, const content::Manifest&) {})); + base::BindOnce([](const GURL&, const blink::Manifest&) {})); // RESOURCE_TYPE_SUB_RESOURCE EXPECT_EQ("*/*", GetFor("/manifest")); diff --git a/content/browser/payments/payment_app_database.cc b/content/browser/payments/payment_app_database.cc index 0724df840a2076..664e105455e83a 100644 --- a/content/browser/payments/payment_app_database.cc +++ b/content/browser/payments/payment_app_database.cc @@ -17,7 +17,7 @@ #include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/browser/service_worker/service_worker_registration.h" #include "content/public/browser/browser_thread.h" -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/image/image.h" #include "url/gurl.h" @@ -71,7 +71,7 @@ PaymentInstrumentPtr ToPaymentInstrumentForMojo(const std::string& input) { PaymentInstrumentPtr instrument = PaymentInstrument::New(); instrument->name = instrument_proto.name(); for (const auto& icon_proto : instrument_proto.icons()) { - Manifest::Icon icon; + blink::Manifest::Icon icon; icon.src = GURL(icon_proto.src()); icon.type = base::UTF8ToUTF16(icon_proto.type()); for (const auto& size_proto : icon_proto.sizes()) { @@ -197,7 +197,7 @@ void PaymentAppDatabase::WritePaymentInstrument( DCHECK_CURRENTLY_ON(BrowserThread::IO); if (instrument->icons.size() > 0) { - std::vector icons(instrument->icons); + std::vector icons(instrument->icons); PaymentInstrumentIconFetcher::Start( scope, service_worker_context_->GetProviderHostIds(scope.GetOrigin()), icons, diff --git a/content/browser/payments/payment_app_info_fetcher.cc b/content/browser/payments/payment_app_info_fetcher.cc index 2d3e5e39810dce..7ffe9e44457801 100644 --- a/content/browser/payments/payment_app_info_fetcher.cc +++ b/content/browser/payments/payment_app_info_fetcher.cc @@ -127,7 +127,7 @@ void PaymentAppInfoFetcher::SelfDeleteFetcher::RunCallbackAndDestroy() { void PaymentAppInfoFetcher::SelfDeleteFetcher::FetchPaymentAppManifestCallback( const GURL& url, - const Manifest& manifest) { + const blink::Manifest& manifest) { DCHECK_CURRENTLY_ON(BrowserThread::UI); manifest_url_ = url; @@ -211,7 +211,7 @@ void PaymentAppInfoFetcher::SelfDeleteFetcher::FetchPaymentAppManifestCallback( icon_url_ = ManifestIconSelector::FindBestMatchingIcon( manifest.icons, kPaymentAppIdealIconSize, kPaymentAppMinimumIconSize, - Manifest::Icon::ANY); + blink::Manifest::Icon::ANY); if (!icon_url_.is_valid()) { WarnIfPossible( "No suitable payment handler icon found in the \"icons\" field defined " diff --git a/content/browser/payments/payment_app_info_fetcher.h b/content/browser/payments/payment_app_info_fetcher.h index 4100d1d7ba7da4..73dd74fcd4520e 100644 --- a/content/browser/payments/payment_app_info_fetcher.h +++ b/content/browser/payments/payment_app_info_fetcher.h @@ -12,7 +12,7 @@ #include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/public/browser/stored_payment_app.h" #include "content/public/browser/web_contents_observer.h" -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" #include "third_party/skia/include/core/SkBitmap.h" namespace content { @@ -67,7 +67,7 @@ class PaymentAppInfoFetcher { // The WebContents::GetManifestCallback. void FetchPaymentAppManifestCallback(const GURL& url, - const Manifest& manifest); + const blink::Manifest& manifest); // The ManifestIconDownloader::IconFetchCallback. void OnIconFetched(const SkBitmap& icon); diff --git a/content/browser/payments/payment_instrument_icon_fetcher.cc b/content/browser/payments/payment_instrument_icon_fetcher.cc index e2d683926ef884..bfcb804f5d08df 100644 --- a/content/browser/payments/payment_instrument_icon_fetcher.cc +++ b/content/browser/payments/payment_instrument_icon_fetcher.cc @@ -28,13 +28,13 @@ const int kPaymentAppMinimumIconSize = 0; void DownloadBestMatchingIcon( WebContents* web_contents, - const std::vector& icons, + const std::vector& icons, PaymentInstrumentIconFetcher::PaymentInstrumentIconFetcherCallback callback); void OnIconFetched( WebContents* web_contents, - const std::vector& icons, + const std::vector& icons, PaymentInstrumentIconFetcher::PaymentInstrumentIconFetcherCallback callback, const SkBitmap& bitmap) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -64,14 +64,14 @@ void OnIconFetched( void DownloadBestMatchingIcon( WebContents* web_contents, - const std::vector& icons, + const std::vector& icons, PaymentInstrumentIconFetcher::PaymentInstrumentIconFetcherCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); GURL icon_url = ManifestIconSelector::FindBestMatchingIcon( icons, kPaymentAppIdealIconSize, kPaymentAppMinimumIconSize, - Manifest::Icon::IconPurpose::ANY); + blink::Manifest::Icon::IconPurpose::ANY); if (web_contents == nullptr || !icon_url.is_valid()) { // If the icon url is invalid, it's better to give the information to // developers in advance unlike when fetching or decoding fails. We already @@ -82,7 +82,7 @@ void DownloadBestMatchingIcon( return; } - std::vector copy_icons; + std::vector copy_icons; for (const auto& icon : icons) { if (icon.src != icon_url) { copy_icons.emplace_back(icon); @@ -123,7 +123,7 @@ WebContents* GetWebContentsFromProviderHostIds( void StartOnUI( const GURL& scope, std::unique_ptr>> provider_hosts, - const std::vector& icons, + const std::vector& icons, PaymentInstrumentIconFetcher::PaymentInstrumentIconFetcherCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -139,7 +139,7 @@ void StartOnUI( void PaymentInstrumentIconFetcher::Start( const GURL& scope, std::unique_ptr>> provider_hosts, - const std::vector& icons, + const std::vector& icons, PaymentInstrumentIconFetcherCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); diff --git a/content/browser/payments/payment_instrument_icon_fetcher.h b/content/browser/payments/payment_instrument_icon_fetcher.h index 9e4f9adb866055..e3c5f8e608d5da 100644 --- a/content/browser/payments/payment_instrument_icon_fetcher.h +++ b/content/browser/payments/payment_instrument_icon_fetcher.h @@ -11,7 +11,7 @@ #include "base/callback_forward.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" #include "third_party/blink/public/platform/modules/payments/payment_app.mojom.h" namespace content { @@ -25,7 +25,7 @@ class PaymentInstrumentIconFetcher { static void Start( const GURL& scope, std::unique_ptr>> provider_hosts, - const std::vector& icons, + const std::vector& icons, PaymentInstrumentIconFetcherCallback callback); private: diff --git a/content/browser/renderer_host/render_widget_host_delegate.h b/content/browser/renderer_host/render_widget_host_delegate.h index b8906bb6b40a77..ed7d2e66d8b7a3 100644 --- a/content/browser/renderer_host/render_widget_host_delegate.h +++ b/content/browser/renderer_host/render_widget_host_delegate.h @@ -15,7 +15,7 @@ #include "content/common/drag_event_source_info.h" #include "content/public/common/drop_data.h" #include "services/metrics/public/cpp/ukm_recorder.h" -#include "third_party/blink/public/platform/web_display_mode.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/platform/web_drag_operation.h" #include "third_party/blink/public/platform/web_input_event.h" #include "ui/gfx/native_widget_types.h" diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index 7cae9ef749d34e..66c26d71ab6909 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -58,7 +58,7 @@ #include "mojo/public/cpp/bindings/binding.h" #include "services/viz/public/interfaces/compositing/compositor_frame_sink.mojom.h" #include "services/viz/public/interfaces/hit_test/input_target_client.mojom.h" -#include "third_party/blink/public/platform/web_display_mode.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "ui/base/ime/text_input_mode.h" #include "ui/base/ime/text_input_type.h" #include "ui/base/ui_base_types.h" diff --git a/content/common/DEPS b/content/common/DEPS index d86f28473689f8..92dfcacbddf542 100644 --- a/content/common/DEPS +++ b/content/common/DEPS @@ -23,7 +23,6 @@ include_rules = [ "+third_party/blink/public/mojom", "+third_party/blink/public/platform/WebAddressSpace.h", "+third_party/blink/public/platform/web_content_security_policy.h", - "+third_party/blink/public/platform/web_display_mode.h", "+third_party/blink/public/platform/web_drag_operation.h", "+third_party/blink/public/platform/web_float_point.h", "+third_party/blink/public/platform/web_float_rect.h", diff --git a/content/common/frame_visual_properties.h b/content/common/frame_visual_properties.h index 26614766899261..6dc8da06d92322 100644 --- a/content/common/frame_visual_properties.h +++ b/content/common/frame_visual_properties.h @@ -7,7 +7,6 @@ #include "content/common/content_export.h" #include "content/public/common/screen_info.h" -#include "third_party/blink/public/platform/web_display_mode.h" #include "ui/gfx/geometry/size.h" namespace content { diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 17f07025ad010f..ce0b2415e61760 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -45,8 +45,8 @@ #include "media/capture/ipc/capture_param_traits.h" #include "net/base/network_change_notifier.h" #include "ppapi/buildflags/buildflags.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/common/screen_orientation/web_screen_orientation_type.h" -#include "third_party/blink/public/platform/web_display_mode.h" #include "third_party/blink/public/platform/web_float_point.h" #include "third_party/blink/public/platform/web_float_rect.h" #include "third_party/blink/public/platform/web_intrinsic_sizing_info.h" diff --git a/content/common/visual_properties.h b/content/common/visual_properties.h index bdeab1c89d51ce..f6e28f04539d51 100644 --- a/content/common/visual_properties.h +++ b/content/common/visual_properties.h @@ -9,7 +9,7 @@ #include "components/viz/common/surfaces/local_surface_id.h" #include "content/common/content_export.h" #include "content/public/common/screen_info.h" -#include "third_party/blink/public/platform/web_display_mode.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "ui/gfx/geometry/size.h" namespace content { diff --git a/content/public/browser/manifest_icon_selector.h b/content/public/browser/manifest_icon_selector.h index f95ea6aa6782ea..e535ec07f187e4 100644 --- a/content/public/browser/manifest_icon_selector.h +++ b/content/public/browser/manifest_icon_selector.h @@ -6,7 +6,8 @@ #define CONTENT_PUBLIC_BROWSER_MANIFEST_ICON_SELECTOR_H_ #include "base/macros.h" -#include "content/public/common/manifest.h" +#include "content/common/content_export.h" +#include "third_party/blink/public/common/manifest/manifest.h" #include "url/gurl.h" namespace content { @@ -26,10 +27,10 @@ class CONTENT_EXPORT ManifestIconSelector { // // Returns the icon url if a suitable icon is found. An empty URL otherwise. static GURL FindBestMatchingIcon( - const std::vector& icons, + const std::vector& icons, int ideal_icon_size_in_px, int minimum_icon_size_in_px, - content::Manifest::Icon::IconPurpose purpose); + blink::Manifest::Icon::IconPurpose purpose); private: DISALLOW_IMPLICIT_CONSTRUCTORS(ManifestIconSelector); diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h index 2835d80ef446e6..c4a7f3173b98c1 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h @@ -41,6 +41,10 @@ #include "base/android/scoped_java_ref.h" #endif +namespace blink { +struct Manifest; +} + namespace base { class TimeTicks; } @@ -75,7 +79,6 @@ class RenderWidgetHostView; class WebContentsDelegate; struct CustomContextMenuContext; struct DropData; -struct Manifest; struct MHTMLGenerationParams; struct PageImportanceSignals; struct RendererPreferences; @@ -771,7 +774,7 @@ class WebContents : public PageNavigator, // frame document's manifest. The url will be empty if the document specifies // no manifest, and the manifest will be empty if any other failures occurred. using GetManifestCallback = - base::OnceCallback; + base::OnceCallback; // Requests the manifest URL and the Manifest of the main frame's document. virtual void GetManifest(GetManifestCallback callback) = 0; diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h index 6954d351c3b8e8..ec777d609fb514 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -22,8 +22,8 @@ #include "content/public/common/media_stream_request.h" #include "content/public/common/previews_state.h" #include "content/public/common/window_container_type.mojom.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/mojom/color_chooser/color_chooser.mojom.h" -#include "third_party/blink/public/platform/web_display_mode.h" #include "third_party/blink/public/platform/web_drag_operation.h" #include "third_party/blink/public/platform/web_security_style.h" #include "third_party/blink/public/web/web_fullscreen_options.h" diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn index ebb4d5efdacfaa..630c3c015d2c34 100644 --- a/content/public/common/BUILD.gn +++ b/content/public/common/BUILD.gn @@ -156,8 +156,6 @@ jumbo_source_set("common_sources") { "isolated_world_ids.h", "javascript_dialog_type.h", "main_function_params.h", - "manifest.cc", - "manifest.h", "manifest_share_target_util.cc", "manifest_share_target_util.h", "manifest_util.cc", diff --git a/content/public/common/manifest.typemap b/content/public/common/manifest.typemap deleted file mode 100644 index 4b27a5b76b7de6..00000000000000 --- a/content/public/common/manifest.typemap +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2017 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -mojom = "//third_party/blink/public/platform/modules/manifest/manifest.mojom" -public_headers = [ "//content/public/common/manifest.h" ] -traits_headers = [ "//content/public/common/manifest_struct_traits.h" ] -sources = [ - # Because this mojom is effectively linked as part of content/public/common, - # and it cannot express a dependency on that target; yet manifest.h belongs to - # that target, so gn check will complain about its inclusion by the traits - # given the lack of explicit dependency. We work around this awkward situation - # by claiming that manifest.h is part of the mojom sources. As long as - # everything is still effectively part of content/public/common, this is fine. - "//content/public/common/manifest.h", - "//content/public/common/manifest_struct_traits.cc", - "//content/public/common/manifest_struct_traits.h", -] -deps = [ - "//ui/gfx/geometry/mojo:struct_traits", -] -type_mappings = [ - "blink.mojom.Manifest=content::Manifest[nullable_is_same_type]", - "blink.mojom.ManifestIcon=content::Manifest::Icon", - "blink.mojom.ManifestRelatedApplication=content::Manifest::RelatedApplication", - "blink.mojom.ManifestShareTarget=content::Manifest::ShareTarget", -] diff --git a/content/public/common/manifest_struct_traits.h b/content/public/common/manifest_struct_traits.h deleted file mode 100644 index f816251fb1daa7..00000000000000 --- a/content/public/common/manifest_struct_traits.h +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_PUBLIC_COMMON_MANIFEST_STRUCT_TRAITS_H_ -#define CONTENT_PUBLIC_COMMON_MANIFEST_STRUCT_TRAITS_H_ - -#include "content/public/common/manifest.h" - -#include "mojo/public/cpp/bindings/struct_traits.h" -#include "third_party/blink/public/platform/modules/manifest/manifest.mojom-shared.h" - -namespace mojo { -namespace internal { - -inline base::StringPiece16 TruncateString16(const base::string16& string) { - return base::StringPiece16(string).substr( - 0, content::Manifest::kMaxIPCStringLength); -} - -inline base::Optional TruncateNullableString16( - const base::NullableString16& string) { - if (string.is_null()) - return base::nullopt; - - return TruncateString16(string.string()); -} - -} // namespace internal - -template <> -struct StructTraits { - static bool IsNull(const content::Manifest& m) { return m.IsEmpty(); } - - static void SetToNull(content::Manifest* m) { *m = content::Manifest(); } - - static base::Optional name(const content::Manifest& m) { - return internal::TruncateNullableString16(m.name); - } - - static base::Optional short_name( - const content::Manifest& m) { - return internal::TruncateNullableString16(m.short_name); - } - - static base::Optional gcm_sender_id( - const content::Manifest& m) { - return internal::TruncateNullableString16(m.gcm_sender_id); - } - - static const GURL& start_url(const content::Manifest& m) { - return m.start_url; - } - - static const GURL& scope(const content::Manifest& m) { return m.scope; } - - static blink::WebDisplayMode display(const content::Manifest& m) { - return m.display; - } - - static blink::WebScreenOrientationLockType orientation( - const content::Manifest& m) { - return m.orientation; - } - - static int64_t theme_color(const content::Manifest& m) { - return m.theme_color; - } - - static int64_t background_color(const content::Manifest& m) { - return m.background_color; - } - - static const GURL& splash_screen_url(const content::Manifest& m) { - return m.splash_screen_url; - } - - static const std::vector& icons( - const content::Manifest& m) { - return m.icons; - } - - static const base::Optional& share_target( - const content::Manifest& m) { - return m.share_target; - } - - static const std::vector& - related_applications(const content::Manifest& m) { - return m.related_applications; - } - - static bool prefer_related_applications(const content::Manifest& m) { - return m.prefer_related_applications; - } - - static bool Read(blink::mojom::ManifestDataView data, content::Manifest* out); -}; - -template <> -struct StructTraits { - static const GURL& src(const content::Manifest::Icon& m) { return m.src; } - - static base::StringPiece16 type(const content::Manifest::Icon& m) { - return internal::TruncateString16(m.type); - } - static const std::vector& sizes(const content::Manifest::Icon& m) { - return m.sizes; - } - - static const std::vector& purpose( - const content::Manifest::Icon& m) { - return m.purpose; - } - - static bool Read(blink::mojom::ManifestIconDataView data, - content::Manifest::Icon* out); -}; - -template <> -struct StructTraits { - static base::Optional platform( - const content::Manifest::RelatedApplication& m) { - return internal::TruncateNullableString16(m.platform); - } - - static const GURL& url(const content::Manifest::RelatedApplication& m) { - return m.url; - } - - static base::Optional id( - const content::Manifest::RelatedApplication& m) { - return internal::TruncateNullableString16(m.id); - } - - static bool Read(blink::mojom::ManifestRelatedApplicationDataView data, - content::Manifest::RelatedApplication* out); -}; - -template <> -struct StructTraits { - static const GURL& url_template(const content::Manifest::ShareTarget& m) { - return m.url_template; - } - static bool Read(blink::mojom::ManifestShareTargetDataView data, - content::Manifest::ShareTarget* out); -}; - -template <> -struct EnumTraits { - static blink::mojom::ManifestIcon_Purpose ToMojom( - content::Manifest::Icon::IconPurpose purpose) { - switch (purpose) { - case content::Manifest::Icon::ANY: - return blink::mojom::ManifestIcon_Purpose::ANY; - case content::Manifest::Icon::BADGE: - return blink::mojom::ManifestIcon_Purpose::BADGE; - } - NOTREACHED(); - return blink::mojom::ManifestIcon_Purpose::ANY; - } - static bool FromMojom(blink::mojom::ManifestIcon_Purpose input, - content::Manifest::Icon::IconPurpose* out) { - switch (input) { - case blink::mojom::ManifestIcon_Purpose::ANY: - *out = content::Manifest::Icon::ANY; - return true; - case blink::mojom::ManifestIcon_Purpose::BADGE: - *out = content::Manifest::Icon::BADGE; - return true; - } - - return false; - } -}; - -} // namespace mojo - -#endif // CONTENT_PUBLIC_COMMON_MANIFEST_STRUCT_TRAITS_H_ diff --git a/content/public/common/manifest_util.h b/content/public/common/manifest_util.h index c3e356f1ec1479..f6c70ba32b0b56 100644 --- a/content/public/common/manifest_util.h +++ b/content/public/common/manifest_util.h @@ -8,8 +8,8 @@ #include #include "content/common/content_export.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/common/screen_orientation/web_screen_orientation_lock_type.h" -#include "third_party/blink/public/platform/web_display_mode.h" namespace content { diff --git a/content/public/common/typemaps.gni b/content/public/common/typemaps.gni index fe6ebc08805393..d0efecf616ea5a 100644 --- a/content/public/common/typemaps.gni +++ b/content/public/common/typemaps.gni @@ -4,7 +4,6 @@ typemaps = [ "//content/public/common/load_timing_info.typemap", - "//content/public/common/manifest.typemap", "//content/public/common/referrer.typemap", "//content/public/common/resource_type.typemap", "//content/public/common/speech_recognition_grammar.typemap", diff --git a/content/public/test/layouttest_support.h b/content/public/test/layouttest_support.h index 34e9bd70a0e05b..f71ea362a5fa71 100644 --- a/content/public/test/layouttest_support.h +++ b/content/public/test/layouttest_support.h @@ -17,6 +17,7 @@ class GURL; namespace blink { +struct Manifest; class WebInputEvent; class WebLocalFrame; struct WebSize; @@ -47,7 +48,6 @@ class RenderFrame; class RendererGamepadProvider; class RenderView; class StoragePartition; -struct Manifest; // Turn the browser process into layout test mode. void EnableBrowserLayoutTestMode(); @@ -101,7 +101,7 @@ void EnableWebTestProxyCreation( const WidgetProxyCreationCallback& widget_proxy_creation_callback, const FrameProxyCreationCallback& frame_proxy_creation_callback); -typedef base::OnceCallback +typedef base::OnceCallback FetchManifestCallback; void FetchManifest(blink::WebView* view, FetchManifestCallback callback); diff --git a/content/renderer/installedapp/related_apps_fetcher.cc b/content/renderer/installedapp/related_apps_fetcher.cc index a7d3091f831564..11d50f8b629418 100644 --- a/content/renderer/installedapp/related_apps_fetcher.cc +++ b/content/renderer/installedapp/related_apps_fetcher.cc @@ -5,10 +5,10 @@ #include "content/renderer/installedapp/related_apps_fetcher.h" #include "base/bind.h" -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" +#include "third_party/blink/public/mojom/manifest/manifest.mojom.h" +#include "third_party/blink/public/mojom/manifest/manifest_manager.mojom.h" #include "third_party/blink/public/platform/modules/installedapp/web_related_application.h" -#include "third_party/blink/public/platform/modules/manifest/manifest.mojom.h" -#include "third_party/blink/public/platform/modules/manifest/manifest_manager.mojom.h" #include "third_party/blink/public/platform/web_string.h" namespace content { @@ -33,7 +33,7 @@ void RelatedAppsFetcher::OnGetManifestForRelatedApplications( const blink::WebVector&, void>> callbacks, const GURL& /*url*/, - const Manifest& manifest) { + const blink::Manifest& manifest) { std::vector related_apps; for (const auto& relatedApplication : manifest.related_applications) { blink::WebRelatedApplication webRelatedApplication; diff --git a/content/renderer/installedapp/related_apps_fetcher.h b/content/renderer/installedapp/related_apps_fetcher.h index 73fbfc15f95ae5..0f50aaad411661 100644 --- a/content/renderer/installedapp/related_apps_fetcher.h +++ b/content/renderer/installedapp/related_apps_fetcher.h @@ -12,6 +12,7 @@ #include "third_party/blink/public/platform/modules/installedapp/web_related_apps_fetcher.h" namespace blink { +struct Manifest; namespace mojom { class ManifestManager; } @@ -19,7 +20,6 @@ class ManifestManager; namespace content { -struct Manifest; class ManifestManager; class CONTENT_EXPORT RelatedAppsFetcher : public blink::WebRelatedAppsFetcher { @@ -41,7 +41,7 @@ class CONTENT_EXPORT RelatedAppsFetcher : public blink::WebRelatedAppsFetcher { const blink::WebVector&, void>> callbacks, const GURL& url, - const Manifest& manifest); + const blink::Manifest& manifest); blink::mojom::ManifestManager* const manifest_manager_; diff --git a/content/renderer/manifest/manifest_manager.cc b/content/renderer/manifest/manifest_manager.cc index 32868f6bf99f9b..9e83891ab48ead 100644 --- a/content/renderer/manifest/manifest_manager.cc +++ b/content/renderer/manifest/manifest_manager.cc @@ -47,7 +47,7 @@ ManifestManager::~ManifestManager() { void ManifestManager::RequestManifest(RequestManifestCallback callback) { RequestManifestImpl(base::BindOnce( [](RequestManifestCallback callback, const GURL& manifest_url, - const Manifest& manifest, + const blink::Manifest& manifest, const blink::mojom::ManifestDebugInfo* debug_info) { std::move(callback).Run(manifest_url, manifest); }, @@ -58,7 +58,7 @@ void ManifestManager::RequestManifestDebugInfo( RequestManifestDebugInfoCallback callback) { RequestManifestImpl(base::BindOnce( [](RequestManifestDebugInfoCallback callback, const GURL& manifest_url, - const Manifest& manifest, + const blink::Manifest& manifest, const blink::mojom::ManifestDebugInfo* debug_info) { std::move(callback).Run(manifest_url, debug_info ? debug_info->Clone() : nullptr); @@ -69,7 +69,7 @@ void ManifestManager::RequestManifestDebugInfo( void ManifestManager::RequestManifestImpl( InternalRequestManifestCallback callback) { if (!may_have_manifest_) { - std::move(callback).Run(GURL(), Manifest(), nullptr); + std::move(callback).Run(GURL(), blink::Manifest(), nullptr); return; } @@ -190,7 +190,7 @@ void ManifestManager::ResolveCallbacks(ResolveState state) { // |manifest_url| will be reset on navigation or if we receive a didchange // event. if (state == ResolveStateFailure) - manifest_ = Manifest(); + manifest_ = blink::Manifest(); manifest_dirty_ = state != ResolveStateSuccess; diff --git a/content/renderer/manifest/manifest_manager.h b/content/renderer/manifest/manifest_manager.h index b6799d46643fbe..67d2d374607f3a 100644 --- a/content/renderer/manifest/manifest_manager.h +++ b/content/renderer/manifest/manifest_manager.h @@ -12,10 +12,10 @@ #include "base/callback_forward.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "content/public/common/manifest.h" #include "content/public/renderer/render_frame_observer.h" #include "mojo/public/cpp/bindings/binding_set.h" -#include "third_party/blink/public/platform/modules/manifest/manifest_manager.mojom.h" +#include "third_party/blink/public/common/manifest/manifest.h" +#include "third_party/blink/public/mojom/manifest/manifest_manager.mojom.h" class GURL; @@ -55,7 +55,7 @@ class ManifestManager : public RenderFrameObserver, using InternalRequestManifestCallback = base::OnceCallback; // RenderFrameObserver implementation. @@ -86,7 +86,7 @@ class ManifestManager : public RenderFrameObserver, bool manifest_dirty_; // Current Manifest. Might be outdated if manifest_dirty_ is true. - Manifest manifest_; + blink::Manifest manifest_; // The URL of the current manifest. GURL manifest_url_; diff --git a/content/renderer/manifest/manifest_parser.cc b/content/renderer/manifest/manifest_parser.cc index bf89713dff2c21..d5e9c771c4abe2 100644 --- a/content/renderer/manifest/manifest_parser.cc +++ b/content/renderer/manifest/manifest_parser.cc @@ -13,7 +13,6 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" -#include "content/public/common/manifest.h" #include "content/public/common/manifest_share_target_util.h" #include "content/public/common/manifest_util.h" #include "content/renderer/manifest/manifest_uma_util.h" @@ -81,7 +80,7 @@ void ManifestParser::Parse() { ManifestUmaUtil::ParseSucceeded(manifest_); } -const Manifest& ManifestParser::manifest() const { +const blink::Manifest& ManifestParser::manifest() const { return manifest_; } @@ -135,7 +134,7 @@ int64_t ManifestParser::ParseColor( const std::string& key) { base::NullableString16 parsed_color = ParseString(dictionary, key, Trim); if (parsed_color.is_null()) - return Manifest::kInvalidOrMissingColor; + return blink::Manifest::kInvalidOrMissingColor; SkColor color; if (!blink::WebCSSParser::ParseColor( @@ -143,7 +142,7 @@ int64_t ManifestParser::ParseColor( AddErrorInfo("property '" + key + "' ignored, '" + base::UTF16ToUTF8(parsed_color.string()) + "' is not a " + "valid color."); - return Manifest::kInvalidOrMissingColor; + return blink::Manifest::kInvalidOrMissingColor; } // We do this here because Java does not have an unsigned int32_t type so @@ -283,13 +282,13 @@ std::vector ManifestParser::ParseIconSizes( return sizes; } -std::vector ManifestParser::ParseIconPurpose( - const base::DictionaryValue& icon) { +std::vector +ManifestParser::ParseIconPurpose(const base::DictionaryValue& icon) { base::NullableString16 purpose_str = ParseString(icon, "purpose", NoTrim); - std::vector purposes; + std::vector purposes; if (purpose_str.is_null()) { - purposes.push_back(Manifest::Icon::IconPurpose::ANY); + purposes.push_back(blink::Manifest::Icon::IconPurpose::ANY); return purposes; } @@ -298,9 +297,9 @@ std::vector ManifestParser::ParseIconPurpose( base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); for (const base::string16& keyword : keywords) { if (base::LowerCaseEqualsASCII(keyword, "any")) { - purposes.push_back(Manifest::Icon::IconPurpose::ANY); + purposes.push_back(blink::Manifest::Icon::IconPurpose::ANY); } else if (base::LowerCaseEqualsASCII(keyword, "badge")) { - purposes.push_back(Manifest::Icon::IconPurpose::BADGE); + purposes.push_back(blink::Manifest::Icon::IconPurpose::BADGE); } else { AddErrorInfo( "found icon with invalid purpose. " @@ -309,15 +308,15 @@ std::vector ManifestParser::ParseIconPurpose( } if (purposes.empty()) { - purposes.push_back(Manifest::Icon::IconPurpose::ANY); + purposes.push_back(blink::Manifest::Icon::IconPurpose::ANY); } return purposes; } -std::vector ManifestParser::ParseIcons( +std::vector ManifestParser::ParseIcons( const base::DictionaryValue& dictionary) { - std::vector icons; + std::vector icons; if (!dictionary.HasKey("icons")) return icons; @@ -332,7 +331,7 @@ std::vector ManifestParser::ParseIcons( if (!icons_list->GetDictionary(i, &icon_dictionary)) continue; - Manifest::Icon icon; + blink::Manifest::Icon icon; icon.src = ParseIconSrc(*icon_dictionary); // An icon MUST have a valid src. If it does not, it MUST be ignored. if (!icon.src.is_valid()) @@ -361,19 +360,19 @@ GURL ManifestParser::ParseShareTargetURLTemplate( return url_template; } -base::Optional ManifestParser::ParseShareTarget( +base::Optional ManifestParser::ParseShareTarget( const base::DictionaryValue& dictionary) { if (!dictionary.HasKey("share_target")) return base::nullopt; - Manifest::ShareTarget share_target; + blink::Manifest::ShareTarget share_target; const base::DictionaryValue* share_target_dict = nullptr; dictionary.GetDictionary("share_target", &share_target_dict); share_target.url_template = ParseShareTargetURLTemplate(*share_target_dict); if (share_target.url_template.is_empty()) return base::nullopt; - return base::Optional(share_target); + return base::Optional(share_target); } base::NullableString16 ManifestParser::ParseRelatedApplicationPlatform( @@ -392,10 +391,10 @@ base::NullableString16 ManifestParser::ParseRelatedApplicationId( return ParseString(application, "id", Trim); } -std::vector +std::vector ManifestParser::ParseRelatedApplications( const base::DictionaryValue& dictionary) { - std::vector applications; + std::vector applications; if (!dictionary.HasKey("related_applications")) return applications; @@ -411,7 +410,7 @@ ManifestParser::ParseRelatedApplications( if (!applications_list->GetDictionary(i, &application_dictionary)) continue; - Manifest::RelatedApplication application; + blink::Manifest::RelatedApplication application; application.platform = ParseRelatedApplicationPlatform(*application_dictionary); // "If platform is undefined, move onto the next item if any are left." diff --git a/content/renderer/manifest/manifest_parser.h b/content/renderer/manifest/manifest_parser.h index 7e0cb7dfae27b3..1c400ee38da50f 100644 --- a/content/renderer/manifest/manifest_parser.h +++ b/content/renderer/manifest/manifest_parser.h @@ -14,8 +14,8 @@ #include "base/strings/nullable_string16.h" #include "base/strings/string_piece.h" #include "content/common/content_export.h" -#include "content/public/common/manifest.h" -#include "third_party/blink/public/platform/modules/manifest/manifest.mojom.h" +#include "third_party/blink/public/common/manifest/manifest.h" +#include "third_party/blink/public/mojom/manifest/manifest.mojom.h" class GURL; @@ -39,7 +39,7 @@ class CONTENT_EXPORT ManifestParser { // http://w3c.github.io/manifest/#dfn-steps-for-processing-a-manifest void Parse(); - const Manifest& manifest() const; + const blink::Manifest& manifest() const; bool failed() const; void TakeErrors(std::vector* errors); @@ -146,14 +146,14 @@ class CONTENT_EXPORT ManifestParser { // Returns a vector of Manifest::Icon::IconPurpose with the successfully // parsed icon purposes, and a vector with Manifest::Icon::IconPurpose::Any if // the parsing failed. - std::vector ParseIconPurpose( + std::vector ParseIconPurpose( const base::DictionaryValue& icon); // Parses the 'icons' field of a Manifest, as defined in: // https://w3c.github.io/manifest/#dfn-steps-for-processing-an-array-of-images // Returns a vector of Manifest::Icon with the successfully parsed icons, if // any. An empty vector if the field was not present or empty. - std::vector ParseIcons( + std::vector ParseIcons( const base::DictionaryValue& dictionary); // Parses the 'url_template' field of a Share Target, as defined in: @@ -165,7 +165,7 @@ class CONTENT_EXPORT ManifestParser { // https://github.com/WICG/web-share-target/blob/master/docs/interface.md // Returns the parsed Web Share target. The returned Share Target is null if // the field didn't exist, parsing failed, or it was empty. - base::Optional ParseShareTarget( + base::Optional ParseShareTarget( const base::DictionaryValue& dictionary); // Parses the 'platform' field of a related application, as defined in: @@ -190,7 +190,7 @@ class CONTENT_EXPORT ManifestParser { // Returns a vector of Manifest::RelatedApplication with the successfully // parsed applications, if any. An empty vector if the field was not present // or empty. - std::vector ParseRelatedApplications( + std::vector ParseRelatedApplications( const base::DictionaryValue& dictionary); // Parses the 'prefer_related_applications' field on the manifest, as defined @@ -231,7 +231,7 @@ class CONTENT_EXPORT ManifestParser { GURL document_url_; bool failed_; - Manifest manifest_; + blink::Manifest manifest_; std::vector errors_; DISALLOW_COPY_AND_ASSIGN(ManifestParser); diff --git a/content/renderer/manifest/manifest_parser_unittest.cc b/content/renderer/manifest/manifest_parser_unittest.cc index db1768db3515fb..b894c38473a189 100644 --- a/content/renderer/manifest/manifest_parser_unittest.cc +++ b/content/renderer/manifest/manifest_parser_unittest.cc @@ -11,8 +11,8 @@ #include "base/macros.h" #include "base/optional.h" #include "base/strings/string_util.h" -#include "content/public/common/manifest.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/manifest/manifest.h" namespace content { @@ -29,9 +29,9 @@ class ManifestParserTest : public testing::Test { ManifestParserTest() {} ~ManifestParserTest() override {} - Manifest ParseManifestWithURLs(const base::StringPiece& data, - const GURL& manifest_url, - const GURL& document_url) { + blink::Manifest ParseManifestWithURLs(const base::StringPiece& data, + const GURL& manifest_url, + const GURL& document_url) { ManifestParser parser(data, manifest_url, document_url); parser.Parse(); std::vector errors; @@ -43,7 +43,7 @@ class ManifestParserTest : public testing::Test { return parser.manifest(); } - Manifest ParseManifest(const base::StringPiece& data) { + blink::Manifest ParseManifest(const base::StringPiece& data) { return ParseManifestWithURLs( data, default_manifest_url, default_document_url); } @@ -85,7 +85,7 @@ TEST_F(ManifestParserTest, CrashTest) { } TEST_F(ManifestParserTest, EmptyStringNull) { - Manifest manifest = ParseManifest(""); + blink::Manifest manifest = ParseManifest(""); // This Manifest is not a valid JSON object, it's a parsing error. EXPECT_EQ(1u, GetErrorCount()); @@ -99,15 +99,15 @@ TEST_F(ManifestParserTest, EmptyStringNull) { ASSERT_TRUE(manifest.start_url.is_empty()); ASSERT_EQ(manifest.display, blink::kWebDisplayModeUndefined); ASSERT_EQ(manifest.orientation, blink::kWebScreenOrientationLockDefault); - ASSERT_EQ(manifest.theme_color, Manifest::kInvalidOrMissingColor); - ASSERT_EQ(manifest.background_color, Manifest::kInvalidOrMissingColor); + ASSERT_EQ(manifest.theme_color, blink::Manifest::kInvalidOrMissingColor); + ASSERT_EQ(manifest.background_color, blink::Manifest::kInvalidOrMissingColor); ASSERT_TRUE(manifest.splash_screen_url.is_empty()); ASSERT_TRUE(manifest.gcm_sender_id.is_null()); ASSERT_TRUE(manifest.scope.is_empty()); } TEST_F(ManifestParserTest, ValidNoContentParses) { - Manifest manifest = ParseManifest("{}"); + blink::Manifest manifest = ParseManifest("{}"); // Empty Manifest is not a parsing error. EXPECT_EQ(0u, GetErrorCount()); @@ -119,15 +119,16 @@ TEST_F(ManifestParserTest, ValidNoContentParses) { ASSERT_TRUE(manifest.start_url.is_empty()); ASSERT_EQ(manifest.display, blink::kWebDisplayModeUndefined); ASSERT_EQ(manifest.orientation, blink::kWebScreenOrientationLockDefault); - ASSERT_EQ(manifest.theme_color, Manifest::kInvalidOrMissingColor); - ASSERT_EQ(manifest.background_color, Manifest::kInvalidOrMissingColor); + ASSERT_EQ(manifest.theme_color, blink::Manifest::kInvalidOrMissingColor); + ASSERT_EQ(manifest.background_color, blink::Manifest::kInvalidOrMissingColor); ASSERT_TRUE(manifest.splash_screen_url.is_empty()); ASSERT_TRUE(manifest.gcm_sender_id.is_null()); ASSERT_TRUE(manifest.scope.is_empty()); } TEST_F(ManifestParserTest, MultipleErrorsReporting) { - Manifest manifest = ParseManifest("{ \"name\": 42, \"short_name\": 4," + blink::Manifest manifest = ParseManifest( + "{ \"name\": 42, \"short_name\": 4," "\"orientation\": {}, \"display\": \"foo\"," "\"start_url\": null, \"icons\": {}, \"theme_color\": 42," "\"background_color\": 42 }"); @@ -155,7 +156,7 @@ TEST_F(ManifestParserTest, MultipleErrorsReporting) { TEST_F(ManifestParserTest, NameParseRules) { // Smoke test. { - Manifest manifest = ParseManifest("{ \"name\": \"foo\" }"); + blink::Manifest manifest = ParseManifest("{ \"name\": \"foo\" }"); ASSERT_TRUE(base::EqualsASCII(manifest.name.string(), "foo")); ASSERT_FALSE(manifest.IsEmpty()); EXPECT_EQ(0u, GetErrorCount()); @@ -163,14 +164,14 @@ TEST_F(ManifestParserTest, NameParseRules) { // Trim whitespaces. { - Manifest manifest = ParseManifest("{ \"name\": \" foo \" }"); + blink::Manifest manifest = ParseManifest("{ \"name\": \" foo \" }"); ASSERT_TRUE(base::EqualsASCII(manifest.name.string(), "foo")); EXPECT_EQ(0u, GetErrorCount()); } // Don't parse if name isn't a string. { - Manifest manifest = ParseManifest("{ \"name\": {} }"); + blink::Manifest manifest = ParseManifest("{ \"name\": {} }"); ASSERT_TRUE(manifest.name.is_null()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'name' ignored, type string expected.", @@ -179,7 +180,7 @@ TEST_F(ManifestParserTest, NameParseRules) { // Don't parse if name isn't a string. { - Manifest manifest = ParseManifest("{ \"name\": 42 }"); + blink::Manifest manifest = ParseManifest("{ \"name\": 42 }"); ASSERT_TRUE(manifest.name.is_null()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'name' ignored, type string expected.", @@ -190,7 +191,7 @@ TEST_F(ManifestParserTest, NameParseRules) { TEST_F(ManifestParserTest, ShortNameParseRules) { // Smoke test. { - Manifest manifest = ParseManifest("{ \"short_name\": \"foo\" }"); + blink::Manifest manifest = ParseManifest("{ \"short_name\": \"foo\" }"); ASSERT_TRUE(base::EqualsASCII(manifest.short_name.string(), "foo")); ASSERT_FALSE(manifest.IsEmpty()); EXPECT_EQ(0u, GetErrorCount()); @@ -198,14 +199,14 @@ TEST_F(ManifestParserTest, ShortNameParseRules) { // Trim whitespaces. { - Manifest manifest = ParseManifest("{ \"short_name\": \" foo \" }"); + blink::Manifest manifest = ParseManifest("{ \"short_name\": \" foo \" }"); ASSERT_TRUE(base::EqualsASCII(manifest.short_name.string(), "foo")); EXPECT_EQ(0u, GetErrorCount()); } // Don't parse if name isn't a string. { - Manifest manifest = ParseManifest("{ \"short_name\": {} }"); + blink::Manifest manifest = ParseManifest("{ \"short_name\": {} }"); ASSERT_TRUE(manifest.short_name.is_null()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'short_name' ignored, type string expected.", @@ -214,7 +215,7 @@ TEST_F(ManifestParserTest, ShortNameParseRules) { // Don't parse if name isn't a string. { - Manifest manifest = ParseManifest("{ \"short_name\": 42 }"); + blink::Manifest manifest = ParseManifest("{ \"short_name\": 42 }"); ASSERT_TRUE(manifest.short_name.is_null()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'short_name' ignored, type string expected.", @@ -225,7 +226,8 @@ TEST_F(ManifestParserTest, ShortNameParseRules) { TEST_F(ManifestParserTest, StartURLParseRules) { // Smoke test. { - Manifest manifest = ParseManifest("{ \"start_url\": \"land.html\" }"); + blink::Manifest manifest = + ParseManifest("{ \"start_url\": \"land.html\" }"); ASSERT_EQ(manifest.start_url.spec(), default_document_url.Resolve("land.html").spec()); ASSERT_FALSE(manifest.IsEmpty()); @@ -234,7 +236,8 @@ TEST_F(ManifestParserTest, StartURLParseRules) { // Whitespaces. { - Manifest manifest = ParseManifest("{ \"start_url\": \" land.html \" }"); + blink::Manifest manifest = + ParseManifest("{ \"start_url\": \" land.html \" }"); ASSERT_EQ(manifest.start_url.spec(), default_document_url.Resolve("land.html").spec()); EXPECT_EQ(0u, GetErrorCount()); @@ -242,7 +245,7 @@ TEST_F(ManifestParserTest, StartURLParseRules) { // Don't parse if property isn't a string. { - Manifest manifest = ParseManifest("{ \"start_url\": {} }"); + blink::Manifest manifest = ParseManifest("{ \"start_url\": {} }"); ASSERT_TRUE(manifest.start_url.is_empty()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'start_url' ignored, type string expected.", @@ -251,7 +254,7 @@ TEST_F(ManifestParserTest, StartURLParseRules) { // Don't parse if property isn't a string. { - Manifest manifest = ParseManifest("{ \"start_url\": 42 }"); + blink::Manifest manifest = ParseManifest("{ \"start_url\": 42 }"); ASSERT_TRUE(manifest.start_url.is_empty()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'start_url' ignored, type string expected.", @@ -260,7 +263,8 @@ TEST_F(ManifestParserTest, StartURLParseRules) { // Don't parse if property isn't a valid URL. { - Manifest manifest = ParseManifest("{ \"start_url\": \"http://www.google.ca:a\" }"); + blink::Manifest manifest = + ParseManifest("{ \"start_url\": \"http://www.google.ca:a\" }"); ASSERT_TRUE(manifest.start_url.is_empty()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'start_url' ignored, URL is invalid.", errors()[0]); @@ -268,7 +272,7 @@ TEST_F(ManifestParserTest, StartURLParseRules) { // Absolute start_url, same origin with document. { - Manifest manifest = + blink::Manifest manifest = ParseManifestWithURLs("{ \"start_url\": \"http://foo.com/land.html\" }", GURL("http://foo.com/manifest.json"), GURL("http://foo.com/index.html")); @@ -278,7 +282,7 @@ TEST_F(ManifestParserTest, StartURLParseRules) { // Absolute start_url, cross origin with document. { - Manifest manifest = + blink::Manifest manifest = ParseManifestWithURLs("{ \"start_url\": \"http://bar.com/land.html\" }", GURL("http://foo.com/manifest.json"), GURL("http://foo.com/index.html")); @@ -291,7 +295,7 @@ TEST_F(ManifestParserTest, StartURLParseRules) { // Resolving has to happen based on the manifest_url. { - Manifest manifest = + blink::Manifest manifest = ParseManifestWithURLs("{ \"start_url\": \"land.html\" }", GURL("http://foo.com/landing/manifest.json"), GURL("http://foo.com/index.html")); @@ -303,7 +307,7 @@ TEST_F(ManifestParserTest, StartURLParseRules) { TEST_F(ManifestParserTest, ScopeParseRules) { // Smoke test. { - Manifest manifest = ParseManifest( + blink::Manifest manifest = ParseManifest( "{ \"scope\": \"land\", \"start_url\": \"land/landing.html\" }"); ASSERT_EQ(manifest.scope.spec(), default_document_url.Resolve("land").spec()); @@ -313,7 +317,7 @@ TEST_F(ManifestParserTest, ScopeParseRules) { // Whitespaces. { - Manifest manifest = ParseManifest( + blink::Manifest manifest = ParseManifest( "{ \"scope\": \" land \", \"start_url\": \"land/landing.html\" }"); ASSERT_EQ(manifest.scope.spec(), default_document_url.Resolve("land").spec()); @@ -322,7 +326,7 @@ TEST_F(ManifestParserTest, ScopeParseRules) { // Don't parse if property isn't a string. { - Manifest manifest = ParseManifest("{ \"scope\": {} }"); + blink::Manifest manifest = ParseManifest("{ \"scope\": {} }"); ASSERT_TRUE(manifest.scope.is_empty()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'scope' ignored, type string expected.", errors()[0]); @@ -330,7 +334,7 @@ TEST_F(ManifestParserTest, ScopeParseRules) { // Don't parse if property isn't a string. { - Manifest manifest = ParseManifest("{ \"scope\": 42 }"); + blink::Manifest manifest = ParseManifest("{ \"scope\": 42 }"); ASSERT_TRUE(manifest.scope.is_empty()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'scope' ignored, type string expected.", errors()[0]); @@ -338,7 +342,7 @@ TEST_F(ManifestParserTest, ScopeParseRules) { // Absolute scope, start URL is in scope. { - Manifest manifest = ParseManifestWithURLs( + blink::Manifest manifest = ParseManifestWithURLs( "{ \"scope\": \"http://foo.com/land\", " "\"start_url\": \"http://foo.com/land/landing.html\" }", GURL("http://foo.com/manifest.json"), @@ -349,11 +353,11 @@ TEST_F(ManifestParserTest, ScopeParseRules) { // Absolute scope, start URL is not in scope. { - Manifest manifest = - ParseManifestWithURLs("{ \"scope\": \"http://foo.com/land\", " - "\"start_url\": \"http://foo.com/index.html\" }", - GURL("http://foo.com/manifest.json"), - GURL("http://foo.com/index.html")); + blink::Manifest manifest = ParseManifestWithURLs( + "{ \"scope\": \"http://foo.com/land\", " + "\"start_url\": \"http://foo.com/index.html\" }", + GURL("http://foo.com/manifest.json"), + GURL("http://foo.com/index.html")); ASSERT_TRUE(manifest.scope.is_empty()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'scope' ignored. Start url should be within scope " @@ -363,11 +367,11 @@ TEST_F(ManifestParserTest, ScopeParseRules) { // Absolute scope, start URL has different origin than scope URL. { - Manifest manifest = - ParseManifestWithURLs("{ \"scope\": \"http://foo.com/land\", " - "\"start_url\": \"http://bar.com/land/landing.html\" }", - GURL("http://foo.com/manifest.json"), - GURL("http://foo.com/index.html")); + blink::Manifest manifest = ParseManifestWithURLs( + "{ \"scope\": \"http://foo.com/land\", " + "\"start_url\": \"http://bar.com/land/landing.html\" }", + GURL("http://foo.com/manifest.json"), + GURL("http://foo.com/index.html")); ASSERT_TRUE(manifest.scope.is_empty()); ASSERT_EQ(2u, GetErrorCount()); EXPECT_EQ( @@ -380,11 +384,11 @@ TEST_F(ManifestParserTest, ScopeParseRules) { // scope and start URL have diferent origin than document URL. { - Manifest manifest = - ParseManifestWithURLs("{ \"scope\": \"http://foo.com/land\", " - "\"start_url\": \"http://foo.com/land/landing.html\" }", - GURL("http://foo.com/manifest.json"), - GURL("http://bar.com/index.html")); + blink::Manifest manifest = ParseManifestWithURLs( + "{ \"scope\": \"http://foo.com/land\", " + "\"start_url\": \"http://foo.com/land/landing.html\" }", + GURL("http://foo.com/manifest.json"), + GURL("http://bar.com/index.html")); ASSERT_TRUE(manifest.scope.is_empty()); ASSERT_EQ(2u, GetErrorCount()); EXPECT_EQ( @@ -396,18 +400,20 @@ TEST_F(ManifestParserTest, ScopeParseRules) { // No start URL. Document URL is in scope. { - Manifest manifest = ParseManifestWithURLs("{ \"scope\": \"http://foo.com/land\" }", - GURL("http://foo.com/manifest.json"), - GURL("http://foo.com/land/index.html")); + blink::Manifest manifest = + ParseManifestWithURLs("{ \"scope\": \"http://foo.com/land\" }", + GURL("http://foo.com/manifest.json"), + GURL("http://foo.com/land/index.html")); ASSERT_EQ(manifest.scope.spec(), "http://foo.com/land"); ASSERT_EQ(0u, GetErrorCount()); } // No start URL. Document is out of scope. { - Manifest manifest = ParseManifestWithURLs("{ \"scope\": \"http://foo.com/land\" }", - GURL("http://foo.com/manifest.json"), - GURL("http://foo.com/index.html")); + blink::Manifest manifest = + ParseManifestWithURLs("{ \"scope\": \"http://foo.com/land\" }", + GURL("http://foo.com/manifest.json"), + GURL("http://foo.com/index.html")); ASSERT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'scope' ignored. Start url should be within scope " "of scope URL.", @@ -416,9 +422,8 @@ TEST_F(ManifestParserTest, ScopeParseRules) { // Resolving has to happen based on the manifest_url. { - Manifest manifest = ParseManifestWithURLs( - "{ \"scope\": \"treasure\" }", - GURL("http://foo.com/map/manifest.json"), + blink::Manifest manifest = ParseManifestWithURLs( + "{ \"scope\": \"treasure\" }", GURL("http://foo.com/map/manifest.json"), GURL("http://foo.com/map/treasure/island/index.html")); ASSERT_EQ(manifest.scope.spec(), "http://foo.com/map/treasure"); EXPECT_EQ(0u, GetErrorCount()); @@ -426,20 +431,18 @@ TEST_F(ManifestParserTest, ScopeParseRules) { // Scope is parent directory. { - Manifest manifest = - ParseManifestWithURLs("{ \"scope\": \"..\" }", - GURL("http://foo.com/map/manifest.json"), - GURL("http://foo.com/index.html")); + blink::Manifest manifest = ParseManifestWithURLs( + "{ \"scope\": \"..\" }", GURL("http://foo.com/map/manifest.json"), + GURL("http://foo.com/index.html")); ASSERT_EQ(manifest.scope.spec(), "http://foo.com/"); EXPECT_EQ(0u, GetErrorCount()); } // Scope tries to go up past domain. { - Manifest manifest = - ParseManifestWithURLs("{ \"scope\": \"../..\" }", - GURL("http://foo.com/map/manifest.json"), - GURL("http://foo.com/index.html")); + blink::Manifest manifest = ParseManifestWithURLs( + "{ \"scope\": \"../..\" }", GURL("http://foo.com/map/manifest.json"), + GURL("http://foo.com/index.html")); ASSERT_EQ(manifest.scope.spec(), "http://foo.com/"); EXPECT_EQ(0u, GetErrorCount()); } @@ -448,7 +451,7 @@ TEST_F(ManifestParserTest, ScopeParseRules) { TEST_F(ManifestParserTest, DisplayParserRules) { // Smoke test. { - Manifest manifest = ParseManifest("{ \"display\": \"browser\" }"); + blink::Manifest manifest = ParseManifest("{ \"display\": \"browser\" }"); EXPECT_EQ(manifest.display, blink::kWebDisplayModeBrowser); EXPECT_FALSE(manifest.IsEmpty()); EXPECT_EQ(0u, GetErrorCount()); @@ -456,14 +459,15 @@ TEST_F(ManifestParserTest, DisplayParserRules) { // Trim whitespaces. { - Manifest manifest = ParseManifest("{ \"display\": \" browser \" }"); + blink::Manifest manifest = + ParseManifest("{ \"display\": \" browser \" }"); EXPECT_EQ(manifest.display, blink::kWebDisplayModeBrowser); EXPECT_EQ(0u, GetErrorCount()); } // Don't parse if name isn't a string. { - Manifest manifest = ParseManifest("{ \"display\": {} }"); + blink::Manifest manifest = ParseManifest("{ \"display\": {} }"); EXPECT_EQ(manifest.display, blink::kWebDisplayModeUndefined); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'display' ignored," @@ -473,7 +477,7 @@ TEST_F(ManifestParserTest, DisplayParserRules) { // Don't parse if name isn't a string. { - Manifest manifest = ParseManifest("{ \"display\": 42 }"); + blink::Manifest manifest = ParseManifest("{ \"display\": 42 }"); EXPECT_EQ(manifest.display, blink::kWebDisplayModeUndefined); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'display' ignored," @@ -483,7 +487,8 @@ TEST_F(ManifestParserTest, DisplayParserRules) { // Parse fails if string isn't known. { - Manifest manifest = ParseManifest("{ \"display\": \"browser_something\" }"); + blink::Manifest manifest = + ParseManifest("{ \"display\": \"browser_something\" }"); EXPECT_EQ(manifest.display, blink::kWebDisplayModeUndefined); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("unknown 'display' value ignored.", @@ -492,35 +497,35 @@ TEST_F(ManifestParserTest, DisplayParserRules) { // Accept 'fullscreen'. { - Manifest manifest = ParseManifest("{ \"display\": \"fullscreen\" }"); + blink::Manifest manifest = ParseManifest("{ \"display\": \"fullscreen\" }"); EXPECT_EQ(manifest.display, blink::kWebDisplayModeFullscreen); EXPECT_EQ(0u, GetErrorCount()); } // Accept 'fullscreen'. { - Manifest manifest = ParseManifest("{ \"display\": \"standalone\" }"); + blink::Manifest manifest = ParseManifest("{ \"display\": \"standalone\" }"); EXPECT_EQ(manifest.display, blink::kWebDisplayModeStandalone); EXPECT_EQ(0u, GetErrorCount()); } // Accept 'minimal-ui'. { - Manifest manifest = ParseManifest("{ \"display\": \"minimal-ui\" }"); + blink::Manifest manifest = ParseManifest("{ \"display\": \"minimal-ui\" }"); EXPECT_EQ(manifest.display, blink::kWebDisplayModeMinimalUi); EXPECT_EQ(0u, GetErrorCount()); } // Accept 'browser'. { - Manifest manifest = ParseManifest("{ \"display\": \"browser\" }"); + blink::Manifest manifest = ParseManifest("{ \"display\": \"browser\" }"); EXPECT_EQ(manifest.display, blink::kWebDisplayModeBrowser); EXPECT_EQ(0u, GetErrorCount()); } // Case insensitive. { - Manifest manifest = ParseManifest("{ \"display\": \"BROWSER\" }"); + blink::Manifest manifest = ParseManifest("{ \"display\": \"BROWSER\" }"); EXPECT_EQ(manifest.display, blink::kWebDisplayModeBrowser); EXPECT_EQ(0u, GetErrorCount()); } @@ -529,7 +534,8 @@ TEST_F(ManifestParserTest, DisplayParserRules) { TEST_F(ManifestParserTest, OrientationParserRules) { // Smoke test. { - Manifest manifest = ParseManifest("{ \"orientation\": \"natural\" }"); + blink::Manifest manifest = + ParseManifest("{ \"orientation\": \"natural\" }"); EXPECT_EQ(manifest.orientation, blink::kWebScreenOrientationLockNatural); EXPECT_FALSE(manifest.IsEmpty()); EXPECT_EQ(0u, GetErrorCount()); @@ -537,14 +543,15 @@ TEST_F(ManifestParserTest, OrientationParserRules) { // Trim whitespaces. { - Manifest manifest = ParseManifest("{ \"orientation\": \"natural\" }"); + blink::Manifest manifest = + ParseManifest("{ \"orientation\": \"natural\" }"); EXPECT_EQ(manifest.orientation, blink::kWebScreenOrientationLockNatural); EXPECT_EQ(0u, GetErrorCount()); } // Don't parse if name isn't a string. { - Manifest manifest = ParseManifest("{ \"orientation\": {} }"); + blink::Manifest manifest = ParseManifest("{ \"orientation\": {} }"); EXPECT_EQ(manifest.orientation, blink::kWebScreenOrientationLockDefault); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'orientation' ignored, type string expected.", @@ -553,7 +560,7 @@ TEST_F(ManifestParserTest, OrientationParserRules) { // Don't parse if name isn't a string. { - Manifest manifest = ParseManifest("{ \"orientation\": 42 }"); + blink::Manifest manifest = ParseManifest("{ \"orientation\": 42 }"); EXPECT_EQ(manifest.orientation, blink::kWebScreenOrientationLockDefault); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'orientation' ignored, type string expected.", @@ -562,7 +569,8 @@ TEST_F(ManifestParserTest, OrientationParserRules) { // Parse fails if string isn't known. { - Manifest manifest = ParseManifest("{ \"orientation\": \"naturalish\" }"); + blink::Manifest manifest = + ParseManifest("{ \"orientation\": \"naturalish\" }"); EXPECT_EQ(manifest.orientation, blink::kWebScreenOrientationLockDefault); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("unknown 'orientation' value ignored.", @@ -571,28 +579,30 @@ TEST_F(ManifestParserTest, OrientationParserRules) { // Accept 'any'. { - Manifest manifest = ParseManifest("{ \"orientation\": \"any\" }"); + blink::Manifest manifest = ParseManifest("{ \"orientation\": \"any\" }"); EXPECT_EQ(manifest.orientation, blink::kWebScreenOrientationLockAny); EXPECT_EQ(0u, GetErrorCount()); } // Accept 'natural'. { - Manifest manifest = ParseManifest("{ \"orientation\": \"natural\" }"); + blink::Manifest manifest = + ParseManifest("{ \"orientation\": \"natural\" }"); EXPECT_EQ(manifest.orientation, blink::kWebScreenOrientationLockNatural); EXPECT_EQ(0u, GetErrorCount()); } // Accept 'landscape'. { - Manifest manifest = ParseManifest("{ \"orientation\": \"landscape\" }"); + blink::Manifest manifest = + ParseManifest("{ \"orientation\": \"landscape\" }"); EXPECT_EQ(manifest.orientation, blink::kWebScreenOrientationLockLandscape); EXPECT_EQ(0u, GetErrorCount()); } // Accept 'landscape-primary'. { - Manifest manifest = + blink::Manifest manifest = ParseManifest("{ \"orientation\": \"landscape-primary\" }"); EXPECT_EQ(manifest.orientation, blink::kWebScreenOrientationLockLandscapePrimary); @@ -601,7 +611,7 @@ TEST_F(ManifestParserTest, OrientationParserRules) { // Accept 'landscape-secondary'. { - Manifest manifest = + blink::Manifest manifest = ParseManifest("{ \"orientation\": \"landscape-secondary\" }"); EXPECT_EQ(manifest.orientation, blink::kWebScreenOrientationLockLandscapeSecondary); @@ -610,15 +620,16 @@ TEST_F(ManifestParserTest, OrientationParserRules) { // Accept 'portrait'. { - Manifest manifest = ParseManifest("{ \"orientation\": \"portrait\" }"); + blink::Manifest manifest = + ParseManifest("{ \"orientation\": \"portrait\" }"); EXPECT_EQ(manifest.orientation, blink::kWebScreenOrientationLockPortrait); EXPECT_EQ(0u, GetErrorCount()); } // Accept 'portrait-primary'. { - Manifest manifest = - ParseManifest("{ \"orientation\": \"portrait-primary\" }"); + blink::Manifest manifest = + ParseManifest("{ \"orientation\": \"portrait-primary\" }"); EXPECT_EQ(manifest.orientation, blink::kWebScreenOrientationLockPortraitPrimary); EXPECT_EQ(0u, GetErrorCount()); @@ -626,7 +637,7 @@ TEST_F(ManifestParserTest, OrientationParserRules) { // Accept 'portrait-secondary'. { - Manifest manifest = + blink::Manifest manifest = ParseManifest("{ \"orientation\": \"portrait-secondary\" }"); EXPECT_EQ(manifest.orientation, blink::kWebScreenOrientationLockPortraitSecondary); @@ -635,7 +646,8 @@ TEST_F(ManifestParserTest, OrientationParserRules) { // Case insensitive. { - Manifest manifest = ParseManifest("{ \"orientation\": \"LANDSCAPE\" }"); + blink::Manifest manifest = + ParseManifest("{ \"orientation\": \"LANDSCAPE\" }"); EXPECT_EQ(manifest.orientation, blink::kWebScreenOrientationLockLandscape); EXPECT_EQ(0u, GetErrorCount()); } @@ -644,7 +656,7 @@ TEST_F(ManifestParserTest, OrientationParserRules) { TEST_F(ManifestParserTest, IconsParseRules) { // Smoke test: if no icon, empty list. { - Manifest manifest = ParseManifest("{ \"icons\": [] }"); + blink::Manifest manifest = ParseManifest("{ \"icons\": [] }"); EXPECT_EQ(manifest.icons.size(), 0u); EXPECT_TRUE(manifest.IsEmpty()); EXPECT_EQ(0u, GetErrorCount()); @@ -652,7 +664,7 @@ TEST_F(ManifestParserTest, IconsParseRules) { // Smoke test: if empty icon, empty list. { - Manifest manifest = ParseManifest("{ \"icons\": [ {} ] }"); + blink::Manifest manifest = ParseManifest("{ \"icons\": [ {} ] }"); EXPECT_EQ(manifest.icons.size(), 0u); EXPECT_TRUE(manifest.IsEmpty()); EXPECT_EQ(0u, GetErrorCount()); @@ -660,7 +672,8 @@ TEST_F(ManifestParserTest, IconsParseRules) { // Smoke test: icon with invalid src, empty list. { - Manifest manifest = ParseManifest("{ \"icons\": [ { \"icons\": [] } ] }"); + blink::Manifest manifest = + ParseManifest("{ \"icons\": [ { \"icons\": [] } ] }"); EXPECT_EQ(manifest.icons.size(), 0u); EXPECT_TRUE(manifest.IsEmpty()); EXPECT_EQ(0u, GetErrorCount()); @@ -668,7 +681,8 @@ TEST_F(ManifestParserTest, IconsParseRules) { // Smoke test: if icon with empty src, it will be present in the list. { - Manifest manifest = ParseManifest("{ \"icons\": [ { \"src\": \"\" } ] }"); + blink::Manifest manifest = + ParseManifest("{ \"icons\": [ { \"src\": \"\" } ] }"); EXPECT_EQ(manifest.icons.size(), 1u); EXPECT_EQ(manifest.icons[0].src.spec(), "http://foo.com/manifest.json"); EXPECT_FALSE(manifest.IsEmpty()); @@ -677,7 +691,7 @@ TEST_F(ManifestParserTest, IconsParseRules) { // Smoke test: if one icons with valid src, it will be present in the list. { - Manifest manifest = + blink::Manifest manifest = ParseManifest("{ \"icons\": [{ \"src\": \"foo.jpg\" }] }"); EXPECT_EQ(manifest.icons.size(), 1u); EXPECT_EQ(manifest.icons[0].src.spec(), "http://foo.com/foo.jpg"); @@ -689,7 +703,7 @@ TEST_F(ManifestParserTest, IconsParseRules) { TEST_F(ManifestParserTest, IconSrcParseRules) { // Smoke test. { - Manifest manifest = + blink::Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"foo.png\" } ] }"); EXPECT_EQ(manifest.icons[0].src.spec(), default_document_url.Resolve("foo.png").spec()); @@ -698,7 +712,7 @@ TEST_F(ManifestParserTest, IconSrcParseRules) { // Whitespaces. { - Manifest manifest = + blink::Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \" foo.png \" } ] }"); EXPECT_EQ(manifest.icons[0].src.spec(), default_document_url.Resolve("foo.png").spec()); @@ -707,7 +721,8 @@ TEST_F(ManifestParserTest, IconSrcParseRules) { // Don't parse if property isn't a string. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": {} } ] }"); + blink::Manifest manifest = + ParseManifest("{ \"icons\": [ {\"src\": {} } ] }"); EXPECT_TRUE(manifest.icons.empty()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'src' ignored, type string expected.", @@ -716,7 +731,8 @@ TEST_F(ManifestParserTest, IconSrcParseRules) { // Don't parse if property isn't a string. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": 42 } ] }"); + blink::Manifest manifest = + ParseManifest("{ \"icons\": [ {\"src\": 42 } ] }"); EXPECT_TRUE(manifest.icons.empty()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'src' ignored, type string expected.", @@ -725,10 +741,9 @@ TEST_F(ManifestParserTest, IconSrcParseRules) { // Resolving has to happen based on the document_url. { - Manifest manifest = ParseManifestWithURLs( + blink::Manifest manifest = ParseManifestWithURLs( "{ \"icons\": [ {\"src\": \"icons/foo.png\" } ] }", - GURL("http://foo.com/landing/index.html"), - default_manifest_url); + GURL("http://foo.com/landing/index.html"), default_manifest_url); EXPECT_EQ(manifest.icons[0].src.spec(), "http://foo.com/landing/icons/foo.png"); EXPECT_EQ(0u, GetErrorCount()); @@ -738,7 +753,7 @@ TEST_F(ManifestParserTest, IconSrcParseRules) { TEST_F(ManifestParserTest, IconTypeParseRules) { // Smoke test. { - Manifest manifest = + blink::Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\", \"type\": \"foo\" } ] }"); EXPECT_TRUE(base::EqualsASCII(manifest.icons[0].type, "foo")); EXPECT_EQ(0u, GetErrorCount()); @@ -746,15 +761,16 @@ TEST_F(ManifestParserTest, IconTypeParseRules) { // Trim whitespaces. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," - " \"type\": \" foo \" } ] }"); + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," + " \"type\": \" foo \" } ] }"); EXPECT_TRUE(base::EqualsASCII(manifest.icons[0].type, "foo")); EXPECT_EQ(0u, GetErrorCount()); } // Don't parse if property isn't a string. { - Manifest manifest = + blink::Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\", \"type\": {} } ] }"); EXPECT_TRUE(manifest.icons[0].type.empty()); EXPECT_EQ(1u, GetErrorCount()); @@ -764,7 +780,7 @@ TEST_F(ManifestParserTest, IconTypeParseRules) { // Don't parse if property isn't a string. { - Manifest manifest = + blink::Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\", \"type\": 42 } ] }"); EXPECT_TRUE(manifest.icons[0].type.empty()); EXPECT_EQ(1u, GetErrorCount()); @@ -776,7 +792,8 @@ TEST_F(ManifestParserTest, IconTypeParseRules) { TEST_F(ManifestParserTest, IconSizesParseRules) { // Smoke test. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"sizes\": \"42x42\" } ] }"); EXPECT_EQ(manifest.icons[0].sizes.size(), 1u); EXPECT_EQ(0u, GetErrorCount()); @@ -784,7 +801,8 @@ TEST_F(ManifestParserTest, IconSizesParseRules) { // Trim whitespaces. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"sizes\": \" 42x42 \" } ] }"); EXPECT_EQ(manifest.icons[0].sizes.size(), 1u); EXPECT_EQ(0u, GetErrorCount()); @@ -792,7 +810,8 @@ TEST_F(ManifestParserTest, IconSizesParseRules) { // Ignore sizes if property isn't a string. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"sizes\": {} } ] }"); EXPECT_EQ(manifest.icons[0].sizes.size(), 0u); EXPECT_EQ(1u, GetErrorCount()); @@ -802,7 +821,8 @@ TEST_F(ManifestParserTest, IconSizesParseRules) { // Ignore sizes if property isn't a string. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"sizes\": 42 } ] }"); EXPECT_EQ(manifest.icons[0].sizes.size(), 0u); EXPECT_EQ(1u, GetErrorCount()); @@ -812,7 +832,8 @@ TEST_F(ManifestParserTest, IconSizesParseRules) { // Smoke test: value correctly parsed. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"sizes\": \"42x42 48x48\" } ] }"); EXPECT_EQ(manifest.icons[0].sizes[0], gfx::Size(42, 42)); EXPECT_EQ(manifest.icons[0].sizes[1], gfx::Size(48, 48)); @@ -821,7 +842,8 @@ TEST_F(ManifestParserTest, IconSizesParseRules) { // 'x' and 'X' are equivalent. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"sizes\": \"42X42 48X48\" } ] }"); EXPECT_EQ(manifest.icons[0].sizes[0], gfx::Size(42, 42)); EXPECT_EQ(manifest.icons[0].sizes[1], gfx::Size(48, 48)); @@ -830,7 +852,8 @@ TEST_F(ManifestParserTest, IconSizesParseRules) { // Twice the same value is parsed twice. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"sizes\": \"42X42 42x42\" } ] }"); EXPECT_EQ(manifest.icons[0].sizes[0], gfx::Size(42, 42)); EXPECT_EQ(manifest.icons[0].sizes[1], gfx::Size(42, 42)); @@ -839,7 +862,8 @@ TEST_F(ManifestParserTest, IconSizesParseRules) { // Width or height can't start with 0. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"sizes\": \"004X007 042x00\" } ] }"); EXPECT_EQ(manifest.icons[0].sizes.size(), 0u); EXPECT_EQ(1u, GetErrorCount()); @@ -849,7 +873,8 @@ TEST_F(ManifestParserTest, IconSizesParseRules) { // Width and height MUST contain digits. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"sizes\": \"e4X1.0 55ax1e10\" } ] }"); EXPECT_EQ(manifest.icons[0].sizes.size(), 0u); EXPECT_EQ(1u, GetErrorCount()); @@ -859,7 +884,8 @@ TEST_F(ManifestParserTest, IconSizesParseRules) { // 'any' is correctly parsed and transformed to gfx::Size(0,0). { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"sizes\": \"any AnY ANY aNy\" } ] }"); gfx::Size any = gfx::Size(0, 0); EXPECT_EQ(manifest.icons[0].sizes.size(), 4u); @@ -872,7 +898,8 @@ TEST_F(ManifestParserTest, IconSizesParseRules) { // Some invalid width/height combinations. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"sizes\": \"x 40xx 1x2x3 x42 42xx42\" } ] }"); EXPECT_EQ(manifest.icons[0].sizes.size(), 0u); EXPECT_EQ(1u, GetErrorCount()); @@ -890,7 +917,8 @@ TEST_F(ManifestParserTest, IconPurposeParseRules) { // Smoke test. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"purpose\": \"any\" } ] }"); EXPECT_EQ(manifest.icons[0].purpose.size(), 1u); EXPECT_EQ(0u, GetErrorCount()); @@ -898,7 +926,8 @@ TEST_F(ManifestParserTest, IconPurposeParseRules) { // Trim leading and trailing whitespaces. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"purpose\": \" any \" } ] }"); EXPECT_EQ(manifest.icons[0].purpose.size(), 1u); EXPECT_EQ(0u, GetErrorCount()); @@ -906,19 +935,23 @@ TEST_F(ManifestParserTest, IconPurposeParseRules) { // 'any' is added when property isn't present. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\" } ] }"); + blink::Manifest manifest = + ParseManifest("{ \"icons\": [ {\"src\": \"\" } ] }"); EXPECT_EQ(manifest.icons[0].purpose.size(), 1u); - EXPECT_EQ(manifest.icons[0].purpose[0], Manifest::Icon::IconPurpose::ANY); + EXPECT_EQ(manifest.icons[0].purpose[0], + blink::Manifest::Icon::IconPurpose::ANY); EXPECT_EQ(0u, GetErrorCount()); } // 'any' is added with error message when property isn't a string (is a // number). { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"purpose\": 42 } ] }"); EXPECT_EQ(manifest.icons[0].purpose.size(), 1u); - EXPECT_EQ(manifest.icons[0].purpose[0], Manifest::Icon::IconPurpose::ANY); + EXPECT_EQ(manifest.icons[0].purpose[0], + blink::Manifest::Icon::IconPurpose::ANY); ASSERT_EQ(1u, GetErrorCount()); EXPECT_EQ(kPurposeParseStringError, errors()[0]); } @@ -926,60 +959,75 @@ TEST_F(ManifestParserTest, IconPurposeParseRules) { // 'any' is added with error message when property isn't a string (is a // dictionary). { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"purpose\": {} } ] }"); EXPECT_EQ(manifest.icons[0].purpose.size(), 1u); - EXPECT_EQ(manifest.icons[0].purpose[0], Manifest::Icon::IconPurpose::ANY); + EXPECT_EQ(manifest.icons[0].purpose[0], + blink::Manifest::Icon::IconPurpose::ANY); ASSERT_EQ(1u, GetErrorCount()); EXPECT_EQ(kPurposeParseStringError, errors()[0]); } // Smoke test: values correctly parsed. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"purpose\": \"Any Badge\" } ] }"); ASSERT_EQ(manifest.icons[0].purpose.size(), 2u); - EXPECT_EQ(manifest.icons[0].purpose[0], Manifest::Icon::IconPurpose::ANY); - EXPECT_EQ(manifest.icons[0].purpose[1], Manifest::Icon::IconPurpose::BADGE); + EXPECT_EQ(manifest.icons[0].purpose[0], + blink::Manifest::Icon::IconPurpose::ANY); + EXPECT_EQ(manifest.icons[0].purpose[1], + blink::Manifest::Icon::IconPurpose::BADGE); EXPECT_EQ(0u, GetErrorCount()); } // Trim whitespaces between values. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"purpose\": \" Any Badge \" } ] }"); ASSERT_EQ(manifest.icons[0].purpose.size(), 2u); - EXPECT_EQ(manifest.icons[0].purpose[0], Manifest::Icon::IconPurpose::ANY); - EXPECT_EQ(manifest.icons[0].purpose[1], Manifest::Icon::IconPurpose::BADGE); + EXPECT_EQ(manifest.icons[0].purpose[0], + blink::Manifest::Icon::IconPurpose::ANY); + EXPECT_EQ(manifest.icons[0].purpose[1], + blink::Manifest::Icon::IconPurpose::BADGE); EXPECT_EQ(0u, GetErrorCount()); } // Twice the same value is parsed twice. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"purpose\": \"badge badge\" } ] }"); ASSERT_EQ(manifest.icons[0].purpose.size(), 2u); - EXPECT_EQ(manifest.icons[0].purpose[0], Manifest::Icon::IconPurpose::BADGE); - EXPECT_EQ(manifest.icons[0].purpose[1], Manifest::Icon::IconPurpose::BADGE); + EXPECT_EQ(manifest.icons[0].purpose[0], + blink::Manifest::Icon::IconPurpose::BADGE); + EXPECT_EQ(manifest.icons[0].purpose[1], + blink::Manifest::Icon::IconPurpose::BADGE); EXPECT_EQ(0u, GetErrorCount()); } // Invalid icon purpose is ignored. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"purpose\": \"badge notification\" } ] }"); ASSERT_EQ(manifest.icons[0].purpose.size(), 1u); - EXPECT_EQ(manifest.icons[0].purpose[0], Manifest::Icon::IconPurpose::BADGE); + EXPECT_EQ(manifest.icons[0].purpose[0], + blink::Manifest::Icon::IconPurpose::BADGE); ASSERT_EQ(1u, GetErrorCount()); EXPECT_EQ(kPurposeInvalidValueError, errors()[0]); } // 'any' is added when developer-supplied purpose is invalid. { - Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," + blink::Manifest manifest = ParseManifest( + "{ \"icons\": [ {\"src\": \"\"," "\"purpose\": \"notification\" } ] }"); ASSERT_EQ(manifest.icons[0].purpose.size(), 1u); - EXPECT_EQ(manifest.icons[0].purpose[0], Manifest::Icon::IconPurpose::ANY); + EXPECT_EQ(manifest.icons[0].purpose[0], + blink::Manifest::Icon::IconPurpose::ANY); ASSERT_EQ(1u, GetErrorCount()); EXPECT_EQ(kPurposeInvalidValueError, errors()[0]); } @@ -988,7 +1036,7 @@ TEST_F(ManifestParserTest, IconPurposeParseRules) { TEST_F(ManifestParserTest, ShareTargetParseRules) { // Contains share_target field but no keys. { - Manifest manifest = ParseManifest("{ \"share_target\": {} }"); + blink::Manifest manifest = ParseManifest("{ \"share_target\": {} }"); EXPECT_FALSE(manifest.share_target.has_value()); EXPECT_TRUE(manifest.IsEmpty()); EXPECT_EQ(0u, GetErrorCount()); @@ -996,7 +1044,7 @@ TEST_F(ManifestParserTest, ShareTargetParseRules) { // Key in share_target that isn't valid. { - Manifest manifest = ParseManifest( + blink::Manifest manifest = ParseManifest( "{ \"share_target\": {\"incorrect_key\": \"some_value\" } }"); ASSERT_FALSE(manifest.share_target.has_value()); EXPECT_TRUE(manifest.IsEmpty()); @@ -1010,7 +1058,7 @@ TEST_F(ManifestParserTest, ShareTargetUrlTemplateParseRules) { // Contains share_target and url_template, but url_template is empty. { - Manifest manifest = ParseManifestWithURLs( + blink::Manifest manifest = ParseManifestWithURLs( "{ \"share_target\": { \"url_template\": \"\" } }", manifest_url, document_url); ASSERT_TRUE(manifest.share_target.has_value()); @@ -1022,7 +1070,7 @@ TEST_F(ManifestParserTest, ShareTargetUrlTemplateParseRules) { // Don't parse if property isn't a string. { - Manifest manifest = + blink::Manifest manifest = ParseManifestWithURLs("{ \"share_target\": { \"url_template\": {} } }", manifest_url, document_url); EXPECT_FALSE(manifest.share_target.has_value()); @@ -1034,7 +1082,7 @@ TEST_F(ManifestParserTest, ShareTargetUrlTemplateParseRules) { // Don't parse if property isn't a string. { - Manifest manifest = + blink::Manifest manifest = ParseManifestWithURLs("{ \"share_target\": { \"url_template\": 42 } }", manifest_url, document_url); EXPECT_FALSE(manifest.share_target.has_value()); @@ -1046,7 +1094,7 @@ TEST_F(ManifestParserTest, ShareTargetUrlTemplateParseRules) { // Don't parse if property isn't a valid URL. { - Manifest manifest = ParseManifestWithURLs( + blink::Manifest manifest = ParseManifestWithURLs( "{ \"share_target\": { \"url_template\": \"https://foo.com:a\" } " "}", manifest_url, document_url); @@ -1059,7 +1107,7 @@ TEST_F(ManifestParserTest, ShareTargetUrlTemplateParseRules) { // Fail parsing if url_template is at a different origin than the Web // Manifest. { - Manifest manifest = ParseManifestWithURLs( + blink::Manifest manifest = ParseManifestWithURLs( "{ \"share_target\": { \"url_template\": \"https://foo2.com/\" } }", manifest_url, document_url); EXPECT_FALSE(manifest.share_target.has_value()); @@ -1073,7 +1121,7 @@ TEST_F(ManifestParserTest, ShareTargetUrlTemplateParseRules) { // Smoke test: Contains share_target and url_template, and url_template is // valid template. { - Manifest manifest = ParseManifestWithURLs( + blink::Manifest manifest = ParseManifestWithURLs( "{ \"share_target\": {\"url_template\": \"share/?title={title}\" } }", manifest_url, document_url); ASSERT_TRUE(manifest.share_target.has_value()); @@ -1086,7 +1134,7 @@ TEST_F(ManifestParserTest, ShareTargetUrlTemplateParseRules) { // Smoke test: Contains share_target and url_template, and url_template is // invalid template. { - Manifest manifest = ParseManifestWithURLs( + blink::Manifest manifest = ParseManifestWithURLs( "{ \"share_target\": {\"url_template\": \"share/?title={title\" } }", manifest_url, document_url); ASSERT_FALSE(manifest.share_target.has_value()); @@ -1101,7 +1149,7 @@ TEST_F(ManifestParserTest, ShareTargetUrlTemplateParseRules) { // Smoke test: Contains share_target and url_template, and url_template // contains unknown placeholder. { - Manifest manifest = ParseManifestWithURLs( + blink::Manifest manifest = ParseManifestWithURLs( "{ \"share_target\": {\"url_template\": \"share/?title={abcxyz}\" } }", manifest_url, document_url); ASSERT_TRUE(manifest.share_target.has_value()); @@ -1115,7 +1163,7 @@ TEST_F(ManifestParserTest, ShareTargetUrlTemplateParseRules) { // '{' and '}' in path, query and fragment. Only '{' and '}' in path should be // escaped. { - Manifest manifest = ParseManifestWithURLs( + blink::Manifest manifest = ParseManifestWithURLs( "{ \"share_target\": {\"url_template\": " "\"share/a{text}/?title={title}#{frag}\" } }", manifest_url, document_url); @@ -1129,7 +1177,7 @@ TEST_F(ManifestParserTest, ShareTargetUrlTemplateParseRules) { // Smoke test: Contains share_target and url_template. url_template is // valid template and is absolute. { - Manifest manifest = ParseManifestWithURLs( + blink::Manifest manifest = ParseManifestWithURLs( "{ \"share_target\": { \"url_template\": \"https://foo.com/#{text}\" } " "}", manifest_url, document_url); @@ -1144,8 +1192,7 @@ TEST_F(ManifestParserTest, ShareTargetUrlTemplateParseRules) { TEST_F(ManifestParserTest, RelatedApplicationsParseRules) { // If no application, empty list. { - Manifest manifest = ParseManifest( - "{ \"related_applications\": []}"); + blink::Manifest manifest = ParseManifest("{ \"related_applications\": []}"); EXPECT_EQ(manifest.related_applications.size(), 0u); EXPECT_TRUE(manifest.IsEmpty()); EXPECT_EQ(0u, GetErrorCount()); @@ -1153,8 +1200,8 @@ TEST_F(ManifestParserTest, RelatedApplicationsParseRules) { // If empty application, empty list. { - Manifest manifest = ParseManifest( - "{ \"related_applications\": [{}]}"); + blink::Manifest manifest = + ParseManifest("{ \"related_applications\": [{}]}"); EXPECT_EQ(manifest.related_applications.size(), 0u); EXPECT_TRUE(manifest.IsEmpty()); EXPECT_EQ(1u, GetErrorCount()); @@ -1164,8 +1211,8 @@ TEST_F(ManifestParserTest, RelatedApplicationsParseRules) { // If invalid platform, application is ignored. { - Manifest manifest = ParseManifest( - "{ \"related_applications\": [{\"platform\": 123}]}"); + blink::Manifest manifest = + ParseManifest("{ \"related_applications\": [{\"platform\": 123}]}"); EXPECT_EQ(manifest.related_applications.size(), 0u); EXPECT_TRUE(manifest.IsEmpty()); EXPECT_EQ(2u, GetErrorCount()); @@ -1179,8 +1226,8 @@ TEST_F(ManifestParserTest, RelatedApplicationsParseRules) { // If missing platform, application is ignored. { - Manifest manifest = ParseManifest( - "{ \"related_applications\": [{\"id\": \"foo\"}]}"); + blink::Manifest manifest = + ParseManifest("{ \"related_applications\": [{\"id\": \"foo\"}]}"); EXPECT_EQ(manifest.related_applications.size(), 0u); EXPECT_TRUE(manifest.IsEmpty()); EXPECT_EQ(1u, GetErrorCount()); @@ -1190,7 +1237,7 @@ TEST_F(ManifestParserTest, RelatedApplicationsParseRules) { // If missing id and url, application is ignored. { - Manifest manifest = ParseManifest( + blink::Manifest manifest = ParseManifest( "{ \"related_applications\": [{\"platform\": \"play\"}]}"); EXPECT_EQ(manifest.related_applications.size(), 0u); EXPECT_TRUE(manifest.IsEmpty()); @@ -1201,7 +1248,7 @@ TEST_F(ManifestParserTest, RelatedApplicationsParseRules) { // Valid application, with url. { - Manifest manifest = ParseManifest( + blink::Manifest manifest = ParseManifest( "{ \"related_applications\": [" "{\"platform\": \"play\", \"url\": \"http://www.foo.com\"}]}"); EXPECT_EQ(manifest.related_applications.size(), 1u); @@ -1216,7 +1263,7 @@ TEST_F(ManifestParserTest, RelatedApplicationsParseRules) { // Application with an invalid url. { - Manifest manifest = ParseManifest( + blink::Manifest manifest = ParseManifest( "{ \"related_applications\": [" "{\"platform\": \"play\", \"url\": \"http://www.foo.com:co&uk\"}]}"); EXPECT_TRUE(manifest.IsEmpty()); @@ -1228,7 +1275,7 @@ TEST_F(ManifestParserTest, RelatedApplicationsParseRules) { // Valid application, with id. { - Manifest manifest = ParseManifest( + blink::Manifest manifest = ParseManifest( "{ \"related_applications\": [" "{\"platform\": \"itunes\", \"id\": \"foo\"}]}"); EXPECT_EQ(manifest.related_applications.size(), 1u); @@ -1243,7 +1290,7 @@ TEST_F(ManifestParserTest, RelatedApplicationsParseRules) { // All valid applications are in list. { - Manifest manifest = ParseManifest( + blink::Manifest manifest = ParseManifest( "{ \"related_applications\": [" "{\"platform\": \"play\", \"id\": \"foo\"}," "{\"platform\": \"itunes\", \"id\": \"bar\"}]}"); @@ -1265,7 +1312,7 @@ TEST_F(ManifestParserTest, RelatedApplicationsParseRules) { // Two invalid applications and one valid. Only the valid application should // be in the list. { - Manifest manifest = ParseManifest( + blink::Manifest manifest = ParseManifest( "{ \"related_applications\": [" "{\"platform\": \"itunes\"}," "{\"platform\": \"play\", \"id\": \"foo\"}," @@ -1288,7 +1335,7 @@ TEST_F(ManifestParserTest, RelatedApplicationsParseRules) { TEST_F(ManifestParserTest, ParsePreferRelatedApplicationsParseRules) { // Smoke test. { - Manifest manifest = + blink::Manifest manifest = ParseManifest("{ \"prefer_related_applications\": true }"); EXPECT_TRUE(manifest.prefer_related_applications); EXPECT_EQ(0u, GetErrorCount()); @@ -1296,7 +1343,7 @@ TEST_F(ManifestParserTest, ParsePreferRelatedApplicationsParseRules) { // Don't parse if the property isn't a boolean. { - Manifest manifest = + blink::Manifest manifest = ParseManifest("{ \"prefer_related_applications\": {} }"); EXPECT_FALSE(manifest.prefer_related_applications); EXPECT_EQ(1u, GetErrorCount()); @@ -1306,8 +1353,8 @@ TEST_F(ManifestParserTest, ParsePreferRelatedApplicationsParseRules) { errors()[0]); } { - Manifest manifest = ParseManifest( - "{ \"prefer_related_applications\": \"true\" }"); + blink::Manifest manifest = + ParseManifest("{ \"prefer_related_applications\": \"true\" }"); EXPECT_FALSE(manifest.prefer_related_applications); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ( @@ -1316,7 +1363,8 @@ TEST_F(ManifestParserTest, ParsePreferRelatedApplicationsParseRules) { errors()[0]); } { - Manifest manifest = ParseManifest("{ \"prefer_related_applications\": 1 }"); + blink::Manifest manifest = + ParseManifest("{ \"prefer_related_applications\": 1 }"); EXPECT_FALSE(manifest.prefer_related_applications); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ( @@ -1327,7 +1375,7 @@ TEST_F(ManifestParserTest, ParsePreferRelatedApplicationsParseRules) { // "False" should set the boolean false without throwing errors. { - Manifest manifest = + blink::Manifest manifest = ParseManifest("{ \"prefer_related_applications\": false }"); EXPECT_FALSE(manifest.prefer_related_applications); EXPECT_EQ(0u, GetErrorCount()); @@ -1337,7 +1385,8 @@ TEST_F(ManifestParserTest, ParsePreferRelatedApplicationsParseRules) { TEST_F(ManifestParserTest, ThemeColorParserRules) { // Smoke test. { - Manifest manifest = ParseManifest("{ \"theme_color\": \"#FF0000\" }"); + blink::Manifest manifest = + ParseManifest("{ \"theme_color\": \"#FF0000\" }"); EXPECT_EQ(ExtractColor(manifest.theme_color), 0xFFFF0000u); EXPECT_FALSE(manifest.IsEmpty()); EXPECT_EQ(0u, GetErrorCount()); @@ -1345,15 +1394,16 @@ TEST_F(ManifestParserTest, ThemeColorParserRules) { // Trim whitespaces. { - Manifest manifest = ParseManifest("{ \"theme_color\": \" blue \" }"); + blink::Manifest manifest = + ParseManifest("{ \"theme_color\": \" blue \" }"); EXPECT_EQ(ExtractColor(manifest.theme_color), 0xFF0000FFu); EXPECT_EQ(0u, GetErrorCount()); } // Don't parse if theme_color isn't a string. { - Manifest manifest = ParseManifest("{ \"theme_color\": {} }"); - EXPECT_EQ(manifest.theme_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = ParseManifest("{ \"theme_color\": {} }"); + EXPECT_EQ(manifest.theme_color, blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'theme_color' ignored, type string expected.", errors()[0]); @@ -1361,8 +1411,8 @@ TEST_F(ManifestParserTest, ThemeColorParserRules) { // Don't parse if theme_color isn't a string. { - Manifest manifest = ParseManifest("{ \"theme_color\": false }"); - EXPECT_EQ(manifest.theme_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = ParseManifest("{ \"theme_color\": false }"); + EXPECT_EQ(manifest.theme_color, blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'theme_color' ignored, type string expected.", errors()[0]); @@ -1370,8 +1420,8 @@ TEST_F(ManifestParserTest, ThemeColorParserRules) { // Don't parse if theme_color isn't a string. { - Manifest manifest = ParseManifest("{ \"theme_color\": null }"); - EXPECT_EQ(manifest.theme_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = ParseManifest("{ \"theme_color\": null }"); + EXPECT_EQ(manifest.theme_color, blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'theme_color' ignored, type string expected.", errors()[0]); @@ -1379,8 +1429,8 @@ TEST_F(ManifestParserTest, ThemeColorParserRules) { // Don't parse if theme_color isn't a string. { - Manifest manifest = ParseManifest("{ \"theme_color\": [] }"); - EXPECT_EQ(manifest.theme_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = ParseManifest("{ \"theme_color\": [] }"); + EXPECT_EQ(manifest.theme_color, blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'theme_color' ignored, type string expected.", errors()[0]); @@ -1388,8 +1438,8 @@ TEST_F(ManifestParserTest, ThemeColorParserRules) { // Don't parse if theme_color isn't a string. { - Manifest manifest = ParseManifest("{ \"theme_color\": 42 }"); - EXPECT_EQ(manifest.theme_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = ParseManifest("{ \"theme_color\": 42 }"); + EXPECT_EQ(manifest.theme_color, blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'theme_color' ignored, type string expected.", errors()[0]); @@ -1397,8 +1447,9 @@ TEST_F(ManifestParserTest, ThemeColorParserRules) { // Parse fails if string is not in a known format. { - Manifest manifest = ParseManifest("{ \"theme_color\": \"foo(bar)\" }"); - EXPECT_EQ(manifest.theme_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = + ParseManifest("{ \"theme_color\": \"foo(bar)\" }"); + EXPECT_EQ(manifest.theme_color, blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'theme_color' ignored," " 'foo(bar)' is not a valid color.", @@ -1407,8 +1458,8 @@ TEST_F(ManifestParserTest, ThemeColorParserRules) { // Parse fails if string is not in a known format. { - Manifest manifest = ParseManifest("{ \"theme_color\": \"bleu\" }"); - EXPECT_EQ(manifest.theme_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = ParseManifest("{ \"theme_color\": \"bleu\" }"); + EXPECT_EQ(manifest.theme_color, blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'theme_color' ignored, 'bleu' is not a valid color.", errors()[0]); @@ -1416,8 +1467,8 @@ TEST_F(ManifestParserTest, ThemeColorParserRules) { // Parse fails if string is not in a known format. { - Manifest manifest = ParseManifest("{ \"theme_color\": \"FF00FF\" }"); - EXPECT_EQ(manifest.theme_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = ParseManifest("{ \"theme_color\": \"FF00FF\" }"); + EXPECT_EQ(manifest.theme_color, blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'theme_color' ignored, 'FF00FF'" " is not a valid color.", @@ -1426,8 +1477,9 @@ TEST_F(ManifestParserTest, ThemeColorParserRules) { // Parse fails if multiple values for theme_color are given. { - Manifest manifest = ParseManifest("{ \"theme_color\": \"#ABC #DEF\" }"); - EXPECT_EQ(manifest.theme_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = + ParseManifest("{ \"theme_color\": \"#ABC #DEF\" }"); + EXPECT_EQ(manifest.theme_color, blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'theme_color' ignored, " "'#ABC #DEF' is not a valid color.", @@ -1436,9 +1488,9 @@ TEST_F(ManifestParserTest, ThemeColorParserRules) { // Parse fails if multiple values for theme_color are given. { - Manifest manifest = ParseManifest( - "{ \"theme_color\": \"#AABBCC #DDEEFF\" }"); - EXPECT_EQ(manifest.theme_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = + ParseManifest("{ \"theme_color\": \"#AABBCC #DDEEFF\" }"); + EXPECT_EQ(manifest.theme_color, blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'theme_color' ignored, " "'#AABBCC #DDEEFF' is not a valid color.", @@ -1447,42 +1499,45 @@ TEST_F(ManifestParserTest, ThemeColorParserRules) { // Accept CSS color keyword format. { - Manifest manifest = ParseManifest("{ \"theme_color\": \"blue\" }"); + blink::Manifest manifest = ParseManifest("{ \"theme_color\": \"blue\" }"); EXPECT_EQ(ExtractColor(manifest.theme_color), 0xFF0000FFu); EXPECT_EQ(0u, GetErrorCount()); } // Accept CSS color keyword format. { - Manifest manifest = ParseManifest("{ \"theme_color\": \"chartreuse\" }"); + blink::Manifest manifest = + ParseManifest("{ \"theme_color\": \"chartreuse\" }"); EXPECT_EQ(ExtractColor(manifest.theme_color), 0xFF7FFF00u); EXPECT_EQ(0u, GetErrorCount()); } // Accept CSS RGB format. { - Manifest manifest = ParseManifest("{ \"theme_color\": \"#FFF\" }"); + blink::Manifest manifest = ParseManifest("{ \"theme_color\": \"#FFF\" }"); EXPECT_EQ(ExtractColor(manifest.theme_color), 0xFFFFFFFFu); EXPECT_EQ(0u, GetErrorCount()); } // Accept CSS RGB format. { - Manifest manifest = ParseManifest("{ \"theme_color\": \"#ABC\" }"); + blink::Manifest manifest = ParseManifest("{ \"theme_color\": \"#ABC\" }"); EXPECT_EQ(ExtractColor(manifest.theme_color), 0xFFAABBCCu); EXPECT_EQ(0u, GetErrorCount()); } // Accept CSS RRGGBB format. { - Manifest manifest = ParseManifest("{ \"theme_color\": \"#FF0000\" }"); + blink::Manifest manifest = + ParseManifest("{ \"theme_color\": \"#FF0000\" }"); EXPECT_EQ(ExtractColor(manifest.theme_color), 0xFFFF0000u); EXPECT_EQ(0u, GetErrorCount()); } // Accept translucent colors. { - Manifest manifest = ParseManifest("{ \"theme_color\": \"rgba(255,0,0," + blink::Manifest manifest = ParseManifest( + "{ \"theme_color\": \"rgba(255,0,0," "0.4)\" }"); EXPECT_EQ(ExtractColor(manifest.theme_color), 0x66FF0000u); EXPECT_EQ(0u, GetErrorCount()); @@ -1490,7 +1545,8 @@ TEST_F(ManifestParserTest, ThemeColorParserRules) { // Accept transparent colors. { - Manifest manifest = ParseManifest("{ \"theme_color\": \"rgba(0,0,0,0)\" }"); + blink::Manifest manifest = + ParseManifest("{ \"theme_color\": \"rgba(0,0,0,0)\" }"); EXPECT_EQ(ExtractColor(manifest.theme_color), 0x00000000u); EXPECT_EQ(0u, GetErrorCount()); } @@ -1499,7 +1555,8 @@ TEST_F(ManifestParserTest, ThemeColorParserRules) { TEST_F(ManifestParserTest, BackgroundColorParserRules) { // Smoke test. { - Manifest manifest = ParseManifest("{ \"background_color\": \"#FF0000\" }"); + blink::Manifest manifest = + ParseManifest("{ \"background_color\": \"#FF0000\" }"); EXPECT_EQ(ExtractColor(manifest.background_color), 0xFFFF0000u); EXPECT_FALSE(manifest.IsEmpty()); EXPECT_EQ(0u, GetErrorCount()); @@ -1507,16 +1564,17 @@ TEST_F(ManifestParserTest, BackgroundColorParserRules) { // Trim whitespaces. { - Manifest manifest = ParseManifest( - "{ \"background_color\": \" blue \" }"); + blink::Manifest manifest = + ParseManifest("{ \"background_color\": \" blue \" }"); EXPECT_EQ(ExtractColor(manifest.background_color), 0xFF0000FFu); EXPECT_EQ(0u, GetErrorCount()); } // Don't parse if background_color isn't a string. { - Manifest manifest = ParseManifest("{ \"background_color\": {} }"); - EXPECT_EQ(manifest.background_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = ParseManifest("{ \"background_color\": {} }"); + EXPECT_EQ(manifest.background_color, + blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'background_color' ignored, type string expected.", errors()[0]); @@ -1524,8 +1582,9 @@ TEST_F(ManifestParserTest, BackgroundColorParserRules) { // Don't parse if background_color isn't a string. { - Manifest manifest = ParseManifest("{ \"background_color\": false }"); - EXPECT_EQ(manifest.background_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = ParseManifest("{ \"background_color\": false }"); + EXPECT_EQ(manifest.background_color, + blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'background_color' ignored, type string expected.", errors()[0]); @@ -1533,8 +1592,9 @@ TEST_F(ManifestParserTest, BackgroundColorParserRules) { // Don't parse if background_color isn't a string. { - Manifest manifest = ParseManifest("{ \"background_color\": null }"); - EXPECT_EQ(manifest.background_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = ParseManifest("{ \"background_color\": null }"); + EXPECT_EQ(manifest.background_color, + blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'background_color' ignored, type string expected.", errors()[0]); @@ -1542,8 +1602,9 @@ TEST_F(ManifestParserTest, BackgroundColorParserRules) { // Don't parse if background_color isn't a string. { - Manifest manifest = ParseManifest("{ \"background_color\": [] }"); - EXPECT_EQ(manifest.background_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = ParseManifest("{ \"background_color\": [] }"); + EXPECT_EQ(manifest.background_color, + blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'background_color' ignored, type string expected.", errors()[0]); @@ -1551,8 +1612,9 @@ TEST_F(ManifestParserTest, BackgroundColorParserRules) { // Don't parse if background_color isn't a string. { - Manifest manifest = ParseManifest("{ \"background_color\": 42 }"); - EXPECT_EQ(manifest.background_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = ParseManifest("{ \"background_color\": 42 }"); + EXPECT_EQ(manifest.background_color, + blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'background_color' ignored, type string expected.", errors()[0]); @@ -1560,8 +1622,10 @@ TEST_F(ManifestParserTest, BackgroundColorParserRules) { // Parse fails if string is not in a known format. { - Manifest manifest = ParseManifest("{ \"background_color\": \"foo(bar)\" }"); - EXPECT_EQ(manifest.background_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = + ParseManifest("{ \"background_color\": \"foo(bar)\" }"); + EXPECT_EQ(manifest.background_color, + blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'background_color' ignored," " 'foo(bar)' is not a valid color.", @@ -1570,8 +1634,10 @@ TEST_F(ManifestParserTest, BackgroundColorParserRules) { // Parse fails if string is not in a known format. { - Manifest manifest = ParseManifest("{ \"background_color\": \"bleu\" }"); - EXPECT_EQ(manifest.background_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = + ParseManifest("{ \"background_color\": \"bleu\" }"); + EXPECT_EQ(manifest.background_color, + blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'background_color' ignored," " 'bleu' is not a valid color.", @@ -1580,8 +1646,10 @@ TEST_F(ManifestParserTest, BackgroundColorParserRules) { // Parse fails if string is not in a known format. { - Manifest manifest = ParseManifest("{ \"background_color\": \"FF00FF\" }"); - EXPECT_EQ(manifest.background_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = + ParseManifest("{ \"background_color\": \"FF00FF\" }"); + EXPECT_EQ(manifest.background_color, + blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'background_color' ignored," " 'FF00FF' is not a valid color.", @@ -1590,9 +1658,10 @@ TEST_F(ManifestParserTest, BackgroundColorParserRules) { // Parse fails if multiple values for background_color are given. { - Manifest manifest = ParseManifest( - "{ \"background_color\": \"#ABC #DEF\" }"); - EXPECT_EQ(manifest.background_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = + ParseManifest("{ \"background_color\": \"#ABC #DEF\" }"); + EXPECT_EQ(manifest.background_color, + blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'background_color' ignored, " "'#ABC #DEF' is not a valid color.", @@ -1601,9 +1670,10 @@ TEST_F(ManifestParserTest, BackgroundColorParserRules) { // Parse fails if multiple values for background_color are given. { - Manifest manifest = ParseManifest( - "{ \"background_color\": \"#AABBCC #DDEEFF\" }"); - EXPECT_EQ(manifest.background_color, Manifest::kInvalidOrMissingColor); + blink::Manifest manifest = + ParseManifest("{ \"background_color\": \"#AABBCC #DDEEFF\" }"); + EXPECT_EQ(manifest.background_color, + blink::Manifest::kInvalidOrMissingColor); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'background_color' ignored, " "'#AABBCC #DDEEFF' is not a valid color.", @@ -1612,43 +1682,48 @@ TEST_F(ManifestParserTest, BackgroundColorParserRules) { // Accept CSS color keyword format. { - Manifest manifest = ParseManifest("{ \"background_color\": \"blue\" }"); + blink::Manifest manifest = + ParseManifest("{ \"background_color\": \"blue\" }"); EXPECT_EQ(ExtractColor(manifest.background_color), 0xFF0000FFu); EXPECT_EQ(0u, GetErrorCount()); } // Accept CSS color keyword format. { - Manifest manifest = ParseManifest( - "{ \"background_color\": \"chartreuse\" }"); + blink::Manifest manifest = + ParseManifest("{ \"background_color\": \"chartreuse\" }"); EXPECT_EQ(ExtractColor(manifest.background_color), 0xFF7FFF00u); EXPECT_EQ(0u, GetErrorCount()); } // Accept CSS RGB format. { - Manifest manifest = ParseManifest("{ \"background_color\": \"#FFF\" }"); + blink::Manifest manifest = + ParseManifest("{ \"background_color\": \"#FFF\" }"); EXPECT_EQ(ExtractColor(manifest.background_color), 0xFFFFFFFFu); EXPECT_EQ(0u, GetErrorCount()); } // Accept CSS RGB format. { - Manifest manifest = ParseManifest("{ \"background_color\": \"#ABC\" }"); + blink::Manifest manifest = + ParseManifest("{ \"background_color\": \"#ABC\" }"); EXPECT_EQ(ExtractColor(manifest.background_color), 0xFFAABBCCu); EXPECT_EQ(0u, GetErrorCount()); } // Accept CSS RRGGBB format. { - Manifest manifest = ParseManifest("{ \"background_color\": \"#FF0000\" }"); + blink::Manifest manifest = + ParseManifest("{ \"background_color\": \"#FF0000\" }"); EXPECT_EQ(ExtractColor(manifest.background_color), 0xFFFF0000u); EXPECT_EQ(0u, GetErrorCount()); } // Accept translucent colors. { - Manifest manifest = ParseManifest("{ \"background_color\": \"rgba(255,0,0," + blink::Manifest manifest = ParseManifest( + "{ \"background_color\": \"rgba(255,0,0," "0.4)\" }"); EXPECT_EQ(ExtractColor(manifest.background_color), 0x66FF0000u); EXPECT_EQ(0u, GetErrorCount()); @@ -1656,7 +1731,8 @@ TEST_F(ManifestParserTest, BackgroundColorParserRules) { // Accept transparent colors. { - Manifest manifest = ParseManifest("{ \"background_color\": \"rgba(0,0,0," + blink::Manifest manifest = ParseManifest( + "{ \"background_color\": \"rgba(0,0,0," "0)\" }"); EXPECT_EQ(ExtractColor(manifest.background_color), 0x00000000u); EXPECT_EQ(0u, GetErrorCount()); @@ -1666,7 +1742,7 @@ TEST_F(ManifestParserTest, BackgroundColorParserRules) { TEST_F(ManifestParserTest, SplashScreenUrlParseRules) { // Smoke test. { - Manifest manifest = + blink::Manifest manifest = ParseManifest("{ \"splash_screen_url\": \"splash.html\" }"); ASSERT_EQ(manifest.splash_screen_url.spec(), default_document_url.Resolve("splash.html").spec()); @@ -1676,7 +1752,7 @@ TEST_F(ManifestParserTest, SplashScreenUrlParseRules) { // Whitespaces. { - Manifest manifest = + blink::Manifest manifest = ParseManifest("{ \"splash_screen_url\": \" splash.html\" }"); ASSERT_EQ(manifest.splash_screen_url.spec(), default_document_url.Resolve("splash.html").spec()); @@ -1685,7 +1761,7 @@ TEST_F(ManifestParserTest, SplashScreenUrlParseRules) { // Don't parse if property isn't a string. { - Manifest manifest = ParseManifest("{ \"splash_screen_url\": {} }"); + blink::Manifest manifest = ParseManifest("{ \"splash_screen_url\": {} }"); ASSERT_TRUE(manifest.splash_screen_url.is_empty()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'splash_screen_url' ignored, type string expected.", @@ -1694,7 +1770,7 @@ TEST_F(ManifestParserTest, SplashScreenUrlParseRules) { // Don't parse if property isn't a string. { - Manifest manifest = ParseManifest("{ \"splash_screen_url\": 42 }"); + blink::Manifest manifest = ParseManifest("{ \"splash_screen_url\": 42 }"); ASSERT_TRUE(manifest.splash_screen_url.is_empty()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'splash_screen_url' ignored, type string expected.", @@ -1703,7 +1779,7 @@ TEST_F(ManifestParserTest, SplashScreenUrlParseRules) { // Don't parse if property isn't a valid URL. { - Manifest manifest = + blink::Manifest manifest = ParseManifest("{ \"splash_screen_url\": \"http://www.google.ca:a\" }"); ASSERT_TRUE(manifest.splash_screen_url.is_empty()); EXPECT_EQ(1u, GetErrorCount()); @@ -1713,7 +1789,7 @@ TEST_F(ManifestParserTest, SplashScreenUrlParseRules) { // Absolute splash_screen_url, same origin with document. { - Manifest manifest = ParseManifestWithURLs( + blink::Manifest manifest = ParseManifestWithURLs( "{ \"splash_screen_url\": \"http://foo.com/splash.html\" }", GURL("http://foo.com/manifest.json"), GURL("http://foo.com/index.html")); @@ -1723,7 +1799,7 @@ TEST_F(ManifestParserTest, SplashScreenUrlParseRules) { // Absolute splash_screen_url, cross origin with document. { - Manifest manifest = ParseManifestWithURLs( + blink::Manifest manifest = ParseManifestWithURLs( "{ \"splash_screen_url\": \"http://bar.com/splash.html\" }", GURL("http://foo.com/manifest.json"), GURL("http://foo.com/index.html")); @@ -1737,7 +1813,7 @@ TEST_F(ManifestParserTest, SplashScreenUrlParseRules) { // Resolving has to happen based on the manifest_url. { - Manifest manifest = + blink::Manifest manifest = ParseManifestWithURLs("{ \"splash_screen_url\": \"splash.html\" }", GURL("http://foo.com/splashy/manifest.json"), GURL("http://foo.com/index.html")); @@ -1750,28 +1826,29 @@ TEST_F(ManifestParserTest, SplashScreenUrlParseRules) { TEST_F(ManifestParserTest, GCMSenderIDParseRules) { // Smoke test. { - Manifest manifest = ParseManifest("{ \"gcm_sender_id\": \"foo\" }"); + blink::Manifest manifest = ParseManifest("{ \"gcm_sender_id\": \"foo\" }"); EXPECT_TRUE(base::EqualsASCII(manifest.gcm_sender_id.string(), "foo")); EXPECT_EQ(0u, GetErrorCount()); } // Trim whitespaces. { - Manifest manifest = ParseManifest("{ \"gcm_sender_id\": \" foo \" }"); + blink::Manifest manifest = + ParseManifest("{ \"gcm_sender_id\": \" foo \" }"); EXPECT_TRUE(base::EqualsASCII(manifest.gcm_sender_id.string(), "foo")); EXPECT_EQ(0u, GetErrorCount()); } // Don't parse if the property isn't a string. { - Manifest manifest = ParseManifest("{ \"gcm_sender_id\": {} }"); + blink::Manifest manifest = ParseManifest("{ \"gcm_sender_id\": {} }"); EXPECT_TRUE(manifest.gcm_sender_id.is_null()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'gcm_sender_id' ignored, type string expected.", errors()[0]); } { - Manifest manifest = ParseManifest("{ \"gcm_sender_id\": 42 }"); + blink::Manifest manifest = ParseManifest("{ \"gcm_sender_id\": 42 }"); EXPECT_TRUE(manifest.gcm_sender_id.is_null()); EXPECT_EQ(1u, GetErrorCount()); EXPECT_EQ("property 'gcm_sender_id' ignored, type string expected.", diff --git a/content/renderer/manifest/manifest_uma_util.cc b/content/renderer/manifest/manifest_uma_util.cc index 3d37795db3df3b..7bb45b5c6da88a 100644 --- a/content/renderer/manifest/manifest_uma_util.cc +++ b/content/renderer/manifest/manifest_uma_util.cc @@ -5,7 +5,7 @@ #include "content/renderer/manifest/manifest_uma_util.h" #include "base/metrics/histogram_macros.h" -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" namespace content { @@ -29,7 +29,7 @@ enum ManifestFetchResultType { } // anonymous namespace -void ManifestUmaUtil::ParseSucceeded(const Manifest& manifest) { +void ManifestUmaUtil::ParseSucceeded(const blink::Manifest& manifest) { UMA_HISTOGRAM_BOOLEAN(kUMANameParseSuccess, true); UMA_HISTOGRAM_BOOLEAN("Manifest.IsEmpty", manifest.IsEmpty()); if (manifest.IsEmpty()) diff --git a/content/renderer/manifest/manifest_uma_util.h b/content/renderer/manifest/manifest_uma_util.h index 29a263d5cecc9f..1bf569b8ca6f2a 100644 --- a/content/renderer/manifest/manifest_uma_util.h +++ b/content/renderer/manifest/manifest_uma_util.h @@ -5,9 +5,11 @@ #ifndef CONTENT_RENDERER_MANIFEST_MANIFEST_UMA_UTIL_H_ #define CONTENT_RENDERER_MANIFEST_MANIFEST_UMA_UTIL_H_ -namespace content { - +namespace blink { struct Manifest; +} + +namespace content { class ManifestUmaUtil { public: @@ -20,7 +22,7 @@ class ManifestUmaUtil { // Record that the Manifest was successfully parsed. If it is an empty // Manifest, it will recorded as so and nothing will happen. Otherwise, the // presence of each properties will be recorded. - static void ParseSucceeded(const Manifest& manifest); + static void ParseSucceeded(const blink::Manifest& manifest); // Record that the Manifest parsing failed. static void ParseFailed(); diff --git a/content/renderer/push_messaging/push_messaging_client.cc b/content/renderer/push_messaging/push_messaging_client.cc index 7ab8191e0beaa3..9fc24d41d5d6d9 100644 --- a/content/renderer/push_messaging/push_messaging_client.cc +++ b/content/renderer/push_messaging/push_messaging_client.cc @@ -17,7 +17,7 @@ #include "content/renderer/render_frame_impl.h" #include "content/renderer/service_worker/web_service_worker_registration_impl.h" #include "services/service_manager/public/cpp/connector.h" -#include "third_party/blink/public/platform/modules/manifest/manifest_manager.mojom.h" +#include "third_party/blink/public/mojom/manifest/manifest_manager.mojom.h" #include "third_party/blink/public/platform/modules/push_messaging/web_push_error.h" #include "third_party/blink/public/platform/modules/push_messaging/web_push_subscription.h" #include "third_party/blink/public/platform/modules/push_messaging/web_push_subscription_options.h" @@ -78,7 +78,7 @@ void PushMessagingClient::DidGetManifest( bool user_gesture, std::unique_ptr callbacks, const GURL& manifest_url, - const Manifest& manifest) { + const blink::Manifest& manifest) { // Get the sender_info from the manifest since it wasn't provided by // the caller. if (manifest.IsEmpty()) { diff --git a/content/renderer/push_messaging/push_messaging_client.h b/content/renderer/push_messaging/push_messaging_client.h index 20142f3e8d80bb..c8d6e8e3bb5a65 100644 --- a/content/renderer/push_messaging/push_messaging_client.h +++ b/content/renderer/push_messaging/push_messaging_client.h @@ -14,12 +14,13 @@ #include "base/macros.h" #include "content/common/push_messaging.mojom.h" #include "content/public/renderer/render_frame_observer.h" -#include "third_party/blink/public/platform/modules/manifest/manifest.mojom.h" +#include "third_party/blink/public/mojom/manifest/manifest.mojom.h" #include "third_party/blink/public/platform/modules/push_messaging/web_push_client.h" class GURL; namespace blink { +struct Manifest; struct WebPushSubscriptionOptions; } @@ -29,7 +30,6 @@ namespace mojom { enum class PushRegistrationStatus; } -struct Manifest; struct PushSubscriptionOptions; class PushMessagingClient : public RenderFrameObserver, @@ -55,7 +55,7 @@ class PushMessagingClient : public RenderFrameObserver, bool user_gesture, std::unique_ptr callbacks, const GURL& manifest_url, - const Manifest& manifest); + const blink::Manifest& manifest); void DoSubscribe( blink::WebServiceWorkerRegistration* service_worker_registration, diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index 6d3deeb7448a46..f8669a9de9e13d 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -70,9 +70,9 @@ #include "services/service_manager/public/mojom/connector.mojom.h" #include "services/service_manager/public/mojom/interface_provider.mojom.h" #include "third_party/blink/public/common/feature_policy/feature_policy.h" +#include "third_party/blink/public/mojom/manifest/manifest_manager.mojom.h" #include "third_party/blink/public/mojom/page/page_visibility_state.mojom.h" #include "third_party/blink/public/platform/autoplay.mojom.h" -#include "third_party/blink/public/platform/modules/manifest/manifest_manager.mojom.h" #include "third_party/blink/public/platform/site_engagement.mojom.h" #include "third_party/blink/public/platform/web_effective_connection_type.h" #include "third_party/blink/public/platform/web_focus_type.h" diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index 94b08962093b0b..13880ecc19ab74 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h @@ -49,7 +49,7 @@ #include "ipc/ipc_sender.h" #include "mojo/public/cpp/bindings/binding.h" #include "ppapi/buildflags/buildflags.h" -#include "third_party/blink/public/platform/web_display_mode.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/platform/web_input_event.h" #include "third_party/blink/public/platform/web_rect.h" #include "third_party/blink/public/platform/web_referrer_policy.h" diff --git a/content/shell/renderer/layout_test/blink_test_runner.cc b/content/shell/renderer/layout_test/blink_test_runner.cc index de254a93cc9816..2b6f6099c4e6ee 100644 --- a/content/shell/renderer/layout_test/blink_test_runner.cc +++ b/content/shell/renderer/layout_test/blink_test_runner.cc @@ -651,7 +651,7 @@ bool BlinkTestRunner::AllowExternalPages() { void BlinkTestRunner::FetchManifest( blink::WebView* view, - base::OnceCallback callback) { + base::OnceCallback callback) { ::content::FetchManifest(view, std::move(callback)); } diff --git a/content/shell/renderer/layout_test/blink_test_runner.h b/content/shell/renderer/layout_test/blink_test_runner.h index e84d4855347375..502bb48bb23cd1 100644 --- a/content/shell/renderer/layout_test/blink_test_runner.h +++ b/content/shell/renderer/layout_test/blink_test_runner.h @@ -132,7 +132,8 @@ class BlinkTestRunner : public RenderViewObserver, bool AllowExternalPages() override; void FetchManifest( blink::WebView* view, - base::OnceCallback callback) override; + base::OnceCallback callback) + override; void SetPermission(const std::string& name, const std::string& value, const GURL& origin, diff --git a/content/shell/test_runner/test_runner_for_specific_view.cc b/content/shell/test_runner/test_runner_for_specific_view.cc index cef9fa3f8b42f4..832f03fa2134c7 100644 --- a/content/shell/test_runner/test_runner_for_specific_view.cc +++ b/content/shell/test_runner/test_runner_for_specific_view.cc @@ -317,7 +317,7 @@ void TestRunnerForSpecificView::GetManifestThen( void TestRunnerForSpecificView::GetManifestCallback( v8::UniquePersistent callback, const GURL& manifest_url, - const content::Manifest& manifest) { + const blink::Manifest& manifest) { PostV8CallbackWithArgs(std::move(callback), 0, nullptr); } diff --git a/content/shell/test_runner/test_runner_for_specific_view.h b/content/shell/test_runner/test_runner_for_specific_view.h index 696b75a6f94aa6..aba973bf89dbeb 100644 --- a/content/shell/test_runner/test_runner_for_specific_view.h +++ b/content/shell/test_runner/test_runner_for_specific_view.h @@ -19,14 +19,11 @@ class GURL; class SkBitmap; namespace blink { +struct Manifest; class WebLocalFrame; class WebView; } -namespace content { -struct Manifest; -} - namespace gin { class Arguments; } @@ -98,7 +95,7 @@ class TestRunnerForSpecificView { void GetManifestThen(v8::Local callback); void GetManifestCallback(v8::UniquePersistent callback, const GURL& manifest_url, - const content::Manifest& manifest); + const blink::Manifest& manifest); // Calls |callback| with a DOMString[] representing the events recorded since // the last call to this function. diff --git a/content/shell/test_runner/web_test_delegate.h b/content/shell/test_runner/web_test_delegate.h index ae9b362a915861..5f572495fa18a1 100644 --- a/content/shell/test_runner/web_test_delegate.h +++ b/content/shell/test_runner/web_test_delegate.h @@ -25,6 +25,7 @@ class DictionaryValue; } namespace blink { +struct Manifest; class WebInputEvent; class WebLocalFrame; class WebMediaStream; @@ -35,10 +36,6 @@ class WebURLRequest; class WebView; } -namespace content { -struct Manifest; -} - namespace device { class MotionData; class OrientationData; @@ -239,7 +236,7 @@ class WebTestDelegate { // Fetch the manifest for a given WebView from the given url. virtual void FetchManifest( blink::WebView* view, - base::OnceCallback + base::OnceCallback callback) = 0; // Sends a message to the LayoutTestPermissionManager in order for it to diff --git a/services/device/public/mojom/BUILD.gn b/services/device/public/mojom/BUILD.gn index 8f90b0228ad55b..c84436d36a3ed7 100644 --- a/services/device/public/mojom/BUILD.gn +++ b/services/device/public/mojom/BUILD.gn @@ -55,6 +55,7 @@ mojom("mojom") { "//third_party/blink/renderer/bindings/modules/v8:generate_mojo_bindings", "//third_party/blink/renderer/platform:blink_platform_public_deps", "//third_party/blink/public:mojo_bindings_blink", + "//third_party/blink/public/mojom:mojom_platform_blink", ] } diff --git a/third_party/blink/common/BUILD.gn b/third_party/blink/common/BUILD.gn index b2d88aa3760f17..49dcf1b24b849d 100644 --- a/third_party/blink/common/BUILD.gn +++ b/third_party/blink/common/BUILD.gn @@ -21,6 +21,7 @@ jumbo_source_set("common") { "device_memory/approximated_device_memory.cc", "feature_policy/feature_policy.cc", "frame/frame_policy.cc", + "manifest/manifest.cc", "message_port/cloneable_message.cc", "message_port/cloneable_message_struct_traits.cc", "message_port/cloneable_message_struct_traits.h", diff --git a/third_party/blink/common/DEPS b/third_party/blink/common/DEPS index 3308652373dfa1..fb732ff0667b61 100644 --- a/third_party/blink/common/DEPS +++ b/third_party/blink/common/DEPS @@ -16,5 +16,6 @@ include_rules = [ "+third_party/blink/common", "+third_party/blink/public/common", "+third_party/blink/public/mojom", + "+ui/gfx/geometry", "+url", ] diff --git a/third_party/blink/common/manifest/OWNERS b/third_party/blink/common/manifest/OWNERS new file mode 100644 index 00000000000000..296f6915eb57ba --- /dev/null +++ b/third_party/blink/common/manifest/OWNERS @@ -0,0 +1,6 @@ +mlamouri@chromium.org + +per-file *_mojom_traits*.*=set noparent +per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS + +# COMPONENT: Manifest diff --git a/content/public/common/manifest.cc b/third_party/blink/common/manifest/manifest.cc similarity index 95% rename from content/public/common/manifest.cc rename to third_party/blink/common/manifest/manifest.cc index ad5211065be31d..cb706d6fc5ceaf 100644 --- a/content/public/common/manifest.cc +++ b/third_party/blink/common/manifest/manifest.cc @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/public/common/manifest.h" +#include "third_party/blink/public/common/manifest/manifest.h" -namespace content { +namespace blink { // We need to provide a value here which is out of the range of a 32-bit integer // since otherwise we would not be able to check whether a theme color was valid @@ -57,4 +57,4 @@ bool Manifest::IsEmpty() const { scope.is_empty(); } -} // namespace content +} // namespace blink diff --git a/content/public/common/manifest_struct_traits.cc b/third_party/blink/common/manifest/manifest_mojom_traits.cc similarity index 84% rename from content/public/common/manifest_struct_traits.cc rename to third_party/blink/common/manifest/manifest_mojom_traits.cc index 531a9318b47172..621f65d661e26c 100644 --- a/content/public/common/manifest_struct_traits.cc +++ b/third_party/blink/common/manifest/manifest_mojom_traits.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/public/common/manifest_struct_traits.h" +#include "third_party/blink/public/common/manifest/manifest_mojom_traits.h" #include "mojo/public/cpp/base/string16_mojom_traits.h" +#include "third_party/blink/public/common/manifest/web_display_mode_mojom_traits.h" #include "third_party/blink/public/common/screen_orientation/web_screen_orientation_enum_traits.h" -#include "third_party/blink/public/platform/web_display_mode_struct_traits.h" #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" #include "url/mojom/url_gurl_mojom_traits.h" @@ -16,7 +16,7 @@ namespace { bool ValidateColor(int64_t color) { return color >= std::numeric_limits::min() || color <= std::numeric_limits::max() || - color == content::Manifest::kInvalidOrMissingColor; + color == ::blink::Manifest::kInvalidOrMissingColor; } // A wrapper around base::Optional so a custom StructTraits @@ -39,7 +39,7 @@ struct StructTraits { } mojo::ArrayDataView buffer_view; input.GetDataDataView(&buffer_view); - if (buffer_view.size() > content::Manifest::kMaxIPCStringLength) + if (buffer_view.size() > ::blink::Manifest::kMaxIPCStringLength) return false; output->string.emplace(); @@ -48,9 +48,9 @@ struct StructTraits { } }; -bool StructTraits::Read( +bool StructTraits::Read( blink::mojom::ManifestDataView data, - content::Manifest* out) { + ::blink::Manifest* out) { TruncatedString16 string; if (!data.ReadName(&string)) return false; @@ -100,9 +100,9 @@ bool StructTraits::Read( return true; } -bool StructTraits:: +bool StructTraits:: Read(blink::mojom::ManifestIconDataView data, - content::Manifest::Icon* out) { + ::blink::Manifest::Icon* out) { if (!data.ReadSrc(&out->src)) return false; @@ -125,9 +125,9 @@ bool StructTraits:: } bool StructTraits:: + ::blink::Manifest::RelatedApplication>:: Read(blink::mojom::ManifestRelatedApplicationDataView data, - content::Manifest::RelatedApplication* out) { + ::blink::Manifest::RelatedApplication* out) { TruncatedString16 string; if (!data.ReadPlatform(&string)) return false; @@ -144,9 +144,9 @@ bool StructTraits:: + ::blink::Manifest::ShareTarget>:: Read(blink::mojom::ManifestShareTargetDataView data, - content::Manifest::ShareTarget* out) { + ::blink::Manifest::ShareTarget* out) { return data.ReadUrlTemplate(&out->url_template); } diff --git a/third_party/blink/public/BUILD.gn b/third_party/blink/public/BUILD.gn index 4b81a2348b0227..1510427f14cbfc 100644 --- a/third_party/blink/public/BUILD.gn +++ b/third_party/blink/public/BUILD.gn @@ -74,8 +74,8 @@ buildflag_header("buildflags") { if (is_android) { java_cpp_enum("blink_headers_java_enums_srcjar") { sources = [ + "./common/manifest/web_display_mode.h", "./platform/modules/remoteplayback/web_remote_playback_availability.h", - "./platform/web_display_mode.h", "./platform/web_focus_type.h", "./platform/web_input_event.h", "./platform/web_referrer_policy.h", @@ -250,7 +250,6 @@ source_set("blink_headers") { "platform/web_data_consumer_handle.h", "platform/web_database_observer.h", "platform/web_display_item_list.h", - "platform/web_display_mode.h", "platform/web_distillability.h", "platform/web_document_subresource_filter.h", "platform/web_double_point.h", @@ -730,7 +729,6 @@ mojom("mojo_bindings") { "platform/autoplay.mojom", "platform/content_security_policy.mojom", "platform/dedicated_worker_factory.mojom", - "platform/display_mode.mojom", "platform/media_download_in_product_help.mojom", "platform/mime_registry.mojom", "platform/modules/app_banner/app_banner.mojom", @@ -747,8 +745,6 @@ mojom("mojo_bindings") { "platform/modules/insecure_input/insecure_input_service.mojom", "platform/modules/keyboard_lock/keyboard_lock.mojom", "platform/modules/locks/lock_manager.mojom", - "platform/modules/manifest/manifest.mojom", - "platform/modules/manifest/manifest_manager.mojom", "platform/modules/notifications/notification.mojom", "platform/modules/notifications/notification_service.mojom", "platform/modules/payments/payment_app.mojom", diff --git a/third_party/blink/public/common/BUILD.gn b/third_party/blink/public/common/BUILD.gn index ceff04931d3d3c..210bcd85ac6d99 100644 --- a/third_party/blink/public/common/BUILD.gn +++ b/third_party/blink/public/common/BUILD.gn @@ -39,6 +39,8 @@ source_set("headers") { "feature_policy/feature_policy.h", "frame/frame_policy.h", "frame/sandbox_flags.h", + "manifest/manifest.h", + "manifest/web_display_mode.h", "message_port/cloneable_message.h", "message_port/message_port_channel.h", "message_port/transferable_message.h", diff --git a/third_party/blink/public/common/DEPS b/third_party/blink/public/common/DEPS index d880a8caefc1e7..ef1ec1b47af667 100644 --- a/third_party/blink/public/common/DEPS +++ b/third_party/blink/public/common/DEPS @@ -12,6 +12,7 @@ include_rules = [ "+mojo", "+third_party/blink/public/common", "+third_party/blink/public/mojom", + "+ui/gfx/geometry", "+url", # This file should not be included outside of blink, so it does not belong diff --git a/third_party/blink/public/common/manifest/OWNERS b/third_party/blink/public/common/manifest/OWNERS new file mode 100644 index 00000000000000..b0ac8c63dcadb7 --- /dev/null +++ b/third_party/blink/public/common/manifest/OWNERS @@ -0,0 +1,9 @@ +mlamouri@chromium.org + +per-file *.typemap=set noparent +per-file *.typemap=file://ipc/SECURITY_OWNERS + +per-file *_mojom_traits*.*=set noparent +per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS + +# COMPONENT: Manifest diff --git a/third_party/blink/public/common/manifest/display_mode.typemap b/third_party/blink/public/common/manifest/display_mode.typemap new file mode 100644 index 00000000000000..df5f721f5a72cd --- /dev/null +++ b/third_party/blink/public/common/manifest/display_mode.typemap @@ -0,0 +1,11 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +mojom = "//third_party/blink/public/mojom/manifest/display_mode.mojom" +public_headers = + [ "//third_party/blink/public/common/manifest/web_display_mode.h" ] +traits_headers = [ + "//third_party/blink/public/common/manifest/web_display_mode_mojom_traits.h", +] +type_mappings = [ "blink.mojom.DisplayMode=::blink::WebDisplayMode" ] diff --git a/content/public/common/manifest.h b/third_party/blink/public/common/manifest/manifest.h similarity index 92% rename from content/public/common/manifest.h rename to third_party/blink/public/common/manifest/manifest.h index 185d31feaddd1a..0faf659babed3a 100644 --- a/content/public/common/manifest.h +++ b/third_party/blink/public/common/manifest/manifest.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_PUBLIC_COMMON_MANIFEST_H_ -#define CONTENT_PUBLIC_COMMON_MANIFEST_H_ +#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_MANIFEST_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_MANIFEST_H_ #include #include @@ -13,21 +13,21 @@ #include "base/optional.h" #include "base/strings/nullable_string16.h" #include "base/strings/string16.h" -#include "content/common/content_export.h" +#include "third_party/blink/common/common_export.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/common/screen_orientation/web_screen_orientation_lock_type.h" -#include "third_party/blink/public/platform/web_display_mode.h" #include "ui/gfx/geometry/size.h" #include "url/gurl.h" -namespace content { +namespace blink { // The Manifest structure is an internal representation of the Manifest file // described in the "Manifest for Web Application" document: // http://w3c.github.io/manifest/ -struct CONTENT_EXPORT Manifest { +struct BLINK_COMMON_EXPORT Manifest { // Structure representing an icon as per the Manifest specification, see: // http://w3c.github.io/manifest/#dfn-icon-object - struct CONTENT_EXPORT Icon { + struct BLINK_COMMON_EXPORT Icon { enum IconPurpose { ANY = 0, BADGE, @@ -61,7 +61,7 @@ struct CONTENT_EXPORT Manifest { }; // Structure representing how a Web Share target handles an incoming share. - struct CONTENT_EXPORT ShareTarget { + struct BLINK_COMMON_EXPORT ShareTarget { ShareTarget(); ~ShareTarget(); @@ -71,7 +71,7 @@ struct CONTENT_EXPORT Manifest { }; // Structure representing a related application. - struct CONTENT_EXPORT RelatedApplication { + struct BLINK_COMMON_EXPORT RelatedApplication { RelatedApplication(); ~RelatedApplication(); @@ -172,6 +172,6 @@ struct CONTENT_EXPORT Manifest { static const int64_t kInvalidOrMissingColor; }; -} // namespace content +} // namespace blink -#endif // CONTENT_PUBLIC_COMMON_MANIFEST_H_ +#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_MANIFEST_H_ diff --git a/third_party/blink/public/common/manifest/manifest.typemap b/third_party/blink/public/common/manifest/manifest.typemap new file mode 100644 index 00000000000000..1383544fad647d --- /dev/null +++ b/third_party/blink/public/common/manifest/manifest.typemap @@ -0,0 +1,23 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +mojom = "//third_party/blink/public/mojom/manifest/manifest.mojom" +public_headers = [ + "//third_party/blink/public/common/manifest/manifest.h", + "//third_party/blink/common/common_export.h", +] +traits_headers = + [ "//third_party/blink/public/common/manifest/manifest_mojom_traits.h" ] +sources = [ + "//third_party/blink/common/manifest/manifest_mojom_traits.cc", +] +deps = [ + "//ui/gfx/geometry/mojo:struct_traits", +] +type_mappings = [ + "blink.mojom.Manifest=::blink::Manifest[nullable_is_same_type]", + "blink.mojom.ManifestIcon=::blink::Manifest::Icon", + "blink.mojom.ManifestRelatedApplication=::blink::Manifest::RelatedApplication", + "blink.mojom.ManifestShareTarget=::blink::Manifest::ShareTarget", +] diff --git a/third_party/blink/public/common/manifest/manifest_mojom_traits.h b/third_party/blink/public/common/manifest/manifest_mojom_traits.h new file mode 100644 index 00000000000000..c5e09fcb834915 --- /dev/null +++ b/third_party/blink/public/common/manifest/manifest_mojom_traits.h @@ -0,0 +1,199 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_MANIFEST_MOJOM_TRAITS_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_MANIFEST_MOJOM_TRAITS_H_ + +#include "third_party/blink/public/common/manifest/manifest.h" + +#include "mojo/public/cpp/bindings/struct_traits.h" +#include "third_party/blink/common/common_export.h" +#include "third_party/blink/public/mojom/manifest/manifest.mojom.h" + +namespace mojo { +namespace internal { + +inline base::StringPiece16 TruncateString16(const base::string16& string) { + return base::StringPiece16(string).substr( + 0, ::blink::Manifest::kMaxIPCStringLength); +} + +inline base::Optional TruncateNullableString16( + const base::NullableString16& string) { + if (string.is_null()) + return base::nullopt; + + return TruncateString16(string.string()); +} + +} // namespace internal + +template <> +struct BLINK_COMMON_EXPORT + StructTraits { + static bool IsNull(const ::blink::Manifest& manifest) { + return manifest.IsEmpty(); + } + + static void SetToNull(::blink::Manifest* manifest) { + *manifest = ::blink::Manifest(); + } + + static base::Optional name( + const ::blink::Manifest& manifest) { + return internal::TruncateNullableString16(manifest.name); + } + + static base::Optional short_name( + const ::blink::Manifest& manifest) { + return internal::TruncateNullableString16(manifest.short_name); + } + + static base::Optional gcm_sender_id( + const ::blink::Manifest& manifest) { + return internal::TruncateNullableString16(manifest.gcm_sender_id); + } + + static const GURL& start_url(const ::blink::Manifest& manifest) { + return manifest.start_url; + } + + static const GURL& scope(const ::blink::Manifest& manifest) { + return manifest.scope; + } + + static blink::WebDisplayMode display(const ::blink::Manifest& manifest) { + return manifest.display; + } + + static blink::WebScreenOrientationLockType orientation( + const ::blink::Manifest& manifest) { + return manifest.orientation; + } + + static int64_t theme_color(const ::blink::Manifest& manifest) { + return manifest.theme_color; + } + + static int64_t background_color(const ::blink::Manifest& manifest) { + return manifest.background_color; + } + + static const GURL& splash_screen_url(const ::blink::Manifest& manifest) { + return manifest.splash_screen_url; + } + + static const std::vector<::blink::Manifest::Icon>& icons( + const ::blink::Manifest& manifest) { + return manifest.icons; + } + + static const base::Optional<::blink::Manifest::ShareTarget>& share_target( + const ::blink::Manifest& manifest) { + return manifest.share_target; + } + + static const std::vector<::blink::Manifest::RelatedApplication>& + related_applications(const ::blink::Manifest& manifest) { + return manifest.related_applications; + } + + static bool prefer_related_applications(const ::blink::Manifest& manifest) { + return manifest.prefer_related_applications; + } + + static bool Read(blink::mojom::ManifestDataView data, ::blink::Manifest* out); +}; + +template <> +struct BLINK_COMMON_EXPORT + StructTraits { + static const GURL& src(const ::blink::Manifest::Icon& icon) { + return icon.src; + } + + static base::StringPiece16 type(const ::blink::Manifest::Icon& icon) { + return internal::TruncateString16(icon.type); + } + static const std::vector& sizes( + const ::blink::Manifest::Icon& icon) { + return icon.sizes; + } + + static const std::vector<::blink::Manifest::Icon::IconPurpose>& purpose( + const ::blink::Manifest::Icon& icon) { + return icon.purpose; + } + + static bool Read(blink::mojom::ManifestIconDataView data, + ::blink::Manifest::Icon* out); +}; + +template <> +struct BLINK_COMMON_EXPORT + StructTraits { + static base::Optional platform( + const ::blink::Manifest::RelatedApplication& related_application) { + return internal::TruncateNullableString16(related_application.platform); + } + + static const GURL& url( + const ::blink::Manifest::RelatedApplication& related_application) { + return related_application.url; + } + + static base::Optional id( + const ::blink::Manifest::RelatedApplication& related_application) { + return internal::TruncateNullableString16(related_application.id); + } + + static bool Read(blink::mojom::ManifestRelatedApplicationDataView data, + ::blink::Manifest::RelatedApplication* out); +}; + +template <> +struct BLINK_COMMON_EXPORT + StructTraits { + static const GURL& url_template( + const ::blink::Manifest::ShareTarget& share_target) { + return share_target.url_template; + } + static bool Read(blink::mojom::ManifestShareTargetDataView data, + ::blink::Manifest::ShareTarget* out); +}; + +template <> +struct BLINK_COMMON_EXPORT EnumTraits { + static blink::mojom::ManifestIcon_Purpose ToMojom( + ::blink::Manifest::Icon::IconPurpose purpose) { + switch (purpose) { + case ::blink::Manifest::Icon::ANY: + return blink::mojom::ManifestIcon_Purpose::ANY; + case ::blink::Manifest::Icon::BADGE: + return blink::mojom::ManifestIcon_Purpose::BADGE; + } + NOTREACHED(); + return blink::mojom::ManifestIcon_Purpose::ANY; + } + static bool FromMojom(blink::mojom::ManifestIcon_Purpose input, + ::blink::Manifest::Icon::IconPurpose* out) { + switch (input) { + case blink::mojom::ManifestIcon_Purpose::ANY: + *out = ::blink::Manifest::Icon::ANY; + return true; + case blink::mojom::ManifestIcon_Purpose::BADGE: + *out = ::blink::Manifest::Icon::BADGE; + return true; + } + + return false; + } +}; + +} // namespace mojo + +#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_MANIFEST_MOJOM_TRAITS_H_ diff --git a/third_party/blink/public/platform/web_display_mode.h b/third_party/blink/public/common/manifest/web_display_mode.h similarity index 72% rename from third_party/blink/public/platform/web_display_mode.h rename to third_party/blink/public/common/manifest/web_display_mode.h index ad1582528e0764..9ed8949672c242 100644 --- a/third_party/blink/public/platform/web_display_mode.h +++ b/third_party/blink/public/common/manifest/web_display_mode.h @@ -2,13 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_DISPLAY_MODE_H_ -#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_DISPLAY_MODE_H_ +#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_WEB_DISPLAY_MODE_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_WEB_DISPLAY_MODE_H_ namespace blink { // Enumerates values of the display property of the Web App Manifest. // +// TODO(dgozman): instead of this enum, use blink.mojom.DisplayMode directly. // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.blink_public.platform // GENERATED_JAVA_PREFIX_TO_STRIP: WebDisplayMode enum WebDisplayMode { @@ -24,4 +25,4 @@ enum WebDisplayMode { } // namespace blink -#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_DISPLAY_MODE_H_ +#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_WEB_DISPLAY_MODE_H_ diff --git a/third_party/blink/public/platform/web_display_mode_struct_traits.h b/third_party/blink/public/common/manifest/web_display_mode_mojom_traits.h similarity index 81% rename from third_party/blink/public/platform/web_display_mode_struct_traits.h rename to third_party/blink/public/common/manifest/web_display_mode_mojom_traits.h index d82ac24705ed9e..6319d540d981d4 100644 --- a/third_party/blink/public/platform/web_display_mode_struct_traits.h +++ b/third_party/blink/public/common/manifest/web_display_mode_mojom_traits.h @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_DISPLAY_MODE_STRUCT_TRAITS_H_ -#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_DISPLAY_MODE_STRUCT_TRAITS_H_ +#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_WEB_DISPLAY_MODE_MOJOM_TRAITS_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_WEB_DISPLAY_MODE_MOJOM_TRAITS_H_ #include "mojo/public/cpp/bindings/enum_traits.h" -#include "third_party/blink/public/platform/display_mode.mojom-shared.h" -#include "third_party/blink/public/platform/web_display_mode.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" +#include "third_party/blink/public/mojom/manifest/display_mode.mojom-shared.h" namespace mojo { @@ -55,4 +55,4 @@ struct EnumTraits { } // namespace mojo -#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_DISPLAY_MODE_STRUCT_TRAITS_H_ +#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_WEB_DISPLAY_MODE_MOJOM_TRAITS_H_ diff --git a/third_party/blink/public/mojom/BUILD.gn b/third_party/blink/public/mojom/BUILD.gn index 3a90358ac4f584..098c9346aca607 100644 --- a/third_party/blink/public/mojom/BUILD.gn +++ b/third_party/blink/public/mojom/BUILD.gn @@ -21,6 +21,9 @@ mojom("mojom_platform") { "file/file_utilities.mojom", "leak_detector/leak_detector.mojom", "loader/prefetch_url_loader_service.mojom", + "manifest/display_mode.mojom", + "manifest/manifest.mojom", + "manifest/manifest_manager.mojom", "net/ip_address_space.mojom", "page/page_visibility_state.mojom", "quota/quota_dispatcher_host.mojom", @@ -40,6 +43,7 @@ mojom("mojom_platform") { public_deps = [ "//mojo/public/mojom/base", + "//services/device/public/mojom", "//services/network/public/mojom", # TODO(https://crbug.com/822804): Remove when mojom bindings deps checks diff --git a/third_party/blink/public/platform/modules/manifest/OWNERS b/third_party/blink/public/mojom/manifest/OWNERS similarity index 100% rename from third_party/blink/public/platform/modules/manifest/OWNERS rename to third_party/blink/public/mojom/manifest/OWNERS diff --git a/third_party/blink/public/platform/display_mode.mojom b/third_party/blink/public/mojom/manifest/display_mode.mojom similarity index 100% rename from third_party/blink/public/platform/display_mode.mojom rename to third_party/blink/public/mojom/manifest/display_mode.mojom diff --git a/third_party/blink/public/platform/modules/manifest/manifest.mojom b/third_party/blink/public/mojom/manifest/manifest.mojom similarity index 97% rename from third_party/blink/public/platform/modules/manifest/manifest.mojom rename to third_party/blink/public/mojom/manifest/manifest.mojom index 562df51fe21300..e82cce588df773 100644 --- a/third_party/blink/public/platform/modules/manifest/manifest.mojom +++ b/third_party/blink/public/mojom/manifest/manifest.mojom @@ -6,7 +6,7 @@ module blink.mojom; import "services/device/public/mojom/screen_orientation_lock_types.mojom"; import "mojo/public/mojom/base/string16.mojom"; -import "third_party/blink/public/platform/display_mode.mojom"; +import "third_party/blink/public/mojom/manifest/display_mode.mojom"; import "ui/gfx/geometry/mojo/geometry.mojom"; import "url/mojom/url.mojom"; @@ -14,6 +14,7 @@ import "url/mojom/url.mojom"; // The Manifest structure is an internal representation of the Manifest file // described in the "Manifest for Web Application" document: // http://w3c.github.io/manifest/ +[JavaClassName="WebManifest"] struct Manifest { mojo_base.mojom.String16? name; diff --git a/third_party/blink/public/platform/modules/manifest/manifest_manager.mojom b/third_party/blink/public/mojom/manifest/manifest_manager.mojom similarity index 92% rename from third_party/blink/public/platform/modules/manifest/manifest_manager.mojom rename to third_party/blink/public/mojom/manifest/manifest_manager.mojom index 9ce53952132014..d6a2471e964336 100644 --- a/third_party/blink/public/platform/modules/manifest/manifest_manager.mojom +++ b/third_party/blink/public/mojom/manifest/manifest_manager.mojom @@ -4,7 +4,7 @@ module blink.mojom; -import "third_party/blink/public/platform/modules/manifest/manifest.mojom"; +import "third_party/blink/public/mojom/manifest/manifest.mojom"; import "url/mojom/url.mojom"; interface ManifestManager { diff --git a/third_party/blink/public/platform/display_mode.typemap b/third_party/blink/public/platform/display_mode.typemap deleted file mode 100644 index dd7a112c08b47e..00000000000000 --- a/third_party/blink/public/platform/display_mode.typemap +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright 2017 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -mojom = "//third_party/blink/public/platform/display_mode.mojom" -public_headers = [ "//third_party/blink/public/platform/web_display_mode.h" ] -traits_headers = - [ "//third_party/blink/public/platform/web_display_mode_struct_traits.h" ] -type_mappings = [ "blink.mojom.DisplayMode=::blink::WebDisplayMode" ] diff --git a/third_party/blink/public/platform/modules/payments/payment_app.mojom b/third_party/blink/public/platform/modules/payments/payment_app.mojom index 8c75e8226e2671..5dd163f7c9cee2 100644 --- a/third_party/blink/public/platform/modules/payments/payment_app.mojom +++ b/third_party/blink/public/platform/modules/payments/payment_app.mojom @@ -6,7 +6,7 @@ module payments.mojom; import "components/payments/mojom/payment_request_data.mojom"; import "mojo/public/mojom/base/time.mojom"; -import "third_party/blink/public/platform/modules/manifest/manifest.mojom"; +import "third_party/blink/public/mojom/manifest/manifest.mojom"; import "third_party/blink/public/platform/modules/payments/payment_request.mojom"; import "url/mojom/url.mojom"; diff --git a/third_party/blink/public/public_typemaps.gni b/third_party/blink/public/public_typemaps.gni index 6e2b339c6ef8f5..b6175f87c02d5b 100644 --- a/third_party/blink/public/public_typemaps.gni +++ b/third_party/blink/public/public_typemaps.gni @@ -5,8 +5,9 @@ # These are typemaps which are exposed by Blink to its embedder. typemaps = [ "//third_party/blink/public/platform/content_security_policy.typemap", - "//third_party/blink/public/platform/display_mode.typemap", "//third_party/blink/public/platform/referrer_policy.typemap", "//third_party/blink/public/common/screen_orientation/screen_orientation_lock_types.typemap", + "//third_party/blink/public/common/manifest/display_mode.typemap", + "//third_party/blink/public/common/manifest/manifest.typemap", "//third_party/blink/public/web/console_message.typemap", ] diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h index d9cea512dfc08a..f7c3e651b3ce00 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h @@ -32,8 +32,8 @@ #define THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_VIEW_H_ #include "base/time/time.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/mojom/page/page_visibility_state.mojom-shared.h" -#include "third_party/blink/public/platform/web_display_mode.h" #include "third_party/blink/public/platform/web_drag_operation.h" #include "third_party/blink/public/platform/web_focus_type.h" #include "third_party/blink/public/platform/web_string.h" diff --git a/third_party/blink/renderer/core/css/media_query_evaluator.cc b/third_party/blink/renderer/core/css/media_query_evaluator.cc index 772767b1ee4281..dbe9f9340051fb 100644 --- a/third_party/blink/renderer/core/css/media_query_evaluator.cc +++ b/third_party/blink/renderer/core/css/media_query_evaluator.cc @@ -29,9 +29,9 @@ #include "third_party/blink/renderer/core/css/media_query_evaluator.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/platform/pointer_properties.h" #include "third_party/blink/public/platform/shape_properties.h" -#include "third_party/blink/public/platform/web_display_mode.h" #include "third_party/blink/renderer/core/css/css_primitive_value.h" #include "third_party/blink/renderer/core/css/css_resolution_units.h" #include "third_party/blink/renderer/core/css/css_to_length_conversion_data.h" diff --git a/third_party/blink/renderer/core/css/media_values.h b/third_party/blink/renderer/core/css/media_values.h index e12ea739111a0a..c33d238427b23a 100644 --- a/third_party/blink/renderer/core/css/media_values.h +++ b/third_party/blink/renderer/core/css/media_values.h @@ -5,9 +5,9 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_MEDIA_VALUES_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_MEDIA_VALUES_H_ +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/platform/pointer_properties.h" #include "third_party/blink/public/platform/shape_properties.h" -#include "third_party/blink/public/platform/web_display_mode.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/css_primitive_value.h" #include "third_party/blink/renderer/platform/heap/handle.h" diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h index 8d945bba18180c..df74fc8f3876ee 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h @@ -35,7 +35,7 @@ #include "base/memory/scoped_refptr.h" #include "build/build_config.h" -#include "third_party/blink/public/platform/web_display_mode.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/platform/web_float_size.h" #include "third_party/blink/public/platform/web_gesture_curve_target.h" #include "third_party/blink/public/platform/web_gesture_event.h" diff --git a/third_party/blink/renderer/core/exported/web_view_test.cc b/third_party/blink/renderer/core/exported/web_view_test.cc index 3b8e63356e4e5f..5151df936326bb 100644 --- a/third_party/blink/renderer/core/exported/web_view_test.cc +++ b/third_party/blink/renderer/core/exported/web_view_test.cc @@ -39,11 +39,11 @@ #include "gin/object_template_builder.h" #include "gin/wrappable.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/mojom/page/page_visibility_state.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_coalesced_input_event.h" #include "third_party/blink/public/platform/web_cursor_info.h" -#include "third_party/blink/public/platform/web_display_mode.h" #include "third_party/blink/public/platform/web_drag_data.h" #include "third_party/blink/public/platform/web_drag_operation.h" #include "third_party/blink/public/platform/web_float_point.h" diff --git a/third_party/blink/renderer/core/frame/local_frame_view.h b/third_party/blink/renderer/core/frame/local_frame_view.h index 0d938f16101931..b5602e6982d079 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.h +++ b/third_party/blink/renderer/core/frame/local_frame_view.h @@ -30,8 +30,8 @@ #include #include "base/single_thread_task_runner.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/platform/shape_properties.h" -#include "third_party/blink/public/platform/web_display_mode.h" #include "third_party/blink/public/platform/web_rect.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/document_lifecycle.h" diff --git a/third_party/blink/renderer/core/frame/settings.h b/third_party/blink/renderer/core/frame/settings.h index e20ae99f1e19e2..30419bda9063a1 100644 --- a/third_party/blink/renderer/core/frame/settings.h +++ b/third_party/blink/renderer/core/frame/settings.h @@ -31,8 +31,8 @@ #include #include "base/macros.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/public/platform/pointer_properties.h" -#include "third_party/blink/public/platform/web_display_mode.h" #include "third_party/blink/public/platform/web_effective_connection_type.h" #include "third_party/blink/public/platform/web_viewport_style.h" #include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" diff --git a/third_party/blink/renderer/core/testing/internal_settings.h b/third_party/blink/renderer/core/testing/internal_settings.h index 29f5fd775412a7..a1bef292b5d44f 100644 --- a/third_party/blink/renderer/core/testing/internal_settings.h +++ b/third_party/blink/renderer/core/testing/internal_settings.h @@ -27,7 +27,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_TESTING_INTERNAL_SETTINGS_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_TESTING_INTERNAL_SETTINGS_H_ -#include "third_party/blink/public/platform/web_display_mode.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" #include "third_party/blink/renderer/core/editing/editing_behavior_types.h" #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/testing/internal_settings_generated.h" diff --git a/third_party/blink/renderer/modules/payments/payment_instruments.cc b/third_party/blink/renderer/modules/payments/payment_instruments.cc index 130e48232327b6..49144aa306883a 100644 --- a/third_party/blink/renderer/modules/payments/payment_instruments.cc +++ b/third_party/blink/renderer/modules/payments/payment_instruments.cc @@ -9,7 +9,7 @@ #include "base/location.h" #include "third_party/blink/public/common/feature_policy/feature_policy.h" #include "third_party/blink/public/mojom/feature_policy/feature_policy.mojom-blink.h" -#include "third_party/blink/public/platform/modules/manifest/manifest.mojom-blink.h" +#include "third_party/blink/public/mojom/manifest/manifest.mojom-blink.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/web_feature.mojom-blink.h" #include "third_party/blink/public/platform/web_icon_sizes_parser.h" diff --git a/third_party/blink/renderer/platform/mojo/blink_typemaps.gni b/third_party/blink/renderer/platform/mojo/blink_typemaps.gni index 1bf76441abac7a..fa6f80c21ae6bd 100644 --- a/third_party/blink/renderer/platform/mojo/blink_typemaps.gni +++ b/third_party/blink/renderer/platform/mojo/blink_typemaps.gni @@ -17,9 +17,9 @@ typemaps = [ "//third_party/blink/renderer/platform/mojo/security_origin.typemap", "//third_party/blink/renderer/platform/mojo/string.typemap", "//third_party/blink/renderer/platform/mojo/time.typemap", - "//third_party/blink/public/platform/display_mode.typemap", "//third_party/blink/public/platform/modules/bluetooth/bluetooth.typemap", "//third_party/blink/public/platform/modules/fetch/fetch_api_request.typemap", "//third_party/blink/public/platform/modules/notifications/notification_types.typemap", + "//third_party/blink/public/common/manifest/display_mode.typemap", "//third_party/blink/public/common/screen_orientation/screen_orientation_lock_types.typemap", ]