Pass arguments instance through the chain in order to throw error

This commit is contained in:
Samuel Attard 2018-02-27 16:11:54 +11:00
Родитель e84d7c0cda
Коммит 5336b4a89c
6 изменённых файлов: 14 добавлений и 8 удалений

Просмотреть файл

@ -1082,8 +1082,13 @@ void BrowserWindow::ToggleTabBar() {
window_->ToggleTabBar();
}
void BrowserWindow::AddTabbedWindow(NativeWindow* window) {
window_->AddTabbedWindow(window);
void BrowserWindow::AddTabbedWindow(mate::Arguments* args) {
NativeWindow* window;
if (!args->GetNext(&window)) {
args->ThrowError("Insert good error message here");
return;
}
window_->AddTabbedWindow(window, args);
}
void BrowserWindow::SetVibrancy(mate::Arguments* args) {

Просмотреть файл

@ -243,7 +243,7 @@ class BrowserWindow : public mate::TrackableObject<BrowserWindow>,
void MergeAllWindows();
void MoveTabToNewWindow();
void ToggleTabBar();
void AddTabbedWindow(NativeWindow* window);
void AddTabbedWindow(mate::Arguments* args);
void SetVibrancy(mate::Arguments* args);
void SetTouchBar(const std::vector<mate::PersistentDictionary>& items);

Просмотреть файл

@ -336,7 +336,7 @@ void NativeWindow::MoveTabToNewWindow() {
void NativeWindow::ToggleTabBar() {
}
void NativeWindow::AddTabbedWindow(NativeWindow* window) {
void NativeWindow::AddTabbedWindow(NativeWindow* window, mate::Arguments* args) {
}
void NativeWindow::SetVibrancy(const std::string& filename) {

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -918,6 +918,7 @@ NativeWindowMac::NativeWindowMac(
}
if (transparent()) {
NSLog(@"Setting transparent");
// Setting the background color to clear will also hide the shadow.
[window_ setBackgroundColor:[NSColor clearColor]];
}
@ -1671,9 +1672,9 @@ void NativeWindowMac::ToggleTabBar() {
}
}
void NativeWindowMac::AddTabbedWindow(NativeWindow* window) {
void NativeWindowMac::AddTabbedWindow(NativeWindow* window, mate::Arguments* args) {
if (window_.get() == window->GetNativeWindow()) {
NSLog(@"Error: AddTabbedWindow cannot be called by a window on itself.");
args->ThrowError("AddTabbedWindow cannot be called by a window on itself");
} else {
if ([window_ respondsToSelector:@selector(addTabbedWindow:ordered:)]) {
[window_ addTabbedWindow:window->GetNativeWindow() ordered:NSWindowAbove];