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 "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/session/session_state_delegate.h" | 8 #include "ash/session/session_state_delegate.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "chrome/browser/chrome_browser_main.h" | 14 #include "chrome/browser/chrome_browser_main.h" |
15 #include "chrome/browser/ui/ash/ash_init.h" | 15 #include "chrome/browser/ui/ash/ash_init.h" |
16 #include "chrome/browser/ui/ash/ash_util.h" | 16 #include "chrome/browser/ui/ash/ash_util.h" |
17 #include "chrome/browser/ui/views/ash/tab_scrubber.h" | 17 #include "chrome/browser/ui/views/ash/tab_scrubber.h" |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
19 #include "ui/aura/env.h" | 19 #include "ui/aura/env.h" |
20 #include "ui/gfx/screen.h" | 20 #include "ui/gfx/screen.h" |
21 #include "ui/keyboard/content/keyboard.h" | 21 #include "ui/keyboard/content/keyboard.h" |
22 #include "ui/keyboard/keyboard_controller.h" | 22 #include "ui/keyboard/keyboard_controller.h" |
23 | 23 |
24 #if defined(OS_CHROMEOS) | 24 #if defined(OS_CHROMEOS) |
25 #include "chrome/browser/ui/views/select_file_dialog_extension.h" | 25 #include "chrome/browser/ui/views/select_file_dialog_extension.h" |
26 #include "chrome/browser/ui/views/select_file_dialog_extension_factory.h" | 26 #include "chrome/browser/ui/views/select_file_dialog_extension_factory.h" |
27 #endif | 27 #endif |
28 | 28 |
29 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() { | 29 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() {} |
30 } | |
31 | 30 |
32 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() { | 31 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() {} |
33 } | |
34 | 32 |
35 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { | 33 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { |
36 if (chrome::ShouldOpenAshOnStartup()) { | 34 if (chrome::ShouldOpenAshOnStartup()) { |
37 chrome::OpenAsh(gfx::kNullAcceleratedWidget); | 35 chrome::OpenAsh(gfx::kNullAcceleratedWidget); |
38 | |
39 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 36 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
40 ash::Shell::GetInstance()->CreateShelf(); | 37 ash::Shell::GetInstance()->CreateShelf(); |
41 ash::Shell::GetInstance()->ShowShelf(); | 38 ash::Shell::GetInstance()->ShowShelf(); |
42 #endif | 39 #endif |
43 } | 40 } |
| 41 |
44 #if defined(OS_CHROMEOS) | 42 #if defined(OS_CHROMEOS) |
45 // For OS_CHROMEOS, virtual keyboard needs to be initialized before profile | 43 // For OS_CHROMEOS, virtual keyboard needs to be initialized before profile |
46 // initialized. Otherwise, virtual keyboard extension will not load at login | 44 // initialized. Otherwise, virtual keyboard extension will not load at login |
47 // screen. | 45 // screen. |
48 keyboard::InitializeKeyboard(); | 46 keyboard::InitializeKeyboard(); |
49 #endif | 47 #endif |
50 | 48 |
51 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
52 ui::SelectFileDialog::SetFactory(new SelectFileDialogExtensionFactory); | 50 ui::SelectFileDialog::SetFactory(new SelectFileDialogExtensionFactory); |
53 #endif | 51 #endif |
54 } | 52 } |
55 | 53 |
56 void ChromeBrowserMainExtraPartsAsh::PostProfileInit() { | 54 void ChromeBrowserMainExtraPartsAsh::PostProfileInit() { |
| 55 if (chrome::IsRunningInMash()) |
| 56 chrome::InitializeMash(); |
| 57 |
57 if (!ash::Shell::HasInstance()) | 58 if (!ash::Shell::HasInstance()) |
58 return; | 59 return; |
59 | 60 |
60 // Initialize TabScrubber after the Ash Shell has been initialized. | 61 // Initialize TabScrubber after the Ash Shell has been initialized. |
61 TabScrubber::GetInstance(); | 62 TabScrubber::GetInstance(); |
62 // Activate virtual keyboard after profile is initialized. It depends on the | 63 // Activate virtual keyboard after profile is initialized. It depends on the |
63 // default profile. | 64 // default profile. |
64 ash::Shell::GetPrimaryRootWindowController()->ActivateKeyboard( | 65 ash::Shell::GetPrimaryRootWindowController()->ActivateKeyboard( |
65 keyboard::KeyboardController::GetInstance()); | 66 keyboard::KeyboardController::GetInstance()); |
66 } | 67 } |
67 | 68 |
68 void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() { | 69 void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() { |
69 chrome::CloseAsh(); | 70 chrome::CloseAsh(); |
70 } | 71 } |
OLD | NEW |