Merge remote-tracking branch 'origin/chromium-upgrade/72'
This commit is contained in:
commit
f3e30c7ae3
178 changed files with 2102 additions and 1734 deletions
|
@ -30,7 +30,7 @@
|
|||
#include "base/files/file_path.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/sys_info.h"
|
||||
#include "base/system/sys_info.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/icon_manager.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
|
@ -780,24 +780,24 @@ void App::OnGpuProcessCrashed(base::TerminationStatus status) {
|
|||
|
||||
void App::BrowserChildProcessLaunchedAndConnected(
|
||||
const content::ChildProcessData& data) {
|
||||
ChildProcessLaunched(data.process_type, data.GetHandle());
|
||||
ChildProcessLaunched(data.process_type, data.GetProcess().Handle());
|
||||
}
|
||||
|
||||
void App::BrowserChildProcessHostDisconnected(
|
||||
const content::ChildProcessData& data) {
|
||||
ChildProcessDisconnected(base::GetProcId(data.GetHandle()));
|
||||
ChildProcessDisconnected(base::GetProcId(data.GetProcess().Handle()));
|
||||
}
|
||||
|
||||
void App::BrowserChildProcessCrashed(
|
||||
const content::ChildProcessData& data,
|
||||
const content::ChildProcessTerminationInfo& info) {
|
||||
ChildProcessDisconnected(base::GetProcId(data.GetHandle()));
|
||||
ChildProcessDisconnected(base::GetProcId(data.GetProcess().Handle()));
|
||||
}
|
||||
|
||||
void App::BrowserChildProcessKilled(
|
||||
const content::ChildProcessData& data,
|
||||
const content::ChildProcessTerminationInfo& info) {
|
||||
ChildProcessDisconnected(base::GetProcId(data.GetHandle()));
|
||||
ChildProcessDisconnected(base::GetProcId(data.GetProcess().Handle()));
|
||||
}
|
||||
|
||||
void App::RenderProcessReady(content::RenderProcessHost* host) {
|
||||
|
@ -1387,7 +1387,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("App", atom::api::App::GetConstructor(isolate)->GetFunction());
|
||||
dict.Set("App", atom::api::App::GetConstructor(isolate)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked());
|
||||
dict.Set("app", atom::api::App::Create(isolate));
|
||||
#if defined(OS_MACOSX)
|
||||
auto browser = base::Unretained(Browser::Get());
|
||||
|
|
|
@ -147,7 +147,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("autoUpdater", AutoUpdater::Create(isolate));
|
||||
dict.Set("AutoUpdater", AutoUpdater::GetConstructor(isolate)->GetFunction());
|
||||
dict.Set("AutoUpdater", AutoUpdater::GetConstructor(isolate)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -159,8 +159,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Isolate* isolate = context->GetIsolate();
|
||||
BrowserView::SetConstructor(isolate, base::Bind(&BrowserView::New));
|
||||
|
||||
mate::Dictionary browser_view(
|
||||
isolate, BrowserView::GetConstructor(isolate)->GetFunction());
|
||||
mate::Dictionary browser_view(isolate, BrowserView::GetConstructor(isolate)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked());
|
||||
browser_view.SetMethod("fromId",
|
||||
&mate::TrackableObject<BrowserView>::FromWeakMapID);
|
||||
browser_view.SetMethod("getAllViews",
|
||||
|
|
|
@ -59,8 +59,9 @@ void BrowserWindow::OverrideNSWindowContentView(InspectableWebContents* iwc) {
|
|||
// Make NativeWindow use a NSView as content view.
|
||||
static_cast<NativeWindowMac*>(window())->OverrideNSWindowContentView();
|
||||
// Add webview to contentView.
|
||||
NSView* webView = iwc->GetView()->GetNativeView();
|
||||
NSView* contentView = [window()->GetNativeWindow() contentView];
|
||||
NSView* webView = iwc->GetView()->GetNativeView().GetNativeNSView();
|
||||
NSView* contentView =
|
||||
[window()->GetNativeWindow().GetNativeNSWindow() contentView];
|
||||
[webView setFrame:[contentView bounds]];
|
||||
|
||||
// ensure that buttons view is floated to top of view hierarchy
|
||||
|
@ -80,7 +81,7 @@ void BrowserWindow::UpdateDraggableRegions(
|
|||
// All ControlRegionViews should be added as children of the WebContentsView,
|
||||
// because WebContentsView will be removed and re-added when entering and
|
||||
// leaving fullscreen mode.
|
||||
NSView* webView = web_contents()->GetNativeView();
|
||||
NSView* webView = web_contents()->GetNativeView().GetNativeNSView();
|
||||
NSInteger webViewWidth = NSWidth([webView bounds]);
|
||||
NSInteger webViewHeight = NSHeight([webView bounds]);
|
||||
|
||||
|
|
|
@ -194,7 +194,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary(isolate, exports)
|
||||
.Set("Debugger", Debugger::GetConstructor(isolate)->GetFunction());
|
||||
.Set("Debugger", Debugger::GetConstructor(isolate)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -244,8 +244,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary(isolate, exports)
|
||||
.Set("DownloadItem",
|
||||
atom::api::DownloadItem::GetConstructor(isolate)->GetFunction());
|
||||
.Set("DownloadItem", atom::api::DownloadItem::GetConstructor(isolate)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -132,8 +132,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("inAppPurchase", InAppPurchase::Create(isolate));
|
||||
dict.Set("InAppPurchase",
|
||||
InAppPurchase::GetConstructor(isolate)->GetFunction());
|
||||
dict.Set("InAppPurchase", InAppPurchase::GetConstructor(isolate)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -233,7 +233,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
Menu::SetConstructor(isolate, base::Bind(&Menu::New));
|
||||
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("Menu", Menu::GetConstructor(isolate)->GetFunction());
|
||||
dict.Set(
|
||||
"Menu",
|
||||
Menu::GetConstructor(isolate)->GetFunction(context).ToLocalChecked());
|
||||
#if defined(OS_MACOSX)
|
||||
dict.SetMethod("setApplicationMenu", &Menu::SetApplicationMenu);
|
||||
dict.SetMethod("sendActionToFirstResponder",
|
||||
|
|
|
@ -56,7 +56,7 @@ void MenuMac::PopupOnUI(const base::WeakPtr<NativeWindow>& native_window,
|
|||
base::Closure callback) {
|
||||
if (!native_window)
|
||||
return;
|
||||
NSWindow* nswindow = native_window->GetNativeWindow();
|
||||
NSWindow* nswindow = native_window->GetNativeWindow().GetNativeNSWindow();
|
||||
|
||||
auto close_callback = base::Bind(
|
||||
&MenuMac::OnClosed, weak_factory_.GetWeakPtr(), window_id, callback);
|
||||
|
@ -99,7 +99,7 @@ void MenuMac::PopupOnUI(const base::WeakPtr<NativeWindow>& native_window,
|
|||
|
||||
[popup_controllers_[window_id] setCloseCallback:close_callback];
|
||||
// Make sure events can be pumped while the menu is up.
|
||||
base::MessageLoop::ScopedNestableTaskAllower allow;
|
||||
base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
|
||||
|
||||
// One of the events that could be pumped is |window.close()|.
|
||||
// User-initiated event-tracking loops protect against this by
|
||||
|
|
|
@ -31,7 +31,9 @@ void Net::BuildPrototype(v8::Isolate* isolate,
|
|||
}
|
||||
|
||||
v8::Local<v8::Value> Net::URLRequest(v8::Isolate* isolate) {
|
||||
return URLRequest::GetConstructor(isolate)->GetFunction();
|
||||
return URLRequest::GetConstructor(isolate)
|
||||
->GetFunction(isolate->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
@ -53,7 +55,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("net", Net::Create(isolate));
|
||||
dict.Set("Net", Net::GetConstructor(isolate)->GetFunction());
|
||||
dict.Set("Net",
|
||||
Net::GetConstructor(isolate)->GetFunction(context).ToLocalChecked());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -263,8 +263,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
Notification::SetConstructor(isolate, base::Bind(&Notification::New));
|
||||
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("Notification",
|
||||
Notification::GetConstructor(isolate)->GetFunction());
|
||||
dict.Set("Notification", Notification::GetConstructor(isolate)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked());
|
||||
|
||||
dict.SetMethod("isSupported", &Notification::IsSupported);
|
||||
}
|
||||
|
|
|
@ -141,8 +141,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("powerMonitor", PowerMonitor::Create(isolate));
|
||||
dict.Set("PowerMonitor",
|
||||
PowerMonitor::GetConstructor(isolate)->GetFunction());
|
||||
dict.Set("PowerMonitor", PowerMonitor::GetConstructor(isolate)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -164,7 +164,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("screen", Screen::Create(isolate));
|
||||
dict.Set("Screen", Screen::GetConstructor(isolate)->GetFunction());
|
||||
dict.Set(
|
||||
"Screen",
|
||||
Screen::GetConstructor(isolate)->GetFunction(context).ToLocalChecked());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -444,10 +444,9 @@ void Session::ClearStorageData(mate::Arguments* args) {
|
|||
// https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo-deviceid
|
||||
MediaDeviceIDSalt::Reset(browser_context()->prefs());
|
||||
}
|
||||
storage_partition->ClearData(
|
||||
options.storage_types, options.quota_types, options.origin,
|
||||
content::StoragePartition::OriginMatcherFunction(), base::Time(),
|
||||
base::Time::Max(), base::Bind(&OnClearStorageDataDone, callback));
|
||||
storage_partition->ClearData(options.storage_types, options.quota_types,
|
||||
options.origin, base::Time(), base::Time::Max(),
|
||||
base::Bind(&OnClearStorageDataDone, callback));
|
||||
}
|
||||
|
||||
void Session::FlushStorageData() {
|
||||
|
@ -805,8 +804,12 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("Session", Session::GetConstructor(isolate)->GetFunction());
|
||||
dict.Set("Cookies", Cookies::GetConstructor(isolate)->GetFunction());
|
||||
dict.Set(
|
||||
"Session",
|
||||
Session::GetConstructor(isolate)->GetFunction(context).ToLocalChecked());
|
||||
dict.Set(
|
||||
"Cookies",
|
||||
Cookies::GetConstructor(isolate)->GetFunction(context).ToLocalChecked());
|
||||
dict.SetMethod("fromPartition", &FromPartition);
|
||||
}
|
||||
|
||||
|
|
|
@ -121,8 +121,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("systemPreferences", SystemPreferences::Create(isolate));
|
||||
dict.Set("SystemPreferences",
|
||||
SystemPreferences::GetConstructor(isolate)->GetFunction());
|
||||
dict.Set("SystemPreferences", SystemPreferences::GetConstructor(isolate)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -1179,8 +1179,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Isolate* isolate = context->GetIsolate();
|
||||
TopLevelWindow::SetConstructor(isolate, base::Bind(&TopLevelWindow::New));
|
||||
|
||||
mate::Dictionary constructor(
|
||||
isolate, TopLevelWindow::GetConstructor(isolate)->GetFunction());
|
||||
mate::Dictionary constructor(isolate, TopLevelWindow::GetConstructor(isolate)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked());
|
||||
constructor.SetMethod("fromId",
|
||||
&mate::TrackableObject<TopLevelWindow>::FromWeakMapID);
|
||||
constructor.SetMethod("getAllWindows",
|
||||
|
|
|
@ -254,7 +254,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
Tray::SetConstructor(isolate, base::Bind(&Tray::New));
|
||||
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("Tray", Tray::GetConstructor(isolate)->GetFunction());
|
||||
dict.Set(
|
||||
"Tray",
|
||||
Tray::GetConstructor(isolate)->GetFunction(context).ToLocalChecked());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -76,8 +76,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Isolate* isolate = context->GetIsolate();
|
||||
View::SetConstructor(isolate, base::Bind(&View::New));
|
||||
|
||||
mate::Dictionary constructor(isolate,
|
||||
View::GetConstructor(isolate)->GetFunction());
|
||||
mate::Dictionary constructor(
|
||||
isolate,
|
||||
View::GetConstructor(isolate)->GetFunction(context).ToLocalChecked());
|
||||
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("View", constructor);
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "atom/common/native_mate_converters/value_converter.h"
|
||||
#include "atom/common/options_switches.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
|
@ -240,7 +241,7 @@ namespace api {
|
|||
namespace {
|
||||
|
||||
content::ServiceWorkerContext* GetServiceWorkerContext(
|
||||
const content::WebContents* web_contents) {
|
||||
content::WebContents* web_contents) {
|
||||
auto* context = web_contents->GetBrowserContext();
|
||||
auto* site_instance = web_contents->GetSiteInstance();
|
||||
if (!context || !site_instance)
|
||||
|
@ -421,15 +422,14 @@ void WebContents::InitWithSessionAndOptions(
|
|||
|
||||
#if defined(OS_LINUX) || defined(OS_WIN)
|
||||
// Update font settings.
|
||||
CR_DEFINE_STATIC_LOCAL(
|
||||
const gfx::FontRenderParams, params,
|
||||
(gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(), nullptr)));
|
||||
prefs->should_antialias_text = params.antialiasing;
|
||||
prefs->use_subpixel_positioning = params.subpixel_positioning;
|
||||
prefs->hinting = params.hinting;
|
||||
prefs->use_autohinter = params.autohinter;
|
||||
prefs->use_bitmaps = params.use_bitmaps;
|
||||
prefs->subpixel_rendering = params.subpixel_rendering;
|
||||
static const base::NoDestructor<gfx::FontRenderParams> params(
|
||||
gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(), nullptr));
|
||||
prefs->should_antialias_text = params->antialiasing;
|
||||
prefs->use_subpixel_positioning = params->subpixel_positioning;
|
||||
prefs->hinting = params->hinting;
|
||||
prefs->use_autohinter = params->autohinter;
|
||||
prefs->use_bitmaps = params->use_bitmaps;
|
||||
prefs->subpixel_rendering = params->subpixel_rendering;
|
||||
#endif
|
||||
|
||||
// Save the preferences in C++.
|
||||
|
@ -470,9 +470,9 @@ WebContents::~WebContents() {
|
|||
RenderViewDeleted(web_contents()->GetRenderViewHost());
|
||||
|
||||
if (type_ == WEB_VIEW) {
|
||||
DCHECK(!web_contents()->GetOuterWebContents())
|
||||
<< "Should never manually destroy an attached webview";
|
||||
// For webview simply destroy the WebContents immediately.
|
||||
// TODO(zcbenz): Add an internal API for webview instead of using
|
||||
// destroy(), so we don't have to add a special branch here.
|
||||
DestroyWebContents(false /* async */);
|
||||
} else if (type_ == BROWSER_WINDOW && owner_window()) {
|
||||
// For BrowserWindow we should close the window and clean up everything
|
||||
|
@ -617,15 +617,15 @@ void WebContents::UpdateTargetURL(content::WebContents* source,
|
|||
Emit("update-target-url", url);
|
||||
}
|
||||
|
||||
void WebContents::HandleKeyboardEvent(
|
||||
bool WebContents::HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
if (type_ == WEB_VIEW && embedder_) {
|
||||
// Send the unhandled keyboard events back to the embedder.
|
||||
embedder_->HandleKeyboardEvent(source, event);
|
||||
return embedder_->HandleKeyboardEvent(source, event);
|
||||
} else {
|
||||
// Go to the default keyboard handling.
|
||||
CommonWebContentsDelegate::HandleKeyboardEvent(source, event);
|
||||
return CommonWebContentsDelegate::HandleKeyboardEvent(source, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1129,7 +1129,7 @@ void WebContents::NavigationEntryCommitted(
|
|||
void WebContents::SetBackgroundThrottling(bool allowed) {
|
||||
background_throttling_ = allowed;
|
||||
|
||||
const auto* contents = web_contents();
|
||||
auto* contents = web_contents();
|
||||
if (!contents) {
|
||||
return;
|
||||
}
|
||||
|
@ -1188,8 +1188,9 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
|
|||
if (!options.Get("httpReferrer", ¶ms.referrer)) {
|
||||
GURL http_referrer;
|
||||
if (options.Get("httpReferrer", &http_referrer))
|
||||
params.referrer = content::Referrer(http_referrer.GetAsReferrer(),
|
||||
blink::kWebReferrerPolicyDefault);
|
||||
params.referrer =
|
||||
content::Referrer(http_referrer.GetAsReferrer(),
|
||||
network::mojom::ReferrerPolicy::kDefault);
|
||||
}
|
||||
|
||||
std::string user_agent;
|
||||
|
@ -1793,7 +1794,7 @@ void WebContents::StartDrag(const mate::Dictionary& item,
|
|||
|
||||
// Start dragging.
|
||||
if (!files.empty()) {
|
||||
base::MessageLoop::ScopedNestableTaskAllower allow;
|
||||
base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
|
||||
DragFileItems(files, icon->image(), web_contents()->GetNativeView());
|
||||
} else {
|
||||
args->ThrowError("Must specify either 'file' or 'files' option");
|
||||
|
@ -2149,6 +2150,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
|
|||
.SetMethod("startDrag", &WebContents::StartDrag)
|
||||
.SetMethod("isGuest", &WebContents::IsGuest)
|
||||
.SetMethod("attachToIframe", &WebContents::AttachToIframe)
|
||||
.SetMethod("detachFromOuterFrame", &WebContents::DetachFromOuterFrame)
|
||||
.SetMethod("isOffscreen", &WebContents::IsOffScreen)
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
.SetMethod("startPainting", &WebContents::StartPainting)
|
||||
|
@ -2284,7 +2286,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("WebContents", WebContents::GetConstructor(isolate)->GetFunction());
|
||||
dict.Set("WebContents", WebContents::GetConstructor(isolate)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked());
|
||||
dict.SetMethod("create", &WebContents::Create);
|
||||
dict.SetMethod("fromId", &mate::TrackableObject<WebContents>::FromWeakMapID);
|
||||
dict.SetMethod("getAllWebContents",
|
||||
|
|
|
@ -242,6 +242,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
bool IsGuest() const;
|
||||
void AttachToIframe(content::WebContents* embedder_web_contents,
|
||||
int embedder_frame_id);
|
||||
void DetachFromOuterFrame();
|
||||
|
||||
// Methods for offscreen rendering
|
||||
bool IsOffScreen() const;
|
||||
|
@ -362,7 +363,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
void CloseContents(content::WebContents* source) override;
|
||||
void ActivateContents(content::WebContents* contents) override;
|
||||
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
||||
void HandleKeyboardEvent(
|
||||
bool HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
|
||||
|
|
|
@ -4,9 +4,12 @@
|
|||
|
||||
#include "atom/browser/api/atom_api_web_contents.h"
|
||||
|
||||
#include "content/browser/web_contents/web_contents_impl.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
#include "atom/browser/osr/osr_render_widget_host_view.h"
|
||||
#include "atom/browser/osr/osr_web_contents_view.h"
|
||||
#include "content/browser/web_contents/web_contents_impl.h"
|
||||
#endif
|
||||
|
||||
// Including both web_contents_impl.h and node.h would introduce a error, we
|
||||
// have to isolate the usage of WebContentsImpl into a clean file to fix it:
|
||||
|
@ -16,6 +19,13 @@ namespace atom {
|
|||
|
||||
namespace api {
|
||||
|
||||
void WebContents::DetachFromOuterFrame() {
|
||||
// See detach_webview_frame.patch on how to detach.
|
||||
auto* impl = static_cast<content::WebContentsImpl*>(web_contents());
|
||||
impl->GetRenderManagerForTesting()->RemoveOuterDelegateFrame();
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
OffScreenWebContentsView* WebContents::GetOffScreenWebContentsView() const {
|
||||
if (IsOffScreen()) {
|
||||
const auto* impl =
|
||||
|
@ -35,6 +45,7 @@ OffScreenRenderWidgetHostView* WebContents::GetOffScreenRenderWidgetHostView()
|
|||
return nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace api
|
||||
|
|
@ -17,7 +17,7 @@ bool WebContents::IsFocused() const {
|
|||
return false;
|
||||
|
||||
if (GetType() != BACKGROUND_PAGE) {
|
||||
auto window = [web_contents()->GetNativeView() window];
|
||||
auto window = [web_contents()->GetNativeView().GetNativeNSView() window];
|
||||
// On Mac the render widget host view does not lose focus when the window
|
||||
// loses focus so check if the top level window is the key window.
|
||||
if (window && ![window isKeyWindow])
|
||||
|
|
|
@ -35,7 +35,8 @@ v8::Local<v8::Object> CreateEventObject(v8::Isolate* isolate) {
|
|||
}
|
||||
|
||||
return v8::Local<v8::ObjectTemplate>::New(isolate, event_template)
|
||||
->NewInstance();
|
||||
->NewInstance(isolate->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -95,6 +95,7 @@
|
|||
#endif // BUILDFLAG(OVERRIDE_LOCATION_PROVIDER)
|
||||
|
||||
#if BUILDFLAG(ENABLE_TTS)
|
||||
#include "chrome/browser/speech/tts_controller_delegate_impl.h"
|
||||
#include "chrome/browser/speech/tts_message_filter.h"
|
||||
#endif // BUILDFLAG(ENABLE_TTS)
|
||||
|
||||
|
@ -158,8 +159,6 @@ AtomBrowserClient* AtomBrowserClient::Get() {
|
|||
|
||||
// static
|
||||
void AtomBrowserClient::SetApplicationLocale(const std::string& locale) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
|
||||
if (!BrowserThread::IsThreadInitialized(BrowserThread::IO) ||
|
||||
!base::PostTaskWithTraits(
|
||||
FROM_HERE, {BrowserThread::IO},
|
||||
|
@ -368,6 +367,14 @@ AtomBrowserClient::CreateSpeechRecognitionManagerDelegate() {
|
|||
return new AtomSpeechRecognitionManagerDelegate;
|
||||
}
|
||||
|
||||
content::TtsControllerDelegate* AtomBrowserClient::GetTtsControllerDelegate() {
|
||||
#if BUILDFLAG(ENABLE_TTS)
|
||||
return TtsControllerDelegateImpl::GetInstance();
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void AtomBrowserClient::OverrideWebkitPrefs(content::RenderViewHost* host,
|
||||
content::WebPreferences* prefs) {
|
||||
prefs->javascript_enabled = true;
|
||||
|
@ -536,6 +543,17 @@ AtomBrowserClient::CreateQuotaPermissionContext() {
|
|||
return new AtomQuotaPermissionContext;
|
||||
}
|
||||
|
||||
content::GeneratedCodeCacheSettings
|
||||
AtomBrowserClient::GetGeneratedCodeCacheSettings(
|
||||
content::BrowserContext* context) {
|
||||
// TODO(deepak1556): Use platform cache directory.
|
||||
base::FilePath cache_path = context->GetPath();
|
||||
// If we pass 0 for size, disk_cache will pick a default size using the
|
||||
// heuristics based on available disk size. These are implemented in
|
||||
// disk_cache::PreferredCacheSize in net/disk_cache/cache_util.cc.
|
||||
return content::GeneratedCodeCacheSettings(true, 0, cache_path);
|
||||
}
|
||||
|
||||
void AtomBrowserClient::AllowCertificateError(
|
||||
content::WebContents* web_contents,
|
||||
int cert_error,
|
||||
|
@ -804,7 +822,9 @@ bool AtomBrowserClient::HandleExternalProtocol(
|
|||
content::NavigationUIData* navigation_data,
|
||||
bool is_main_frame,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture) {
|
||||
bool has_user_gesture,
|
||||
const std::string& method,
|
||||
const net::HttpRequestHeaders& headers) {
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {BrowserThread::UI},
|
||||
base::BindOnce(&HandleExternalProtocolInUI, url, web_contents_getter,
|
||||
|
|
|
@ -74,6 +74,7 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
|||
service_manager::mojom::ServiceRequest* service_request) override;
|
||||
content::SpeechRecognitionManagerDelegate*
|
||||
CreateSpeechRecognitionManagerDelegate() override;
|
||||
content::TtsControllerDelegate* GetTtsControllerDelegate() override;
|
||||
void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
|
||||
content::WebPreferences* prefs) override;
|
||||
SiteInstanceForNavigationType ShouldOverrideSiteInstanceForNavigation(
|
||||
|
@ -91,6 +92,8 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
|||
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
|
||||
std::string GetGeolocationApiKey() override;
|
||||
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
|
||||
content::GeneratedCodeCacheSettings GetGeneratedCodeCacheSettings(
|
||||
content::BrowserContext* context) override;
|
||||
void AllowCertificateError(
|
||||
content::WebContents* web_contents,
|
||||
int cert_error,
|
||||
|
@ -165,7 +168,9 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
|||
content::NavigationUIData* navigation_data,
|
||||
bool is_main_frame,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture) override;
|
||||
bool has_user_gesture,
|
||||
const std::string& method,
|
||||
const net::HttpRequestHeaders& headers) override;
|
||||
|
||||
private:
|
||||
struct ProcessPreferences {
|
||||
|
|
|
@ -191,11 +191,6 @@ base::FilePath AtomBrowserContext::GetPath() const {
|
|||
return path_;
|
||||
}
|
||||
|
||||
base::FilePath AtomBrowserContext::GetCachePath() const {
|
||||
// TODO(deepak1556): Use platform cache directory.
|
||||
return path_;
|
||||
}
|
||||
|
||||
bool AtomBrowserContext::IsOffTheRecord() const {
|
||||
return in_memory_;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@ class AtomBrowserContext
|
|||
|
||||
// content::BrowserContext:
|
||||
base::FilePath GetPath() const override;
|
||||
base::FilePath GetCachePath() const override;
|
||||
bool IsOffTheRecord() const override;
|
||||
content::ResourceContext* GetResourceContext() override;
|
||||
std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
|
||||
|
|
|
@ -47,9 +47,7 @@
|
|||
#include "services/device/public/mojom/constants.mojom.h"
|
||||
#include "services/service_manager/public/cpp/connector.h"
|
||||
#include "ui/base/idle/idle.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/material_design/material_design_controller.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "ui/base/ui_base_switches.h"
|
||||
|
||||
#if defined(USE_AURA)
|
||||
|
@ -73,6 +71,7 @@
|
|||
|
||||
#if defined(OS_WIN)
|
||||
#include "ui/base/cursor/cursor_loader_win.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/l10n/l10n_util_win.h"
|
||||
#include "ui/display/win/dpi.h"
|
||||
#include "ui/gfx/platform_font_win.h"
|
||||
|
@ -355,9 +354,6 @@ int AtomBrowserMainParts::PreCreateThreads() {
|
|||
layout_provider_.reset(new views::LayoutProvider());
|
||||
|
||||
// Initialize the app locale.
|
||||
AtomBrowserClient::SetApplicationLocale(
|
||||
l10n_util::GetApplicationLocale(custom_locale_));
|
||||
|
||||
fake_browser_process_->SetApplicationLocale(
|
||||
AtomBrowserClient::Get()->GetApplicationLocale());
|
||||
|
||||
|
@ -513,29 +509,6 @@ void AtomBrowserMainParts::PreMainMessageLoopStart() {
|
|||
#endif
|
||||
|
||||
void AtomBrowserMainParts::PreMainMessageLoopStartCommon() {
|
||||
// Initialize ui::ResourceBundle.
|
||||
ui::ResourceBundle::InitSharedInstanceWithLocale(
|
||||
"", nullptr, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
|
||||
auto* cmd_line = base::CommandLine::ForCurrentProcess();
|
||||
if (cmd_line->HasSwitch(switches::kLang)) {
|
||||
const std::string locale = cmd_line->GetSwitchValueASCII(switches::kLang);
|
||||
const base::FilePath locale_file_path =
|
||||
ui::ResourceBundle::GetSharedInstance().GetLocaleFilePath(locale, true);
|
||||
if (!locale_file_path.empty()) {
|
||||
custom_locale_ = locale;
|
||||
#if defined(OS_LINUX)
|
||||
/* When built with USE_GLIB, libcc's GetApplicationLocaleInternal() uses
|
||||
* glib's g_get_language_names(), which keys off of getenv("LC_ALL") */
|
||||
g_setenv("LC_ALL", custom_locale_.c_str(), TRUE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
if (custom_locale_.empty())
|
||||
l10n_util::OverrideLocaleWithCocoaLocale();
|
||||
#endif
|
||||
LoadResourceBundle(custom_locale_);
|
||||
#if defined(OS_MACOSX)
|
||||
InitializeMainNib();
|
||||
#endif
|
||||
|
|
|
@ -112,7 +112,6 @@ class AtomBrowserMainParts : public content::BrowserMainParts {
|
|||
#endif
|
||||
|
||||
std::unique_ptr<views::LayoutProvider> layout_provider_;
|
||||
std::string custom_locale_;
|
||||
|
||||
// A fake BrowserProcess object that used to feed the source code from chrome.
|
||||
std::unique_ptr<BrowserProcessImpl> fake_browser_process_;
|
||||
|
|
|
@ -325,7 +325,7 @@ std::string Browser::DockGetBadgeText() {
|
|||
|
||||
void Browser::DockHide() {
|
||||
for (auto* const& window : WindowList::GetWindows())
|
||||
[window->GetNativeWindow() setCanHide:NO];
|
||||
[window->GetNativeWindow().GetNativeNSWindow() setCanHide:NO];
|
||||
|
||||
ProcessSerialNumber psn = {0, kCurrentProcess};
|
||||
TransformProcessType(&psn, kProcessTransformToUIElementApplication);
|
||||
|
|
|
@ -258,7 +258,7 @@ BrowserProcessImpl::safe_browsing_detection_service() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
subresource_filter::ContentRulesetService*
|
||||
subresource_filter::RulesetService*
|
||||
BrowserProcessImpl::subresource_filter_ruleset_service() {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -299,6 +299,11 @@ gcm::GCMDriver* BrowserProcessImpl::gcm_driver() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
resource_coordinator::ResourceCoordinatorParts*
|
||||
BrowserProcessImpl::resource_coordinator_parts() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
resource_coordinator::TabManager* BrowserProcessImpl::GetTabManager() {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -86,8 +86,8 @@ class BrowserProcessImpl : public BrowserProcess {
|
|||
safe_browsing::SafeBrowsingService* safe_browsing_service() override;
|
||||
safe_browsing::ClientSideDetectionService* safe_browsing_detection_service()
|
||||
override;
|
||||
subresource_filter::ContentRulesetService*
|
||||
subresource_filter_ruleset_service() override;
|
||||
subresource_filter::RulesetService* subresource_filter_ruleset_service()
|
||||
override;
|
||||
optimization_guide::OptimizationGuideService* optimization_guide_service()
|
||||
override;
|
||||
net_log::ChromeNetLog* net_log() override;
|
||||
|
@ -98,6 +98,8 @@ class BrowserProcessImpl : public BrowserProcess {
|
|||
WebRtcLogUploader* webrtc_log_uploader() override;
|
||||
network_time::NetworkTimeTracker* network_time_tracker() override;
|
||||
gcm::GCMDriver* gcm_driver() override;
|
||||
resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
|
||||
override;
|
||||
resource_coordinator::TabManager* GetTabManager() override;
|
||||
shell_integration::DefaultWebClientState CachedDefaultWebClientState()
|
||||
override;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "base/files/file_util.h"
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/task/post_task.h"
|
||||
#include "base/threading/scoped_blocking_call.h"
|
||||
#include "base/threading/sequenced_task_runner_handle.h"
|
||||
#include "chrome/browser/ssl/security_state_tab_helper.h"
|
||||
#include "chrome/browser/ui/browser_dialogs.h"
|
||||
|
@ -121,14 +122,14 @@ std::unique_ptr<base::DictionaryValue> CreateFileSystemValue(
|
|||
}
|
||||
|
||||
void WriteToFile(const base::FilePath& path, const std::string& content) {
|
||||
base::AssertBlockingAllowed();
|
||||
base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::WILL_BLOCK);
|
||||
DCHECK(!path.empty());
|
||||
|
||||
base::WriteFile(path, content.data(), content.size());
|
||||
}
|
||||
|
||||
void AppendToFile(const base::FilePath& path, const std::string& content) {
|
||||
base::AssertBlockingAllowed();
|
||||
base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::WILL_BLOCK);
|
||||
DCHECK(!path.empty());
|
||||
|
||||
base::AppendToFile(path, content.data(), content.size());
|
||||
|
|
|
@ -100,7 +100,7 @@ class CommonWebContentsDelegate : public content::WebContentsDelegate,
|
|||
content::WebContents* web_contents,
|
||||
content::SecurityStyleExplanations* explanations) override;
|
||||
bool TakeFocus(content::WebContents* source, bool reverse) override;
|
||||
void HandleKeyboardEvent(
|
||||
bool HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
|
||||
|
|
|
@ -17,33 +17,40 @@
|
|||
|
||||
namespace atom {
|
||||
|
||||
void CommonWebContentsDelegate::HandleKeyboardEvent(
|
||||
bool CommonWebContentsDelegate::HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
if (event.skip_in_browser ||
|
||||
event.GetType() == content::NativeWebKeyboardEvent::kChar)
|
||||
return;
|
||||
return false;
|
||||
|
||||
// Escape exits tabbed fullscreen mode.
|
||||
if (event.windows_key_code == ui::VKEY_ESCAPE && is_html_fullscreen()) {
|
||||
ExitFullscreenModeForTab(source);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if the webContents has preferences and to ignore shortcuts
|
||||
auto* web_preferences = WebContentsPreferences::From(source);
|
||||
if (web_preferences &&
|
||||
web_preferences->IsEnabled("ignoreMenuShortcuts", false))
|
||||
return;
|
||||
return false;
|
||||
|
||||
// Send the event to the menu before sending it to the window
|
||||
if (event.os_event.type == NSKeyDown &&
|
||||
[[NSApp mainMenu] performKeyEquivalent:event.os_event])
|
||||
return;
|
||||
return true;
|
||||
|
||||
if (event.os_event.window &&
|
||||
[event.os_event.window isKindOfClass:[EventDispatchingWindow class]])
|
||||
[event.os_event.window isKindOfClass:[EventDispatchingWindow class]]) {
|
||||
[event.os_event.window redispatchKeyEvent:event.os_event];
|
||||
// FIXME(nornagon): this isn't the right return value; we should implement
|
||||
// devtools windows as Widgets in order to take advantage of the
|
||||
// pre-existing redispatch code in bridged_native_widget.
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -17,25 +17,28 @@
|
|||
|
||||
namespace atom {
|
||||
|
||||
void CommonWebContentsDelegate::HandleKeyboardEvent(
|
||||
bool CommonWebContentsDelegate::HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
// Escape exits tabbed fullscreen mode.
|
||||
if (event.windows_key_code == ui::VKEY_ESCAPE && is_html_fullscreen()) {
|
||||
ExitFullscreenModeForTab(source);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if the webContents has preferences and to ignore shortcuts
|
||||
auto* web_preferences = WebContentsPreferences::From(source);
|
||||
if (web_preferences &&
|
||||
web_preferences->IsEnabled("ignoreMenuShortcuts", false))
|
||||
return;
|
||||
return false;
|
||||
|
||||
// Let the NativeWindow handle other parts.
|
||||
if (owner_window()) {
|
||||
owner_window()->HandleKeyboardEvent(source, event);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CommonWebContentsDelegate::ShowAutofillPopup(
|
||||
|
|
|
@ -8,8 +8,11 @@
|
|||
#import "atom/browser/mac/atom_application_delegate.h"
|
||||
#include "atom/browser/mac/dict_util.h"
|
||||
#include "base/auto_reset.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "content/public/browser/browser_accessibility_state.h"
|
||||
#include "content/public/browser/native_event_processor_mac.h"
|
||||
#include "content/public/browser/native_event_processor_observer_mac.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -22,6 +25,12 @@ inline void dispatch_sync_main(dispatch_block_t block) {
|
|||
|
||||
} // namespace
|
||||
|
||||
@interface AtomApplication () <NativeEventProcessor> {
|
||||
base::ObserverList<content::NativeEventProcessorObserver>::Unchecked
|
||||
observers_;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation AtomApplication
|
||||
|
||||
+ (AtomApplication*)sharedApplication {
|
||||
|
@ -48,6 +57,8 @@ inline void dispatch_sync_main(dispatch_block_t block) {
|
|||
|
||||
- (void)sendEvent:(NSEvent*)event {
|
||||
base::AutoReset<BOOL> scoper(&handlingSendEvent_, YES);
|
||||
content::ScopedNotifyNativeEventProcessorObserver scopedObserverNotifier(
|
||||
&observers_, event);
|
||||
[super sendEvent:event];
|
||||
}
|
||||
|
||||
|
@ -188,4 +199,14 @@ inline void dispatch_sync_main(dispatch_block_t block) {
|
|||
atom::Browser::Get()->ShowAboutPanel();
|
||||
}
|
||||
|
||||
- (void)addNativeEventProcessorObserver:
|
||||
(content::NativeEventProcessorObserver*)observer {
|
||||
observers_.AddObserver(observer);
|
||||
}
|
||||
|
||||
- (void)removeNativeEventProcessorObserver:
|
||||
(content::NativeEventProcessorObserver*)observer {
|
||||
observers_.RemoveObserver(observer);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -160,7 +160,8 @@ namespace atom {
|
|||
NativeBrowserViewMac::NativeBrowserViewMac(
|
||||
InspectableWebContents* inspectable_web_contents)
|
||||
: NativeBrowserView(inspectable_web_contents) {
|
||||
auto* view = GetInspectableWebContentsView()->GetNativeView();
|
||||
auto* view =
|
||||
GetInspectableWebContentsView()->GetNativeView().GetNativeNSView();
|
||||
view.autoresizingMask = kDefaultAutoResizingMask;
|
||||
}
|
||||
|
||||
|
@ -175,12 +176,14 @@ void NativeBrowserViewMac::SetAutoResizeFlags(uint8_t flags) {
|
|||
autoresizing_mask |= NSViewHeightSizable;
|
||||
}
|
||||
|
||||
auto* view = GetInspectableWebContentsView()->GetNativeView();
|
||||
auto* view =
|
||||
GetInspectableWebContentsView()->GetNativeView().GetNativeNSView();
|
||||
view.autoresizingMask = autoresizing_mask;
|
||||
}
|
||||
|
||||
void NativeBrowserViewMac::SetBounds(const gfx::Rect& bounds) {
|
||||
auto* view = GetInspectableWebContentsView()->GetNativeView();
|
||||
auto* view =
|
||||
GetInspectableWebContentsView()->GetNativeView().GetNativeNSView();
|
||||
auto* superview = view.superview;
|
||||
const auto superview_height = superview ? superview.frame.size.height : 0;
|
||||
view.frame =
|
||||
|
@ -189,15 +192,17 @@ void NativeBrowserViewMac::SetBounds(const gfx::Rect& bounds) {
|
|||
}
|
||||
|
||||
void NativeBrowserViewMac::SetBackgroundColor(SkColor color) {
|
||||
auto* view = GetInspectableWebContentsView()->GetNativeView();
|
||||
auto* view =
|
||||
GetInspectableWebContentsView()->GetNativeView().GetNativeNSView();
|
||||
view.wantsLayer = YES;
|
||||
view.layer.backgroundColor = skia::CGColorCreateFromSkColor(color);
|
||||
}
|
||||
|
||||
void NativeBrowserViewMac::UpdateDraggableRegions(
|
||||
const std::vector<gfx::Rect>& drag_exclude_rects) {
|
||||
NSView* web_view = GetWebContents()->GetNativeView();
|
||||
NSView* inspectable_view = GetInspectableWebContentsView()->GetNativeView();
|
||||
NSView* web_view = GetWebContents()->GetNativeView().GetNativeNSView();
|
||||
NSView* inspectable_view =
|
||||
GetInspectableWebContentsView()->GetNativeView().GetNativeNSView();
|
||||
NSView* window_content_view = inspectable_view.superview;
|
||||
const auto window_content_view_height = NSHeight(window_content_view.bounds);
|
||||
|
||||
|
|
|
@ -347,7 +347,8 @@ NativeWindowMac::NativeWindowMac(const mate::Dictionary& options,
|
|||
params.type = views::Widget::InitParams::TYPE_WINDOW;
|
||||
params.native_widget = new AtomNativeWidgetMac(this, styleMask, widget());
|
||||
widget()->Init(params);
|
||||
window_ = static_cast<AtomNSWindow*>(widget()->GetNativeWindow());
|
||||
window_ = static_cast<AtomNSWindow*>(
|
||||
widget()->GetNativeWindow().GetNativeNSWindow());
|
||||
|
||||
[window_ setEnableLargerThanScreen:enable_larger_than_screen()];
|
||||
|
||||
|
@ -497,7 +498,7 @@ void NativeWindowMac::SetContentView(views::View* view) {
|
|||
void NativeWindowMac::Close() {
|
||||
// When this is a sheet showing, performClose won't work.
|
||||
if (is_modal() && parent() && IsVisible()) {
|
||||
[parent()->GetNativeWindow() endSheet:window_];
|
||||
[parent()->GetNativeWindow().GetNativeNSWindow() endSheet:window_];
|
||||
CloseImmediately();
|
||||
return;
|
||||
}
|
||||
|
@ -545,9 +546,10 @@ bool NativeWindowMac::IsFocused() {
|
|||
void NativeWindowMac::Show() {
|
||||
if (is_modal() && parent()) {
|
||||
if ([window_ sheetParent] == nil)
|
||||
[parent()->GetNativeWindow() beginSheet:window_
|
||||
completionHandler:^(NSModalResponse){
|
||||
}];
|
||||
[parent()->GetNativeWindow().GetNativeNSWindow()
|
||||
beginSheet:window_
|
||||
completionHandler:^(NSModalResponse){
|
||||
}];
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -573,7 +575,7 @@ void NativeWindowMac::ShowInactive() {
|
|||
void NativeWindowMac::Hide() {
|
||||
if (is_modal() && parent()) {
|
||||
[window_ orderOut:nil];
|
||||
[parent()->GetNativeWindow() endSheet:window_];
|
||||
[parent()->GetNativeWindow().GetNativeNSWindow() endSheet:window_];
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -897,7 +899,7 @@ void NativeWindowMac::FlashFrame(bool flash) {
|
|||
void NativeWindowMac::SetSkipTaskbar(bool skip) {}
|
||||
|
||||
void NativeWindowMac::SetSimpleFullScreen(bool simple_fullscreen) {
|
||||
NSWindow* window = GetNativeWindow();
|
||||
NSWindow* window = GetNativeWindow().GetNativeNSWindow();
|
||||
|
||||
if (simple_fullscreen && !is_simple_fullscreen_) {
|
||||
is_simple_fullscreen_ = true;
|
||||
|
@ -1079,7 +1081,8 @@ void NativeWindowMac::AddBrowserView(NativeBrowserView* view) {
|
|||
}
|
||||
|
||||
add_browser_view(view);
|
||||
auto* native_view = view->GetInspectableWebContentsView()->GetNativeView();
|
||||
auto* native_view =
|
||||
view->GetInspectableWebContentsView()->GetNativeView().GetNativeNSView();
|
||||
[[window_ contentView] addSubview:native_view
|
||||
positioned:NSWindowAbove
|
||||
relativeTo:nil];
|
||||
|
@ -1097,7 +1100,8 @@ void NativeWindowMac::RemoveBrowserView(NativeBrowserView* view) {
|
|||
return;
|
||||
}
|
||||
|
||||
[view->GetInspectableWebContentsView()->GetNativeView() removeFromSuperview];
|
||||
[view->GetInspectableWebContentsView()->GetNativeView().GetNativeNSView()
|
||||
removeFromSuperview];
|
||||
remove_browser_view(view);
|
||||
|
||||
[CATransaction commit];
|
||||
|
@ -1212,11 +1216,12 @@ void NativeWindowMac::ToggleTabBar() {
|
|||
}
|
||||
|
||||
bool NativeWindowMac::AddTabbedWindow(NativeWindow* window) {
|
||||
if (window_ == window->GetNativeWindow()) {
|
||||
if (window_ == window->GetNativeWindow().GetNativeNSWindow()) {
|
||||
return false;
|
||||
} else {
|
||||
if (@available(macOS 10.12, *))
|
||||
[window_ addTabbedWindow:window->GetNativeWindow() ordered:NSWindowAbove];
|
||||
[window_ addTabbedWindow:window->GetNativeWindow().GetNativeNSWindow()
|
||||
ordered:NSWindowAbove];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1441,7 +1446,8 @@ void NativeWindowMac::InternalSetParentWindow(NativeWindow* parent,
|
|||
NativeWindow::SetParentWindow(parent);
|
||||
|
||||
// Do not remove/add if we are already properly attached.
|
||||
if (attach && parent && [window_ parentWindow] == parent->GetNativeWindow())
|
||||
if (attach && parent &&
|
||||
[window_ parentWindow] == parent->GetNativeWindow().GetNativeNSWindow())
|
||||
return;
|
||||
|
||||
// Remove current parent window.
|
||||
|
@ -1451,7 +1457,9 @@ void NativeWindowMac::InternalSetParentWindow(NativeWindow* parent,
|
|||
// Set new parent window.
|
||||
// Note that this method will force the window to become visible.
|
||||
if (parent && attach)
|
||||
[parent->GetNativeWindow() addChildWindow:window_ ordered:NSWindowAbove];
|
||||
[parent->GetNativeWindow().GetNativeNSWindow()
|
||||
addChildWindow:window_
|
||||
ordered:NSWindowAbove];
|
||||
}
|
||||
|
||||
void NativeWindowMac::ShowWindowButton(NSWindowButton button) {
|
||||
|
|
|
@ -1216,6 +1216,14 @@ void NativeWindowViews::OnWidgetBoundsChanged(views::Widget* changed_widget,
|
|||
}
|
||||
}
|
||||
|
||||
void NativeWindowViews::OnWidgetDestroying(views::Widget* widget) {
|
||||
#if defined(OS_LINUX)
|
||||
aura::Window* window = GetNativeWindow();
|
||||
if (window)
|
||||
window->RemovePreTargetHandler(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void NativeWindowViews::DeleteDelegate() {
|
||||
if (is_modal() && this->parent()) {
|
||||
auto* parent = this->parent();
|
||||
|
|
|
@ -161,6 +161,7 @@ class NativeWindowViews : public NativeWindow,
|
|||
void AutoresizeBrowserView(int width_delta,
|
||||
int height_delta,
|
||||
NativeBrowserView* browser_view);
|
||||
void OnWidgetDestroying(views::Widget* widget) override;
|
||||
// views::WidgetDelegate:
|
||||
void DeleteDelegate() override;
|
||||
views::View* GetInitiallyFocusedView() override;
|
||||
|
|
|
@ -419,16 +419,12 @@ bool AtomNetworkDelegate::OnCanAccessFile(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AtomNetworkDelegate::OnCanEnablePrivacyMode(
|
||||
bool AtomNetworkDelegate::OnForcePrivacyMode(
|
||||
const GURL& url,
|
||||
const GURL& first_party_for_cookies) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AtomNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AtomNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader(
|
||||
const net::URLRequest& request,
|
||||
const GURL& target_url,
|
||||
|
|
|
@ -127,10 +127,8 @@ class AtomNetworkDelegate : public net::NetworkDelegate {
|
|||
bool OnCanAccessFile(const net::URLRequest& request,
|
||||
const base::FilePath& original_path,
|
||||
const base::FilePath& absolute_path) const override;
|
||||
bool OnCanEnablePrivacyMode(
|
||||
const GURL& url,
|
||||
const GURL& first_party_for_cookies) const override;
|
||||
bool OnAreExperimentalCookieFeaturesEnabled() const override;
|
||||
bool OnForcePrivacyMode(const GURL& url,
|
||||
const GURL& first_party_for_cookies) const override;
|
||||
bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
|
||||
const net::URLRequest& request,
|
||||
const GURL& target_url,
|
||||
|
|
|
@ -107,15 +107,7 @@ class ResourceContext : public content::ResourceContext {
|
|||
ResourceContext() = default;
|
||||
~ResourceContext() override = default;
|
||||
|
||||
net::URLRequestContext* GetRequestContext() override {
|
||||
return request_context_;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class URLRequestContextGetter;
|
||||
|
||||
net::URLRequestContext* request_context_ = nullptr;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ResourceContext);
|
||||
};
|
||||
|
||||
|
@ -332,8 +324,6 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
|||
}
|
||||
top_job_factory_->Chain(std::move(inner_job_factory));
|
||||
url_request_context_->set_job_factory(top_job_factory_.get());
|
||||
|
||||
context_handle_->resource_context_->request_context_ = url_request_context_;
|
||||
}
|
||||
|
||||
return url_request_context_;
|
||||
|
|
|
@ -92,7 +92,9 @@ void ShowCertificateTrust(atom::NativeWindow* parent_window,
|
|||
SecTrustRef trust = nullptr;
|
||||
SecTrustCreateWithCertificates(cert_chain, sec_policy, &trust);
|
||||
|
||||
NSWindow* window = parent_window ? parent_window->GetNativeWindow() : nil;
|
||||
NSWindow* window = parent_window
|
||||
? parent_window->GetNativeWindow().GetNativeNSWindow()
|
||||
: nil;
|
||||
auto msg = base::SysUTF8ToNSString(message);
|
||||
|
||||
auto panel = [[SFCertificateTrustPanel alloc] init];
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
} else {
|
||||
auto* contents = inspectableWebContentsView_->inspectable_web_contents()
|
||||
->GetWebContents();
|
||||
auto contentsView = contents->GetNativeView();
|
||||
auto* contentsView = contents->GetNativeView().GetNativeNSView();
|
||||
[contentsView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||
[self addSubview:contentsView];
|
||||
}
|
||||
|
@ -79,7 +79,7 @@
|
|||
inspectableWebContentsView_->inspectable_web_contents();
|
||||
auto* devToolsWebContents =
|
||||
inspectable_web_contents->GetDevToolsWebContents();
|
||||
auto devToolsView = devToolsWebContents->GetNativeView();
|
||||
auto* devToolsView = devToolsWebContents->GetNativeView().GetNativeNSView();
|
||||
|
||||
devtools_visible_ = visible;
|
||||
if (devtools_docked_) {
|
||||
|
@ -134,7 +134,7 @@
|
|||
inspectableWebContentsView_->inspectable_web_contents();
|
||||
auto* devToolsWebContents =
|
||||
inspectable_web_contents->GetDevToolsWebContents();
|
||||
auto devToolsView = devToolsWebContents->GetNativeView();
|
||||
auto devToolsView = devToolsWebContents->GetNativeView().GetNativeNSView();
|
||||
|
||||
auto styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable |
|
||||
NSMiniaturizableWindowMask | NSWindowStyleMaskResizable |
|
||||
|
@ -203,7 +203,7 @@
|
|||
if (!inspectable_web_contents || inspectable_web_contents->IsGuest())
|
||||
return;
|
||||
auto* webContents = inspectable_web_contents->GetWebContents();
|
||||
auto webContentsView = webContents->GetNativeView();
|
||||
auto* webContentsView = webContents->GetNativeView().GetNativeNSView();
|
||||
|
||||
NSView* view = [notification object];
|
||||
if ([[webContentsView subviews] containsObject:view]) {
|
||||
|
@ -215,7 +215,7 @@
|
|||
inspectable_web_contents->GetDevToolsWebContents();
|
||||
if (!devToolsWebContents)
|
||||
return;
|
||||
auto devToolsView = devToolsWebContents->GetNativeView();
|
||||
auto devToolsView = devToolsWebContents->GetNativeView().GetNativeNSView();
|
||||
|
||||
if ([[devToolsView subviews] containsObject:view]) {
|
||||
devtools_is_first_responder_ = YES;
|
||||
|
|
|
@ -21,7 +21,7 @@ class AtomNativeWidgetMac : public views::NativeWidgetMac {
|
|||
protected:
|
||||
// NativeWidgetMac:
|
||||
NativeWidgetMacNSWindow* CreateNSWindow(
|
||||
const views::Widget::InitParams& params) override;
|
||||
const views_bridge_mac::mojom::CreateWindowParams* params) override;
|
||||
|
||||
private:
|
||||
NativeWindowMac* shell_;
|
||||
|
|
|
@ -19,7 +19,7 @@ AtomNativeWidgetMac::AtomNativeWidgetMac(
|
|||
AtomNativeWidgetMac::~AtomNativeWidgetMac() {}
|
||||
|
||||
NativeWidgetMacNSWindow* AtomNativeWidgetMac::CreateNSWindow(
|
||||
const views::Widget::InitParams& params) {
|
||||
const views_bridge_mac::mojom::CreateWindowParams* params) {
|
||||
return [[[AtomNSWindow alloc] initWithShell:shell_ styleMask:style_mask_]
|
||||
autorelease];
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "atom/browser/ui/cocoa/atom_preview_item.h"
|
||||
#include "atom/browser/ui/cocoa/atom_touch_bar.h"
|
||||
#include "base/mac/mac_util.h"
|
||||
#include "ui/views/cocoa/bridged_native_widget_host_impl.h"
|
||||
#include "ui/views/widget/native_widget_mac.h"
|
||||
#include "ui/views_bridge_mac/bridged_native_widget_impl.h"
|
||||
|
||||
|
@ -21,12 +22,13 @@
|
|||
// on the fly.
|
||||
// TODO(zcbenz): Add interface in NativeWidgetMac to allow overriding creating
|
||||
// window delegate.
|
||||
auto* bridged_view = views::BridgedNativeWidgetImpl::GetFromNativeWindow(
|
||||
auto* bridge_host = views::BridgedNativeWidgetHostImpl::GetFromNativeWindow(
|
||||
shell->GetNativeWindow());
|
||||
auto* bridged_view = bridge_host->bridge_impl();
|
||||
if ((self = [super initWithBridgedNativeWidget:bridged_view])) {
|
||||
shell_ = shell;
|
||||
is_zooming_ = false;
|
||||
level_ = [shell_->GetNativeWindow() level];
|
||||
level_ = [shell_->GetNativeWindow().GetNativeNSWindow() level];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -138,7 +140,7 @@
|
|||
}
|
||||
|
||||
- (void)windowWillMiniaturize:(NSNotification*)notification {
|
||||
NSWindow* window = shell_->GetNativeWindow();
|
||||
NSWindow* window = shell_->GetNativeWindow().GetNativeNSWindow();
|
||||
// store the current status window level to be restored in
|
||||
// windowDidDeminiaturize
|
||||
level_ = [window level];
|
||||
|
@ -152,7 +154,7 @@
|
|||
|
||||
- (void)windowDidDeminiaturize:(NSNotification*)notification {
|
||||
[super windowDidDeminiaturize:notification];
|
||||
[shell_->GetNativeWindow() setLevel:level_];
|
||||
[shell_->GetNativeWindow().GetNativeNSWindow() setLevel:level_];
|
||||
shell_->NotifyWindowRestore();
|
||||
}
|
||||
|
||||
|
@ -179,7 +181,7 @@
|
|||
// artifacts.
|
||||
if (@available(macOS 10.10, *)) {
|
||||
if (shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) {
|
||||
NSWindow* window = shell_->GetNativeWindow();
|
||||
NSWindow* window = shell_->GetNativeWindow().GetNativeNSWindow();
|
||||
[window setToolbar:nil];
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +194,7 @@
|
|||
// For frameless window we don't show set title for normal mode since the
|
||||
// titlebar is expected to be empty, but after entering fullscreen mode we
|
||||
// have to set one, because title bar is visible here.
|
||||
NSWindow* window = shell_->GetNativeWindow();
|
||||
NSWindow* window = shell_->GetNativeWindow().GetNativeNSWindow();
|
||||
if ((shell_->transparent() || !shell_->has_frame()) &&
|
||||
// FIXME(zcbenz): Showing titlebar for hiddenInset window is weird under
|
||||
// fullscreen mode.
|
||||
|
@ -221,7 +223,7 @@
|
|||
- (void)windowWillExitFullScreen:(NSNotification*)notification {
|
||||
if (@available(macOS 10.10, *)) {
|
||||
// Restore the titlebar visibility.
|
||||
NSWindow* window = shell_->GetNativeWindow();
|
||||
NSWindow* window = shell_->GetNativeWindow().GetNativeNSWindow();
|
||||
if ((shell_->transparent() || !shell_->has_frame()) &&
|
||||
(shell_->title_bar_style() != atom::NativeWindowMac::HIDDEN_INSET ||
|
||||
shell_->fullscreen_window_title())) {
|
||||
|
@ -247,8 +249,9 @@
|
|||
// Clears the delegate when window is going to be closed, since EL Capitan it
|
||||
// is possible that the methods of delegate would get called after the window
|
||||
// has been closed.
|
||||
auto* bridged_view = views::BridgedNativeWidgetImpl::GetFromNativeWindow(
|
||||
auto* bridge_host = views::BridgedNativeWidgetHostImpl::GetFromNativeWindow(
|
||||
shell_->GetNativeWindow());
|
||||
auto* bridged_view = bridge_host->bridge_impl();
|
||||
bridged_view->OnWindowWillClose();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,26 +33,27 @@ void DragFileItems(const std::vector<base::FilePath>& files,
|
|||
|
||||
// Synthesize a drag event, since we don't have access to the actual event
|
||||
// that initiated a drag (possibly consumed by the Web UI, for example).
|
||||
NSPoint position = [[view window] mouseLocationOutsideOfEventStream];
|
||||
NSWindow* window = [view.GetNativeNSView() window];
|
||||
NSPoint position = [window mouseLocationOutsideOfEventStream];
|
||||
NSTimeInterval eventTime = [[NSApp currentEvent] timestamp];
|
||||
NSEvent* dragEvent = [NSEvent mouseEventWithType:NSLeftMouseDragged
|
||||
location:position
|
||||
modifierFlags:NSLeftMouseDraggedMask
|
||||
timestamp:eventTime
|
||||
windowNumber:[[view window] windowNumber]
|
||||
windowNumber:[window windowNumber]
|
||||
context:nil
|
||||
eventNumber:0
|
||||
clickCount:1
|
||||
pressure:1.0];
|
||||
|
||||
// Run the drag operation.
|
||||
[[view window] dragImage:icon.ToNSImage()
|
||||
at:position
|
||||
offset:NSZeroSize
|
||||
event:dragEvent
|
||||
pasteboard:pasteboard
|
||||
source:view
|
||||
slideBack:YES];
|
||||
[window dragImage:icon.ToNSImage()
|
||||
at:position
|
||||
offset:NSZeroSize
|
||||
event:dragEvent
|
||||
pasteboard:pasteboard
|
||||
source:view.GetNativeNSView()
|
||||
slideBack:YES];
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -210,7 +210,8 @@ int RunModalDialog(NSSavePanel* dialog, const DialogSettings& settings) {
|
|||
settings.force_detached) {
|
||||
chosen = [dialog runModal];
|
||||
} else {
|
||||
NSWindow* window = settings.parent_window->GetNativeWindow();
|
||||
NSWindow* window =
|
||||
settings.parent_window->GetNativeWindow().GetNativeNSWindow();
|
||||
|
||||
[dialog beginSheetModalForWindow:window
|
||||
completionHandler:^(NSInteger c) {
|
||||
|
@ -328,7 +329,8 @@ void ShowOpenDialog(const DialogSettings& settings,
|
|||
OpenDialogCompletion(chosen, dialog, settings, callback);
|
||||
}];
|
||||
} else {
|
||||
NSWindow* window = settings.parent_window->GetNativeWindow();
|
||||
NSWindow* window =
|
||||
settings.parent_window->GetNativeWindow().GetNativeNSWindow();
|
||||
[dialog beginSheetModalForWindow:window
|
||||
completionHandler:^(NSInteger chosen) {
|
||||
OpenDialogCompletion(chosen, dialog, settings, callback);
|
||||
|
@ -389,7 +391,8 @@ void ShowSaveDialog(const DialogSettings& settings,
|
|||
SaveDialogCompletion(chosen, dialog, settings, callback);
|
||||
}];
|
||||
} else {
|
||||
NSWindow* window = settings.parent_window->GetNativeWindow();
|
||||
NSWindow* window =
|
||||
settings.parent_window->GetNativeWindow().GetNativeNSWindow();
|
||||
[dialog beginSheetModalForWindow:window
|
||||
completionHandler:^(NSInteger chosen) {
|
||||
SaveDialogCompletion(chosen, dialog, settings, callback);
|
||||
|
|
|
@ -779,12 +779,11 @@ bool InspectableWebContentsImpl::ShouldCreateWebContents(
|
|||
return false;
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::HandleKeyboardEvent(
|
||||
bool InspectableWebContentsImpl::HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
auto* delegate = web_contents_->GetDelegate();
|
||||
if (delegate)
|
||||
delegate->HandleKeyboardEvent(source, event);
|
||||
return !delegate || delegate->HandleKeyboardEvent(source, event);
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::CloseContents(content::WebContents* source) {
|
||||
|
|
|
@ -182,7 +182,7 @@ class InspectableWebContentsImpl
|
|||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
content::SessionStorageNamespace* session_storage_namespace) override;
|
||||
void HandleKeyboardEvent(content::WebContents*,
|
||||
bool HandleKeyboardEvent(content::WebContents*,
|
||||
const content::NativeWebKeyboardEvent&) override;
|
||||
void CloseContents(content::WebContents* source) override;
|
||||
content::ColorChooser* OpenColorChooser(
|
||||
|
|
|
@ -156,7 +156,7 @@ int ShowMessageBox(NativeWindow* parent_window,
|
|||
andAlert:alert
|
||||
callEndModal:true];
|
||||
|
||||
NSWindow* window = parent_window->GetNativeWindow();
|
||||
NSWindow* window = parent_window->GetNativeWindow().GetNativeNSWindow();
|
||||
[alert beginSheetModalForWindow:window
|
||||
modalDelegate:delegate
|
||||
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
|
||||
|
@ -193,7 +193,9 @@ void ShowMessageBox(NativeWindow* parent_window,
|
|||
andAlert:alert
|
||||
callEndModal:false];
|
||||
|
||||
NSWindow* window = parent_window ? parent_window->GetNativeWindow() : nil;
|
||||
NSWindow* window =
|
||||
parent_window ? parent_window->GetNativeWindow().GetNativeNSWindow()
|
||||
: nil;
|
||||
[alert
|
||||
beginSheetModalForWindow:window
|
||||
modalDelegate:delegate
|
||||
|
|
|
@ -47,9 +47,6 @@ bool ViewsDelegate::GetSavedWindowPlacement(
|
|||
return false;
|
||||
}
|
||||
|
||||
void ViewsDelegate::NotifyAccessibilityEvent(views::View* view,
|
||||
ax::mojom::Event event_type) {}
|
||||
|
||||
void ViewsDelegate::NotifyMenuItemFocused(const base::string16& menu_name,
|
||||
const base::string16& menu_item_name,
|
||||
int item_index,
|
||||
|
|
|
@ -27,8 +27,6 @@ class ViewsDelegate : public views::ViewsDelegate {
|
|||
const std::string& window_name,
|
||||
gfx::Rect* bounds,
|
||||
ui::WindowShowState* show_state) const override;
|
||||
void NotifyAccessibilityEvent(views::View* view,
|
||||
ax::mojom::Event event_type) override;
|
||||
void NotifyMenuItemFocused(const base::string16& menu_name,
|
||||
const base::string16& menu_item_name,
|
||||
int item_index,
|
||||
|
|
|
@ -23,8 +23,7 @@ SubmenuButton::SubmenuButton(const base::string16& title,
|
|||
views::MenuButtonListener* menu_button_listener,
|
||||
const SkColor& background_color)
|
||||
: views::MenuButton(gfx::RemoveAcceleratorChar(title, '&', NULL, NULL),
|
||||
menu_button_listener,
|
||||
false),
|
||||
menu_button_listener),
|
||||
background_color_(background_color) {
|
||||
#if defined(OS_LINUX)
|
||||
// Dont' use native style border.
|
||||
|
@ -72,7 +71,7 @@ void SubmenuButton::SetUnderlineColor(SkColor color) {
|
|||
}
|
||||
|
||||
void SubmenuButton::GetAccessibleNodeData(ui::AXNodeData* node_data) {
|
||||
node_data->SetName(accessible_name());
|
||||
node_data->SetName(GetAccessibleName());
|
||||
node_data->role = ax::mojom::Role::kPopUpButton;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,29 @@ bool GetAsInteger(const base::Value* val,
|
|||
return false;
|
||||
}
|
||||
|
||||
bool GetAsAutoplayPolicy(const base::Value* val,
|
||||
const base::StringPiece& path,
|
||||
content::AutoplayPolicy* out) {
|
||||
std::string policy_str;
|
||||
if (GetAsString(val, path, &policy_str)) {
|
||||
if (policy_str == "no-user-gesture-required") {
|
||||
*out = content::AutoplayPolicy::kNoUserGestureRequired;
|
||||
return true;
|
||||
} else if (policy_str == "user-gesture-required") {
|
||||
*out = content::AutoplayPolicy::kUserGestureRequired;
|
||||
return true;
|
||||
} else if (policy_str == "user-gesture-required-for-cross-origin") {
|
||||
*out = content::AutoplayPolicy::kUserGestureRequiredForCrossOrigin;
|
||||
return true;
|
||||
} else if (policy_str == "document-user-activation-required") {
|
||||
*out = content::AutoplayPolicy::kDocumentUserActivationRequired;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace atom {
|
||||
|
@ -364,6 +387,10 @@ void WebContentsPreferences::OverrideWebkitPrefs(
|
|||
IsEnabled("textAreasAreResizable", true /* default_value */);
|
||||
prefs->navigate_on_drag_drop =
|
||||
IsEnabled("navigateOnDragDrop", false /* default_value */);
|
||||
if (!GetAsAutoplayPolicy(&preference_, "autoplayPolicy",
|
||||
&prefs->autoplay_policy)) {
|
||||
prefs->autoplay_policy = content::AutoplayPolicy::kNoUserGestureRequired;
|
||||
}
|
||||
|
||||
// Check if webgl should be enabled.
|
||||
bool is_webgl_enabled = IsEnabled("webgl", true /* default_value */);
|
||||
|
|
|
@ -105,7 +105,7 @@ class FileSelectHelper : public base::RefCounted<FileSelectHelper>,
|
|||
|
||||
void OnFilesSelected(std::vector<FileChooserFileInfoPtr> file_info) {
|
||||
if (listener_) {
|
||||
listener_->FileSelected(std::move(file_info), mode_);
|
||||
listener_->FileSelected(std::move(file_info), base::FilePath(), mode_);
|
||||
listener_.reset();
|
||||
}
|
||||
render_frame_host_ = nullptr;
|
||||
|
@ -265,7 +265,7 @@ void WebDialogHelper::EnumerateDirectory(
|
|||
blink::mojom::NativeFileInfo::New(path, base::string16())));
|
||||
}
|
||||
|
||||
listener->FileSelected(std::move(file_info),
|
||||
listener->FileSelected(std::move(file_info), dir,
|
||||
FileChooserParams::Mode::kUploadFolder);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,11 +38,13 @@ void WebViewGuestDelegate::AttachToIframe(
|
|||
DCHECK_EQ(embedder_web_contents_,
|
||||
content::WebContents::FromRenderFrameHost(embedder_frame));
|
||||
|
||||
content::WebContents* guest_web_contents = api_web_contents_->web_contents();
|
||||
// Attach this inner WebContents |guest_web_contents| to the outer
|
||||
// WebContents |embedder_web_contents|. The outer WebContents's
|
||||
// frame |embedder_frame| hosts the inner WebContents.
|
||||
api_web_contents_->web_contents()->AttachToOuterWebContentsFrame(
|
||||
embedder_web_contents_, embedder_frame);
|
||||
guest_web_contents->AttachToOuterWebContentsFrame(
|
||||
base::WrapUnique<content::WebContents>(guest_web_contents),
|
||||
embedder_frame);
|
||||
|
||||
ResetZoomController();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue