From 1a5e631c99d55da3fa3e3d2e469d4ab95a5af5eb Mon Sep 17 00:00:00 2001
From: Herrie <github.com@herrie.org>
Date: Fri, 25 Aug 2017 21:12:16 +0200
Subject: [PATCH 10/10] Update additional params from Chromium 53->56

---
 .../content/browser/web_contents/web_contents_impl.cc     |  8 ++++++--
 .../content/public/common/common_param_traits_macros.h    |  1 +
 .../third_party/WebKit/public/web/WebWindowFeatures.h     | 15 +++++++++++----
 .../WebKit/public/web/WindowFeaturesStructTraits.cpp      |  2 ++
 .../WebKit/public/web/WindowFeaturesStructTraits.h        |  4 ++++
 .../third_party/WebKit/public/web/window_features.mojom   |  2 ++
 6 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc b/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc
index 228b62a..c1a74a8 100644
--- a/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc
+++ b/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc
@@ -2094,6 +2094,10 @@ void WebContentsImpl::CreateNewWindow(
       rfh->Init();
     return;
   }
+  
+  std::vector<base::string16> additional_features;
+  for (auto webStr : params.features.additionalFeatures)
+    additional_features.push_back(webStr);
 
   // Create the new web contents. This will automatically create the new
   // WebContentsView. In the future, we may want to create the view separately.
@@ -2138,7 +2142,7 @@ void WebContentsImpl::CreateNewWindow(
 
       // set the additional features required by the LuneOS app
       // (ideally this information should be propagated using the IPC messaging)
-      new_view->setWindowAdditionalFeatures(params.additional_features);
+      new_view->setWindowAdditionalFeatures(additional_features);
       new_view->setInitialTargetURL(params.target_url);
 
       // TODO(brettw): It seems bogus that we have to call this function on the
@@ -2168,7 +2172,7 @@ void WebContentsImpl::CreateNewWindow(
       gfx::Rect initial_rect;
       delegate_->AddNewContents(
           this, new_contents, params.disposition, initial_rect,
-          params.user_gesture, &was_blocked, params.additional_features);
+          params.user_gesture, &was_blocked, additional_features);
     }
     if (!was_blocked) {
       OpenURLParams open_params(params.target_url, params.referrer,
diff --git a/src/3rdparty/chromium/content/public/common/common_param_traits_macros.h b/src/3rdparty/chromium/content/public/common/common_param_traits_macros.h
index c4568af..457fd2d 100644
--- a/src/3rdparty/chromium/content/public/common/common_param_traits_macros.h
+++ b/src/3rdparty/chromium/content/public/common/common_param_traits_macros.h
@@ -267,6 +267,7 @@ IPC_STRUCT_TRAITS_BEGIN(blink::WebWindowFeatures)
   IPC_STRUCT_TRAITS_MEMBER(resizable)
   IPC_STRUCT_TRAITS_MEMBER(fullscreen)
   IPC_STRUCT_TRAITS_MEMBER(dialog)
+  IPC_STRUCT_TRAITS_MEMBER(additionalFeatures)
 IPC_STRUCT_TRAITS_END()
 
 IPC_ENUM_TRAITS_MAX_VALUE(ui::AXEvent, ui::AX_EVENT_LAST)
diff --git a/src/3rdparty/chromium/third_party/WebKit/public/web/WebWindowFeatures.h b/src/3rdparty/chromium/third_party/WebKit/public/web/WebWindowFeatures.h
index a1f6743..7c11a7d 100644
--- a/src/3rdparty/chromium/third_party/WebKit/public/web/WebWindowFeatures.h
+++ b/src/3rdparty/chromium/third_party/WebKit/public/web/WebWindowFeatures.h
@@ -60,7 +60,7 @@ struct WebWindowFeatures {
 
   bool fullscreen;
   bool dialog;
-  WebVector<WebString> additionalFeatures;
+  std::vector<base::string16> additionalFeatures;
 
   WebWindowFeatures()
       : x(0),
@@ -97,8 +97,15 @@ struct WebWindowFeatures {
         scrollbarsVisible(f.scrollbarsVisible),
         resizable(f.resizable),
         fullscreen(f.fullscreen),
-        dialog(f.dialog),
-        additionalFeatures(f.additionalFeatures) {}
+        dialog(f.dialog) 
+    {
+        for(auto str: f.additionalFeatures) {
+            str.ensure16Bit();
+            base::string16 destStr((const base::char16*)str.characters16(), str.length());
+            
+            additionalFeatures.push_back(destStr);
+        }
+    }
 
   operator WindowFeatures() const {
     WindowFeatures result;
@@ -119,7 +126,7 @@ struct WebWindowFeatures {
     result.fullscreen = fullscreen;
     result.dialog = dialog;
     for (size_t i = 0; i < additionalFeatures.size(); ++i)
-      result.additionalFeatures.append(additionalFeatures[i]);
+      result.additionalFeatures.append(WTF::String(additionalFeatures[i].data(), additionalFeatures[i].length()));
     return result;
   }
 #endif
diff --git a/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.cpp b/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.cpp
index 69dce5b..d4b83fc 100644
--- a/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.cpp
+++ b/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.cpp
@@ -27,6 +27,8 @@ bool StructTraits<::blink::mojom::WindowFeaturesDataView,
   out->resizable = data.resizable();
   out->fullscreen = data.fullscreen();
   out->dialog = data.dialog();
+  
+  data.ReadAdditionalfeatures(&out->additionalFeatures);
   return true;
 }
 
diff --git a/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.h b/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.h
index ca776ed..405fb498 100644
--- a/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.h
+++ b/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.h
@@ -65,6 +65,10 @@ struct StructTraits<::blink::mojom::WindowFeaturesDataView,
     return features.dialog;
   }
 
+  static std::vector<base::string16> additionalFeatures(const ::blink::WebWindowFeatures& features) {
+    return features.additionalFeatures;
+  }
+
   static bool Read(::blink::mojom::WindowFeaturesDataView,
                    ::blink::WebWindowFeatures* out);
 };
diff --git a/src/3rdparty/chromium/third_party/WebKit/public/web/window_features.mojom b/src/3rdparty/chromium/third_party/WebKit/public/web/window_features.mojom
index a26b8a3..cb21f15 100644
--- a/src/3rdparty/chromium/third_party/WebKit/public/web/window_features.mojom
+++ b/src/3rdparty/chromium/third_party/WebKit/public/web/window_features.mojom
@@ -30,4 +30,6 @@ struct WindowFeatures {
     // NOTE: WebWindowFeatures::additionalFeatures is not mirrored by this
     // mojom struct as it's never used by the browser and therefore doesn't need
     // to be sent.
+	// ... but webOS/LuneOS apps need that to send additional info to the OS
+    array<string> additionalFeatures;
 };
-- 
2.7.4

