Update to Chromium version 81.0.4044.0 (#737173)

This commit is contained in:
Marshall Greenblatt
2020-03-03 19:29:39 -05:00
parent a22b670a00
commit 9d9ee8b45f
135 changed files with 2602 additions and 1329 deletions

View File

@ -8,7 +8,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "third_party/blink/public/platform/web_mouse_event.h"
#include "third_party/blink/public/common/input/web_mouse_event.h"
CefBrowserPlatformDelegateNative::CefBrowserPlatformDelegateNative(
const CefWindowInfo& window_info,

View File

@ -21,9 +21,9 @@
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "third_party/blink/public/platform/web_input_event.h"
#include "third_party/blink/public/platform/web_mouse_event.h"
#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/common/input/web_mouse_event.h"
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
#import "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/underlay_opengl_hosting_window.h"
#include "ui/events/base_event_utils.h"

View File

@ -22,8 +22,8 @@
#include "base/win/registry.h"
#include "base/win/win_util.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "third_party/blink/public/platform/web_mouse_event.h"
#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
#include "third_party/blink/public/common/input/web_mouse_event.h"
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
#include "ui/aura/window.h"
#include "ui/base/win/shell.h"
#include "ui/display/display.h"

View File

@ -9,6 +9,10 @@
#include "libcef/browser/file_dialog_runner.h"
#include "base/memory/weak_ptr.h"
@class NSView;
class CefFileDialogRunnerMac : public CefFileDialogRunner {
public:
CefFileDialogRunnerMac();
@ -17,6 +21,21 @@ class CefFileDialogRunnerMac : public CefFileDialogRunner {
void Run(CefBrowserHostImpl* browser,
const FileChooserParams& params,
RunFileChooserCallback callback) override;
private:
static void RunOpenFileDialog(
base::WeakPtr<CefFileDialogRunnerMac> weak_this,
const CefFileDialogRunner::FileChooserParams& params,
NSView* view,
int filter_index);
static void RunSaveFileDialog(
base::WeakPtr<CefFileDialogRunnerMac> weak_this,
const CefFileDialogRunner::FileChooserParams& params,
NSView* view,
int filter_index);
CefFileDialogRunner::RunFileChooserCallback callback_;
base::WeakPtrFactory<CefFileDialogRunnerMac> weak_ptr_factory_;
};
#endif // CEF_LIBCEF_BROWSER_NATIVE_FILE_DIALOG_RUNNER_MAC_H_

View File

@ -229,12 +229,34 @@ void AddFilters(NSPopUpButton* button,
@end
namespace {
CefFileDialogRunnerMac::CefFileDialogRunnerMac() : weak_ptr_factory_(this) {}
void RunOpenFileDialog(const CefFileDialogRunner::FileChooserParams& params,
NSView* view,
int filter_index,
CefFileDialogRunner::RunFileChooserCallback callback) {
void CefFileDialogRunnerMac::Run(CefBrowserHostImpl* browser,
const FileChooserParams& params,
RunFileChooserCallback callback) {
callback_ = std::move(callback);
int filter_index = params.selected_accept_filter;
NSView* owner = CAST_CEF_WINDOW_HANDLE_TO_NSVIEW(browser->GetWindowHandle());
auto weak_this = weak_ptr_factory_.GetWeakPtr();
if (params.mode == blink::mojom::FileChooserParams::Mode::kOpen ||
params.mode == blink::mojom::FileChooserParams::Mode::kOpenMultiple ||
params.mode == blink::mojom::FileChooserParams::Mode::kUploadFolder) {
RunOpenFileDialog(weak_this, params, owner, filter_index);
} else if (params.mode == blink::mojom::FileChooserParams::Mode::kSave) {
RunSaveFileDialog(weak_this, params, owner, filter_index);
} else {
NOTIMPLEMENTED();
}
}
// static
void CefFileDialogRunnerMac::RunOpenFileDialog(
base::WeakPtr<CefFileDialogRunnerMac> weak_this,
const CefFileDialogRunner::FileChooserParams& params,
NSView* view,
int filter_index) {
NSOpenPanel* openPanel = [NSOpenPanel openPanel];
base::string16 title;
@ -308,18 +330,21 @@ void RunOpenFileDialog(const CefFileDialogRunner::FileChooserParams& params,
if (url.isFileURL)
files.push_back(base::FilePath(url.path.UTF8String));
}
callback.Run(filter_index_to_use, files);
std::move(weak_this->callback_)
.Run(filter_index_to_use, files);
} else {
callback.Run(filter_index_to_use,
std::vector<base::FilePath>());
std::move(weak_this->callback_)
.Run(filter_index_to_use, std::vector<base::FilePath>());
}
}];
}
void RunSaveFileDialog(const CefFileDialogRunner::FileChooserParams& params,
NSView* view,
int filter_index,
CefFileDialogRunner::RunFileChooserCallback callback) {
// static
void CefFileDialogRunnerMac::RunSaveFileDialog(
base::WeakPtr<CefFileDialogRunnerMac> weak_this,
const CefFileDialogRunner::FileChooserParams& params,
NSView* view,
int filter_index) {
NSSavePanel* savePanel = [NSSavePanel savePanel];
base::string16 title;
@ -371,31 +396,11 @@ void RunSaveFileDialog(const CefFileDialogRunner::FileChooserParams& params,
NSURL* url = savePanel.URL;
const char* path = url.path.UTF8String;
std::vector<base::FilePath> files(1, base::FilePath(path));
callback.Run(filter_index_to_use, files);
std::move(weak_this->callback_)
.Run(filter_index_to_use, files);
} else {
callback.Run(filter_index_to_use,
std::vector<base::FilePath>());
std::move(weak_this->callback_)
.Run(filter_index_to_use, std::vector<base::FilePath>());
}
}];
}
} // namespace
CefFileDialogRunnerMac::CefFileDialogRunnerMac() {}
void CefFileDialogRunnerMac::Run(CefBrowserHostImpl* browser,
const FileChooserParams& params,
RunFileChooserCallback callback) {
int filter_index = params.selected_accept_filter;
NSView* owner = CAST_CEF_WINDOW_HANDLE_TO_NSVIEW(browser->GetWindowHandle());
if (params.mode == blink::mojom::FileChooserParams::Mode::kOpen ||
params.mode == blink::mojom::FileChooserParams::Mode::kOpenMultiple ||
params.mode == blink::mojom::FileChooserParams::Mode::kUploadFolder) {
RunOpenFileDialog(params, owner, filter_index, callback);
} else if (params.mode == blink::mojom::FileChooserParams::Mode::kSave) {
RunSaveFileDialog(params, owner, filter_index, callback);
} else {
NOTIMPLEMENTED();
}
}

View File

@ -520,5 +520,5 @@ void CefFileDialogRunnerWin::Run(CefBrowserHostImpl* browser,
NOTIMPLEMENTED();
}
callback.Run(filter_index, files);
std::move(callback).Run(filter_index, files);
}

