move native-mate back into the api layer

This commit is contained in:
Shelley Vohr 2018-02-27 13:00:42 -08:00
parent 837a2d4bbd
commit 2abc69780e
No known key found for this signature in database
GPG key ID: F13993A75599653C
5 changed files with 11 additions and 9 deletions

View file

@ -1084,7 +1084,9 @@ void BrowserWindow::ToggleTabBar() {
void BrowserWindow::AddTabbedWindow(NativeWindow* window,
mate::Arguments* args) {
window_->AddTabbedWindow(window, args);
const bool windowAdded = window_->AddTabbedWindow(window);
if (!windowAdded)
args->ThrowError("AddTabbedWindow cannot be called by a window on itself");
}
void BrowserWindow::SetVibrancy(mate::Arguments* args) {

View file

@ -336,8 +336,8 @@ void NativeWindow::MoveTabToNewWindow() {
void NativeWindow::ToggleTabBar() {
}
void NativeWindow::AddTabbedWindow(NativeWindow* window,
mate::Arguments* args) {
bool NativeWindow::AddTabbedWindow(NativeWindow* window) {
return true; // for non-Mac platforms
}
void NativeWindow::SetVibrancy(const std::string& filename) {

View file

@ -192,7 +192,7 @@ class NativeWindow : public base::SupportsUserData,
virtual void MergeAllWindows();
virtual void MoveTabToNewWindow();
virtual void ToggleTabBar();
virtual void AddTabbedWindow(NativeWindow* window, mate::Arguments* args);
virtual bool AddTabbedWindow(NativeWindow* window);
// Webview APIs.
virtual void FocusOnWebView();

View file

@ -109,7 +109,7 @@ class NativeWindowMac : public NativeWindow {
void MergeAllWindows() override;
void MoveTabToNewWindow() override;
void ToggleTabBar() override;
void AddTabbedWindow(NativeWindow* window, mate::Arguments* args) override;
bool AddTabbedWindow(NativeWindow* window) override;
void SetVibrancy(const std::string& type) override;
void SetTouchBar(

View file

@ -1672,14 +1672,14 @@ void NativeWindowMac::ToggleTabBar() {
}
}
void NativeWindowMac::AddTabbedWindow(NativeWindow* window, mate::Arguments* args) {
bool NativeWindowMac::AddTabbedWindow(NativeWindow* window) {
if (window_.get() == window->GetNativeWindow()) {
args->ThrowError("AddTabbedWindow cannot be called by a window on itself");
return false;
} else {
if ([window_ respondsToSelector:@selector(addTabbedWindow:ordered:)]) {
if ([window_ respondsToSelector:@selector(addTabbedWindow:ordered:)])
[window_ addTabbedWindow:window->GetNativeWindow() ordered:NSWindowAbove];
}
}
return true;
}
void NativeWindowMac::SetRenderWidgetHostOpaque(bool opaque) {