Merge pull request #12004 from electron/window-rename
Rename api::Window to api::BrowserWindow
This commit is contained in:
commit
47950f7b97
10 changed files with 327 additions and 306 deletions
File diff suppressed because it is too large
Load diff
|
@ -2,8 +2,8 @@
|
||||||
// Use of this source code is governed by the MIT license that can be
|
// Use of this source code is governed by the MIT license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef ATOM_BROWSER_API_ATOM_API_WINDOW_H_
|
#ifndef ATOM_BROWSER_API_ATOM_API_BROWSER_WINDOW_H_
|
||||||
#define ATOM_BROWSER_API_ATOM_API_WINDOW_H_
|
#define ATOM_BROWSER_API_ATOM_API_BROWSER_WINDOW_H_
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -38,8 +38,8 @@ namespace api {
|
||||||
|
|
||||||
class WebContents;
|
class WebContents;
|
||||||
|
|
||||||
class Window : public mate::TrackableObject<Window>,
|
class BrowserWindow : public mate::TrackableObject<BrowserWindow>,
|
||||||
public NativeWindowObserver {
|
public NativeWindowObserver {
|
||||||
public:
|
public:
|
||||||
static mate::WrappableBase* New(mate::Arguments* args);
|
static mate::WrappableBase* New(mate::Arguments* args);
|
||||||
|
|
||||||
|
@ -55,9 +55,10 @@ class Window : public mate::TrackableObject<Window>,
|
||||||
int32_t ID() const;
|
int32_t ID() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Window(v8::Isolate* isolate, v8::Local<v8::Object> wrapper,
|
BrowserWindow(v8::Isolate* isolate,
|
||||||
const mate::Dictionary& options);
|
v8::Local<v8::Object> wrapper,
|
||||||
~Window() override;
|
const mate::Dictionary& options);
|
||||||
|
~BrowserWindow() override;
|
||||||
|
|
||||||
// NativeWindowObserver:
|
// NativeWindowObserver:
|
||||||
void WillCloseWindow(bool* prevent_default) override;
|
void WillCloseWindow(bool* prevent_default) override;
|
||||||
|
@ -249,7 +250,7 @@ class Window : public mate::TrackableObject<Window>,
|
||||||
|
|
||||||
std::unique_ptr<NativeWindow> window_;
|
std::unique_ptr<NativeWindow> window_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(Window);
|
DISALLOW_COPY_AND_ASSIGN(BrowserWindow);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace api
|
} // namespace api
|
||||||
|
@ -269,8 +270,8 @@ struct Converter<atom::NativeWindow*> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
atom::api::Window* window;
|
atom::api::BrowserWindow* window;
|
||||||
if (!Converter<atom::api::Window*>::FromV8(isolate, val, &window))
|
if (!Converter<atom::api::BrowserWindow*>::FromV8(isolate, val, &window))
|
||||||
return false;
|
return false;
|
||||||
*out = window->window();
|
*out = window->window();
|
||||||
return true;
|
return true;
|
||||||
|
@ -279,4 +280,4 @@ struct Converter<atom::NativeWindow*> {
|
||||||
|
|
||||||
} // namespace mate
|
} // namespace mate
|
||||||
|
|
||||||
#endif // ATOM_BROWSER_API_ATOM_API_WINDOW_H_
|
#endif // ATOM_BROWSER_API_ATOM_API_BROWSER_WINDOW_H_
|
|
@ -6,7 +6,7 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "atom/browser/api/atom_api_window.h"
|
#include "atom/browser/api/atom_api_browser_window.h"
|
||||||
#include "atom/browser/native_window.h"
|
#include "atom/browser/native_window.h"
|
||||||
#include "atom/browser/ui/certificate_trust.h"
|
#include "atom/browser/ui/certificate_trust.h"
|
||||||
#include "atom/browser/ui/file_dialog.h"
|
#include "atom/browser/ui/file_dialog.h"
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "atom/browser/api/atom_api_window.h"
|
#include "atom/browser/api/atom_api_browser_window.h"
|
||||||
#include "atom/browser/api/trackable_object.h"
|
#include "atom/browser/api/trackable_object.h"
|
||||||
#include "atom/browser/ui/atom_menu_model.h"
|
#include "atom/browser/ui/atom_menu_model.h"
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
|
@ -54,7 +54,8 @@ class Menu : public mate::TrackableObject<Menu>,
|
||||||
void ExecuteCommand(int command_id, int event_flags) override;
|
void ExecuteCommand(int command_id, int event_flags) override;
|
||||||
void MenuWillShow(ui::SimpleMenuModel* source) override;
|
void MenuWillShow(ui::SimpleMenuModel* source) override;
|
||||||
|
|
||||||
virtual void PopupAt(Window* window, int x, int y, int positioning_item,
|
virtual void PopupAt(BrowserWindow* window,
|
||||||
|
int x, int y, int positioning_item,
|
||||||
const base::Closure& callback) = 0;
|
const base::Closure& callback) = 0;
|
||||||
virtual void ClosePopupAt(int32_t window_id) = 0;
|
virtual void ClosePopupAt(int32_t window_id) = 0;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@ class MenuMac : public Menu {
|
||||||
protected:
|
protected:
|
||||||
MenuMac(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);
|
MenuMac(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);
|
||||||
|
|
||||||
void PopupAt(Window* window, int x, int y, int positioning_item,
|
void PopupAt(BrowserWindow* window,
|
||||||
|
int x, int y, int positioning_item,
|
||||||
const base::Closure& callback) override;
|
const base::Closure& callback) override;
|
||||||
void PopupOnUI(const base::WeakPtr<NativeWindow>& native_window,
|
void PopupOnUI(const base::WeakPtr<NativeWindow>& native_window,
|
||||||
int32_t window_id,
|
int32_t window_id,
|
||||||
|
|
|
@ -27,7 +27,8 @@ MenuMac::MenuMac(v8::Isolate* isolate, v8::Local<v8::Object> wrapper)
|
||||||
weak_factory_(this) {
|
weak_factory_(this) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuMac::PopupAt(Window* window, int x, int y, int positioning_item,
|
void MenuMac::PopupAt(BrowserWindow* window,
|
||||||
|
int x, int y, int positioning_item,
|
||||||
const base::Closure& callback) {
|
const base::Closure& callback) {
|
||||||
NativeWindow* native_window = window->window();
|
NativeWindow* native_window = window->window();
|
||||||
if (!native_window)
|
if (!native_window)
|
||||||
|
|
|
@ -21,7 +21,8 @@ MenuViews::MenuViews(v8::Isolate* isolate, v8::Local<v8::Object> wrapper)
|
||||||
weak_factory_(this) {
|
weak_factory_(this) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuViews::PopupAt(Window* window, int x, int y, int positioning_item,
|
void MenuViews::PopupAt(BrowserWindow* window,
|
||||||
|
int x, int y, int positioning_item,
|
||||||
const base::Closure& callback) {
|
const base::Closure& callback) {
|
||||||
NativeWindow* native_window = static_cast<NativeWindow*>(window->window());
|
NativeWindow* native_window = static_cast<NativeWindow*>(window->window());
|
||||||
if (!native_window)
|
if (!native_window)
|
||||||
|
|
|
@ -21,7 +21,8 @@ class MenuViews : public Menu {
|
||||||
MenuViews(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);
|
MenuViews(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void PopupAt(Window* window, int x, int y, int positioning_item,
|
void PopupAt(BrowserWindow* window,
|
||||||
|
int x, int y, int positioning_item,
|
||||||
const base::Closure& callback) override;
|
const base::Closure& callback) override;
|
||||||
void ClosePopupAt(int32_t window_id) override;
|
void ClosePopupAt(int32_t window_id) override;
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "atom/browser/api/atom_api_browser_window.h"
|
||||||
#include "atom/browser/api/atom_api_debugger.h"
|
#include "atom/browser/api/atom_api_debugger.h"
|
||||||
#include "atom/browser/api/atom_api_session.h"
|
#include "atom/browser/api/atom_api_session.h"
|
||||||
#include "atom/browser/api/atom_api_window.h"
|
|
||||||
#include "atom/browser/atom_browser_client.h"
|
#include "atom/browser/atom_browser_client.h"
|
||||||
#include "atom/browser/atom_browser_context.h"
|
#include "atom/browser/atom_browser_context.h"
|
||||||
#include "atom/browser/atom_browser_main_parts.h"
|
#include "atom/browser/atom_browser_main_parts.h"
|
||||||
|
@ -963,7 +963,7 @@ bool WebContents::OnMessageReceived(const IPC::Message& message,
|
||||||
// For webview only #1 will happen, for BrowserWindow both #1 and #3 may
|
// For webview only #1 will happen, for BrowserWindow both #1 and #3 may
|
||||||
// happen. The #2 should never happen for webContents, because webview is
|
// happen. The #2 should never happen for webContents, because webview is
|
||||||
// managed by GuestViewManager, and BrowserWindow's webContents is managed
|
// managed by GuestViewManager, and BrowserWindow's webContents is managed
|
||||||
// by api::Window.
|
// by api::BrowserWindow.
|
||||||
// For #1, the destructor will do the cleanup work and we only need to make
|
// For #1, the destructor will do the cleanup work and we only need to make
|
||||||
// sure "destroyed" event is emitted. For #3, the content::WebContents will
|
// sure "destroyed" event is emitted. For #3, the content::WebContents will
|
||||||
// be destroyed on close, and WebContentsDestroyed would be called for it, so
|
// be destroyed on close, and WebContentsDestroyed would be called for it, so
|
||||||
|
@ -1773,7 +1773,7 @@ v8::Local<v8::Value> WebContents::GetWebPreferences(v8::Isolate* isolate) {
|
||||||
|
|
||||||
v8::Local<v8::Value> WebContents::GetOwnerBrowserWindow() {
|
v8::Local<v8::Value> WebContents::GetOwnerBrowserWindow() {
|
||||||
if (owner_window())
|
if (owner_window())
|
||||||
return Window::From(isolate(), owner_window());
|
return BrowserWindow::From(isolate(), owner_window());
|
||||||
else
|
else
|
||||||
return v8::Null(isolate());
|
return v8::Null(isolate());
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,8 +161,8 @@
|
||||||
'atom/browser/api/atom_api_web_request.cc',
|
'atom/browser/api/atom_api_web_request.cc',
|
||||||
'atom/browser/api/atom_api_web_request.h',
|
'atom/browser/api/atom_api_web_request.h',
|
||||||
'atom/browser/api/atom_api_web_view_manager.cc',
|
'atom/browser/api/atom_api_web_view_manager.cc',
|
||||||
'atom/browser/api/atom_api_window.cc',
|
'atom/browser/api/atom_api_browser_window.cc',
|
||||||
'atom/browser/api/atom_api_window.h',
|
'atom/browser/api/atom_api_browser_window.h',
|
||||||
'atom/browser/api/event.cc',
|
'atom/browser/api/event.cc',
|
||||||
'atom/browser/api/event.h',
|
'atom/browser/api/event.h',
|
||||||
'atom/browser/api/event_emitter.cc',
|
'atom/browser/api/event_emitter.cc',
|
||||||
|
|
Loading…
Reference in a new issue