View File

@ -29,7 +29,7 @@ class CefJavaScriptDialogRunnerMac : public CefJavaScriptDialogRunner {
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
const DialogClosedCallback& callback) override;
DialogClosedCallback callback) override;
void Cancel() override;
// Callback from CefJavaScriptDialogHelper when the dialog is closed.

View File

@ -38,7 +38,7 @@
- (id)initHelperWithCallback:
(CefJavaScriptDialogRunner::DialogClosedCallback)callback {
if (self = [super init])
callback_ = callback;
callback_ = std::move(callback);
return self;
}
@ -69,7 +69,7 @@
if (textField_)
input = base::SysNSStringToUTF16([textField_ stringValue]);
callback_.Run(success, input);
std::move(callback_).Run(success, input);
}
- (void)cancel {
@ -92,15 +92,15 @@ void CefJavaScriptDialogRunnerMac::Run(
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
const DialogClosedCallback& callback) {
DialogClosedCallback callback) {
DCHECK(!helper_.get());
callback_ = callback;
callback_ = std::move(callback);
bool text_field = message_type == content::JAVASCRIPT_DIALOG_TYPE_PROMPT;
bool one_button = message_type == content::JAVASCRIPT_DIALOG_TYPE_ALERT;
helper_.reset([[CefJavaScriptDialogHelper alloc]
initHelperWithCallback:base::Bind(
initHelperWithCallback:base::BindOnce(
&CefJavaScriptDialogRunnerMac::DialogClosed,
weak_ptr_factory_.GetWeakPtr())]);
@ -167,5 +167,5 @@ void CefJavaScriptDialogRunnerMac::DialogClosed(
bool success,
const base::string16& user_input) {
helper_.reset(nil);
callback_.Run(success, user_input);
std::move(callback_).Run(success, user_input);
}

View File

@ -96,13 +96,13 @@ void CefJavaScriptDialogRunnerWin::Run(
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
const DialogClosedCallback& callback) {
DialogClosedCallback callback) {
DCHECK(!dialog_win_);
message_type_ = message_type;
message_text_ = message_text;
default_prompt_text_ = default_prompt_text;
callback_ = callback;
callback_ = std::move(callback);
InstallMessageHook();
hook_installed_ = true;
@ -177,8 +177,7 @@ void CefJavaScriptDialogRunnerWin::CloseDialog(
// cleared. Otherwise, RenderWidgetHostImpl::IsIgnoringInputEvents will
// return true and RenderWidgetHostViewAura::OnWindowFocused will fail to
// re-assign browser focus.
callback_.Run(success, user_input);
callback_.Reset();
std::move(callback_).Run(success, user_input);
Cancel();
}

View File

@ -22,7 +22,7 @@ class CefJavaScriptDialogRunnerWin : public CefJavaScriptDialogRunner {
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
const DialogClosedCallback& callback) override;
DialogClosedCallback callback) override;
void Cancel() override;
private: