0

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 <dgozman@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Mathieu Perreault <mathp@chromium.org>
Reviewed-by: Mounir Lamouri <mlamouri@chromium.org>
Reviewed-by: Mikel Astiz <mastiz@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: David Trainor <dtrainor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554953}
This commit is contained in:
Dmitry Gozman
2018-05-01 01:17:40 +00:00
committed by Commit Bot
parent e4774fc791
commit c07726e17c
122 changed files with 920 additions and 813 deletions
chrome
components
content
services/device/public/mojom
third_party/blink

@@ -93,7 +93,7 @@ public class ShortcutHelper {
// be correctly populated into the WebappRegistry/WebappDataStorage. // be correctly populated into the WebappRegistry/WebappDataStorage.
public static final int WEBAPP_SHORTCUT_VERSION = 2; 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; public static final long MANIFEST_COLOR_INVALID_OR_MISSING = ((long) Integer.MAX_VALUE) + 1;
private static final String TAG = "ShortcutHelper"; private static final String TAG = "ShortcutHelper";

@@ -143,7 +143,6 @@ include_rules = [
"+third_party/blink/public/common", "+third_party/blink/public/common",
"+third_party/blink/public/mojom", "+third_party/blink/public/mojom",
"+third_party/blink/public/platform/web_cache.h", "+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_loading_behavior_flag.h",
"+third_party/blink/public/platform/web_gesture_event.h", "+third_party/blink/public/platform/web_gesture_event.h",
"+third_party/blink/public/platform/web_input_event.h", "+third_party/blink/public/platform/web_input_event.h",

@@ -15,7 +15,7 @@
#include "components/rappor/rappor_service_impl.h" #include "components/rappor/rappor_service_impl.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "jni/LaunchMetrics_jni.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" #include "url/gurl.h"
using base::android::JavaParamRef; using base::android::JavaParamRef;

@@ -24,8 +24,8 @@
#include "content/public/browser/manifest_icon_downloader.h" #include "content/public/browser/manifest_icon_downloader.h"
#include "content/public/browser/manifest_icon_selector.h" #include "content/public/browser/manifest_icon_selector.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/manifest.h"
#include "jni/ShortcutHelper_jni.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/android/java_bitmap.h"
#include "ui/gfx/color_analysis.h" #include "ui/gfx/color_analysis.h"
#include "url/gurl.h" #include "url/gurl.h"
@@ -138,7 +138,7 @@ void AddShortcutWithSkBitmap(const ShortcutInfo& info,
// static // static
std::unique_ptr<ShortcutInfo> ShortcutHelper::CreateShortcutInfo( std::unique_ptr<ShortcutInfo> ShortcutHelper::CreateShortcutInfo(
const GURL& manifest_url, const GURL& manifest_url,
const content::Manifest& manifest, const blink::Manifest& manifest,
const GURL& primary_icon_url, const GURL& primary_icon_url,
const GURL& badge_icon_url) { const GURL& badge_icon_url) {
auto shortcut_info = std::make_unique<ShortcutInfo>(GURL()); auto shortcut_info = std::make_unique<ShortcutInfo>(GURL());
@@ -156,7 +156,7 @@ std::unique_ptr<ShortcutInfo> ShortcutHelper::CreateShortcutInfo(
content::ManifestIconSelector::FindBestMatchingIcon( content::ManifestIconSelector::FindBestMatchingIcon(
manifest.icons, shortcut_info->ideal_splash_image_size_in_px, manifest.icons, shortcut_info->ideal_splash_image_size_in_px,
shortcut_info->minimum_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; return shortcut_info;
} }

@@ -34,7 +34,7 @@ class ShortcutHelper {
// screen. // screen.
static std::unique_ptr<ShortcutInfo> CreateShortcutInfo( static std::unique_ptr<ShortcutInfo> CreateShortcutInfo(
const GURL& manifest_url, const GURL& manifest_url,
const content::Manifest& manifest, const blink::Manifest& manifest,
const GURL& primary_icon_url, const GURL& primary_icon_url,
const GURL& badge_icon_url); const GURL& badge_icon_url);

@@ -10,8 +10,8 @@ ShortcutInfo::ShortcutInfo(const GURL& shortcut_url)
display(blink::kWebDisplayModeBrowser), display(blink::kWebDisplayModeBrowser),
orientation(blink::kWebScreenOrientationLockDefault), orientation(blink::kWebScreenOrientationLockDefault),
source(SOURCE_ADD_TO_HOMESCREEN_SHORTCUT), source(SOURCE_ADD_TO_HOMESCREEN_SHORTCUT),
theme_color(content::Manifest::kInvalidOrMissingColor), theme_color(blink::Manifest::kInvalidOrMissingColor),
background_color(content::Manifest::kInvalidOrMissingColor), background_color(blink::Manifest::kInvalidOrMissingColor),
ideal_splash_image_size_in_px(0), ideal_splash_image_size_in_px(0),
minimum_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() { ShortcutInfo::~ShortcutInfo() {
} }
void ShortcutInfo::UpdateFromManifest(const content::Manifest& manifest) { void ShortcutInfo::UpdateFromManifest(const blink::Manifest& manifest) {
if (!manifest.short_name.string().empty() || if (!manifest.short_name.string().empty() ||
!manifest.name.string().empty()) { !manifest.name.string().empty()) {
short_name = manifest.short_name.string(); 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. // 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; theme_color = manifest.theme_color;
// Set the background color based on the manifest value, if any. // 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; background_color = manifest.background_color;
// Sets the URL of the HTML splash screen, if any. // 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. // Set the icon urls based on the icons in the manifest, if any.
icon_urls.clear(); 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()); icon_urls.push_back(icon.src.spec());
if (manifest.share_target) if (manifest.share_target)

@@ -10,7 +10,7 @@
#include <vector> #include <vector>
#include "base/strings/string16.h" #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 "third_party/blink/public/common/screen_orientation/web_screen_orientation_lock_type.h"
#include "url/gurl.h" #include "url/gurl.h"
@@ -71,7 +71,7 @@ struct ShortcutInfo {
~ShortcutInfo(); ~ShortcutInfo();
// Updates the info based on the given |manifest|. // 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. // Updates the source of the shortcut.
void UpdateSource(const Source source); void UpdateSource(const Source source);

@@ -7,8 +7,8 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "content/public/common/manifest.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/manifest/manifest.h"
#include "url/gurl.h" #include "url/gurl.h"
class ShortcutInfoTest : public testing::Test { class ShortcutInfoTest : public testing::Test {
@@ -17,7 +17,7 @@ class ShortcutInfoTest : public testing::Test {
protected: protected:
ShortcutInfo info_; ShortcutInfo info_;
content::Manifest manifest_; blink::Manifest manifest_;
DISALLOW_COPY_AND_ASSIGN(ShortcutInfoTest); DISALLOW_COPY_AND_ASSIGN(ShortcutInfoTest);
}; };
@@ -50,7 +50,7 @@ TEST_F(ShortcutInfoTest, AllAttributesUpdate) {
manifest_.splash_screen_url = GURL("https://new.com/splash.html"); manifest_.splash_screen_url = GURL("https://new.com/splash.html");
info_.icon_urls.push_back("https://old.com/icon.png"); 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"); icon.src = GURL("https://new.com/icon.png");
manifest_.icons.push_back(icon); manifest_.icons.push_back(icon);

@@ -9,7 +9,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/time/time.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" #include "third_party/blink/public/common/screen_orientation/web_screen_orientation_lock_type.h"
// Structure with information about a WebAPK. // Structure with information about a WebAPK.

@@ -116,10 +116,10 @@ GURL GetScope(const ShortcutInfo& info) {
: ShortcutHelper::GetScopeFromURL(info.url); : 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. // string.
std::string ColorToString(int64_t color) { std::string ColorToString(int64_t color) {
if (color == content::Manifest::kInvalidOrMissingColor) if (color == blink::Manifest::kInvalidOrMissingColor)
return ""; return "";
SkColor sk_color = reinterpret_cast<uint32_t&>(color); SkColor sk_color = reinterpret_cast<uint32_t&>(color);
return color_utils::SkColorToRgbaString(sk_color); return color_utils::SkColorToRgbaString(sk_color);

@@ -15,8 +15,8 @@
#include "chrome/browser/installable/installable_manager.h" #include "chrome/browser/installable/installable_manager.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/manifest.h"
#include "jni/WebApkUpdateDataFetcher_jni.h" #include "jni/WebApkUpdateDataFetcher_jni.h"
#include "third_party/blink/public/common/manifest/manifest.h"
#include "third_party/smhasher/src/MurmurHash2.h" #include "third_party/smhasher/src/MurmurHash2.h"
#include "ui/gfx/android/java_bitmap.h" #include "ui/gfx/android/java_bitmap.h"
#include "ui/gfx/codec/png_codec.h" #include "ui/gfx/codec/png_codec.h"

@@ -14,7 +14,6 @@
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
namespace content { namespace content {
struct Manifest;
class WebContents; class WebContents;
} }

@@ -4,7 +4,7 @@
#include "chrome/browser/android/webapk/webapk_web_manifest_checker.h" #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" #include "url/gurl.h"
namespace { namespace {
@@ -19,8 +19,8 @@ bool IsUrlWebApkCompatible(const GURL& url) {
} // anonymous namespace } // anonymous namespace
bool AreWebManifestUrlsWebApkCompatible(const content::Manifest& manifest) { bool AreWebManifestUrlsWebApkCompatible(const blink::Manifest& manifest) {
for (const content::Manifest::Icon& icon : manifest.icons) { for (const blink::Manifest::Icon& icon : manifest.icons) {
if (!IsUrlWebApkCompatible(icon.src)) if (!IsUrlWebApkCompatible(icon.src))
return false; return false;
} }

@@ -5,12 +5,12 @@
#ifndef CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_WEB_MANIFEST_CHECKER_H_ #ifndef CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_WEB_MANIFEST_CHECKER_H_
#define 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; struct Manifest;
} }
// Returns whether the format of the URLs in the Web Manifest is WebAPK // Returns whether the format of the URLs in the Web Manifest is WebAPK
// compatible. // compatible.
bool AreWebManifestUrlsWebApkCompatible(const content::Manifest& manifest); bool AreWebManifestUrlsWebApkCompatible(const blink::Manifest& manifest);
#endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_WEB_MANIFEST_CHECKER_H_ #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_WEB_MANIFEST_CHECKER_H_

@@ -5,9 +5,9 @@
#include "chrome/browser/android/webapk/webapk_web_manifest_checker.h" #include "chrome/browser/android/webapk/webapk_web_manifest_checker.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "content/public/common/manifest.h"
#include "testing/gtest/include/gtest/gtest.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" #include "url/gurl.h"
namespace { namespace {
@@ -16,14 +16,14 @@ base::NullableString16 ToNullableUTF16(const std::string& str) {
return base::NullableString16(base::UTF8ToUTF16(str), false); return base::NullableString16(base::UTF8ToUTF16(str), false);
} }
content::Manifest GetValidManifest() { blink::Manifest GetValidManifest() {
content::Manifest manifest; blink::Manifest manifest;
manifest.name = ToNullableUTF16("foo"); manifest.name = ToNullableUTF16("foo");
manifest.short_name = ToNullableUTF16("bar"); manifest.short_name = ToNullableUTF16("bar");
manifest.start_url = GURL("http://example.com"); manifest.start_url = GURL("http://example.com");
manifest.display = blink::kWebDisplayModeStandalone; manifest.display = blink::kWebDisplayModeStandalone;
content::Manifest::Icon icon; blink::Manifest::Icon icon;
icon.type = base::ASCIIToUTF16("image/png"); icon.type = base::ASCIIToUTF16("image/png");
icon.sizes.push_back(gfx::Size(144, 144)); icon.sizes.push_back(gfx::Size(144, 144));
manifest.icons.push_back(icon); manifest.icons.push_back(icon);
@@ -34,14 +34,14 @@ content::Manifest GetValidManifest() {
} // anonymous namespace } // anonymous namespace
TEST(WebApkWebManifestCheckerTest, Compatible) { TEST(WebApkWebManifestCheckerTest, Compatible) {
content::Manifest manifest = GetValidManifest(); blink::Manifest manifest = GetValidManifest();
EXPECT_TRUE(AreWebManifestUrlsWebApkCompatible(manifest)); EXPECT_TRUE(AreWebManifestUrlsWebApkCompatible(manifest));
} }
TEST(WebApkWebManifestCheckerTest, CompatibleURLHasNoPassword) { TEST(WebApkWebManifestCheckerTest, CompatibleURLHasNoPassword) {
const GURL kUrlWithPassword("http://answer:42@life/universe/and/everything"); const GURL kUrlWithPassword("http://answer:42@life/universe/and/everything");
content::Manifest manifest = GetValidManifest(); blink::Manifest manifest = GetValidManifest();
manifest.start_url = kUrlWithPassword; manifest.start_url = kUrlWithPassword;
EXPECT_FALSE(AreWebManifestUrlsWebApkCompatible(manifest)); EXPECT_FALSE(AreWebManifestUrlsWebApkCompatible(manifest));

@@ -26,8 +26,8 @@
#include "content/public/browser/manifest_icon_selector.h" #include "content/public/browser/manifest_icon_selector.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.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/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 "third_party/blink/public/common/screen_orientation/web_screen_orientation_lock_type.h"
#include "ui/gfx/codec/png_codec.h" #include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/favicon_size.h" #include "ui/gfx/favicon_size.h"
@@ -241,7 +241,7 @@ void AddToHomescreenDataFetcher::OnDidGetManifestAndIcons(
content::ManifestIconSelector::FindBestMatchingIcon( content::ManifestIconSelector::FindBestMatchingIcon(
data.manifest->icons, shortcut_info_.ideal_splash_image_size_in_px, data.manifest->icons, shortcut_info_.ideal_splash_image_size_in_px,
shortcut_info_.minimum_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) { if (data.badge_icon) {
shortcut_info_.best_badge_icon_url = data.badge_icon_url; shortcut_info_.best_badge_icon_url = data.badge_icon_url;
badge_icon_ = *data.badge_icon; badge_icon_ = *data.badge_icon;

@@ -25,8 +25,8 @@
#include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/manifest.h" #include "third_party/blink/public/common/manifest/manifest.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/image/image_unittest_util.h" #include "ui/gfx/image/image_unittest_util.h"
#include "url/gurl.h" #include "url/gurl.h"
@@ -103,18 +103,18 @@ base::NullableString16 NullableStringFromUTF8(const std::string& value) {
return base::NullableString16(base::UTF8ToUTF16(value), false); return base::NullableString16(base::UTF8ToUTF16(value), false);
} }
// Builds WebAPK compatible content::Manifest. // Builds WebAPK compatible blink::Manifest.
content::Manifest BuildDefaultManifest() { blink::Manifest BuildDefaultManifest() {
content::Manifest manifest; blink::Manifest manifest;
manifest.name = NullableStringFromUTF8(kDefaultManifestName); manifest.name = NullableStringFromUTF8(kDefaultManifestName);
manifest.short_name = NullableStringFromUTF8(kDefaultManifestShortName); manifest.short_name = NullableStringFromUTF8(kDefaultManifestShortName);
manifest.start_url = GURL(kDefaultStartUrl); manifest.start_url = GURL(kDefaultStartUrl);
manifest.display = kDefaultManifestDisplayMode; manifest.display = kDefaultManifestDisplayMode;
content::Manifest::Icon primary_icon; blink::Manifest::Icon primary_icon;
primary_icon.type = base::ASCIIToUTF16("image/png"); primary_icon.type = base::ASCIIToUTF16("image/png");
primary_icon.sizes.push_back(gfx::Size(144, 144)); 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); primary_icon.src = GURL(kDefaultIconUrl);
manifest.icons.push_back(primary_icon); manifest.icons.push_back(primary_icon);
@@ -177,7 +177,7 @@ class TestInstallableManager : public InstallableManager {
void SetInstallable(bool is_installable) { is_installable_ = is_installable; } void SetInstallable(bool is_installable) { is_installable_ = is_installable; }
void SetManifest(const content::Manifest& manifest) { void SetManifest(const blink::Manifest& manifest) {
manifest_ = manifest; manifest_ = manifest;
if (!manifest.icons.empty()) { if (!manifest.icons.empty()) {
@@ -202,7 +202,7 @@ class TestInstallableManager : public InstallableManager {
void ResolveQueuedMetrics() { std::move(queued_metrics_callback_).Run(); } void ResolveQueuedMetrics() { std::move(queued_metrics_callback_).Run(); }
private: private:
content::Manifest manifest_; blink::Manifest manifest_;
GURL primary_icon_url_; GURL primary_icon_url_;
GURL badge_icon_url_; GURL badge_icon_url_;
std::unique_ptr<SkBitmap> primary_icon_; std::unique_ptr<SkBitmap> primary_icon_;
@@ -290,7 +290,7 @@ class AddToHomescreenDataFetcherTest : public ChromeRenderViewHostTestHarness {
histograms.ExpectTotalCount("Webapp.AddToHomescreenDialog.Timeout", 1); histograms.ExpectTotalCount("Webapp.AddToHomescreenDialog.Timeout", 1);
} }
void SetManifest(const content::Manifest& manifest) { void SetManifest(const blink::Manifest& manifest) {
installable_manager_->SetManifest(manifest); installable_manager_->SetManifest(manifest);
} }
@@ -329,7 +329,7 @@ TEST_F(AddToHomescreenDataFetcherTest, EmptyManifest) {
TEST_F(AddToHomescreenDataFetcherTest, NoIconManifest) { TEST_F(AddToHomescreenDataFetcherTest, NoIconManifest) {
// Test a manifest with no icons. This should use the short name and have // Test a manifest with no icons. This should use the short name and have
// a generated icon (empty icon url). // a generated icon (empty icon url).
content::Manifest manifest = BuildDefaultManifest(); blink::Manifest manifest = BuildDefaultManifest();
manifest.icons.clear(); manifest.icons.clear();
SetManifest(manifest); SetManifest(manifest);
@@ -486,7 +486,7 @@ TEST_F(AddToHomescreenDataFetcherTest, ServiceWorkerCheckTimesOutUnknown) {
TEST_F(AddToHomescreenDataFetcherTest, InstallableManifest) { TEST_F(AddToHomescreenDataFetcherTest, InstallableManifest) {
// Test a site that has an offline-capable service worker. // Test a site that has an offline-capable service worker.
content::Manifest manifest(BuildDefaultManifest()); blink::Manifest manifest(BuildDefaultManifest());
SetManifest(manifest); SetManifest(manifest);
base::HistogramTester histograms; base::HistogramTester histograms;
@@ -513,7 +513,7 @@ TEST_F(AddToHomescreenDataFetcherTest, ManifestNameClobbersWebApplicationName) {
// Manifest::short_name that Manifest::name is used as the title. // Manifest::short_name that Manifest::name is used as the title.
{ {
// Check the case where we have no icons. // Check the case where we have no icons.
content::Manifest manifest = BuildDefaultManifest(); blink::Manifest manifest = BuildDefaultManifest();
manifest.icons.clear(); manifest.icons.clear();
manifest.short_name = base::NullableString16(); manifest.short_name = base::NullableString16();
SetManifest(manifest); SetManifest(manifest);
@@ -528,7 +528,7 @@ TEST_F(AddToHomescreenDataFetcherTest, ManifestNameClobbersWebApplicationName) {
kDefaultManifestName)); kDefaultManifestName));
} }
content::Manifest manifest(BuildDefaultManifest()); blink::Manifest manifest(BuildDefaultManifest());
manifest.short_name = base::NullableString16(); manifest.short_name = base::NullableString16();
SetManifest(manifest); SetManifest(manifest);
@@ -585,7 +585,7 @@ TEST_F(AddToHomescreenDataFetcherTest, ManifestNoNameNoShortName) {
// - The page is not WebAPK compatible. // - The page is not WebAPK compatible.
// - WebApplicationInfo::title is used as the "name". // - WebApplicationInfo::title is used as the "name".
// - We still use the icons from the manifest. // - We still use the icons from the manifest.
content::Manifest manifest(BuildDefaultManifest()); blink::Manifest manifest(BuildDefaultManifest());
manifest.name = base::NullableString16(); manifest.name = base::NullableString16();
manifest.short_name = base::NullableString16(); manifest.short_name = base::NullableString16();

@@ -26,7 +26,7 @@ infobars::InfoBar* AppBannerInfoBarDelegateDesktop::Create(
content::WebContents* web_contents, content::WebContents* web_contents,
base::WeakPtr<AppBannerManager> weak_manager, base::WeakPtr<AppBannerManager> weak_manager,
extensions::BookmarkAppHelper* bookmark_app_helper, extensions::BookmarkAppHelper* bookmark_app_helper,
const content::Manifest& manifest) { const blink::Manifest& manifest) {
InfoBarService* infobar_service = InfoBarService* infobar_service =
InfoBarService::FromWebContents(web_contents); InfoBarService::FromWebContents(web_contents);
return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar(
@@ -38,7 +38,7 @@ infobars::InfoBar* AppBannerInfoBarDelegateDesktop::Create(
AppBannerInfoBarDelegateDesktop::AppBannerInfoBarDelegateDesktop( AppBannerInfoBarDelegateDesktop::AppBannerInfoBarDelegateDesktop(
base::WeakPtr<AppBannerManager> weak_manager, base::WeakPtr<AppBannerManager> weak_manager,
extensions::BookmarkAppHelper* bookmark_app_helper, extensions::BookmarkAppHelper* bookmark_app_helper,
const content::Manifest& manifest) const blink::Manifest& manifest)
: ConfirmInfoBarDelegate(), : ConfirmInfoBarDelegate(),
weak_manager_(weak_manager), weak_manager_(weak_manager),
bookmark_app_helper_(bookmark_app_helper), bookmark_app_helper_(bookmark_app_helper),

@@ -9,7 +9,7 @@
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "components/infobars/core/confirm_infobar_delegate.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 { namespace content {
class WebContents; class WebContents;
@@ -34,13 +34,13 @@ class AppBannerInfoBarDelegateDesktop : public ConfirmInfoBarDelegate {
content::WebContents* web_contents, content::WebContents* web_contents,
base::WeakPtr<AppBannerManager> weak_manager, base::WeakPtr<AppBannerManager> weak_manager,
extensions::BookmarkAppHelper* bookmark_app_helper, extensions::BookmarkAppHelper* bookmark_app_helper,
const content::Manifest& manifest); const blink::Manifest& manifest);
private: private:
AppBannerInfoBarDelegateDesktop( AppBannerInfoBarDelegateDesktop(
base::WeakPtr<AppBannerManager> weak_manager, base::WeakPtr<AppBannerManager> weak_manager,
extensions::BookmarkAppHelper* bookmark_app_helper, extensions::BookmarkAppHelper* bookmark_app_helper,
const content::Manifest& manifest); const blink::Manifest& manifest);
~AppBannerInfoBarDelegateDesktop() override; ~AppBannerInfoBarDelegateDesktop() override;
// ConfirmInfoBarDelegate: // ConfirmInfoBarDelegate:
@@ -54,7 +54,7 @@ class AppBannerInfoBarDelegateDesktop : public ConfirmInfoBarDelegate {
base::WeakPtr<AppBannerManager> weak_manager_; base::WeakPtr<AppBannerManager> weak_manager_;
extensions::BookmarkAppHelper* bookmark_app_helper_; extensions::BookmarkAppHelper* bookmark_app_helper_;
content::Manifest manifest_; blink::Manifest manifest_;
bool has_user_interaction_; bool has_user_interaction_;
DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateDesktop); DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateDesktop);

@@ -400,7 +400,7 @@ void AppBannerManager::ResetBindings() {
void AppBannerManager::ResetCurrentPageData() { void AppBannerManager::ResetCurrentPageData() {
active_media_players_.clear(); active_media_players_.clear();
manifest_ = content::Manifest(); manifest_ = blink::Manifest();
manifest_url_ = GURL(); manifest_url_ = GURL();
validated_url_ = GURL(); validated_url_ = GURL();
referrer_.erase(); referrer_.erase();

@@ -19,8 +19,8 @@
#include "chrome/browser/installable/installable_metrics.h" #include "chrome/browser/installable/installable_metrics.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "mojo/public/cpp/bindings/binding.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/modules/app_banner/app_banner.mojom.h"
#include "third_party/blink/public/platform/web_display_mode.h"
class InstallableManager; class InstallableManager;
class SkBitmap; class SkBitmap;
@@ -281,7 +281,7 @@ class AppBannerManager : public content::WebContentsObserver,
GURL manifest_url_; GURL manifest_url_;
// The manifest object. // The manifest object.
content::Manifest manifest_; blink::Manifest manifest_;
// The URL of the primary icon. // The URL of the primary icon.
GURL primary_icon_url_; GURL primary_icon_url_;

@@ -6,7 +6,7 @@
#define CHROME_BROWSER_BANNERS_APP_BANNER_METRICS_H_ #define CHROME_BROWSER_BANNERS_APP_BANNER_METRICS_H_
#include "chrome/browser/installable/installable_logging.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 { namespace banners {

@@ -353,7 +353,7 @@ class ChromeServiceWorkerManifestFetchTest
static void ManifestCallbackAndRun(const base::Closure& continuation, static void ManifestCallbackAndRun(const base::Closure& continuation,
const GURL&, const GURL&,
const content::Manifest&) { const blink::Manifest&) {
continuation.Run(); continuation.Run();
} }

@@ -65,7 +65,7 @@
#include "net/url_request/url_request.h" #include "net/url_request/url_request.h"
#include "skia/ext/image_operations.h" #include "skia/ext/image_operations.h"
#include "skia/ext/platform_canvas.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 "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/canvas.h" #include "ui/gfx/canvas.h"
@@ -338,7 +338,7 @@ namespace extensions {
// static // static
void BookmarkAppHelper::UpdateWebAppInfoFromManifest( void BookmarkAppHelper::UpdateWebAppInfoFromManifest(
const content::Manifest& manifest, const blink::Manifest& manifest,
WebApplicationInfo* web_app_info, WebApplicationInfo* web_app_info,
ForInstallableSite for_installable_site) { ForInstallableSite for_installable_site) {
if (!manifest.short_name.is_null()) if (!manifest.short_name.is_null())
@@ -362,7 +362,7 @@ void BookmarkAppHelper::UpdateWebAppInfoFromManifest(
web_app_info->scope = manifest.start_url.Resolve("."); 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<SkColor>(manifest.theme_color); web_app_info->theme_color = static_cast<SkColor>(manifest.theme_color);
// If any icons are specified in the manifest, they take precedence over any // If any icons are specified in the manifest, they take precedence over any

@@ -18,7 +18,7 @@
#include "chrome/common/web_application_info.h" #include "chrome/common/web_application_info.h"
#include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.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 ExtensionService;
class FaviconDownloader; class FaviconDownloader;
@@ -71,7 +71,7 @@ class BookmarkAppHelper : public content::NotificationObserver {
~BookmarkAppHelper() override; ~BookmarkAppHelper() override;
// Update the given WebApplicationInfo with information from the manifest. // 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, WebApplicationInfo* web_app_info,
ForInstallableSite installable_site); ForInstallableSite installable_site);

@@ -299,7 +299,7 @@ class TestBookmarkAppHelper : public BookmarkAppHelper {
} }
void CompleteInstallableCheck(const char* manifest_url, void CompleteInstallableCheck(const char* manifest_url,
const content::Manifest& manifest, const blink::Manifest& manifest,
ForInstallableSite for_installable_site) { ForInstallableSite for_installable_site) {
bool installable = for_installable_site == ForInstallableSite::kYes; bool installable = for_installable_site == ForInstallableSite::kYes;
InstallableData data = { InstallableData data = {
@@ -349,7 +349,7 @@ TEST_F(BookmarkAppHelperExtensionServiceTest, CreateBookmarkApp) {
helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete, helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete,
base::Unretained(&helper))); base::Unretained(&helper)));
helper.CompleteInstallableCheck(kManifestUrl, content::Manifest(), helper.CompleteInstallableCheck(kManifestUrl, blink::Manifest(),
ForInstallableSite::kNo); ForInstallableSite::kNo);
std::map<GURL, std::vector<SkBitmap> > icon_map; std::map<GURL, std::vector<SkBitmap> > icon_map;
@@ -399,7 +399,7 @@ TEST_P(BookmarkAppHelperExtensionServiceInstallableSiteTest,
helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete, helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete,
base::Unretained(&helper))); base::Unretained(&helper)));
content::Manifest manifest; blink::Manifest manifest;
manifest.start_url = GURL(kAppUrl); manifest.start_url = GURL(kAppUrl);
manifest.name = base::NullableString16(base::UTF8ToUTF16(kAppTitle), false); manifest.name = base::NullableString16(base::UTF8ToUTF16(kAppTitle), false);
manifest.scope = GURL(kAppScope); manifest.scope = GURL(kAppScope);
@@ -441,11 +441,11 @@ TEST_P(BookmarkAppHelperExtensionServiceInstallableSiteTest,
helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete, helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete,
base::Unretained(&helper))); base::Unretained(&helper)));
content::Manifest manifest; blink::Manifest manifest;
manifest.start_url = GURL(kAppUrl); manifest.start_url = GURL(kAppUrl);
manifest.name = base::NullableString16(base::UTF8ToUTF16(kAppTitle), false); manifest.name = base::NullableString16(base::UTF8ToUTF16(kAppTitle), false);
manifest.scope = GURL(kAppScope); manifest.scope = GURL(kAppScope);
content::Manifest::Icon icon; blink::Manifest::Icon icon;
icon.src = GURL(kAppIconURL1); icon.src = GURL(kAppIconURL1);
manifest.icons.push_back(icon); manifest.icons.push_back(icon);
icon.src = GURL(kAppIconURL2); icon.src = GURL(kAppIconURL2);
@@ -491,7 +491,7 @@ TEST_P(BookmarkAppHelperExtensionServiceInstallableSiteTest,
helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete, helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete,
base::Unretained(&helper))); base::Unretained(&helper)));
content::Manifest manifest; blink::Manifest manifest;
manifest.start_url = GURL(kAppUrl); manifest.start_url = GURL(kAppUrl);
manifest.name = base::NullableString16(base::UTF8ToUTF16(kAppTitle), false); manifest.name = base::NullableString16(base::UTF8ToUTF16(kAppTitle), false);
helper.CompleteInstallableCheck(kManifestUrl, manifest, GetParam()); helper.CompleteInstallableCheck(kManifestUrl, manifest, GetParam());
@@ -525,7 +525,7 @@ TEST_F(BookmarkAppHelperExtensionServiceTest,
std::unique_ptr<content::WebContents> contents( std::unique_ptr<content::WebContents> contents(
content::WebContentsTester::CreateTestWebContents(profile(), nullptr)); content::WebContentsTester::CreateTestWebContents(profile(), nullptr));
content::Manifest manifest; blink::Manifest manifest;
manifest.start_url = GURL(kAppUrl); manifest.start_url = GURL(kAppUrl);
manifest.name = base::NullableString16(base::UTF8ToUTF16(kAppTitle), false); manifest.name = base::NullableString16(base::UTF8ToUTF16(kAppTitle), false);
manifest.scope = GURL(kAppScope); manifest.scope = GURL(kAppScope);
@@ -578,7 +578,7 @@ TEST_F(BookmarkAppHelperExtensionServiceTest,
helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete, helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete,
base::Unretained(&helper))); base::Unretained(&helper)));
helper.CompleteInstallableCheck(kManifestUrl, content::Manifest(), helper.CompleteInstallableCheck(kManifestUrl, blink::Manifest(),
ForInstallableSite::kNo); ForInstallableSite::kNo);
std::map<GURL, std::vector<SkBitmap>> icon_map; std::map<GURL, std::vector<SkBitmap>> icon_map;
helper.CompleteIconDownload(true, icon_map); helper.CompleteIconDownload(true, icon_map);
@@ -746,7 +746,7 @@ TEST_F(BookmarkAppHelperTest, UpdateWebAppInfoFromManifest) {
info.url = GURL(kAppIcon1); info.url = GURL(kAppIcon1);
web_app_info.icons.push_back(info); web_app_info.icons.push_back(info);
content::Manifest manifest; blink::Manifest manifest;
manifest.start_url = GURL(kAppUrl); manifest.start_url = GURL(kAppUrl);
manifest.short_name = base::NullableString16(base::UTF8ToUTF16(kAppShortName), manifest.short_name = base::NullableString16(base::UTF8ToUTF16(kAppShortName),
false); false);
@@ -765,7 +765,7 @@ TEST_F(BookmarkAppHelperTest, UpdateWebAppInfoFromManifest) {
// that icons provided by the manifest replace icons in |web_app_info|. // that icons provided by the manifest replace icons in |web_app_info|.
manifest.name = base::NullableString16(base::UTF8ToUTF16(kAppTitle), false); manifest.name = base::NullableString16(base::UTF8ToUTF16(kAppTitle), false);
content::Manifest::Icon icon; blink::Manifest::Icon icon;
icon.src = GURL(kAppIcon2); icon.src = GURL(kAppIcon2);
manifest.icons.push_back(icon); manifest.icons.push_back(icon);
icon.src = GURL(kAppIcon3); icon.src = GURL(kAppIcon3);
@@ -783,7 +783,7 @@ TEST_F(BookmarkAppHelperTest, UpdateWebAppInfoFromManifest) {
// Tests "scope" is only set for installable sites. // Tests "scope" is only set for installable sites.
TEST_F(BookmarkAppHelperTest, UpdateWebAppInfoFromManifestInstallableSite) { TEST_F(BookmarkAppHelperTest, UpdateWebAppInfoFromManifestInstallableSite) {
{ {
content::Manifest manifest; blink::Manifest manifest;
manifest.start_url = GURL(kAppUrl); manifest.start_url = GURL(kAppUrl);
WebApplicationInfo web_app_info; WebApplicationInfo web_app_info;
BookmarkAppHelper::UpdateWebAppInfoFromManifest( BookmarkAppHelper::UpdateWebAppInfoFromManifest(
@@ -793,7 +793,7 @@ TEST_F(BookmarkAppHelperTest, UpdateWebAppInfoFromManifestInstallableSite) {
} }
{ {
content::Manifest manifest; blink::Manifest manifest;
manifest.start_url = GURL(kAppUrl); manifest.start_url = GURL(kAppUrl);
WebApplicationInfo web_app_info; WebApplicationInfo web_app_info;
BookmarkAppHelper::UpdateWebAppInfoFromManifest( BookmarkAppHelper::UpdateWebAppInfoFromManifest(
@@ -802,7 +802,7 @@ TEST_F(BookmarkAppHelperTest, UpdateWebAppInfoFromManifestInstallableSite) {
} }
{ {
content::Manifest manifest; blink::Manifest manifest;
manifest.start_url = GURL(kAppUrl); manifest.start_url = GURL(kAppUrl);
WebApplicationInfo web_app_info; WebApplicationInfo web_app_info;
BookmarkAppHelper::UpdateWebAppInfoFromManifest( BookmarkAppHelper::UpdateWebAppInfoFromManifest(

@@ -241,7 +241,7 @@ void InfoBarUiTest::ShowUi(const std::string& name) {
switch (expected_identifiers_.back()) { switch (expected_identifiers_.back()) {
case IBD::APP_BANNER_INFOBAR_DELEGATE: case IBD::APP_BANNER_INFOBAR_DELEGATE:
banners::AppBannerInfoBarDelegateDesktop::Create( banners::AppBannerInfoBarDelegateDesktop::Create(
GetWebContents(), nullptr, nullptr, content::Manifest()); GetWebContents(), nullptr, nullptr, blink::Manifest());
break; break;
case IBD::HUNG_PLUGIN_INFOBAR_DELEGATE: case IBD::HUNG_PLUGIN_INFOBAR_DELEGATE:

@@ -6,7 +6,7 @@
InstallableData::InstallableData(InstallableStatusCode error_code, InstallableData::InstallableData(InstallableStatusCode error_code,
GURL manifest_url, GURL manifest_url,
const content::Manifest* manifest, const blink::Manifest* manifest,
GURL primary_icon_url, GURL primary_icon_url,
const SkBitmap* primary_icon, const SkBitmap* primary_icon,
GURL badge_icon_url, GURL badge_icon_url,

@@ -6,7 +6,7 @@
#define CHROME_BROWSER_INSTALLABLE_INSTALLABLE_DATA_H_ #define CHROME_BROWSER_INSTALLABLE_INSTALLABLE_DATA_H_
#include "chrome/browser/installable/installable_logging.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 "third_party/skia/include/core/SkBitmap.h"
#include "url/gurl.h" #include "url/gurl.h"
@@ -17,7 +17,7 @@
struct InstallableData { struct InstallableData {
InstallableData(InstallableStatusCode error_code, InstallableData(InstallableStatusCode error_code,
GURL manifest_url, GURL manifest_url,
const content::Manifest* manifest, const blink::Manifest* manifest,
GURL primary_icon_url, GURL primary_icon_url,
const SkBitmap* primary_icon, const SkBitmap* primary_icon,
GURL badge_icon_url, GURL badge_icon_url,
@@ -33,7 +33,7 @@ struct InstallableData {
const GURL manifest_url; const GURL manifest_url;
// Empty if the site has an unparseable manifest. // Empty if the site has an unparseable manifest.
const content::Manifest* manifest; const blink::Manifest* manifest;
// Empty if no primary_icon was requested. // Empty if no primary_icon was requested.
const GURL primary_icon_url; const GURL primary_icon_url;

@@ -19,7 +19,7 @@
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
#include "content/public/browser/storage_partition.h" #include "content/public/browser/storage_partition.h"
#include "net/base/url_util.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) #if defined(OS_ANDROID)
#include "chrome/browser/android/shortcut_helper.h" #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 // Returns true if |manifest| specifies a PNG icon with IconPurpose::ANY and of
// height and width >= kMinimumPrimaryIconSizeInPx (or size "any"). // 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) { for (const auto& icon : manifest.icons) {
// The type field is optional. If it isn't present, fall back on checking // 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. // the src extension, and allow the icon if the extension ends with png.
@@ -92,7 +92,7 @@ bool DoesManifestContainRequiredIcon(const content::Manifest& manifest) {
continue; continue;
if (!base::ContainsValue(icon.purpose, if (!base::ContainsValue(icon.purpose,
content::Manifest::Icon::IconPurpose::ANY)) { blink::Manifest::Icon::IconPurpose::ANY)) {
continue; continue;
} }
@@ -443,7 +443,7 @@ void InstallableManager::FetchManifest() {
} }
void InstallableManager::OnDidGetManifest(const GURL& manifest_url, void InstallableManager::OnDidGetManifest(const GURL& manifest_url,
const content::Manifest& manifest) { const blink::Manifest& manifest) {
if (!GetWebContents()) if (!GetWebContents())
return; return;
@@ -471,7 +471,7 @@ void InstallableManager::CheckManifestValid() {
} }
bool InstallableManager::IsManifestValidForWebApp( bool InstallableManager::IsManifestValidForWebApp(
const content::Manifest& manifest) { const blink::Manifest& manifest) {
if (manifest.IsEmpty()) { if (manifest.IsEmpty()) {
valid_manifest_->error = MANIFEST_EMPTY; valid_manifest_->error = MANIFEST_EMPTY;
return false; return false;
@@ -644,7 +644,7 @@ const GURL& InstallableManager::manifest_url() const {
return manifest_->url; return manifest_->url;
} }
const content::Manifest& InstallableManager::manifest() const { const blink::Manifest& InstallableManager::manifest() const {
return manifest_->manifest; return manifest_->manifest;
} }

@@ -22,7 +22,7 @@
#include "content/public/browser/service_worker_context_observer.h" #include "content/public/browser/service_worker_context_observer.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.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 "third_party/skia/include/core/SkBitmap.h"
#include "url/gurl.h" #include "url/gurl.h"
@@ -87,7 +87,7 @@ class InstallableManager
FRIEND_TEST_ALL_PREFIXES(InstallableManagerBrowserTest, FRIEND_TEST_ALL_PREFIXES(InstallableManagerBrowserTest,
ManifestUrlChangeFlushesState); ManifestUrlChangeFlushesState);
using IconPurpose = content::Manifest::Icon::IconPurpose; using IconPurpose = blink::Manifest::Icon::IconPurpose;
struct EligiblityProperty { struct EligiblityProperty {
InstallableStatusCode error = NO_ERROR_DETECTED; InstallableStatusCode error = NO_ERROR_DETECTED;
@@ -97,7 +97,7 @@ class InstallableManager
struct ManifestProperty { struct ManifestProperty {
InstallableStatusCode error = NO_ERROR_DETECTED; InstallableStatusCode error = NO_ERROR_DETECTED;
GURL url; GURL url;
content::Manifest manifest; blink::Manifest manifest;
bool fetched = false; bool fetched = false;
}; };
@@ -177,10 +177,10 @@ class InstallableManager
void CheckEligiblity(); void CheckEligiblity();
void FetchManifest(); void FetchManifest();
void OnDidGetManifest(const GURL& manifest_url, void OnDidGetManifest(const GURL& manifest_url,
const content::Manifest& manifest); const blink::Manifest& manifest);
void CheckManifestValid(); void CheckManifestValid();
bool IsManifestValidForWebApp(const content::Manifest& manifest); bool IsManifestValidForWebApp(const blink::Manifest& manifest);
void CheckServiceWorker(); void CheckServiceWorker();
void OnDidCheckHasServiceWorker(content::ServiceWorkerCapability capability); void OnDidCheckHasServiceWorker(content::ServiceWorkerCapability capability);
@@ -201,7 +201,7 @@ class InstallableManager
void WebContentsDestroyed() override; void WebContentsDestroyed() override;
const GURL& manifest_url() const; const GURL& manifest_url() const;
const content::Manifest& manifest() const; const blink::Manifest& manifest() const;
bool valid_manifest(); bool valid_manifest();
bool has_worker(); bool has_worker();

@@ -18,7 +18,7 @@
#include "content/public/test/browser_test_utils.h" #include "content/public/test/browser_test_utils.h"
#include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/embedded_test_server.h"
using IconPurpose = content::Manifest::Icon::IconPurpose; using IconPurpose = blink::Manifest::Icon::IconPurpose;
namespace { namespace {
@@ -116,7 +116,7 @@ class CallbackTester {
InstallableStatusCode error_code() const { return error_code_; } InstallableStatusCode error_code() const { return error_code_; }
const GURL& manifest_url() const { return manifest_url_; } 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 GURL& primary_icon_url() const { return primary_icon_url_; }
const SkBitmap* primary_icon() const { return primary_icon_.get(); } const SkBitmap* primary_icon() const { return primary_icon_.get(); }
const GURL& badge_icon_url() const { return badge_icon_url_; } const GURL& badge_icon_url() const { return badge_icon_url_; }
@@ -128,7 +128,7 @@ class CallbackTester {
base::Closure quit_closure_; base::Closure quit_closure_;
InstallableStatusCode error_code_; InstallableStatusCode error_code_;
GURL manifest_url_; GURL manifest_url_;
content::Manifest manifest_; blink::Manifest manifest_;
GURL primary_icon_url_; GURL primary_icon_url_;
std::unique_ptr<SkBitmap> primary_icon_; std::unique_ptr<SkBitmap> primary_icon_;
GURL badge_icon_url_; GURL badge_icon_url_;
@@ -187,7 +187,7 @@ class NestedCallbackTester {
base::Closure quit_closure_; base::Closure quit_closure_;
InstallableStatusCode error_code_; InstallableStatusCode error_code_;
GURL manifest_url_; GURL manifest_url_;
content::Manifest manifest_; blink::Manifest manifest_;
GURL primary_icon_url_; GURL primary_icon_url_;
std::unique_ptr<SkBitmap> primary_icon_; std::unique_ptr<SkBitmap> primary_icon_;
bool valid_manifest_; bool valid_manifest_;

@@ -6,9 +6,9 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.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 { class InstallableManagerUnitTest : public testing::Test {
public: public:
@@ -20,14 +20,14 @@ class InstallableManagerUnitTest : public testing::Test {
return base::NullableString16(base::UTF8ToUTF16(str), false); return base::NullableString16(base::UTF8ToUTF16(str), false);
} }
static content::Manifest GetValidManifest() { static blink::Manifest GetValidManifest() {
content::Manifest manifest; blink::Manifest manifest;
manifest.name = ToNullableUTF16("foo"); manifest.name = ToNullableUTF16("foo");
manifest.short_name = ToNullableUTF16("bar"); manifest.short_name = ToNullableUTF16("bar");
manifest.start_url = GURL("http://example.com"); manifest.start_url = GURL("http://example.com");
manifest.display = blink::kWebDisplayModeStandalone; manifest.display = blink::kWebDisplayModeStandalone;
content::Manifest::Icon primary_icon; blink::Manifest::Icon primary_icon;
primary_icon.type = base::ASCIIToUTF16("image/png"); primary_icon.type = base::ASCIIToUTF16("image/png");
primary_icon.sizes.push_back(gfx::Size(144, 144)); primary_icon.sizes.push_back(gfx::Size(144, 144));
primary_icon.purpose.push_back(IconPurpose::ANY); primary_icon.purpose.push_back(IconPurpose::ANY);
@@ -38,7 +38,7 @@ class InstallableManagerUnitTest : public testing::Test {
return manifest; return manifest;
} }
bool IsManifestValid(const content::Manifest& manifest) { bool IsManifestValid(const blink::Manifest& manifest) {
// Explicitly reset the error code before running the method. // Explicitly reset the error code before running the method.
manager_->set_valid_manifest_error(NO_ERROR_DETECTED); manager_->set_valid_manifest_error(NO_ERROR_DETECTED);
return manager_->IsManifestValidForWebApp(manifest); return manager_->IsManifestValidForWebApp(manifest);
@@ -53,19 +53,19 @@ class InstallableManagerUnitTest : public testing::Test {
}; };
TEST_F(InstallableManagerUnitTest, EmptyManifestIsInvalid) { TEST_F(InstallableManagerUnitTest, EmptyManifestIsInvalid) {
content::Manifest manifest; blink::Manifest manifest;
EXPECT_FALSE(IsManifestValid(manifest)); EXPECT_FALSE(IsManifestValid(manifest));
EXPECT_EQ(MANIFEST_EMPTY, GetErrorCode()); EXPECT_EQ(MANIFEST_EMPTY, GetErrorCode());
} }
TEST_F(InstallableManagerUnitTest, CheckMinimalValidManifest) { TEST_F(InstallableManagerUnitTest, CheckMinimalValidManifest) {
content::Manifest manifest = GetValidManifest(); blink::Manifest manifest = GetValidManifest();
EXPECT_TRUE(IsManifestValid(manifest)); EXPECT_TRUE(IsManifestValid(manifest));
EXPECT_EQ(NO_ERROR_DETECTED, GetErrorCode()); EXPECT_EQ(NO_ERROR_DETECTED, GetErrorCode());
} }
TEST_F(InstallableManagerUnitTest, ManifestRequiresNameOrShortName) { TEST_F(InstallableManagerUnitTest, ManifestRequiresNameOrShortName) {
content::Manifest manifest = GetValidManifest(); blink::Manifest manifest = GetValidManifest();
manifest.name = base::NullableString16(); manifest.name = base::NullableString16();
EXPECT_TRUE(IsManifestValid(manifest)); EXPECT_TRUE(IsManifestValid(manifest));
@@ -82,7 +82,7 @@ TEST_F(InstallableManagerUnitTest, ManifestRequiresNameOrShortName) {
} }
TEST_F(InstallableManagerUnitTest, ManifestRequiresNonEmptyNameORShortName) { TEST_F(InstallableManagerUnitTest, ManifestRequiresNonEmptyNameORShortName) {
content::Manifest manifest = GetValidManifest(); blink::Manifest manifest = GetValidManifest();
manifest.name = ToNullableUTF16(""); manifest.name = ToNullableUTF16("");
EXPECT_TRUE(IsManifestValid(manifest)); EXPECT_TRUE(IsManifestValid(manifest));
@@ -99,7 +99,7 @@ TEST_F(InstallableManagerUnitTest, ManifestRequiresNonEmptyNameORShortName) {
} }
TEST_F(InstallableManagerUnitTest, ManifestRequiresValidStartURL) { TEST_F(InstallableManagerUnitTest, ManifestRequiresValidStartURL) {
content::Manifest manifest = GetValidManifest(); blink::Manifest manifest = GetValidManifest();
manifest.start_url = GURL(); manifest.start_url = GURL();
EXPECT_FALSE(IsManifestValid(manifest)); EXPECT_FALSE(IsManifestValid(manifest));
@@ -111,7 +111,7 @@ TEST_F(InstallableManagerUnitTest, ManifestRequiresValidStartURL) {
} }
TEST_F(InstallableManagerUnitTest, ManifestRequiresImagePNG) { TEST_F(InstallableManagerUnitTest, ManifestRequiresImagePNG) {
content::Manifest manifest = GetValidManifest(); blink::Manifest manifest = GetValidManifest();
manifest.icons[0].type = base::ASCIIToUTF16("image/gif"); manifest.icons[0].type = base::ASCIIToUTF16("image/gif");
EXPECT_FALSE(IsManifestValid(manifest)); EXPECT_FALSE(IsManifestValid(manifest));
@@ -138,7 +138,7 @@ TEST_F(InstallableManagerUnitTest, ManifestRequiresImagePNG) {
} }
TEST_F(InstallableManagerUnitTest, ManifestRequiresPurposeAny) { TEST_F(InstallableManagerUnitTest, ManifestRequiresPurposeAny) {
content::Manifest manifest = GetValidManifest(); blink::Manifest manifest = GetValidManifest();
// The icon MUST have IconPurpose::ANY at least. // The icon MUST have IconPurpose::ANY at least.
manifest.icons[0].purpose[0] = IconPurpose::BADGE; manifest.icons[0].purpose[0] = IconPurpose::BADGE;
@@ -152,7 +152,7 @@ TEST_F(InstallableManagerUnitTest, ManifestRequiresPurposeAny) {
} }
TEST_F(InstallableManagerUnitTest, ManifestRequiresMinimalSize) { TEST_F(InstallableManagerUnitTest, ManifestRequiresMinimalSize) {
content::Manifest manifest = GetValidManifest(); blink::Manifest manifest = GetValidManifest();
// The icon MUST be 144x144 size at least. // The icon MUST be 144x144 size at least.
manifest.icons[0].sizes[0] = gfx::Size(1, 1); manifest.icons[0].sizes[0] = gfx::Size(1, 1);
@@ -185,7 +185,7 @@ TEST_F(InstallableManagerUnitTest, ManifestRequiresMinimalSize) {
} }
TEST_F(InstallableManagerUnitTest, ManifestDisplayModes) { TEST_F(InstallableManagerUnitTest, ManifestDisplayModes) {
content::Manifest manifest = GetValidManifest(); blink::Manifest manifest = GetValidManifest();
manifest.display = blink::kWebDisplayModeUndefined; manifest.display = blink::kWebDisplayModeUndefined;
EXPECT_FALSE(IsManifestValid(manifest)); EXPECT_FALSE(IsManifestValid(manifest));

@@ -5,7 +5,7 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
using IconPurpose = content::Manifest::Icon::IconPurpose; using IconPurpose = blink::Manifest::Icon::IconPurpose;
class InstallableTaskQueueUnitTest : public testing::Test {}; class InstallableTaskQueueUnitTest : public testing::Test {};

@@ -15,10 +15,10 @@
#include "ui/gfx/color_utils.h" #include "ui/gfx/color_utils.h"
namespace { 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. // rgba() CSS string.
std::string ColorToString(int64_t color) { std::string ColorToString(int64_t color) {
if (color == content::Manifest::kInvalidOrMissingColor) if (color == blink::Manifest::kInvalidOrMissingColor)
return std::string(); return std::string();
return color_utils::SkColorToRgbaString(reinterpret_cast<uint32_t&>(color)); return color_utils::SkColorToRgbaString(reinterpret_cast<uint32_t&>(color));
} }

@@ -11,7 +11,7 @@
#include "components/prefs/scoped_user_pref_update.h" #include "components/prefs/scoped_user_pref_update.h"
void UpdateShareTargetInPrefs(const GURL& manifest_url, void UpdateShareTargetInPrefs(const GURL& manifest_url,
const content::Manifest& manifest, const blink::Manifest& manifest,
PrefService* pref_service) { PrefService* pref_service) {
DictionaryPrefUpdate update(pref_service, prefs::kWebShareVisitedTargets); DictionaryPrefUpdate update(pref_service, prefs::kWebShareVisitedTargets);
base::DictionaryValue* share_target_dict = update.Get(); base::DictionaryValue* share_target_dict = update.Get();

@@ -7,7 +7,7 @@
#include "base/optional.h" #include "base/optional.h"
#include "base/strings/string_piece.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 GURL;
class PrefService; class PrefService;
@@ -19,7 +19,7 @@ class PrefService;
// share_target field, or it does but there is no url_template field, this will // share_target field, or it does but there is no url_template field, this will
// remove |manifest_url| from kWebShareVisitedTargets, if it is there. // remove |manifest_url| from kWebShareVisitedTargets, if it is there.
void UpdateShareTargetInPrefs(const GURL& manifest_url, void UpdateShareTargetInPrefs(const GURL& manifest_url,
const content::Manifest& manifest, const blink::Manifest& manifest,
PrefService* pref_service); PrefService* pref_service);
#endif // CHROME_BROWSER_WEBSHARE_SHARE_TARGET_PREF_HELPER_H_ #endif // CHROME_BROWSER_WEBSHARE_SHARE_TARGET_PREF_HELPER_H_

@@ -40,12 +40,12 @@ constexpr char kUrlTemplateKey[] = "url_template";
TEST_F(ShareTargetPrefHelperUnittest, AddMultipleShareTargets) { TEST_F(ShareTargetPrefHelperUnittest, AddMultipleShareTargets) {
// Add a share target to prefs that wasn't previously stored. // Add a share target to prefs that wasn't previously stored.
GURL manifest_url("https://www.sharetarget.com/manifest.json"); 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}"; std::string url_template = "https://www.sharetarget.com/share?title={title}";
share_target.url_template = GURL(url_template); share_target.url_template = GURL(url_template);
content::Manifest manifest; blink::Manifest manifest;
manifest.share_target = manifest.share_target =
base::Optional<content::Manifest::ShareTarget>(share_target); base::Optional<blink::Manifest::ShareTarget>(share_target);
UpdateShareTargetInPrefs(manifest_url, manifest, pref_service()); 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. // Add a share target to prefs that wasn't previously stored.
GURL manifest_url(kManifestUrl); GURL manifest_url(kManifestUrl);
content::Manifest::ShareTarget share_target; blink::Manifest::ShareTarget share_target;
share_target.url_template = GURL(kUrlTemplate); share_target.url_template = GURL(kUrlTemplate);
content::Manifest manifest; blink::Manifest manifest;
manifest.share_target = manifest.share_target =
base::Optional<content::Manifest::ShareTarget>(share_target); base::Optional<blink::Manifest::ShareTarget>(share_target);
UpdateShareTargetInPrefs(manifest_url, manifest, pref_service()); UpdateShareTargetInPrefs(manifest_url, manifest, pref_service());
@@ -127,12 +127,12 @@ TEST_F(ShareTargetPrefHelperUnittest, AddShareTargetTwice) {
TEST_F(ShareTargetPrefHelperUnittest, UpdateShareTarget) { TEST_F(ShareTargetPrefHelperUnittest, UpdateShareTarget) {
// Add a share target to prefs that wasn't previously stored. // Add a share target to prefs that wasn't previously stored.
GURL manifest_url("https://www.sharetarget.com/manifest.json"); 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}"; std::string url_template = "https://www.sharetarget.com/share/?title={title}";
share_target.url_template = GURL(url_template); share_target.url_template = GURL(url_template);
content::Manifest manifest; blink::Manifest manifest;
manifest.share_target = manifest.share_target =
base::Optional<content::Manifest::ShareTarget>(share_target); base::Optional<blink::Manifest::ShareTarget>(share_target);
UpdateShareTargetInPrefs(manifest_url, manifest, pref_service()); UpdateShareTargetInPrefs(manifest_url, manifest, pref_service());
@@ -171,7 +171,7 @@ TEST_F(ShareTargetPrefHelperUnittest, DontAddNonShareTarget) {
const base::Optional<std::string> kUrlTemplate; const base::Optional<std::string> kUrlTemplate;
// Don't add a site that has a null template. // Don't add a site that has a null template.
UpdateShareTargetInPrefs(GURL(kManifestUrl), content::Manifest(), UpdateShareTargetInPrefs(GURL(kManifestUrl), blink::Manifest(),
pref_service()); pref_service());
const base::DictionaryValue* share_target_dict = const base::DictionaryValue* share_target_dict =
@@ -185,12 +185,12 @@ TEST_F(ShareTargetPrefHelperUnittest, DontAddNonShareTarget) {
TEST_F(ShareTargetPrefHelperUnittest, RemoveShareTarget) { TEST_F(ShareTargetPrefHelperUnittest, RemoveShareTarget) {
// Add a share target to prefs that wasn't previously stored. // Add a share target to prefs that wasn't previously stored.
GURL manifest_url("https://www.sharetarget.com/manifest.json"); 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}"; std::string url_template = "https://www.sharetarget.com/share/?title={title}";
share_target.url_template = GURL(url_template); share_target.url_template = GURL(url_template);
content::Manifest manifest; blink::Manifest manifest;
manifest.share_target = manifest.share_target =
base::Optional<content::Manifest::ShareTarget>(share_target); base::Optional<blink::Manifest::ShareTarget>(share_target);
UpdateShareTargetInPrefs(manifest_url, manifest, pref_service()); 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. // Share target already added now has null template. Remove from prefs.
manifest_url = GURL("https://www.sharetarget.com/manifest.json"); 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 = share_target_dict =
pref_service()->GetDictionary(prefs::kWebShareVisitedTargets); pref_service()->GetDictionary(prefs::kWebShareVisitedTargets);

@@ -1,5 +1,6 @@
include_rules = [ include_rules = [
"+components/history/core/browser", "+components/history/core/browser",
"+content/public", "+content/public",
"+third_party/blink/public/common",
"+third_party/skia/include", "+third_party/skia/include",
] ]

@@ -17,7 +17,7 @@
#include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h" #include "content/public/browser/navigation_handle.h"
#include "content/public/common/favicon_url.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" #include "ui/gfx/image/image.h"
DEFINE_WEB_CONTENTS_USER_DATA_KEY(favicon::ContentFaviconDriver); DEFINE_WEB_CONTENTS_USER_DATA_KEY(favicon::ContentFaviconDriver);
@@ -28,9 +28,9 @@ namespace {
void ExtractManifestIcons( void ExtractManifestIcons(
ContentFaviconDriver::ManifestDownloadCallback callback, ContentFaviconDriver::ManifestDownloadCallback callback,
const GURL& manifest_url, const GURL& manifest_url,
const content::Manifest& manifest) { const blink::Manifest& manifest) {
std::vector<FaviconURL> candidates; std::vector<FaviconURL> 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, candidates.emplace_back(icon.src, favicon_base::IconType::kWebManifestIcon,
icon.sizes); icon.sizes);
} }

@@ -12,6 +12,7 @@ include_rules = [
"+net", "+net",
"+services/data_decoder/public/cpp", "+services/data_decoder/public/cpp",
"+sql", "+sql",
"+third_party/blink/public/common",
"+third_party/blink/public/platform/modules/payments", "+third_party/blink/public/platform/modules/payments",
"+third_party/skia/include/core/SkBitmap.h", "+third_party/skia/include/core/SkBitmap.h",
"+ui/base", "+ui/base",

@@ -15,7 +15,7 @@
#include "content/public/browser/permission_type.h" #include "content/public/browser/permission_type.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/console_message_level.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 "ui/gfx/geometry/size.h"
#include "url/gurl.h" #include "url/gurl.h"
#include "url/origin.h" #include "url/origin.h"
@@ -228,7 +228,7 @@ void InstallablePaymentAppCrawler::DownloadAndDecodeWebAppIcon(
if (icons == nullptr || icons->empty()) if (icons == nullptr || icons->empty())
return; return;
std::vector<content::Manifest::Icon> manifest_icons; std::vector<blink::Manifest::Icon> manifest_icons;
for (const auto& icon : *icons) { for (const auto& icon : *icons) {
if (icon.src.empty() || !base::IsStringUTF8(icon.src)) { if (icon.src.empty() || !base::IsStringUTF8(icon.src)) {
WarnIfPossible( 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.src = icon_src;
manifest_icon.type = base::UTF8ToUTF16(icon.type); 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. // TODO(crbug.com/782270): Parse icon sizes.
manifest_icon.sizes.emplace_back(gfx::Size()); manifest_icon.sizes.emplace_back(gfx::Size());
manifest_icons.emplace_back(manifest_icon); manifest_icons.emplace_back(manifest_icon);
@@ -268,7 +268,7 @@ void InstallablePaymentAppCrawler::DownloadAndDecodeWebAppIcon(
const int kPaymentAppMinimumIconSize = 0; const int kPaymentAppMinimumIconSize = 0;
GURL best_icon_url = content::ManifestIconSelector::FindBestMatchingIcon( GURL best_icon_url = content::ManifestIconSelector::FindBestMatchingIcon(
manifest_icons, kPaymentAppIdealIconSize, kPaymentAppMinimumIconSize, manifest_icons, kPaymentAppIdealIconSize, kPaymentAppMinimumIconSize,
content::Manifest::Icon::ANY); blink::Manifest::Icon::ANY);
if (!best_icon_url.is_valid()) { if (!best_icon_url.is_valid()) {
WarnIfPossible( WarnIfPossible(
"No suitable icon found in the installabble payment app's manifest (" + "No suitable icon found in the installabble payment app's manifest (" +

@@ -70,7 +70,6 @@ include_rules = [
"+third_party/blink/public/platform/WebAddressSpace.h", "+third_party/blink/public/platform/WebAddressSpace.h",
"+third_party/blink/public/platform/web_content_security_policy.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_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_drag_operation.h",
"+third_party/blink/public/platform/web_focus_type.h", "+third_party/blink/public/platform/web_focus_type.h",
"+third_party/blink/public/platform/web_fullscreen_video_status.h", "+third_party/blink/public/platform/web_fullscreen_video_status.h",
@@ -130,7 +129,6 @@ include_rules = [
"+third_party/blink/public/platform/modules/installedapp/installed_app_provider.mojom.h", "+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/installedapp/related_application.mojom.h",
"+third_party/blink/public/platform/modules/keyboard_lock/keyboard_lock.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/mediasession/media_session.mojom.h",
"+third_party/blink/public/platform/modules/mediastream/media_devices.mojom.h", "+third_party/blink/public/platform/modules/mediastream/media_devices.mojom.h",
"+third_party/blink/public/platform/modules/notifications/notification_service.mojom.h", "+third_party/blink/public/platform/modules/notifications/notification_service.mojom.h",

@@ -25,7 +25,7 @@
#include "content/public/browser/javascript_dialog_manager.h" #include "content/public/browser/javascript_dialog_manager.h"
#include "content/public/browser/render_widget_host_observer.h" #include "content/public/browser/render_widget_host_observer.h"
#include "content/public/common/javascript_dialog_type.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" #include "url/gurl.h"
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)

@@ -13,7 +13,6 @@
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.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/browser_test_utils.h"
#include "content/public/test/content_browser_test.h" #include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.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_request.h"
#include "net/test/embedded_test_server/http_response.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/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 { namespace content {
@@ -80,15 +80,14 @@ class ManifestBrowserTest : public ContentBrowserTest,
message_loop_runner_->Run(); 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_url_ = manifest_url;
manifest_ = manifest; manifest_ = manifest;
message_loop_runner_->Quit(); message_loop_runner_->Quit();
} }
const Manifest& manifest() const { const blink::Manifest& manifest() const { return manifest_; }
return manifest_;
}
const GURL& manifest_url() const { const GURL& manifest_url() const {
return manifest_url_; return manifest_url_;
@@ -148,7 +147,7 @@ class ManifestBrowserTest : public ContentBrowserTest,
std::unique_ptr<MockWebContentsDelegate> mock_web_contents_delegate_; std::unique_ptr<MockWebContentsDelegate> mock_web_contents_delegate_;
std::unique_ptr<net::EmbeddedTestServer> cors_embedded_test_server_; std::unique_ptr<net::EmbeddedTestServer> cors_embedded_test_server_;
GURL manifest_url_; GURL manifest_url_;
Manifest manifest_; blink::Manifest manifest_;
int console_error_count_; int console_error_count_;
std::vector<GURL> reported_manifest_urls_; std::vector<GURL> reported_manifest_urls_;
std::vector<size_t> manifests_reported_when_favicon_url_updated_; std::vector<size_t> manifests_reported_when_favicon_url_updated_;

@@ -14,10 +14,10 @@ namespace content {
// static // static
GURL ManifestIconSelector::FindBestMatchingIcon( GURL ManifestIconSelector::FindBestMatchingIcon(
const std::vector<Manifest::Icon>& icons, const std::vector<blink::Manifest::Icon>& icons,
int ideal_icon_size_in_px, int ideal_icon_size_in_px,
int minimum_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); DCHECK(minimum_icon_size_in_px <= ideal_icon_size_in_px);
// Icon with exact matching size has priority over icon with size "any", which // Icon with exact matching size has priority over icon with size "any", which

@@ -13,18 +13,18 @@
namespace content { namespace content {
using IconPurpose = Manifest::Icon::IconPurpose; using IconPurpose = blink::Manifest::Icon::IconPurpose;
namespace { namespace {
const int kIdealIconSize = 144; const int kIdealIconSize = 144;
const int kMinimumIconSize = 0; const int kMinimumIconSize = 0;
static Manifest::Icon CreateIcon(const std::string& url, static blink::Manifest::Icon CreateIcon(const std::string& url,
const std::string& type, const std::string& type,
const std::vector<gfx::Size> sizes, const std::vector<gfx::Size> sizes,
IconPurpose purpose) { IconPurpose purpose) {
Manifest::Icon icon; blink::Manifest::Icon icon;
icon.src = GURL(url); icon.src = GURL(url);
icon.type = base::UTF8ToUTF16(type); icon.type = base::UTF8ToUTF16(type);
icon.sizes = sizes; icon.sizes = sizes;
@@ -37,7 +37,7 @@ static Manifest::Icon CreateIcon(const std::string& url,
TEST(ManifestIconSelector, NoIcons) { TEST(ManifestIconSelector, NoIcons) {
// No icons should return the empty URL. // No icons should return the empty URL.
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
GURL url = ManifestIconSelector::FindBestMatchingIcon( GURL url = ManifestIconSelector::FindBestMatchingIcon(
icons, kIdealIconSize, kMinimumIconSize, IconPurpose::ANY); icons, kIdealIconSize, kMinimumIconSize, IconPurpose::ANY);
EXPECT_TRUE(url.is_empty()); EXPECT_TRUE(url.is_empty());
@@ -45,7 +45,7 @@ TEST(ManifestIconSelector, NoIcons) {
TEST(ManifestIconSelector, NoSizes) { TEST(ManifestIconSelector, NoSizes) {
// Icon with no sizes are ignored. // Icon with no sizes are ignored.
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back(CreateIcon("http://foo.com/icon.png", "", icons.push_back(CreateIcon("http://foo.com/icon.png", "",
std::vector<gfx::Size>(), IconPurpose::ANY)); std::vector<gfx::Size>(), IconPurpose::ANY));
@@ -60,7 +60,7 @@ TEST(ManifestIconSelector, MIMETypeFiltering) {
std::vector<gfx::Size> sizes; std::vector<gfx::Size> sizes;
sizes.push_back(gfx::Size(1024, 1024)); sizes.push_back(gfx::Size(1024, 1024));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back(CreateIcon("http://foo.com/icon.png", "image/foo_bar", sizes, icons.push_back(CreateIcon("http://foo.com/icon.png", "image/foo_bar", sizes,
IconPurpose::ANY)); IconPurpose::ANY));
icons.push_back( icons.push_back(
@@ -107,7 +107,7 @@ TEST(ManifestIconSelector, PurposeFiltering) {
std::vector<gfx::Size> sizes_144; std::vector<gfx::Size> sizes_144;
sizes_144.push_back(gfx::Size(144, 144)); sizes_144.push_back(gfx::Size(144, 144));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back(CreateIcon("http://foo.com/icon_48.png", "", sizes_48, icons.push_back(CreateIcon("http://foo.com/icon_48.png", "", sizes_48,
IconPurpose::BADGE)); IconPurpose::BADGE));
icons.push_back( icons.push_back(
@@ -147,7 +147,7 @@ TEST(ManifestIconSelector, IdealSizeIsUsedFirst) {
std::vector<gfx::Size> sizes_144; std::vector<gfx::Size> sizes_144;
sizes_144.push_back(gfx::Size(144, 144)); sizes_144.push_back(gfx::Size(144, 144));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back( icons.push_back(
CreateIcon("http://foo.com/icon_48.png", "", sizes_48, IconPurpose::ANY)); CreateIcon("http://foo.com/icon_48.png", "", sizes_48, IconPurpose::ANY));
icons.push_back( icons.push_back(
@@ -182,7 +182,7 @@ TEST(ManifestIconSelector, FirstIconWithIdealSizeIsUsedFirst) {
std::vector<gfx::Size> sizes_3; std::vector<gfx::Size> sizes_3;
sizes_3.push_back(gfx::Size(1024, 1024)); sizes_3.push_back(gfx::Size(1024, 1024));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back( icons.push_back(
CreateIcon("http://foo.com/icon_x1.png", "", sizes_1, IconPurpose::ANY)); CreateIcon("http://foo.com/icon_x1.png", "", sizes_1, IconPurpose::ANY));
icons.push_back( icons.push_back(
@@ -214,7 +214,7 @@ TEST(ManifestIconSelector, FallbackToSmallestLargerIcon) {
std::vector<gfx::Size> sizes_3; std::vector<gfx::Size> sizes_3;
sizes_3.push_back(gfx::Size(192, 192)); sizes_3.push_back(gfx::Size(192, 192));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back( icons.push_back(
CreateIcon("http://foo.com/icon_x1.png", "", sizes_1, IconPurpose::ANY)); CreateIcon("http://foo.com/icon_x1.png", "", sizes_1, IconPurpose::ANY));
icons.push_back( icons.push_back(
@@ -244,7 +244,7 @@ TEST(ManifestIconSelector, FallbackToLargestIconLargerThanMinimum) {
sizes_1_2.push_back(gfx::Size(47, 47)); sizes_1_2.push_back(gfx::Size(47, 47));
sizes_3.push_back(gfx::Size(95, 95)); sizes_3.push_back(gfx::Size(95, 95));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back(CreateIcon("http://foo.com/icon_x1.png", "", sizes_1_2, icons.push_back(CreateIcon("http://foo.com/icon_x1.png", "", sizes_1_2,
IconPurpose::ANY)); IconPurpose::ANY));
icons.push_back(CreateIcon("http://foo.com/icon_x2.png", "", sizes_1_2, icons.push_back(CreateIcon("http://foo.com/icon_x2.png", "", sizes_1_2,
@@ -267,7 +267,7 @@ TEST(ManifestIconSelector, IdealVeryCloseToMinimumMatches) {
std::vector<gfx::Size> sizes; std::vector<gfx::Size> sizes;
sizes.push_back(gfx::Size(2, 2)); sizes.push_back(gfx::Size(2, 2));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back( icons.push_back(
CreateIcon("http://foo.com/icon_x1.png", "", sizes, IconPurpose::ANY)); CreateIcon("http://foo.com/icon_x1.png", "", sizes, IconPurpose::ANY));
@@ -280,7 +280,7 @@ TEST(ManifestIconSelector, SizeVeryCloseToMinimumMatches) {
std::vector<gfx::Size> sizes; std::vector<gfx::Size> sizes;
sizes.push_back(gfx::Size(2, 2)); sizes.push_back(gfx::Size(2, 2));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back( icons.push_back(
CreateIcon("http://foo.com/icon_x1.png", "", sizes, IconPurpose::ANY)); CreateIcon("http://foo.com/icon_x1.png", "", sizes, IconPurpose::ANY));
@@ -293,7 +293,7 @@ TEST(ManifestIconSelector, NotSquareIconsAreIgnored) {
std::vector<gfx::Size> sizes; std::vector<gfx::Size> sizes;
sizes.push_back(gfx::Size(1024, 1023)); sizes.push_back(gfx::Size(1024, 1023));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back( icons.push_back(
CreateIcon("http://foo.com/icon.png", "", sizes, IconPurpose::ANY)); CreateIcon("http://foo.com/icon.png", "", sizes, IconPurpose::ANY));
@@ -320,7 +320,7 @@ TEST(ManifestIconSelector, ClosestIconToIdeal) {
std::vector<gfx::Size> sizes_2; std::vector<gfx::Size> sizes_2;
sizes_2.push_back(gfx::Size(bit_small, bit_small)); sizes_2.push_back(gfx::Size(bit_small, bit_small));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1, icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1,
IconPurpose::ANY)); IconPurpose::ANY));
icons.push_back( icons.push_back(
@@ -342,7 +342,7 @@ TEST(ManifestIconSelector, ClosestIconToIdeal) {
std::vector<gfx::Size> sizes_3; std::vector<gfx::Size> sizes_3;
sizes_3.push_back(gfx::Size(small_size, small_size)); sizes_3.push_back(gfx::Size(small_size, small_size));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back(CreateIcon("http://foo.com/icon_no_1.png", "", sizes_1, icons.push_back(CreateIcon("http://foo.com/icon_no_1.png", "", sizes_1,
IconPurpose::ANY)); IconPurpose::ANY));
icons.push_back( icons.push_back(
@@ -363,7 +363,7 @@ TEST(ManifestIconSelector, ClosestIconToIdeal) {
std::vector<gfx::Size> sizes_2; std::vector<gfx::Size> sizes_2;
sizes_2.push_back(gfx::Size(big, big)); sizes_2.push_back(gfx::Size(big, big));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1, icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1,
IconPurpose::ANY)); IconPurpose::ANY));
icons.push_back( icons.push_back(
@@ -385,7 +385,7 @@ TEST(ManifestIconSelector, ClosestIconToIdeal) {
std::vector<gfx::Size> sizes_3; std::vector<gfx::Size> sizes_3;
sizes_3.push_back(gfx::Size(bit_big, bit_big)); sizes_3.push_back(gfx::Size(bit_big, bit_big));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1, icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1,
IconPurpose::ANY)); IconPurpose::ANY));
icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_2, icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_2,
@@ -406,7 +406,7 @@ TEST(ManifestIconSelector, ClosestIconToIdeal) {
std::vector<gfx::Size> sizes_2; std::vector<gfx::Size> sizes_2;
sizes_2.push_back(gfx::Size(very_big, very_big)); sizes_2.push_back(gfx::Size(very_big, very_big));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1, icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1,
IconPurpose::ANY)); IconPurpose::ANY));
icons.push_back( icons.push_back(
@@ -425,7 +425,7 @@ TEST(ManifestIconSelector, ClosestIconToIdeal) {
std::vector<gfx::Size> sizes_2; std::vector<gfx::Size> sizes_2;
sizes_2.push_back(gfx::Size(bit_big, bit_big)); sizes_2.push_back(gfx::Size(bit_big, bit_big));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1, icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1,
IconPurpose::ANY)); IconPurpose::ANY));
icons.push_back( icons.push_back(
@@ -448,7 +448,7 @@ TEST(ManifestIconSelector, UseAnyIfNoIdealSize) {
std::vector<gfx::Size> sizes_2; std::vector<gfx::Size> sizes_2;
sizes_2.push_back(gfx::Size(0, 0)); sizes_2.push_back(gfx::Size(0, 0));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back( icons.push_back(
CreateIcon("http://foo.com/icon.png", "", sizes_1, IconPurpose::ANY)); CreateIcon("http://foo.com/icon.png", "", sizes_1, IconPurpose::ANY));
icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_2, icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_2,
@@ -466,7 +466,7 @@ TEST(ManifestIconSelector, UseAnyIfNoIdealSize) {
std::vector<gfx::Size> sizes_2; std::vector<gfx::Size> sizes_2;
sizes_2.push_back(gfx::Size(0, 0)); sizes_2.push_back(gfx::Size(0, 0));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1, icons.push_back(CreateIcon("http://foo.com/icon_no.png", "", sizes_1,
IconPurpose::ANY)); IconPurpose::ANY));
icons.push_back( icons.push_back(
@@ -482,7 +482,7 @@ TEST(ManifestIconSelector, UseAnyIfNoIdealSize) {
std::vector<gfx::Size> sizes; std::vector<gfx::Size> sizes;
sizes.push_back(gfx::Size(0, 0)); sizes.push_back(gfx::Size(0, 0));
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
icons.push_back( icons.push_back(
CreateIcon("http://foo.com/icon_no1.png", "", sizes, IconPurpose::ANY)); CreateIcon("http://foo.com/icon_no1.png", "", sizes, IconPurpose::ANY));
icons.push_back( icons.push_back(

@@ -9,9 +9,9 @@
#include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/manifest.h"
#include "services/service_manager/public/cpp/interface_provider.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/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/manifest/manifest.h"
namespace content { namespace content {
@@ -66,12 +66,13 @@ void ManifestManagerHost::OnConnectionError() {
} }
callbacks_.Clear(); callbacks_.Clear();
for (auto& callback : callbacks) for (auto& callback : callbacks)
std::move(callback).Run(GURL(), Manifest()); std::move(callback).Run(GURL(), blink::Manifest());
} }
void ManifestManagerHost::OnRequestManifestResponse(int request_id, void ManifestManagerHost::OnRequestManifestResponse(
const GURL& url, int request_id,
const Manifest& manifest) { const GURL& url,
const blink::Manifest& manifest) {
auto callback = std::move(*callbacks_.Lookup(request_id)); auto callback = std::move(*callbacks_.Lookup(request_id));
callbacks_.Remove(request_id); callbacks_.Remove(request_id);
std::move(callback).Run(url, manifest); std::move(callback).Run(url, manifest);

@@ -11,13 +11,16 @@
#include "content/common/manifest_observer.mojom.h" #include "content/common/manifest_observer.mojom.h"
#include "content/public/browser/web_contents_binding_set.h" #include "content/public/browser/web_contents_binding_set.h"
#include "content/public/browser/web_contents_observer.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 { namespace content {
class RenderFrameHost; class RenderFrameHost;
class WebContents; class WebContents;
struct Manifest;
// ManifestManagerHost is a helper class that allows callers to get the 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 // associated with the main frame of the observed WebContents. It handles the
@@ -30,7 +33,7 @@ class ManifestManagerHost : public WebContentsObserver,
~ManifestManagerHost() override; ~ManifestManagerHost() override;
using GetManifestCallback = using GetManifestCallback =
base::OnceCallback<void(const GURL&, const Manifest&)>; base::OnceCallback<void(const GURL&, const blink::Manifest&)>;
// Calls the given callback with the manifest associated with the main frame. // 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 // 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, void OnRequestManifestResponse(int request_id,
const GURL& url, const GURL& url,
const Manifest& manifest); const blink::Manifest& manifest);
// mojom::ManifestUrlChangeObserver: // mojom::ManifestUrlChangeObserver:
void ManifestUrlChanged(const base::Optional<GURL>& manifest_url) override; void ManifestUrlChanged(const base::Optional<GURL>& manifest_url) override;

@@ -149,7 +149,7 @@ IN_PROC_BROWSER_TEST_F(AcceptHeaderTest, Check) {
EXPECT_EQ("custom/type", GetFor("/xhr_with_accept_header")); EXPECT_EQ("custom/type", GetFor("/xhr_with_accept_header"));
shell()->web_contents()->GetManifest( shell()->web_contents()->GetManifest(
base::BindOnce([](const GURL&, const content::Manifest&) {})); base::BindOnce([](const GURL&, const blink::Manifest&) {}));
// RESOURCE_TYPE_SUB_RESOURCE // RESOURCE_TYPE_SUB_RESOURCE
EXPECT_EQ("*/*", GetFor("/manifest")); EXPECT_EQ("*/*", GetFor("/manifest"));

@@ -17,7 +17,7 @@
#include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/service_worker/service_worker_registration.h" #include "content/browser/service_worker/service_worker_registration.h"
#include "content/public/browser/browser_thread.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 "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/image/image.h" #include "ui/gfx/image/image.h"
#include "url/gurl.h" #include "url/gurl.h"
@@ -71,7 +71,7 @@ PaymentInstrumentPtr ToPaymentInstrumentForMojo(const std::string& input) {
PaymentInstrumentPtr instrument = PaymentInstrument::New(); PaymentInstrumentPtr instrument = PaymentInstrument::New();
instrument->name = instrument_proto.name(); instrument->name = instrument_proto.name();
for (const auto& icon_proto : instrument_proto.icons()) { for (const auto& icon_proto : instrument_proto.icons()) {
Manifest::Icon icon; blink::Manifest::Icon icon;
icon.src = GURL(icon_proto.src()); icon.src = GURL(icon_proto.src());
icon.type = base::UTF8ToUTF16(icon_proto.type()); icon.type = base::UTF8ToUTF16(icon_proto.type());
for (const auto& size_proto : icon_proto.sizes()) { for (const auto& size_proto : icon_proto.sizes()) {
@@ -197,7 +197,7 @@ void PaymentAppDatabase::WritePaymentInstrument(
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (instrument->icons.size() > 0) { if (instrument->icons.size() > 0) {
std::vector<Manifest::Icon> icons(instrument->icons); std::vector<blink::Manifest::Icon> icons(instrument->icons);
PaymentInstrumentIconFetcher::Start( PaymentInstrumentIconFetcher::Start(
scope, service_worker_context_->GetProviderHostIds(scope.GetOrigin()), scope, service_worker_context_->GetProviderHostIds(scope.GetOrigin()),
icons, icons,

@@ -127,7 +127,7 @@ void PaymentAppInfoFetcher::SelfDeleteFetcher::RunCallbackAndDestroy() {
void PaymentAppInfoFetcher::SelfDeleteFetcher::FetchPaymentAppManifestCallback( void PaymentAppInfoFetcher::SelfDeleteFetcher::FetchPaymentAppManifestCallback(
const GURL& url, const GURL& url,
const Manifest& manifest) { const blink::Manifest& manifest) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
manifest_url_ = url; manifest_url_ = url;
@@ -211,7 +211,7 @@ void PaymentAppInfoFetcher::SelfDeleteFetcher::FetchPaymentAppManifestCallback(
icon_url_ = ManifestIconSelector::FindBestMatchingIcon( icon_url_ = ManifestIconSelector::FindBestMatchingIcon(
manifest.icons, kPaymentAppIdealIconSize, kPaymentAppMinimumIconSize, manifest.icons, kPaymentAppIdealIconSize, kPaymentAppMinimumIconSize,
Manifest::Icon::ANY); blink::Manifest::Icon::ANY);
if (!icon_url_.is_valid()) { if (!icon_url_.is_valid()) {
WarnIfPossible( WarnIfPossible(
"No suitable payment handler icon found in the \"icons\" field defined " "No suitable payment handler icon found in the \"icons\" field defined "

@@ -12,7 +12,7 @@
#include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/public/browser/stored_payment_app.h" #include "content/public/browser/stored_payment_app.h"
#include "content/public/browser/web_contents_observer.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" #include "third_party/skia/include/core/SkBitmap.h"
namespace content { namespace content {
@@ -67,7 +67,7 @@ class PaymentAppInfoFetcher {
// The WebContents::GetManifestCallback. // The WebContents::GetManifestCallback.
void FetchPaymentAppManifestCallback(const GURL& url, void FetchPaymentAppManifestCallback(const GURL& url,
const Manifest& manifest); const blink::Manifest& manifest);
// The ManifestIconDownloader::IconFetchCallback. // The ManifestIconDownloader::IconFetchCallback.
void OnIconFetched(const SkBitmap& icon); void OnIconFetched(const SkBitmap& icon);

@@ -28,13 +28,13 @@ const int kPaymentAppMinimumIconSize = 0;
void DownloadBestMatchingIcon( void DownloadBestMatchingIcon(
WebContents* web_contents, WebContents* web_contents,
const std::vector<Manifest::Icon>& icons, const std::vector<blink::Manifest::Icon>& icons,
PaymentInstrumentIconFetcher::PaymentInstrumentIconFetcherCallback PaymentInstrumentIconFetcher::PaymentInstrumentIconFetcherCallback
callback); callback);
void OnIconFetched( void OnIconFetched(
WebContents* web_contents, WebContents* web_contents,
const std::vector<Manifest::Icon>& icons, const std::vector<blink::Manifest::Icon>& icons,
PaymentInstrumentIconFetcher::PaymentInstrumentIconFetcherCallback callback, PaymentInstrumentIconFetcher::PaymentInstrumentIconFetcherCallback callback,
const SkBitmap& bitmap) { const SkBitmap& bitmap) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -64,14 +64,14 @@ void OnIconFetched(
void DownloadBestMatchingIcon( void DownloadBestMatchingIcon(
WebContents* web_contents, WebContents* web_contents,
const std::vector<Manifest::Icon>& icons, const std::vector<blink::Manifest::Icon>& icons,
PaymentInstrumentIconFetcher::PaymentInstrumentIconFetcherCallback PaymentInstrumentIconFetcher::PaymentInstrumentIconFetcherCallback
callback) { callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
GURL icon_url = ManifestIconSelector::FindBestMatchingIcon( GURL icon_url = ManifestIconSelector::FindBestMatchingIcon(
icons, kPaymentAppIdealIconSize, kPaymentAppMinimumIconSize, icons, kPaymentAppIdealIconSize, kPaymentAppMinimumIconSize,
Manifest::Icon::IconPurpose::ANY); blink::Manifest::Icon::IconPurpose::ANY);
if (web_contents == nullptr || !icon_url.is_valid()) { if (web_contents == nullptr || !icon_url.is_valid()) {
// If the icon url is invalid, it's better to give the information to // 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 // developers in advance unlike when fetching or decoding fails. We already
@@ -82,7 +82,7 @@ void DownloadBestMatchingIcon(
return; return;
} }
std::vector<Manifest::Icon> copy_icons; std::vector<blink::Manifest::Icon> copy_icons;
for (const auto& icon : icons) { for (const auto& icon : icons) {
if (icon.src != icon_url) { if (icon.src != icon_url) {
copy_icons.emplace_back(icon); copy_icons.emplace_back(icon);
@@ -123,7 +123,7 @@ WebContents* GetWebContentsFromProviderHostIds(
void StartOnUI( void StartOnUI(
const GURL& scope, const GURL& scope,
std::unique_ptr<std::vector<std::pair<int, int>>> provider_hosts, std::unique_ptr<std::vector<std::pair<int, int>>> provider_hosts,
const std::vector<Manifest::Icon>& icons, const std::vector<blink::Manifest::Icon>& icons,
PaymentInstrumentIconFetcher::PaymentInstrumentIconFetcherCallback PaymentInstrumentIconFetcher::PaymentInstrumentIconFetcherCallback
callback) { callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -139,7 +139,7 @@ void StartOnUI(
void PaymentInstrumentIconFetcher::Start( void PaymentInstrumentIconFetcher::Start(
const GURL& scope, const GURL& scope,
std::unique_ptr<std::vector<std::pair<int, int>>> provider_hosts, std::unique_ptr<std::vector<std::pair<int, int>>> provider_hosts,
const std::vector<Manifest::Icon>& icons, const std::vector<blink::Manifest::Icon>& icons,
PaymentInstrumentIconFetcherCallback callback) { PaymentInstrumentIconFetcherCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);

@@ -11,7 +11,7 @@
#include "base/callback_forward.h" #include "base/callback_forward.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.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" #include "third_party/blink/public/platform/modules/payments/payment_app.mojom.h"
namespace content { namespace content {
@@ -25,7 +25,7 @@ class PaymentInstrumentIconFetcher {
static void Start( static void Start(
const GURL& scope, const GURL& scope,
std::unique_ptr<std::vector<std::pair<int, int>>> provider_hosts, std::unique_ptr<std::vector<std::pair<int, int>>> provider_hosts,
const std::vector<Manifest::Icon>& icons, const std::vector<blink::Manifest::Icon>& icons,
PaymentInstrumentIconFetcherCallback callback); PaymentInstrumentIconFetcherCallback callback);
private: private:

@@ -15,7 +15,7 @@
#include "content/common/drag_event_source_info.h" #include "content/common/drag_event_source_info.h"
#include "content/public/common/drop_data.h" #include "content/public/common/drop_data.h"
#include "services/metrics/public/cpp/ukm_recorder.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_drag_operation.h"
#include "third_party/blink/public/platform/web_input_event.h" #include "third_party/blink/public/platform/web_input_event.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"

@@ -58,7 +58,7 @@
#include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/binding.h"
#include "services/viz/public/interfaces/compositing/compositor_frame_sink.mojom.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 "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_mode.h"
#include "ui/base/ime/text_input_type.h" #include "ui/base/ime/text_input_type.h"
#include "ui/base/ui_base_types.h" #include "ui/base/ui_base_types.h"

@@ -23,7 +23,6 @@ include_rules = [
"+third_party/blink/public/mojom", "+third_party/blink/public/mojom",
"+third_party/blink/public/platform/WebAddressSpace.h", "+third_party/blink/public/platform/WebAddressSpace.h",
"+third_party/blink/public/platform/web_content_security_policy.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_drag_operation.h",
"+third_party/blink/public/platform/web_float_point.h", "+third_party/blink/public/platform/web_float_point.h",
"+third_party/blink/public/platform/web_float_rect.h", "+third_party/blink/public/platform/web_float_rect.h",

@@ -7,7 +7,6 @@
#include "content/common/content_export.h" #include "content/common/content_export.h"
#include "content/public/common/screen_info.h" #include "content/public/common/screen_info.h"
#include "third_party/blink/public/platform/web_display_mode.h"
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
namespace content { namespace content {

@@ -45,8 +45,8 @@
#include "media/capture/ipc/capture_param_traits.h" #include "media/capture/ipc/capture_param_traits.h"
#include "net/base/network_change_notifier.h" #include "net/base/network_change_notifier.h"
#include "ppapi/buildflags/buildflags.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/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_point.h"
#include "third_party/blink/public/platform/web_float_rect.h" #include "third_party/blink/public/platform/web_float_rect.h"
#include "third_party/blink/public/platform/web_intrinsic_sizing_info.h" #include "third_party/blink/public/platform/web_intrinsic_sizing_info.h"

@@ -9,7 +9,7 @@
#include "components/viz/common/surfaces/local_surface_id.h" #include "components/viz/common/surfaces/local_surface_id.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
#include "content/public/common/screen_info.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" #include "ui/gfx/geometry/size.h"
namespace content { namespace content {

@@ -6,7 +6,8 @@
#define CONTENT_PUBLIC_BROWSER_MANIFEST_ICON_SELECTOR_H_ #define CONTENT_PUBLIC_BROWSER_MANIFEST_ICON_SELECTOR_H_
#include "base/macros.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" #include "url/gurl.h"
namespace content { namespace content {
@@ -26,10 +27,10 @@ class CONTENT_EXPORT ManifestIconSelector {
// //
// Returns the icon url if a suitable icon is found. An empty URL otherwise. // Returns the icon url if a suitable icon is found. An empty URL otherwise.
static GURL FindBestMatchingIcon( static GURL FindBestMatchingIcon(
const std::vector<content::Manifest::Icon>& icons, const std::vector<blink::Manifest::Icon>& icons,
int ideal_icon_size_in_px, int ideal_icon_size_in_px,
int minimum_icon_size_in_px, int minimum_icon_size_in_px,
content::Manifest::Icon::IconPurpose purpose); blink::Manifest::Icon::IconPurpose purpose);
private: private:
DISALLOW_IMPLICIT_CONSTRUCTORS(ManifestIconSelector); DISALLOW_IMPLICIT_CONSTRUCTORS(ManifestIconSelector);

@@ -41,6 +41,10 @@
#include "base/android/scoped_java_ref.h" #include "base/android/scoped_java_ref.h"
#endif #endif
namespace blink {
struct Manifest;
}
namespace base { namespace base {
class TimeTicks; class TimeTicks;
} }
@@ -75,7 +79,6 @@ class RenderWidgetHostView;
class WebContentsDelegate; class WebContentsDelegate;
struct CustomContextMenuContext; struct CustomContextMenuContext;
struct DropData; struct DropData;
struct Manifest;
struct MHTMLGenerationParams; struct MHTMLGenerationParams;
struct PageImportanceSignals; struct PageImportanceSignals;
struct RendererPreferences; struct RendererPreferences;
@@ -771,7 +774,7 @@ class WebContents : public PageNavigator,
// frame document's manifest. The url will be empty if the document specifies // 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. // no manifest, and the manifest will be empty if any other failures occurred.
using GetManifestCallback = using GetManifestCallback =
base::OnceCallback<void(const GURL&, const Manifest&)>; base::OnceCallback<void(const GURL&, const blink::Manifest&)>;
// Requests the manifest URL and the Manifest of the main frame's document. // Requests the manifest URL and the Manifest of the main frame's document.
virtual void GetManifest(GetManifestCallback callback) = 0; virtual void GetManifest(GetManifestCallback callback) = 0;

@@ -22,8 +22,8 @@
#include "content/public/common/media_stream_request.h" #include "content/public/common/media_stream_request.h"
#include "content/public/common/previews_state.h" #include "content/public/common/previews_state.h"
#include "content/public/common/window_container_type.mojom.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/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_drag_operation.h"
#include "third_party/blink/public/platform/web_security_style.h" #include "third_party/blink/public/platform/web_security_style.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"

@@ -157,8 +157,6 @@ jumbo_source_set("common_sources") {
"isolated_world_ids.h", "isolated_world_ids.h",
"javascript_dialog_type.h", "javascript_dialog_type.h",
"main_function_params.h", "main_function_params.h",
"manifest.cc",
"manifest.h",
"manifest_share_target_util.cc", "manifest_share_target_util.cc",
"manifest_share_target_util.h", "manifest_share_target_util.h",
"manifest_util.cc", "manifest_util.cc",

@@ -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",
]

@@ -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<base::StringPiece16> TruncateNullableString16(
const base::NullableString16& string) {
if (string.is_null())
return base::nullopt;
return TruncateString16(string.string());
}
} // namespace internal
template <>
struct StructTraits<blink::mojom::ManifestDataView, content::Manifest> {
static bool IsNull(const content::Manifest& m) { return m.IsEmpty(); }
static void SetToNull(content::Manifest* m) { *m = content::Manifest(); }
static base::Optional<base::StringPiece16> name(const content::Manifest& m) {
return internal::TruncateNullableString16(m.name);
}
static base::Optional<base::StringPiece16> short_name(
const content::Manifest& m) {
return internal::TruncateNullableString16(m.short_name);
}
static base::Optional<base::StringPiece16> 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<content::Manifest::Icon>& icons(
const content::Manifest& m) {
return m.icons;
}
static const base::Optional<content::Manifest::ShareTarget>& share_target(
const content::Manifest& m) {
return m.share_target;
}
static const std::vector<content::Manifest::RelatedApplication>&
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<blink::mojom::ManifestIconDataView,
content::Manifest::Icon> {
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<gfx::Size>& sizes(const content::Manifest::Icon& m) {
return m.sizes;
}
static const std::vector<content::Manifest::Icon::IconPurpose>& purpose(
const content::Manifest::Icon& m) {
return m.purpose;
}
static bool Read(blink::mojom::ManifestIconDataView data,
content::Manifest::Icon* out);
};
template <>
struct StructTraits<blink::mojom::ManifestRelatedApplicationDataView,
content::Manifest::RelatedApplication> {
static base::Optional<base::StringPiece16> 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<base::StringPiece16> 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<blink::mojom::ManifestShareTargetDataView,
content::Manifest::ShareTarget> {
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<blink::mojom::ManifestIcon_Purpose,
content::Manifest::Icon::IconPurpose> {
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_

@@ -8,8 +8,8 @@
#include <string> #include <string>
#include "content/common/content_export.h" #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/common/screen_orientation/web_screen_orientation_lock_type.h"
#include "third_party/blink/public/platform/web_display_mode.h"
namespace content { namespace content {

@@ -4,7 +4,6 @@
typemaps = [ typemaps = [
"//content/public/common/load_timing_info.typemap", "//content/public/common/load_timing_info.typemap",
"//content/public/common/manifest.typemap",
"//content/public/common/referrer.typemap", "//content/public/common/referrer.typemap",
"//content/public/common/resource_type.typemap", "//content/public/common/resource_type.typemap",
"//content/public/common/speech_recognition_grammar.typemap", "//content/public/common/speech_recognition_grammar.typemap",

@@ -17,6 +17,7 @@
class GURL; class GURL;
namespace blink { namespace blink {
struct Manifest;
class WebInputEvent; class WebInputEvent;
class WebLocalFrame; class WebLocalFrame;
struct WebSize; struct WebSize;
@@ -46,7 +47,6 @@ class RenderFrame;
class RendererGamepadProvider; class RendererGamepadProvider;
class RenderView; class RenderView;
class StoragePartition; class StoragePartition;
struct Manifest;
// Turn the browser process into layout test mode. // Turn the browser process into layout test mode.
void EnableBrowserLayoutTestMode(); void EnableBrowserLayoutTestMode();
@@ -100,7 +100,7 @@ void EnableWebTestProxyCreation(
const WidgetProxyCreationCallback& widget_proxy_creation_callback, const WidgetProxyCreationCallback& widget_proxy_creation_callback,
const FrameProxyCreationCallback& frame_proxy_creation_callback); const FrameProxyCreationCallback& frame_proxy_creation_callback);
typedef base::OnceCallback<void(const GURL&, const Manifest&)> typedef base::OnceCallback<void(const GURL&, const blink::Manifest&)>
FetchManifestCallback; FetchManifestCallback;
void FetchManifest(blink::WebView* view, FetchManifestCallback callback); void FetchManifest(blink::WebView* view, FetchManifestCallback callback);

@@ -5,10 +5,10 @@
#include "content/renderer/installedapp/related_apps_fetcher.h" #include "content/renderer/installedapp/related_apps_fetcher.h"
#include "base/bind.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/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" #include "third_party/blink/public/platform/web_string.h"
namespace content { namespace content {
@@ -33,7 +33,7 @@ void RelatedAppsFetcher::OnGetManifestForRelatedApplications(
const blink::WebVector<blink::WebRelatedApplication>&, const blink::WebVector<blink::WebRelatedApplication>&,
void>> callbacks, void>> callbacks,
const GURL& /*url*/, const GURL& /*url*/,
const Manifest& manifest) { const blink::Manifest& manifest) {
std::vector<blink::WebRelatedApplication> related_apps; std::vector<blink::WebRelatedApplication> related_apps;
for (const auto& relatedApplication : manifest.related_applications) { for (const auto& relatedApplication : manifest.related_applications) {
blink::WebRelatedApplication webRelatedApplication; blink::WebRelatedApplication webRelatedApplication;

@@ -12,6 +12,7 @@
#include "third_party/blink/public/platform/modules/installedapp/web_related_apps_fetcher.h" #include "third_party/blink/public/platform/modules/installedapp/web_related_apps_fetcher.h"
namespace blink { namespace blink {
struct Manifest;
namespace mojom { namespace mojom {
class ManifestManager; class ManifestManager;
} }
@@ -19,7 +20,6 @@ class ManifestManager;
namespace content { namespace content {
struct Manifest;
class ManifestManager; class ManifestManager;
class CONTENT_EXPORT RelatedAppsFetcher : public blink::WebRelatedAppsFetcher { class CONTENT_EXPORT RelatedAppsFetcher : public blink::WebRelatedAppsFetcher {
@@ -41,7 +41,7 @@ class CONTENT_EXPORT RelatedAppsFetcher : public blink::WebRelatedAppsFetcher {
const blink::WebVector<blink::WebRelatedApplication>&, const blink::WebVector<blink::WebRelatedApplication>&,
void>> callbacks, void>> callbacks,
const GURL& url, const GURL& url,
const Manifest& manifest); const blink::Manifest& manifest);
blink::mojom::ManifestManager* const manifest_manager_; blink::mojom::ManifestManager* const manifest_manager_;

@@ -47,7 +47,7 @@ ManifestManager::~ManifestManager() {
void ManifestManager::RequestManifest(RequestManifestCallback callback) { void ManifestManager::RequestManifest(RequestManifestCallback callback) {
RequestManifestImpl(base::BindOnce( RequestManifestImpl(base::BindOnce(
[](RequestManifestCallback callback, const GURL& manifest_url, [](RequestManifestCallback callback, const GURL& manifest_url,
const Manifest& manifest, const blink::Manifest& manifest,
const blink::mojom::ManifestDebugInfo* debug_info) { const blink::mojom::ManifestDebugInfo* debug_info) {
std::move(callback).Run(manifest_url, manifest); std::move(callback).Run(manifest_url, manifest);
}, },
@@ -58,7 +58,7 @@ void ManifestManager::RequestManifestDebugInfo(
RequestManifestDebugInfoCallback callback) { RequestManifestDebugInfoCallback callback) {
RequestManifestImpl(base::BindOnce( RequestManifestImpl(base::BindOnce(
[](RequestManifestDebugInfoCallback callback, const GURL& manifest_url, [](RequestManifestDebugInfoCallback callback, const GURL& manifest_url,
const Manifest& manifest, const blink::Manifest& manifest,
const blink::mojom::ManifestDebugInfo* debug_info) { const blink::mojom::ManifestDebugInfo* debug_info) {
std::move(callback).Run(manifest_url, std::move(callback).Run(manifest_url,
debug_info ? debug_info->Clone() : nullptr); debug_info ? debug_info->Clone() : nullptr);
@@ -69,7 +69,7 @@ void ManifestManager::RequestManifestDebugInfo(
void ManifestManager::RequestManifestImpl( void ManifestManager::RequestManifestImpl(
InternalRequestManifestCallback callback) { InternalRequestManifestCallback callback) {
if (!may_have_manifest_) { if (!may_have_manifest_) {
std::move(callback).Run(GURL(), Manifest(), nullptr); std::move(callback).Run(GURL(), blink::Manifest(), nullptr);
return; return;
} }
@@ -190,7 +190,7 @@ void ManifestManager::ResolveCallbacks(ResolveState state) {
// |manifest_url| will be reset on navigation or if we receive a didchange // |manifest_url| will be reset on navigation or if we receive a didchange
// event. // event.
if (state == ResolveStateFailure) if (state == ResolveStateFailure)
manifest_ = Manifest(); manifest_ = blink::Manifest();
manifest_dirty_ = state != ResolveStateSuccess; manifest_dirty_ = state != ResolveStateSuccess;

@@ -12,10 +12,10 @@
#include "base/callback_forward.h" #include "base/callback_forward.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "content/public/common/manifest.h"
#include "content/public/renderer/render_frame_observer.h" #include "content/public/renderer/render_frame_observer.h"
#include "mojo/public/cpp/bindings/binding_set.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; class GURL;
@@ -55,7 +55,7 @@ class ManifestManager : public RenderFrameObserver,
using InternalRequestManifestCallback = using InternalRequestManifestCallback =
base::OnceCallback<void(const GURL&, base::OnceCallback<void(const GURL&,
const Manifest&, const blink::Manifest&,
const blink::mojom::ManifestDebugInfo*)>; const blink::mojom::ManifestDebugInfo*)>;
// RenderFrameObserver implementation. // RenderFrameObserver implementation.
@@ -86,7 +86,7 @@ class ManifestManager : public RenderFrameObserver,
bool manifest_dirty_; bool manifest_dirty_;
// Current Manifest. Might be outdated if manifest_dirty_ is true. // Current Manifest. Might be outdated if manifest_dirty_ is true.
Manifest manifest_; blink::Manifest manifest_;
// The URL of the current manifest. // The URL of the current manifest.
GURL manifest_url_; GURL manifest_url_;

@@ -13,7 +13,6 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/values.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_share_target_util.h"
#include "content/public/common/manifest_util.h" #include "content/public/common/manifest_util.h"
#include "content/renderer/manifest/manifest_uma_util.h" #include "content/renderer/manifest/manifest_uma_util.h"
@@ -81,7 +80,7 @@ void ManifestParser::Parse() {
ManifestUmaUtil::ParseSucceeded(manifest_); ManifestUmaUtil::ParseSucceeded(manifest_);
} }
const Manifest& ManifestParser::manifest() const { const blink::Manifest& ManifestParser::manifest() const {
return manifest_; return manifest_;
} }
@@ -135,7 +134,7 @@ int64_t ManifestParser::ParseColor(
const std::string& key) { const std::string& key) {
base::NullableString16 parsed_color = ParseString(dictionary, key, Trim); base::NullableString16 parsed_color = ParseString(dictionary, key, Trim);
if (parsed_color.is_null()) if (parsed_color.is_null())
return Manifest::kInvalidOrMissingColor; return blink::Manifest::kInvalidOrMissingColor;
blink::WebColor color; blink::WebColor color;
if (!blink::WebCSSParser::ParseColor( if (!blink::WebCSSParser::ParseColor(
@@ -143,7 +142,7 @@ int64_t ManifestParser::ParseColor(
AddErrorInfo("property '" + key + "' ignored, '" + AddErrorInfo("property '" + key + "' ignored, '" +
base::UTF16ToUTF8(parsed_color.string()) + "' is not a " + base::UTF16ToUTF8(parsed_color.string()) + "' is not a " +
"valid color."); "valid color.");
return Manifest::kInvalidOrMissingColor; return blink::Manifest::kInvalidOrMissingColor;
} }
// We do this here because Java does not have an unsigned int32_t type so // We do this here because Java does not have an unsigned int32_t type so
@@ -283,13 +282,13 @@ std::vector<gfx::Size> ManifestParser::ParseIconSizes(
return sizes; return sizes;
} }
std::vector<Manifest::Icon::IconPurpose> ManifestParser::ParseIconPurpose( std::vector<blink::Manifest::Icon::IconPurpose>
const base::DictionaryValue& icon) { ManifestParser::ParseIconPurpose(const base::DictionaryValue& icon) {
base::NullableString16 purpose_str = ParseString(icon, "purpose", NoTrim); base::NullableString16 purpose_str = ParseString(icon, "purpose", NoTrim);
std::vector<Manifest::Icon::IconPurpose> purposes; std::vector<blink::Manifest::Icon::IconPurpose> purposes;
if (purpose_str.is_null()) { if (purpose_str.is_null()) {
purposes.push_back(Manifest::Icon::IconPurpose::ANY); purposes.push_back(blink::Manifest::Icon::IconPurpose::ANY);
return purposes; return purposes;
} }
@@ -298,9 +297,9 @@ std::vector<Manifest::Icon::IconPurpose> ManifestParser::ParseIconPurpose(
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
for (const base::string16& keyword : keywords) { for (const base::string16& keyword : keywords) {
if (base::LowerCaseEqualsASCII(keyword, "any")) { 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")) { } else if (base::LowerCaseEqualsASCII(keyword, "badge")) {
purposes.push_back(Manifest::Icon::IconPurpose::BADGE); purposes.push_back(blink::Manifest::Icon::IconPurpose::BADGE);
} else { } else {
AddErrorInfo( AddErrorInfo(
"found icon with invalid purpose. " "found icon with invalid purpose. "
@@ -309,15 +308,15 @@ std::vector<Manifest::Icon::IconPurpose> ManifestParser::ParseIconPurpose(
} }
if (purposes.empty()) { if (purposes.empty()) {
purposes.push_back(Manifest::Icon::IconPurpose::ANY); purposes.push_back(blink::Manifest::Icon::IconPurpose::ANY);
} }
return purposes; return purposes;
} }
std::vector<Manifest::Icon> ManifestParser::ParseIcons( std::vector<blink::Manifest::Icon> ManifestParser::ParseIcons(
const base::DictionaryValue& dictionary) { const base::DictionaryValue& dictionary) {
std::vector<Manifest::Icon> icons; std::vector<blink::Manifest::Icon> icons;
if (!dictionary.HasKey("icons")) if (!dictionary.HasKey("icons"))
return icons; return icons;
@@ -332,7 +331,7 @@ std::vector<Manifest::Icon> ManifestParser::ParseIcons(
if (!icons_list->GetDictionary(i, &icon_dictionary)) if (!icons_list->GetDictionary(i, &icon_dictionary))
continue; continue;
Manifest::Icon icon; blink::Manifest::Icon icon;
icon.src = ParseIconSrc(*icon_dictionary); icon.src = ParseIconSrc(*icon_dictionary);
// An icon MUST have a valid src. If it does not, it MUST be ignored. // An icon MUST have a valid src. If it does not, it MUST be ignored.
if (!icon.src.is_valid()) if (!icon.src.is_valid())
@@ -361,19 +360,19 @@ GURL ManifestParser::ParseShareTargetURLTemplate(
return url_template; return url_template;
} }
base::Optional<Manifest::ShareTarget> ManifestParser::ParseShareTarget( base::Optional<blink::Manifest::ShareTarget> ManifestParser::ParseShareTarget(
const base::DictionaryValue& dictionary) { const base::DictionaryValue& dictionary) {
if (!dictionary.HasKey("share_target")) if (!dictionary.HasKey("share_target"))
return base::nullopt; return base::nullopt;
Manifest::ShareTarget share_target; blink::Manifest::ShareTarget share_target;
const base::DictionaryValue* share_target_dict = nullptr; const base::DictionaryValue* share_target_dict = nullptr;
dictionary.GetDictionary("share_target", &share_target_dict); dictionary.GetDictionary("share_target", &share_target_dict);
share_target.url_template = ParseShareTargetURLTemplate(*share_target_dict); share_target.url_template = ParseShareTargetURLTemplate(*share_target_dict);
if (share_target.url_template.is_empty()) if (share_target.url_template.is_empty())
return base::nullopt; return base::nullopt;
return base::Optional<Manifest::ShareTarget>(share_target); return base::Optional<blink::Manifest::ShareTarget>(share_target);
} }
base::NullableString16 ManifestParser::ParseRelatedApplicationPlatform( base::NullableString16 ManifestParser::ParseRelatedApplicationPlatform(
@@ -392,10 +391,10 @@ base::NullableString16 ManifestParser::ParseRelatedApplicationId(
return ParseString(application, "id", Trim); return ParseString(application, "id", Trim);
} }
std::vector<Manifest::RelatedApplication> std::vector<blink::Manifest::RelatedApplication>
ManifestParser::ParseRelatedApplications( ManifestParser::ParseRelatedApplications(
const base::DictionaryValue& dictionary) { const base::DictionaryValue& dictionary) {
std::vector<Manifest::RelatedApplication> applications; std::vector<blink::Manifest::RelatedApplication> applications;
if (!dictionary.HasKey("related_applications")) if (!dictionary.HasKey("related_applications"))
return applications; return applications;
@@ -411,7 +410,7 @@ ManifestParser::ParseRelatedApplications(
if (!applications_list->GetDictionary(i, &application_dictionary)) if (!applications_list->GetDictionary(i, &application_dictionary))
continue; continue;
Manifest::RelatedApplication application; blink::Manifest::RelatedApplication application;
application.platform = application.platform =
ParseRelatedApplicationPlatform(*application_dictionary); ParseRelatedApplicationPlatform(*application_dictionary);
// "If platform is undefined, move onto the next item if any are left." // "If platform is undefined, move onto the next item if any are left."

@@ -14,8 +14,8 @@
#include "base/strings/nullable_string16.h" #include "base/strings/nullable_string16.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
#include "content/public/common/manifest.h" #include "third_party/blink/public/common/manifest/manifest.h"
#include "third_party/blink/public/platform/modules/manifest/manifest.mojom.h" #include "third_party/blink/public/mojom/manifest/manifest.mojom.h"
class GURL; class GURL;
@@ -39,7 +39,7 @@ class CONTENT_EXPORT ManifestParser {
// http://w3c.github.io/manifest/#dfn-steps-for-processing-a-manifest // http://w3c.github.io/manifest/#dfn-steps-for-processing-a-manifest
void Parse(); void Parse();
const Manifest& manifest() const; const blink::Manifest& manifest() const;
bool failed() const; bool failed() const;
void TakeErrors(std::vector<blink::mojom::ManifestErrorPtr>* errors); void TakeErrors(std::vector<blink::mojom::ManifestErrorPtr>* errors);
@@ -146,14 +146,14 @@ class CONTENT_EXPORT ManifestParser {
// Returns a vector of Manifest::Icon::IconPurpose with the successfully // Returns a vector of Manifest::Icon::IconPurpose with the successfully
// parsed icon purposes, and a vector with Manifest::Icon::IconPurpose::Any if // parsed icon purposes, and a vector with Manifest::Icon::IconPurpose::Any if
// the parsing failed. // the parsing failed.
std::vector<Manifest::Icon::IconPurpose> ParseIconPurpose( std::vector<blink::Manifest::Icon::IconPurpose> ParseIconPurpose(
const base::DictionaryValue& icon); const base::DictionaryValue& icon);
// Parses the 'icons' field of a Manifest, as defined in: // Parses the 'icons' field of a Manifest, as defined in:
// https://w3c.github.io/manifest/#dfn-steps-for-processing-an-array-of-images // 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 // Returns a vector of Manifest::Icon with the successfully parsed icons, if
// any. An empty vector if the field was not present or empty. // any. An empty vector if the field was not present or empty.
std::vector<Manifest::Icon> ParseIcons( std::vector<blink::Manifest::Icon> ParseIcons(
const base::DictionaryValue& dictionary); const base::DictionaryValue& dictionary);
// Parses the 'url_template' field of a Share Target, as defined in: // 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 // 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 // Returns the parsed Web Share target. The returned Share Target is null if
// the field didn't exist, parsing failed, or it was empty. // the field didn't exist, parsing failed, or it was empty.
base::Optional<Manifest::ShareTarget> ParseShareTarget( base::Optional<blink::Manifest::ShareTarget> ParseShareTarget(
const base::DictionaryValue& dictionary); const base::DictionaryValue& dictionary);
// Parses the 'platform' field of a related application, as defined in: // 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 // Returns a vector of Manifest::RelatedApplication with the successfully
// parsed applications, if any. An empty vector if the field was not present // parsed applications, if any. An empty vector if the field was not present
// or empty. // or empty.
std::vector<Manifest::RelatedApplication> ParseRelatedApplications( std::vector<blink::Manifest::RelatedApplication> ParseRelatedApplications(
const base::DictionaryValue& dictionary); const base::DictionaryValue& dictionary);
// Parses the 'prefer_related_applications' field on the manifest, as defined // Parses the 'prefer_related_applications' field on the manifest, as defined
@@ -231,7 +231,7 @@ class CONTENT_EXPORT ManifestParser {
GURL document_url_; GURL document_url_;
bool failed_; bool failed_;
Manifest manifest_; blink::Manifest manifest_;
std::vector<blink::mojom::ManifestErrorPtr> errors_; std::vector<blink::mojom::ManifestErrorPtr> errors_;
DISALLOW_COPY_AND_ASSIGN(ManifestParser); DISALLOW_COPY_AND_ASSIGN(ManifestParser);

File diff suppressed because it is too large Load Diff

@@ -5,7 +5,7 @@
#include "content/renderer/manifest/manifest_uma_util.h" #include "content/renderer/manifest/manifest_uma_util.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "content/public/common/manifest.h" #include "third_party/blink/public/common/manifest/manifest.h"
namespace content { namespace content {
@@ -29,7 +29,7 @@ enum ManifestFetchResultType {
} // anonymous namespace } // anonymous namespace
void ManifestUmaUtil::ParseSucceeded(const Manifest& manifest) { void ManifestUmaUtil::ParseSucceeded(const blink::Manifest& manifest) {
UMA_HISTOGRAM_BOOLEAN(kUMANameParseSuccess, true); UMA_HISTOGRAM_BOOLEAN(kUMANameParseSuccess, true);
UMA_HISTOGRAM_BOOLEAN("Manifest.IsEmpty", manifest.IsEmpty()); UMA_HISTOGRAM_BOOLEAN("Manifest.IsEmpty", manifest.IsEmpty());
if (manifest.IsEmpty()) if (manifest.IsEmpty())

@@ -5,9 +5,11 @@
#ifndef CONTENT_RENDERER_MANIFEST_MANIFEST_UMA_UTIL_H_ #ifndef CONTENT_RENDERER_MANIFEST_MANIFEST_UMA_UTIL_H_
#define CONTENT_RENDERER_MANIFEST_MANIFEST_UMA_UTIL_H_ #define CONTENT_RENDERER_MANIFEST_MANIFEST_UMA_UTIL_H_
namespace content { namespace blink {
struct Manifest; struct Manifest;
}
namespace content {
class ManifestUmaUtil { class ManifestUmaUtil {
public: public:
@@ -20,7 +22,7 @@ class ManifestUmaUtil {
// Record that the Manifest was successfully parsed. If it is an empty // Record that the Manifest was successfully parsed. If it is an empty
// Manifest, it will recorded as so and nothing will happen. Otherwise, the // Manifest, it will recorded as so and nothing will happen. Otherwise, the
// presence of each properties will be recorded. // 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. // Record that the Manifest parsing failed.
static void ParseFailed(); static void ParseFailed();

@@ -17,7 +17,7 @@
#include "content/renderer/render_frame_impl.h" #include "content/renderer/render_frame_impl.h"
#include "content/renderer/service_worker/web_service_worker_registration_impl.h" #include "content/renderer/service_worker/web_service_worker_registration_impl.h"
#include "services/service_manager/public/cpp/connector.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_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.h"
#include "third_party/blink/public/platform/modules/push_messaging/web_push_subscription_options.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, bool user_gesture,
std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks, std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks,
const GURL& manifest_url, const GURL& manifest_url,
const Manifest& manifest) { const blink::Manifest& manifest) {
// Get the sender_info from the manifest since it wasn't provided by // Get the sender_info from the manifest since it wasn't provided by
// the caller. // the caller.
if (manifest.IsEmpty()) { if (manifest.IsEmpty()) {

@@ -14,12 +14,13 @@
#include "base/macros.h" #include "base/macros.h"
#include "content/common/push_messaging.mojom.h" #include "content/common/push_messaging.mojom.h"
#include "content/public/renderer/render_frame_observer.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" #include "third_party/blink/public/platform/modules/push_messaging/web_push_client.h"
class GURL; class GURL;
namespace blink { namespace blink {
struct Manifest;
struct WebPushSubscriptionOptions; struct WebPushSubscriptionOptions;
} }
@@ -29,7 +30,6 @@ namespace mojom {
enum class PushRegistrationStatus; enum class PushRegistrationStatus;
} }
struct Manifest;
struct PushSubscriptionOptions; struct PushSubscriptionOptions;
class PushMessagingClient : public RenderFrameObserver, class PushMessagingClient : public RenderFrameObserver,
@@ -55,7 +55,7 @@ class PushMessagingClient : public RenderFrameObserver,
bool user_gesture, bool user_gesture,
std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks, std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks,
const GURL& manifest_url, const GURL& manifest_url,
const Manifest& manifest); const blink::Manifest& manifest);
void DoSubscribe( void DoSubscribe(
blink::WebServiceWorkerRegistration* service_worker_registration, blink::WebServiceWorkerRegistration* service_worker_registration,

@@ -70,9 +70,9 @@
#include "services/service_manager/public/mojom/connector.mojom.h" #include "services/service_manager/public/mojom/connector.mojom.h"
#include "services/service_manager/public/mojom/interface_provider.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/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/mojom/page/page_visibility_state.mojom.h"
#include "third_party/blink/public/platform/autoplay.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/site_engagement.mojom.h"
#include "third_party/blink/public/platform/web_effective_connection_type.h" #include "third_party/blink/public/platform/web_effective_connection_type.h"
#include "third_party/blink/public/platform/web_focus_type.h" #include "third_party/blink/public/platform/web_focus_type.h"

@@ -49,7 +49,7 @@
#include "ipc/ipc_sender.h" #include "ipc/ipc_sender.h"
#include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/binding.h"
#include "ppapi/buildflags/buildflags.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_input_event.h"
#include "third_party/blink/public/platform/web_rect.h" #include "third_party/blink/public/platform/web_rect.h"
#include "third_party/blink/public/platform/web_referrer_policy.h" #include "third_party/blink/public/platform/web_referrer_policy.h"

@@ -715,7 +715,7 @@ bool BlinkTestRunner::AllowExternalPages() {
void BlinkTestRunner::FetchManifest( void BlinkTestRunner::FetchManifest(
blink::WebView* view, blink::WebView* view,
base::OnceCallback<void(const GURL&, const Manifest&)> callback) { base::OnceCallback<void(const GURL&, const blink::Manifest&)> callback) {
::content::FetchManifest(view, std::move(callback)); ::content::FetchManifest(view, std::move(callback));
} }

@@ -132,7 +132,8 @@ class BlinkTestRunner : public RenderViewObserver,
bool AllowExternalPages() override; bool AllowExternalPages() override;
void FetchManifest( void FetchManifest(
blink::WebView* view, blink::WebView* view,
base::OnceCallback<void(const GURL&, const Manifest&)> callback) override; base::OnceCallback<void(const GURL&, const blink::Manifest&)> callback)
override;
void SetPermission(const std::string& name, void SetPermission(const std::string& name,
const std::string& value, const std::string& value,
const GURL& origin, const GURL& origin,

@@ -317,7 +317,7 @@ void TestRunnerForSpecificView::GetManifestThen(
void TestRunnerForSpecificView::GetManifestCallback( void TestRunnerForSpecificView::GetManifestCallback(
v8::UniquePersistent<v8::Function> callback, v8::UniquePersistent<v8::Function> callback,
const GURL& manifest_url, const GURL& manifest_url,
const content::Manifest& manifest) { const blink::Manifest& manifest) {
PostV8CallbackWithArgs(std::move(callback), 0, nullptr); PostV8CallbackWithArgs(std::move(callback), 0, nullptr);
} }

@@ -19,14 +19,11 @@ class GURL;
class SkBitmap; class SkBitmap;
namespace blink { namespace blink {
struct Manifest;
class WebLocalFrame; class WebLocalFrame;
class WebView; class WebView;
} }
namespace content {
struct Manifest;
}
namespace gin { namespace gin {
class Arguments; class Arguments;
} }
@@ -98,7 +95,7 @@ class TestRunnerForSpecificView {
void GetManifestThen(v8::Local<v8::Function> callback); void GetManifestThen(v8::Local<v8::Function> callback);
void GetManifestCallback(v8::UniquePersistent<v8::Function> callback, void GetManifestCallback(v8::UniquePersistent<v8::Function> callback,
const GURL& manifest_url, const GURL& manifest_url,
const content::Manifest& manifest); const blink::Manifest& manifest);
// Calls |callback| with a DOMString[] representing the events recorded since // Calls |callback| with a DOMString[] representing the events recorded since
// the last call to this function. // the last call to this function.

@@ -25,6 +25,7 @@ class DictionaryValue;
} }
namespace blink { namespace blink {
struct Manifest;
class WebInputEvent; class WebInputEvent;
class WebLocalFrame; class WebLocalFrame;
class WebMediaStream; class WebMediaStream;
@@ -35,10 +36,6 @@ class WebURLRequest;
class WebView; class WebView;
} }
namespace content {
struct Manifest;
}
namespace device { namespace device {
class MotionData; class MotionData;
class OrientationData; class OrientationData;
@@ -239,7 +236,7 @@ class WebTestDelegate {
// Fetch the manifest for a given WebView from the given url. // Fetch the manifest for a given WebView from the given url.
virtual void FetchManifest( virtual void FetchManifest(
blink::WebView* view, blink::WebView* view,
base::OnceCallback<void(const GURL&, const content::Manifest&)> base::OnceCallback<void(const GURL&, const blink::Manifest&)>
callback) = 0; callback) = 0;
// Sends a message to the LayoutTestPermissionManager in order for it to // Sends a message to the LayoutTestPermissionManager in order for it to

@@ -55,6 +55,7 @@ mojom("mojom") {
"//third_party/blink/renderer/bindings/modules/v8:generate_mojo_bindings", "//third_party/blink/renderer/bindings/modules/v8:generate_mojo_bindings",
"//third_party/blink/renderer/platform:blink_platform_public_deps", "//third_party/blink/renderer/platform:blink_platform_public_deps",
"//third_party/blink/public:mojo_bindings_blink", "//third_party/blink/public:mojo_bindings_blink",
"//third_party/blink/public/mojom:mojom_platform_blink",
] ]
} }

@@ -21,6 +21,7 @@ jumbo_source_set("common") {
"device_memory/approximated_device_memory.cc", "device_memory/approximated_device_memory.cc",
"feature_policy/feature_policy.cc", "feature_policy/feature_policy.cc",
"frame/frame_policy.cc", "frame/frame_policy.cc",
"manifest/manifest.cc",
"message_port/cloneable_message.cc", "message_port/cloneable_message.cc",
"message_port/cloneable_message_struct_traits.cc", "message_port/cloneable_message_struct_traits.cc",
"message_port/cloneable_message_struct_traits.h", "message_port/cloneable_message_struct_traits.h",

@@ -16,5 +16,6 @@ include_rules = [
"+third_party/blink/common", "+third_party/blink/common",
"+third_party/blink/public/common", "+third_party/blink/public/common",
"+third_party/blink/public/mojom", "+third_party/blink/public/mojom",
"+ui/gfx/geometry",
"+url", "+url",
] ]

@@ -0,0 +1,6 @@
mlamouri@chromium.org
per-file *_mojom_traits*.*=set noparent
per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS
# COMPONENT: Manifest

@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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 // 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 // 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(); scope.is_empty();
} }
} // namespace content } // namespace blink

@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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 "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/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 "ui/gfx/geometry/mojo/geometry_struct_traits.h"
#include "url/mojom/url_gurl_mojom_traits.h" #include "url/mojom/url_gurl_mojom_traits.h"
@@ -16,7 +16,7 @@ namespace {
bool ValidateColor(int64_t color) { bool ValidateColor(int64_t color) {
return color >= std::numeric_limits<int32_t>::min() || return color >= std::numeric_limits<int32_t>::min() ||
color <= std::numeric_limits<int32_t>::max() || color <= std::numeric_limits<int32_t>::max() ||
color == content::Manifest::kInvalidOrMissingColor; color == blink::Manifest::kInvalidOrMissingColor;
} }
// A wrapper around base::Optional<base::string16> so a custom StructTraits // A wrapper around base::Optional<base::string16> so a custom StructTraits
@@ -39,7 +39,7 @@ struct StructTraits<mojo_base::mojom::String16DataView, TruncatedString16> {
} }
mojo::ArrayDataView<uint16_t> buffer_view; mojo::ArrayDataView<uint16_t> buffer_view;
input.GetDataDataView(&buffer_view); input.GetDataDataView(&buffer_view);
if (buffer_view.size() > content::Manifest::kMaxIPCStringLength) if (buffer_view.size() > blink::Manifest::kMaxIPCStringLength)
return false; return false;
output->string.emplace(); output->string.emplace();
@@ -48,9 +48,9 @@ struct StructTraits<mojo_base::mojom::String16DataView, TruncatedString16> {
} }
}; };
bool StructTraits<blink::mojom::ManifestDataView, content::Manifest>::Read( bool StructTraits<blink::mojom::ManifestDataView, blink::Manifest>::Read(
blink::mojom::ManifestDataView data, blink::mojom::ManifestDataView data,
content::Manifest* out) { blink::Manifest* out) {
TruncatedString16 string; TruncatedString16 string;
if (!data.ReadName(&string)) if (!data.ReadName(&string))
return false; return false;
@@ -100,9 +100,8 @@ bool StructTraits<blink::mojom::ManifestDataView, content::Manifest>::Read(
return true; return true;
} }
bool StructTraits<blink::mojom::ManifestIconDataView, content::Manifest::Icon>:: bool StructTraits<blink::mojom::ManifestIconDataView, blink::Manifest::Icon>::
Read(blink::mojom::ManifestIconDataView data, Read(blink::mojom::ManifestIconDataView data, blink::Manifest::Icon* out) {
content::Manifest::Icon* out) {
if (!data.ReadSrc(&out->src)) if (!data.ReadSrc(&out->src))
return false; return false;
@@ -125,9 +124,9 @@ bool StructTraits<blink::mojom::ManifestIconDataView, content::Manifest::Icon>::
} }
bool StructTraits<blink::mojom::ManifestRelatedApplicationDataView, bool StructTraits<blink::mojom::ManifestRelatedApplicationDataView,
content::Manifest::RelatedApplication>:: blink::Manifest::RelatedApplication>::
Read(blink::mojom::ManifestRelatedApplicationDataView data, Read(blink::mojom::ManifestRelatedApplicationDataView data,
content::Manifest::RelatedApplication* out) { blink::Manifest::RelatedApplication* out) {
TruncatedString16 string; TruncatedString16 string;
if (!data.ReadPlatform(&string)) if (!data.ReadPlatform(&string))
return false; return false;
@@ -144,9 +143,9 @@ bool StructTraits<blink::mojom::ManifestRelatedApplicationDataView,
} }
bool StructTraits<blink::mojom::ManifestShareTargetDataView, bool StructTraits<blink::mojom::ManifestShareTargetDataView,
content::Manifest::ShareTarget>:: blink::Manifest::ShareTarget>::
Read(blink::mojom::ManifestShareTargetDataView data, Read(blink::mojom::ManifestShareTargetDataView data,
content::Manifest::ShareTarget* out) { blink::Manifest::ShareTarget* out) {
return data.ReadUrlTemplate(&out->url_template); return data.ReadUrlTemplate(&out->url_template);
} }

@@ -74,8 +74,8 @@ buildflag_header("buildflags") {
if (is_android) { if (is_android) {
java_cpp_enum("blink_headers_java_enums_srcjar") { java_cpp_enum("blink_headers_java_enums_srcjar") {
sources = [ sources = [
"./common/manifest/web_display_mode.h",
"./platform/modules/remoteplayback/web_remote_playback_availability.h", "./platform/modules/remoteplayback/web_remote_playback_availability.h",
"./platform/web_display_mode.h",
"./platform/web_focus_type.h", "./platform/web_focus_type.h",
"./platform/web_input_event.h", "./platform/web_input_event.h",
"./platform/web_referrer_policy.h", "./platform/web_referrer_policy.h",
@@ -252,7 +252,6 @@ source_set("blink_headers") {
"platform/web_data_consumer_handle.h", "platform/web_data_consumer_handle.h",
"platform/web_database_observer.h", "platform/web_database_observer.h",
"platform/web_display_item_list.h", "platform/web_display_item_list.h",
"platform/web_display_mode.h",
"platform/web_distillability.h", "platform/web_distillability.h",
"platform/web_document_subresource_filter.h", "platform/web_document_subresource_filter.h",
"platform/web_double_point.h", "platform/web_double_point.h",
@@ -735,7 +734,6 @@ mojom("mojo_bindings") {
"platform/autoplay.mojom", "platform/autoplay.mojom",
"platform/content_security_policy.mojom", "platform/content_security_policy.mojom",
"platform/dedicated_worker_factory.mojom", "platform/dedicated_worker_factory.mojom",
"platform/display_mode.mojom",
"platform/media_download_in_product_help.mojom", "platform/media_download_in_product_help.mojom",
"platform/mime_registry.mojom", "platform/mime_registry.mojom",
"platform/modules/app_banner/app_banner.mojom", "platform/modules/app_banner/app_banner.mojom",
@@ -752,8 +750,6 @@ mojom("mojo_bindings") {
"platform/modules/insecure_input/insecure_input_service.mojom", "platform/modules/insecure_input/insecure_input_service.mojom",
"platform/modules/keyboard_lock/keyboard_lock.mojom", "platform/modules/keyboard_lock/keyboard_lock.mojom",
"platform/modules/locks/lock_manager.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.mojom",
"platform/modules/notifications/notification_service.mojom", "platform/modules/notifications/notification_service.mojom",
"platform/modules/payments/payment_app.mojom", "platform/modules/payments/payment_app.mojom",

@@ -39,6 +39,8 @@ source_set("headers") {
"feature_policy/feature_policy.h", "feature_policy/feature_policy.h",
"frame/frame_policy.h", "frame/frame_policy.h",
"frame/sandbox_flags.h", "frame/sandbox_flags.h",
"manifest/manifest.h",
"manifest/web_display_mode.h",
"message_port/cloneable_message.h", "message_port/cloneable_message.h",
"message_port/message_port_channel.h", "message_port/message_port_channel.h",
"message_port/transferable_message.h", "message_port/transferable_message.h",

@@ -12,6 +12,7 @@ include_rules = [
"+mojo", "+mojo",
"+third_party/blink/public/common", "+third_party/blink/public/common",
"+third_party/blink/public/mojom", "+third_party/blink/public/mojom",
"+ui/gfx/geometry",
"+url", "+url",
# This file should not be included outside of blink, so it does not belong # This file should not be included outside of blink, so it does not belong

@@ -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

@@ -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" ]

@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_PUBLIC_COMMON_MANIFEST_H_ #ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_MANIFEST_H_
#define CONTENT_PUBLIC_COMMON_MANIFEST_H_ #define THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_MANIFEST_H_
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
@@ -13,21 +13,21 @@
#include "base/optional.h" #include "base/optional.h"
#include "base/strings/nullable_string16.h" #include "base/strings/nullable_string16.h"
#include "base/strings/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/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 "ui/gfx/geometry/size.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace content { namespace blink {
// The Manifest structure is an internal representation of the Manifest file // The Manifest structure is an internal representation of the Manifest file
// described in the "Manifest for Web Application" document: // described in the "Manifest for Web Application" document:
// http://w3c.github.io/manifest/ // http://w3c.github.io/manifest/
struct CONTENT_EXPORT Manifest { struct BLINK_COMMON_EXPORT Manifest {
// Structure representing an icon as per the Manifest specification, see: // Structure representing an icon as per the Manifest specification, see:
// http://w3c.github.io/manifest/#dfn-icon-object // http://w3c.github.io/manifest/#dfn-icon-object
struct CONTENT_EXPORT Icon { struct BLINK_COMMON_EXPORT Icon {
enum IconPurpose { enum IconPurpose {
ANY = 0, ANY = 0,
BADGE, BADGE,
@@ -61,7 +61,7 @@ struct CONTENT_EXPORT Manifest {
}; };
// Structure representing how a Web Share target handles an incoming share. // Structure representing how a Web Share target handles an incoming share.
struct CONTENT_EXPORT ShareTarget { struct BLINK_COMMON_EXPORT ShareTarget {
ShareTarget(); ShareTarget();
~ShareTarget(); ~ShareTarget();
@@ -71,7 +71,7 @@ struct CONTENT_EXPORT Manifest {
}; };
// Structure representing a related application. // Structure representing a related application.
struct CONTENT_EXPORT RelatedApplication { struct BLINK_COMMON_EXPORT RelatedApplication {
RelatedApplication(); RelatedApplication();
~RelatedApplication(); ~RelatedApplication();
@@ -172,6 +172,6 @@ struct CONTENT_EXPORT Manifest {
static const int64_t kInvalidOrMissingColor; static const int64_t kInvalidOrMissingColor;
}; };
} // namespace content } // namespace blink
#endif // CONTENT_PUBLIC_COMMON_MANIFEST_H_ #endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_MANIFEST_H_

Some files were not shown because too many files have changed in this diff Show More