Add win.getChildWindows() API

This commit is contained in:
Cheng Zhao 2016-06-17 16:57:03 +09:00
parent 22513efd55
commit 6cef29e4ee
3 changed files with 34 additions and 12 deletions

View file

@ -6,15 +6,16 @@
#define ATOM_BROWSER_API_ATOM_API_WINDOW_H_
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "base/memory/scoped_ptr.h"
#include "ui/gfx/image/image.h"
#include "atom/browser/api/trackable_object.h"
#include "atom/browser/native_window.h"
#include "atom/browser/native_window_observer.h"
#include "atom/common/api/atom_api_native_image.h"
#include "atom/common/key_weak_map.h"
#include "native_mate/handle.h"
class GURL;
@ -159,8 +160,9 @@ class Window : public mate::TrackableObject<Window>,
void SetMenuBarVisibility(bool visible);
bool IsMenuBarVisible();
void SetAspectRatio(double aspect_ratio, mate::Arguments* args);
void SetParentWindow(mate::Arguments* args);
void SetParentWindow(v8::Local<v8::Value> value, mate::Arguments* args);
v8::Local<v8::Value> GetParentWindow();
std::vector<v8::Local<v8::Object>> GetChildWindows();
v8::Local<v8::Value> GetNativeWindowHandle();
#if defined(OS_WIN)
@ -183,6 +185,9 @@ class Window : public mate::TrackableObject<Window>,
int32_t ID() const;
v8::Local<v8::Value> WebContents(v8::Isolate* isolate);
// Helpers.
void RemoveFromParentChildWindows();
#if defined(OS_WIN)
typedef std::map<UINT, MessageCallback> MessageCallbackMap;
MessageCallbackMap messages_callback_map_;
@ -191,6 +196,7 @@ class Window : public mate::TrackableObject<Window>,
v8::Global<v8::Value> web_contents_;
v8::Global<v8::Value> menu_;
v8::Global<v8::Value> parent_window_;
KeyWeakMap<int> child_windows_;
api::WebContents* api_web_contents_;