3636#include " content/public/browser/notification_types.h"
3737#include " content/public/browser/render_view_host.h"
3838#include " content/public/browser/web_contents.h"
39+ #include " content/nw/src/api/api_messages.h"
3940#include " content/nw/src/browser/file_select_helper.h"
4041#include " content/nw/src/browser/shell_devtools_delegate.h"
4142#include " content/nw/src/browser/shell_javascript_dialog_creator.h"
@@ -55,6 +56,8 @@ bool Shell::quit_message_loop_ = true;
5556Shell::Shell (WebContents* web_contents, base::DictionaryValue* manifest)
5657 : window_(NULL ),
5758 url_edit_view_ (NULL ),
59+ force_close_(false ),
60+ id_(-1 ),
5861 window_manifest_(manifest),
5962 is_show_devtools_(false ),
6063 is_toolbar_open_(true ),
@@ -94,6 +97,12 @@ Shell::~Shell() {
9497 MessageLoop::current ()->PostTask (FROM_HERE , MessageLoop::QuitClosure ());
9598}
9699
100+ void Shell::SendEvent (const std::string& event) {
101+ base::ListValue args;
102+ web_contents ()->GetRenderViewHost ()->Send (new ShellViewMsg_Object_On_Event (
103+ web_contents ()->GetRoutingID (), id (), event, args));
104+ }
105+
97106Shell* Shell::CreateShell (WebContents* web_contents,
98107 base::DictionaryValue* manifest) {
99108 int width = 700 ;
@@ -106,10 +115,9 @@ Shell* Shell::CreateShell(WebContents* web_contents,
106115
107116 shell->web_contents_ .reset (web_contents);
108117 web_contents->SetDelegate (shell);
109-
110118 shell->PlatformSetContents ();
111-
112119 shell->PlatformResizeSubViews ();
120+
113121 return shell;
114122}
115123
@@ -211,6 +219,7 @@ void Shell::ShowDevTools() {
211219 WebContents::Create (web_contents ()->GetBrowserContext (),
212220 NULL , MSG_ROUTING_NONE , NULL ),
213221 &manifest);
222+ shell->force_close_ = true ;
214223 shell->LoadURL (url);
215224}
216225
0 commit comments