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

Side by Side Diff: trunk/src/ash/shell/content_client/shell_browser_main_parts.cc

Issue 14631021: Revert 199625 "Remove ENABLE_MESSAGE_CENTER" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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
« no previous file with comments | « no previous file | trunk/src/ash/test/ash_test_helper.cc » ('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 "ash/shell/content_client/shell_browser_main_parts.h" 5 #include "ash/shell/content_client/shell_browser_main_parts.h"
6 6
7 #include "ash/desktop_background/desktop_background_controller.h" 7 #include "ash/desktop_background/desktop_background_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell/shell_delegate_impl.h" 9 #include "ash/shell/shell_delegate_impl.h"
10 #include "ash/shell/window_watcher.h" 10 #include "ash/shell/window_watcher.h"
(...skipping 10 matching lines...) Expand all
21 #include "net/base/net_module.h" 21 #include "net/base/net_module.h"
22 #include "ui/aura/client/stacking_client.h" 22 #include "ui/aura/client/stacking_client.h"
23 #include "ui/aura/env.h" 23 #include "ui/aura/env.h"
24 #include "ui/aura/root_window.h" 24 #include "ui/aura/root_window.h"
25 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
26 #include "ui/base/resource/resource_bundle.h" 26 #include "ui/base/resource/resource_bundle.h"
27 #include "ui/base/ui_base_paths.h" 27 #include "ui/base/ui_base_paths.h"
28 #include "ui/compositor/compositor.h" 28 #include "ui/compositor/compositor.h"
29 #include "ui/compositor/test/compositor_test_support.h" 29 #include "ui/compositor/test/compositor_test_support.h"
30 #include "ui/gfx/screen.h" 30 #include "ui/gfx/screen.h"
31 #include "ui/message_center/message_center.h"
32 #include "ui/views/focus/accelerator_handler.h" 31 #include "ui/views/focus/accelerator_handler.h"
33 #include "ui/views/test/test_views_delegate.h" 32 #include "ui/views/test/test_views_delegate.h"
34 33
34 #if defined(ENABLE_MESSAGE_CENTER)
35 #include "ui/message_center/message_center.h"
36 #endif
37
35 #if defined(USE_X11) 38 #if defined(USE_X11)
36 #include "ui/base/touch/touch_factory_x11.h" 39 #include "ui/base/touch/touch_factory_x11.h"
37 #endif 40 #endif
38 41
39 #if defined(OS_CHROMEOS) 42 #if defined(OS_CHROMEOS)
40 #include "chromeos/dbus/dbus_thread_manager.h" 43 #include "chromeos/dbus/dbus_thread_manager.h"
41 #endif 44 #endif
42 45
43 namespace ash { 46 namespace ash {
44 namespace shell { 47 namespace shell {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 102 }
100 103
101 void ShellBrowserMainParts::PreMainMessageLoopRun() { 104 void ShellBrowserMainParts::PreMainMessageLoopRun() {
102 browser_context_.reset(new content::ShellBrowserContext(false)); 105 browser_context_.reset(new content::ShellBrowserContext(false));
103 106
104 // A ViewsDelegate is required. 107 // A ViewsDelegate is required.
105 if (!views::ViewsDelegate::views_delegate) 108 if (!views::ViewsDelegate::views_delegate)
106 views::ViewsDelegate::views_delegate = new ShellViewsDelegate; 109 views::ViewsDelegate::views_delegate = new ShellViewsDelegate;
107 110
108 delegate_ = new ash::shell::ShellDelegateImpl; 111 delegate_ = new ash::shell::ShellDelegateImpl;
112 #if defined(ENABLE_MESSAGE_CENTER)
109 // The global message center state must be initialized absent 113 // The global message center state must be initialized absent
110 // g_browser_process. 114 // g_browser_process.
111 message_center::MessageCenter::Initialize(); 115 message_center::MessageCenter::Initialize();
116 #endif
112 ash::Shell::CreateInstance(delegate_); 117 ash::Shell::CreateInstance(delegate_);
113 ash::Shell::GetInstance()->set_browser_context(browser_context_.get()); 118 ash::Shell::GetInstance()->set_browser_context(browser_context_.get());
114 119
115 window_watcher_.reset(new ash::shell::WindowWatcher); 120 window_watcher_.reset(new ash::shell::WindowWatcher);
116 gfx::Screen* screen = Shell::GetInstance()->GetScreen(); 121 gfx::Screen* screen = Shell::GetInstance()->GetScreen();
117 screen->AddObserver(window_watcher_.get()); 122 screen->AddObserver(window_watcher_.get());
118 delegate_->SetWatcher(window_watcher_.get()); 123 delegate_->SetWatcher(window_watcher_.get());
119 124
120 ash::shell::InitWindowTypeLauncher(); 125 ash::shell::InitWindowTypeLauncher();
121 126
122 DesktopBackgroundController* controller = 127 DesktopBackgroundController* controller =
123 Shell::GetInstance()->desktop_background_controller(); 128 Shell::GetInstance()->desktop_background_controller();
124 if (controller->GetAppropriateResolution() == WALLPAPER_RESOLUTION_LARGE) 129 if (controller->GetAppropriateResolution() == WALLPAPER_RESOLUTION_LARGE)
125 controller->SetDefaultWallpaper(kDefaultLargeWallpaper); 130 controller->SetDefaultWallpaper(kDefaultLargeWallpaper);
126 else 131 else
127 controller->SetDefaultWallpaper(kDefaultSmallWallpaper); 132 controller->SetDefaultWallpaper(kDefaultSmallWallpaper);
128 133
129 ash::Shell::GetPrimaryRootWindow()->ShowRootWindow(); 134 ash::Shell::GetPrimaryRootWindow()->ShowRootWindow();
130 } 135 }
131 136
132 void ShellBrowserMainParts::PostMainMessageLoopRun() { 137 void ShellBrowserMainParts::PostMainMessageLoopRun() {
133 gfx::Screen* screen = Shell::GetInstance()->GetScreen(); 138 gfx::Screen* screen = Shell::GetInstance()->GetScreen();
134 screen->RemoveObserver(window_watcher_.get()); 139 screen->RemoveObserver(window_watcher_.get());
135 140
136 window_watcher_.reset(); 141 window_watcher_.reset();
137 delegate_->SetWatcher(NULL); 142 delegate_->SetWatcher(NULL);
138 delegate_ = NULL; 143 delegate_ = NULL;
139 ash::Shell::DeleteInstance(); 144 ash::Shell::DeleteInstance();
145 #if defined(ENABLE_MESSAGE_CENTER)
140 // The global message center state must be shutdown absent 146 // The global message center state must be shutdown absent
141 // g_browser_process. 147 // g_browser_process.
142 message_center::MessageCenter::Shutdown(); 148 message_center::MessageCenter::Shutdown();
149 #endif
143 aura::Env::DeleteInstance(); 150 aura::Env::DeleteInstance();
144 151
145 // The keyboard may have created a WebContents. The WebContents is destroyed 152 // The keyboard may have created a WebContents. The WebContents is destroyed
146 // with the UI, and it needs the BrowserContext to be alive during its 153 // with the UI, and it needs the BrowserContext to be alive during its
147 // destruction. So destroy all of the UI elements before destroying the 154 // destruction. So destroy all of the UI elements before destroying the
148 // browser context. 155 // browser context.
149 browser_context_.reset(); 156 browser_context_.reset();
150 } 157 }
151 158
152 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { 159 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) {
153 base::MessageLoopForUI::current()->Run(); 160 base::MessageLoopForUI::current()->Run();
154 return true; 161 return true;
155 } 162 }
156 163
157 } // namespace shell 164 } // namespace shell
158 } // namespace ash 165 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | trunk/src/ash/test/ash_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698