#include "browser/api/atom_api_window.h"
#include "base/values.h"
-#include "browser/atom_browser_context.h"
#include "browser/native_window.h"
#include "common/v8_value_converter_impl.h"
#include "content/public/browser/navigation_entry.h"
Window::Window(v8::Handle<v8::Object> wrapper, base::DictionaryValue* options)
: EventEmitter(wrapper),
- window_(NativeWindow::Create(AtomBrowserContext::Get(), options)) {
+ window_(NativeWindow::Create(options)) {
window_->InitFromOptions(options);
window_->AddObserver(this);
}
#include "brightray/browser/browser_context.h"
#include "brightray/browser/inspectable_web_contents.h"
#include "brightray/browser/inspectable_web_contents_view.h"
+#include "browser/atom_browser_context.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
namespace atom {
-NativeWindow::NativeWindow(content::BrowserContext* browser_context,
+NativeWindow::NativeWindow(content::WebContents* web_contents,
base::DictionaryValue* options)
- : inspectable_web_contents_(brightray::InspectableWebContents::Create(
- content::WebContents::CreateParams(browser_context))) {
- content::WebContents* web_contents = GetWebContents();
-
+ : inspectable_web_contents_(
+ brightray::InspectableWebContents::Create(web_contents)) {
web_contents->SetDelegate(this);
// Add window as an observer of the web contents.
NativeWindow::~NativeWindow() {
}
+// static
+NativeWindow* NativeWindow::Create(base::DictionaryValue* options) {
+ content::WebContents::CreateParams create_params(AtomBrowserContext::Get());
+ return Create(content::WebContents::Create(create_params), options);
+}
+
void NativeWindow::InitFromOptions(base::DictionaryValue* options) {
// Setup window from options.
int x, y;
public:
virtual ~NativeWindow();
- static NativeWindow* Create(content::BrowserContext* browser_context,
+ // Create window with existing WebContents.
+ static NativeWindow* Create(content::WebContents* web_contents,
base::DictionaryValue* options);
+ // Create window with new WebContents.
+ static NativeWindow* Create(base::DictionaryValue* options);
+
void InitFromOptions(base::DictionaryValue* options);
virtual void Close() = 0;
}
protected:
- explicit NativeWindow(content::BrowserContext* browser_context,
+ explicit NativeWindow(content::WebContents* web_contents,
base::DictionaryValue* options);
brightray::InspectableWebContents* inspectable_web_contents() const {
class NativeWindowMac : public NativeWindow {
public:
- explicit NativeWindowMac(content::BrowserContext* browser_context,
+ explicit NativeWindowMac(content::WebContents* web_contents,
base::DictionaryValue* options);
virtual ~NativeWindowMac();
namespace atom {
-NativeWindowMac::NativeWindowMac(content::BrowserContext* browser_context,
+NativeWindowMac::NativeWindowMac(content::WebContents* web_contents,
base::DictionaryValue* options)
- : NativeWindow(browser_context, options),
+ : NativeWindow(web_contents, options),
is_fullscreen_(false),
is_kiosk_(false),
attention_request_id_(0) {
}
// static
-NativeWindow* NativeWindow::Create(content::BrowserContext* browser_context,
+NativeWindow* NativeWindow::Create(content::WebContents* web_contents,
base::DictionaryValue* options) {
- return new NativeWindowMac(browser_context, options);
+ return new NativeWindowMac(web_contents, options);
}
} // namespace atom
-Subproject commit be62b66f9a11660610ef08e6cd65d4f669d71e7f
+Subproject commit 5e5ac169db77ab49507ff474e54d73ab3e74ce38