Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: ui/views/examples/content_client/examples_browser_main_parts.cc

Issue 11962021: Revert 177182 - ViewTest.ChangeNativeViewHierarchyFindRoots failure (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/examples/content_client/examples_browser_main_parts.h ('k') | ui/views/views.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/examples/content_client/examples_browser_main_parts.h" 5 #include "ui/views/examples/content_client/examples_browser_main_parts.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
13 #include "base/threading/thread_restrictions.h" 13 #include "base/threading/thread_restrictions.h"
14 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
15 #include "content/shell/shell_browser_context.h" 15 #include "content/shell/shell_browser_context.h"
16 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
17 #include "ui/views/examples/examples_window_with_content.h" 17 #include "ui/views/examples/examples_window_with_content.h"
18 #include "ui/views/focus/accelerator_handler.h" 18 #include "ui/views/focus/accelerator_handler.h"
19 #include "ui/views/test/desktop_test_views_delegate.h" 19 #include "ui/views/test/desktop_test_views_delegate.h"
20 20
21 #if defined(USE_AURA) 21 #if defined(USE_AURA)
22 #include "ui/aura/env.h" 22 #include "ui/aura/env.h"
23 #include "ui/gfx/screen.h" 23 #include "ui/gfx/screen.h"
24 #include "ui/views/widget/desktop_aura/desktop_screen.h" 24 #include "ui/views/widget/desktop_aura/desktop_screen.h"
25 #include "ui/views/widget/desktop_aura/desktop_stacking_client.h"
25 #include "ui/views/widget/native_widget_aura.h" 26 #include "ui/views/widget/native_widget_aura.h"
26 #endif 27 #endif
27 28
28 namespace views { 29 namespace views {
29 namespace examples { 30 namespace examples {
30 31
31 ExamplesBrowserMainParts::ExamplesBrowserMainParts( 32 ExamplesBrowserMainParts::ExamplesBrowserMainParts(
32 const content::MainFunctionParams& parameters) { 33 const content::MainFunctionParams& parameters) {
33 } 34 }
34 35
35 ExamplesBrowserMainParts::~ExamplesBrowserMainParts() { 36 ExamplesBrowserMainParts::~ExamplesBrowserMainParts() {
36 } 37 }
37 38
38 void ExamplesBrowserMainParts::PreMainMessageLoopRun() { 39 void ExamplesBrowserMainParts::PreMainMessageLoopRun() {
39 browser_context_.reset(new content::ShellBrowserContext(false)); 40 browser_context_.reset(new content::ShellBrowserContext(false));
40 41
41 #if !defined(OS_CHROMEOS) && defined(USE_AURA) 42 #if !defined(OS_CHROMEOS) && defined(USE_AURA)
43 stacking_client_.reset(new DesktopStackingClient);
44 aura::client::SetStackingClient(stacking_client_.get());
42 gfx::Screen::SetScreenInstance( 45 gfx::Screen::SetScreenInstance(
43 gfx::SCREEN_TYPE_NATIVE, CreateDesktopScreen()); 46 gfx::SCREEN_TYPE_NATIVE, CreateDesktopScreen());
44 #endif 47 #endif
45 views_delegate_.reset(new DesktopTestViewsDelegate); 48 views_delegate_.reset(new DesktopTestViewsDelegate);
46 49
47 ShowExamplesWindowWithContent(QUIT_ON_CLOSE, browser_context_.get()); 50 ShowExamplesWindowWithContent(QUIT_ON_CLOSE, browser_context_.get());
48 } 51 }
49 52
50 void ExamplesBrowserMainParts::PostMainMessageLoopRun() { 53 void ExamplesBrowserMainParts::PostMainMessageLoopRun() {
51 browser_context_.reset(); 54 browser_context_.reset();
52 views_delegate_.reset(); 55 views_delegate_.reset();
53 #if defined(USE_AURA) 56 #if defined(USE_AURA)
57 stacking_client_.reset();
54 aura::Env::DeleteInstance(); 58 aura::Env::DeleteInstance();
55 #endif 59 #endif
56 } 60 }
57 61
58 bool ExamplesBrowserMainParts::MainMessageLoopRun(int* result_code) { 62 bool ExamplesBrowserMainParts::MainMessageLoopRun(int* result_code) {
59 // xxx: Hax here because this kills event handling. 63 // xxx: Hax here because this kills event handling.
60 #if !defined(USE_AURA) 64 #if !defined(USE_AURA)
61 AcceleratorHandler accelerator_handler; 65 AcceleratorHandler accelerator_handler;
62 base::RunLoop run_loop(&accelerator_handler); 66 base::RunLoop run_loop(&accelerator_handler);
63 #else 67 #else
64 base::RunLoop run_loop; 68 base::RunLoop run_loop;
65 #endif 69 #endif
66 run_loop.Run(); 70 run_loop.Run();
67 return true; 71 return true;
68 } 72 }
69 73
70 } // namespace examples 74 } // namespace examples
71 } // namespace views 75 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/examples/content_client/examples_browser_main_parts.h ('k') | ui/views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698