OLD | NEW |
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 "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h" | 5 #include "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h" |
6 | 6 |
7 #include "chrome/browser/chrome_browser_main.h" | 7 #include "chrome/browser/chrome_browser_main.h" |
| 8 #include "chrome/browser/chromeos/battery_status_provider_chromeos.h" |
8 #include "chrome/browser/toolkit_extra_parts.h" | 9 #include "chrome/browser/toolkit_extra_parts.h" |
9 #include "chrome/browser/ui/ash/ash_init.h" | 10 #include "chrome/browser/ui/ash/ash_init.h" |
10 #include "ui/aura/desktop/desktop_screen.h" | 11 #include "ui/aura/desktop/desktop_screen.h" |
11 #include "ui/aura/desktop/desktop_stacking_client.h" | 12 #include "ui/aura/desktop/desktop_stacking_client.h" |
12 #include "ui/aura/env.h" | 13 #include "ui/aura/env.h" |
13 #include "ui/aura/single_display_manager.h" | 14 #include "ui/aura/single_display_manager.h" |
14 #include "ui/gfx/screen.h" | 15 #include "ui/gfx/screen.h" |
15 | 16 |
16 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() { | 17 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() { |
17 } | 18 } |
18 | 19 |
19 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() { | 20 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() { |
20 } | 21 } |
21 | 22 |
22 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { | 23 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { |
23 if (chrome::ShouldOpenAshOnStartup()) { | 24 if (chrome::ShouldOpenAshOnStartup()) { |
24 chrome::OpenAsh(); | 25 chrome::OpenAsh(); |
25 } else { | 26 } else { |
26 aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager); | 27 aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager); |
27 stacking_client_.reset(new aura::DesktopStackingClient); | 28 stacking_client_.reset(new aura::DesktopStackingClient); |
28 gfx::Screen::SetInstance(aura::CreateDesktopScreen()); | 29 gfx::Screen::SetInstance(aura::CreateDesktopScreen()); |
29 } | 30 } |
| 31 |
| 32 #if defined(OS_CHROMEOS) |
| 33 // Make sure the singleton BatteryStatusProviderChromeos object is created. |
| 34 BatteryStatusProviderChromeos::GetInstance(); |
| 35 #endif |
30 } | 36 } |
31 | 37 |
32 void ChromeBrowserMainExtraPartsAsh::PostProfileInit() { | 38 void ChromeBrowserMainExtraPartsAsh::PostProfileInit() { |
33 } | 39 } |
34 | 40 |
35 void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() { | 41 void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() { |
36 chrome::CloseAsh(); | 42 chrome::CloseAsh(); |
37 } | 43 } |
38 | 44 |
39 namespace chrome { | 45 namespace chrome { |
40 | 46 |
41 void AddAshToolkitExtraParts(ChromeBrowserMainParts* main_parts) { | 47 void AddAshToolkitExtraParts(ChromeBrowserMainParts* main_parts) { |
42 main_parts->AddParts(new ChromeBrowserMainExtraPartsAsh()); | 48 main_parts->AddParts(new ChromeBrowserMainExtraPartsAsh()); |
43 } | 49 } |
44 | 50 |
45 } // namespace chrome | 51 } // namespace chrome |
OLD | NEW |