Skip to content

Commit d9a1fe2

Browse files
GnorTechrogerwang
authored andcommitted
trying to fix start err
1 parent 99e9431 commit d9a1fe2

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

nw.gypi

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,13 @@
339339
'<(DEPTH)/base/allocator/allocator.gyp:allocator',
340340
],
341341
}],
342+
['use_aura==1', {
343+
'dependencies': [
344+
'<(DEPTH)/ui/views/views.gyp:views',
345+
'<(DEPTH)/ui/views/views.gyp:views_test_support',
346+
'<(DEPTH)/ui/views/controls/webview/webview.gyp:webview',
347+
],
348+
}],
342349
['(os_posix==1 and OS != "mac" and linux_use_tcmalloc==1)', {
343350
'dependencies': [
344351
# This is needed by content/app/content_main_runner.cc

src/browser/native_window_win.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ NativeWindowWin::NativeWindowWin(const base::WeakPtr<content::Shell>& shell,
276276
window_ = new views::Widget;
277277
views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
278278
params.delegate = this;
279+
params.top_level = true;
279280
params.remove_standard_frame = !has_frame();
280281
params.use_system_default_icon = true;
281282
window_->Init(params);

src/shell_browser_main_parts.cc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@
5252
#include "content/nw/src/browser/printing/print_dialog_gtk.h"
5353
#endif
5454

55+
#if defined(USE_AURA)
56+
#include "ui/aura/env.h"
57+
#include "ui/gfx/screen.h"
58+
#include "ui/views/test/desktop_test_views_delegate.h"
59+
#include "ui/views/widget/desktop_aura/desktop_screen.h"
60+
#endif // defined(USE_AURA)
61+
5562
using base::MessageLoop;
5663

5764
namespace {
@@ -149,9 +156,29 @@ void ShellBrowserMainParts::PostMainMessageLoopStart() {
149156

150157
int ShellBrowserMainParts::PreCreateThreads() {
151158
net::ProxyResolverV8::RememberDefaultIsolate();
159+
#if defined(USE_AURA)
160+
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE,
161+
views::CreateDesktopScreen());
162+
#endif
152163
return 0;
153164
}
154165

166+
void ShellBrowserMainParts::PostDestroyThreads() {
167+
#if defined(USE_AURA)
168+
aura::Env::DeleteInstance();
169+
delete views::ViewsDelegate::views_delegate;
170+
#endif
171+
}
172+
173+
void ShellBrowserMainParts::ToolkitInitialized() {
174+
#if defined(USE_AURA)
175+
aura::Env::CreateInstance();
176+
177+
DCHECK(!views::ViewsDelegate::views_delegate);
178+
new views::DesktopTestViewsDelegate;
179+
#endif
180+
}
181+
155182
void ShellBrowserMainParts::Init() {
156183
package_.reset(new nw::Package());
157184
CommandLine& command_line = *CommandLine::ForCurrentProcess();

src/shell_browser_main_parts.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ class ShellBrowserMainParts : public BrowserMainParts {
4747
virtual void PostMainMessageLoopStart() OVERRIDE;
4848
virtual bool MainMessageLoopRun(int* result_code) OVERRIDE;
4949
virtual void PostMainMessageLoopRun() OVERRIDE;
50-
virtual int PreCreateThreads() OVERRIDE;
50+
virtual int PreCreateThreads() OVERRIDE;
51+
virtual void PostDestroyThreads() OVERRIDE;
52+
virtual void ToolkitInitialized() OVERRIDE;
5153

5254
// Init browser context and every thing
5355
void Init();

0 commit comments

Comments
 (0)