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

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

Issue 284113011: Repurpose views+content example into a generic multiprocess views runtime (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: app_list_demo.cc using example_main Created 6 years, 7 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
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/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/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/browser/shell_browser_context.h" 15 #include "content/shell/browser/shell_browser_context.h"
16 #include "ui/aura/env.h" 16 #include "ui/aura/env.h"
17 #include "ui/base/ime/input_method_initializer.h" 17 #include "ui/base/ime/input_method_initializer.h"
18 #include "ui/gfx/screen.h" 18 #include "ui/gfx/screen.h"
19 #include "ui/views/examples/examples_window_with_content.h" 19 #include "ui/views/examples/content_client/examples_main.h"
20 #include "ui/views/test/desktop_test_views_delegate.h" 20 #include "ui/views/test/desktop_test_views_delegate.h"
21 #include "ui/views/widget/native_widget_aura.h" 21 #include "ui/views/widget/native_widget_aura.h"
22 #include "ui/wm/core/wm_state.h" 22 #include "ui/wm/core/wm_state.h"
23 #include "url/gurl.h" 23 #include "url/gurl.h"
24 24
25 #if defined(OS_CHROMEOS) 25 #if defined(OS_CHROMEOS)
26 #include "ui/aura/test/test_screen.h" 26 #include "ui/aura/test/test_screen.h"
27 #include "ui/aura/window.h" 27 #include "ui/aura/window.h"
28 #include "ui/aura/window_event_dispatcher.h" 28 #include "ui/aura/window_event_dispatcher.h"
29 #include "ui/wm/test/wm_test_helper.h" 29 #include "ui/wm/test/wm_test_helper.h"
30 #else // !defined(OS_CHROMEOS) 30 #else // !defined(OS_CHROMEOS)
31 #include "ui/views/widget/desktop_aura/desktop_screen.h" 31 #include "ui/views/widget/desktop_aura/desktop_screen.h"
32 #endif 32 #endif
33 33
34 namespace views { 34 namespace views {
35 namespace examples { 35 namespace examples {
36 36
37 ExamplesBrowserMainParts::ExamplesBrowserMainParts( 37 ExamplesBrowserMainParts::ExamplesBrowserMainParts(
38 const content::MainFunctionParams& parameters) { 38 const content::MainFunctionParams& content_params,
39 ExamplesMainParams* examples_params)
40 : examples_params_(examples_params) {
39 } 41 }
40 42
41 ExamplesBrowserMainParts::~ExamplesBrowserMainParts() { 43 ExamplesBrowserMainParts::~ExamplesBrowserMainParts() {
42 } 44 }
43 45
44 void ExamplesBrowserMainParts::ToolkitInitialized() { 46 void ExamplesBrowserMainParts::ToolkitInitialized() {
45 wm_state_.reset(new wm::WMState); 47 wm_state_.reset(new wm::WMState);
46 } 48 }
47 49
48 void ExamplesBrowserMainParts::PreMainMessageLoopRun() { 50 void ExamplesBrowserMainParts::PreMainMessageLoopRun() {
(...skipping 10 matching lines...) Expand all
59 wm_test_helper_->host()->Show(); 61 wm_test_helper_->host()->Show();
60 // Ensure Aura knows where to open new windows. 62 // Ensure Aura knows where to open new windows.
61 window_context = wm_test_helper_->host()->window(); 63 window_context = wm_test_helper_->host()->window();
62 #else 64 #else
63 aura::Env::CreateInstance(true); 65 aura::Env::CreateInstance(true);
64 gfx::Screen::SetScreenInstance( 66 gfx::Screen::SetScreenInstance(
65 gfx::SCREEN_TYPE_NATIVE, CreateDesktopScreen()); 67 gfx::SCREEN_TYPE_NATIVE, CreateDesktopScreen());
66 #endif 68 #endif
67 views_delegate_.reset(new DesktopTestViewsDelegate); 69 views_delegate_.reset(new DesktopTestViewsDelegate);
68 70
69 ShowExamplesWindowWithContent( 71 examples_params_->task().Run(browser_context_.get(), window_context);
70 QUIT_ON_CLOSE, browser_context_.get(), window_context);
71 } 72 }
72 73
73 void ExamplesBrowserMainParts::PostMainMessageLoopRun() { 74 void ExamplesBrowserMainParts::PostMainMessageLoopRun() {
74 browser_context_.reset(); 75 browser_context_.reset();
75 #if defined(OS_CHROMEOS) 76 #if defined(OS_CHROMEOS)
76 wm_test_helper_.reset(); 77 wm_test_helper_.reset();
77 #endif 78 #endif
78 views_delegate_.reset(); 79 views_delegate_.reset();
79 aura::Env::DeleteInstance(); 80 aura::Env::DeleteInstance();
80 } 81 }
81 82
82 bool ExamplesBrowserMainParts::MainMessageLoopRun(int* result_code) { 83 bool ExamplesBrowserMainParts::MainMessageLoopRun(int* result_code) {
83 base::RunLoop run_loop; 84 base::RunLoop run_loop;
84 run_loop.Run(); 85 run_loop.Run();
85 return true; 86 return true;
86 } 87 }
87 88
88 } // namespace examples 89 } // namespace examples
89 } // namespace views 90 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698