Implement window.open.
This commit is contained in:
parent
5fb5ce2251
commit
7f581973c3
2 changed files with 25 additions and 0 deletions
|
@ -107,6 +107,24 @@ content::WebContents* NativeWindow::GetWebContents() const {
|
||||||
return inspectable_web_contents_->GetWebContents();
|
return inspectable_web_contents_->GetWebContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Window opened by window.open.
|
||||||
|
void NativeWindow::WebContentsCreated(
|
||||||
|
content::WebContents* source_contents,
|
||||||
|
int64 source_frame_id,
|
||||||
|
const string16& frame_name,
|
||||||
|
const GURL& target_url,
|
||||||
|
content::WebContents* new_contents) {
|
||||||
|
LOG(WARNING) << "Please use node-style Window API to create window, "
|
||||||
|
"using window.open has very strict constrains.";
|
||||||
|
|
||||||
|
scoped_ptr<base::DictionaryValue> options(new base::DictionaryValue);
|
||||||
|
options->SetInteger(switches::kWidth, 800);
|
||||||
|
options->SetInteger(switches::kHeight, 600);
|
||||||
|
|
||||||
|
NativeWindow* window = Create(new_contents, options.get());
|
||||||
|
window->InitFromOptions(options.get());
|
||||||
|
}
|
||||||
|
|
||||||
void NativeWindow::Observe(int type,
|
void NativeWindow::Observe(int type,
|
||||||
const content::NotificationSource& source,
|
const content::NotificationSource& source,
|
||||||
const content::NotificationDetails& details) {
|
const content::NotificationDetails& details) {
|
||||||
|
|
|
@ -101,6 +101,13 @@ class NativeWindow : public content::WebContentsDelegate,
|
||||||
return inspectable_web_contents_.get();
|
return inspectable_web_contents_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Implementations of content::WebContentsDelegate.
|
||||||
|
virtual void WebContentsCreated(content::WebContents* source_contents,
|
||||||
|
int64 source_frame_id,
|
||||||
|
const string16& frame_name,
|
||||||
|
const GURL& target_url,
|
||||||
|
content::WebContents* new_contents) OVERRIDE;
|
||||||
|
|
||||||
// Implementations of content::NotificationObserver
|
// Implementations of content::NotificationObserver
|
||||||
virtual void Observe(int type,
|
virtual void Observe(int type,
|
||||||
const content::NotificationSource& source,
|
const content::NotificationSource& source,
|
||||||
|
|
Loading…
Reference in a new issue