chore: bump chromium to f5b345dd470f14eef6e44732ccf23 (master) (#20649)

This commit is contained in:
Electron Bot 2019-10-28 18:12:35 -04:00 committed by Jeremy Apthorp
parent fb8b1fd1c9
commit b6246dcf12
154 changed files with 1490 additions and 1197 deletions

View file

@ -11,6 +11,7 @@
#include "base/i18n/rtl.h"
#include "chrome/browser/ui/autofill/popup_view_common.h"
#include "electron/buildflags/buildflags.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "shell/browser/native_window_views.h"
#include "shell/browser/ui/autofill_popup.h"
#include "shell/common/api/api.mojom.h"
@ -113,9 +114,8 @@ void AutofillPopup::SetItems(const std::vector<base::string16>& values,
}
void AutofillPopup::AcceptSuggestion(int index) {
mojom::ElectronAutofillAgentAssociatedPtr autofill_agent;
frame_host_->GetRemoteAssociatedInterfaces()->GetInterface(
mojo::MakeRequest(&autofill_agent));
mojo::AssociatedRemote<mojom::ElectronAutofillAgent> autofill_agent;
frame_host_->GetRemoteAssociatedInterfaces()->GetInterface(&autofill_agent);
autofill_agent->AcceptDataListSuggestion(GetValueAt(index));
}

View file

@ -60,9 +60,10 @@ class BundledDataSource : public content::URLDataSource {
// content::URLDataSource implementation.
std::string GetSource() override { return kChromeUIDevToolsHost; }
void StartDataRequest(const std::string& path,
void StartDataRequest(const GURL& url,
const content::WebContents::Getter& wc_getter,
const GotDataCallback& callback) override {
const std::string path = content::URLDataSource::URLToRequestPath(url);
// Serve request from local bundle.
std::string bundled_path_prefix(kChromeUIDevToolsBundledPath);
bundled_path_prefix += "/";

View file

@ -5,7 +5,7 @@
#include <memory>
#include "shell/browser/ui/file_dialog.h"
#include "shell/browser/ui/util_gtk.h"
#include "shell/browser/ui/gtk_util.h"
#include "base/callback.h"
#include "base/files/file_util.h"

View file

@ -0,0 +1,82 @@
// Copyright (c) 2019 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/ui/gtk_util.h"
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <stdint.h>
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkUnPreMultiply.h"
namespace gtk_util {
// Copied from L40-L55 in
// https://cs.chromium.org/chromium/src/chrome/browser/ui/libgtkui/select_file_dialog_impl_gtk.cc
#if GTK_CHECK_VERSION(3, 90, 0)
// GTK stock items have been deprecated. The docs say to switch to using the
// strings "_Open", etc. However this breaks i18n. We could supply our own
// internationalized strings, but the "_" in these strings is significant: it's
// the keyboard shortcut to select these actions. TODO: Provide
// internationalized strings when GTK provides support for it.
const char* const kCancelLabel = "_Cancel";
const char* const kNoLabel = "_No";
const char* const kOkLabel = "_OK";
const char* const kOpenLabel = "_Open";
const char* const kSaveLabel = "_Save";
const char* const kYesLabel = "_Yes";
#else
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
const char* const kCancelLabel = GTK_STOCK_CANCEL;
const char* const kNoLabel = GTK_STOCK_NO;
const char* const kOkLabel = GTK_STOCK_OK;
const char* const kOpenLabel = GTK_STOCK_OPEN;
const char* const kSaveLabel = GTK_STOCK_SAVE;
const char* const kYesLabel = GTK_STOCK_YES;
G_GNUC_END_IGNORE_DEPRECATIONS
#endif
GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap) {
if (bitmap.isNull())
return nullptr;
int width = bitmap.width();
int height = bitmap.height();
GdkPixbuf* pixbuf =
gdk_pixbuf_new(GDK_COLORSPACE_RGB, // The only colorspace gtk supports.
TRUE, // There is an alpha channel.
8, width, height);
// SkBitmaps are premultiplied, we need to unpremultiply them.
const int kBytesPerPixel = 4;
uint8_t* divided = gdk_pixbuf_get_pixels(pixbuf);
for (int y = 0, i = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
uint32_t pixel = bitmap.getAddr32(0, y)[x];
int alpha = SkColorGetA(pixel);
if (alpha != 0 && alpha != 255) {
SkColor unmultiplied = SkUnPreMultiply::PMColorToColor(pixel);
divided[i + 0] = SkColorGetR(unmultiplied);
divided[i + 1] = SkColorGetG(unmultiplied);
divided[i + 2] = SkColorGetB(unmultiplied);
divided[i + 3] = alpha;
} else {
divided[i + 0] = SkColorGetR(pixel);
divided[i + 1] = SkColorGetG(pixel);
divided[i + 2] = SkColorGetB(pixel);
divided[i + 3] = alpha;
}
i += kBytesPerPixel;
}
}
return pixbuf;
}
} // namespace gtk_util

View file

@ -2,8 +2,12 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_UI_UTIL_GTK_H_
#define SHELL_BROWSER_UI_UTIL_GTK_H_
#ifndef SHELL_BROWSER_UI_GTK_UTIL_H_
#define SHELL_BROWSER_UI_GTK_UTIL_H_
#include <gtk/gtk.h>
class SkBitmap;
namespace gtk_util {
@ -16,6 +20,11 @@ extern const char* const kOpenLabel;
extern const char* const kSaveLabel;
extern const char* const kYesLabel;
// Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so
// it is an expensive operation. The returned GdkPixbuf will have a refcount of
// 1, and the caller is responsible for unrefing it when done.
GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap);
} // namespace gtk_util
#endif // SHELL_BROWSER_UI_UTIL_GTK_H_
#endif // SHELL_BROWSER_UI_GTK_UTIL_H_

View file

@ -805,22 +805,6 @@ bool InspectableWebContentsImpl::DidAddMessageToConsole(
return true;
}
bool InspectableWebContentsImpl::ShouldCreateWebContents(
content::WebContents* web_contents,
content::RenderFrameHost* opener,
content::SiteInstance* source_site_instance,
int32_t route_id,
int32_t main_frame_route_id,
int32_t main_frame_widget_route_id,
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
content::SessionStorageNamespace* session_storage_namespace) {
return false;
}
bool InspectableWebContentsImpl::HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {

View file

@ -176,19 +176,6 @@ class InspectableWebContentsImpl
const base::string16& message,
int32_t line_no,
const base::string16& source_id) override;
bool ShouldCreateWebContents(
content::WebContents* web_contents,
content::RenderFrameHost* opener,
content::SiteInstance* source_site_instance,
int32_t route_id,
int32_t main_frame_route_id,
int32_t main_frame_widget_route_id,
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
content::SessionStorageNamespace* session_storage_namespace) override;
bool HandleKeyboardEvent(content::WebContents*,
const content::NativeWebKeyboardEvent&) override;
void CloseContents(content::WebContents* source) override;

View file

@ -2,14 +2,13 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/ui/gtk_util.h"
#include "shell/browser/ui/message_box.h"
#include "shell/browser/ui/util_gtk.h"
#include "base/callback.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/libgtkui/gtk_util.h"
#include "chrome/browser/ui/libgtkui/skia_utils_gtk.h"
#include "shell/browser/browser.h"
#include "shell/browser/native_window_observer.h"
#include "shell/browser/native_window_views.h"
@ -56,7 +55,7 @@ class GtkMessageBox : public NativeWindowObserver {
static constexpr int pixel_width = 48;
static constexpr int pixel_height = 48;
GdkPixbuf* pixbuf =
libgtkui::GdkPixbufFromSkBitmap(*settings.icon.bitmap());
gtk_util::GdkPixbufFromSkBitmap(*settings.icon.bitmap());
GdkPixbuf* scaled_pixbuf = gdk_pixbuf_scale_simple(
pixbuf, pixel_width, pixel_height, GDK_INTERP_BILINEAR);
GtkWidget* w = gtk_image_new_from_pixbuf(scaled_pixbuf);

View file

@ -1,36 +0,0 @@
// Copyright (c) 2019 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/ui/util_gtk.h"
#include <gtk/gtk.h>
namespace gtk_util {
// Copied from L40-L55 in
// https://cs.chromium.org/chromium/src/chrome/browser/ui/libgtkui/select_file_dialog_impl_gtk.cc
#if GTK_CHECK_VERSION(3, 90, 0)
// GTK stock items have been deprecated. The docs say to switch to using the
// strings "_Open", etc. However this breaks i18n. We could supply our own
// internationalized strings, but the "_" in these strings is significant: it's
// the keyboard shortcut to select these actions. TODO: Provide
// internationalized strings when GTK provides support for it.
const char* const kCancelLabel = "_Cancel";
const char* const kNoLabel = "_No";
const char* const kOkLabel = "_OK";
const char* const kOpenLabel = "_Open";
const char* const kSaveLabel = "_Save";
const char* const kYesLabel = "_Yes";
#else
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
const char* const kCancelLabel = GTK_STOCK_CANCEL;
const char* const kNoLabel = GTK_STOCK_NO;
const char* const kOkLabel = GTK_STOCK_OK;
const char* const kOpenLabel = GTK_STOCK_OPEN;
const char* const kSaveLabel = GTK_STOCK_SAVE;
const char* const kYesLabel = GTK_STOCK_YES;
G_GNUC_END_IGNORE_DEPRECATIONS
#endif
} // namespace gtk_util