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/shell.h" |
7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
8 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
9 #include "chrome/browser/chrome_browser_main.h" | 10 #include "chrome/browser/chrome_browser_main.h" |
10 #include "chrome/browser/toolkit_extra_parts.h" | 11 #include "chrome/browser/toolkit_extra_parts.h" |
11 #include "chrome/browser/ui/ash/ash_init.h" | 12 #include "chrome/browser/ui/ash/ash_init.h" |
12 #include "chrome/browser/ui/ash/ash_util.h" | 13 #include "chrome/browser/ui/ash/ash_util.h" |
13 #include "chrome/browser/ui/views/ash/tab_scrubber.h" | 14 #include "chrome/browser/ui/views/ash/tab_scrubber.h" |
14 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
15 #include "ui/aura/env.h" | 16 #include "ui/aura/env.h" |
16 #include "ui/gfx/screen.h" | 17 #include "ui/gfx/screen.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 56 |
56 #endif | 57 #endif |
57 | 58 |
58 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() { | 59 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() { |
59 } | 60 } |
60 | 61 |
61 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() { | 62 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() { |
62 } | 63 } |
63 | 64 |
64 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { | 65 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { |
| 66 // For OS_CHROMEOS, initialization order needs to be carefully controlled, |
| 67 // so OpenAsh is called from ChromeBrowserMainPartsChromeos. |
| 68 #if !defined(OS_CHROMEOS) |
65 if (chrome::ShouldOpenAshOnStartup()) { | 69 if (chrome::ShouldOpenAshOnStartup()) { |
66 chrome::OpenAsh(); | 70 chrome::OpenAsh(); |
67 if (!CommandLine::ForCurrentProcess()->HasSwitch( | |
68 switches::kAshDisableTabScrubbing)) { | |
69 TabScrubber::GetInstance(); | |
70 } | |
71 } else { | 71 } else { |
72 #if !defined(OS_CHROMEOS) | |
73 gfx::Screen::SetScreenTypeDelegate(new ScreenTypeDelegateWin); | 72 gfx::Screen::SetScreenTypeDelegate(new ScreenTypeDelegateWin); |
74 ui::SelectFileDialog::SetShellDialogsDelegate( | 73 ui::SelectFileDialog::SetShellDialogsDelegate( |
75 &g_shell_dialogs_delegate.Get()); | 74 &g_shell_dialogs_delegate.Get()); |
| 75 } |
76 #endif | 76 #endif |
77 } | |
78 | 77 |
79 #if defined(FILE_MANAGER_EXTENSION) | 78 #if defined(FILE_MANAGER_EXTENSION) |
80 ui::SelectFileDialog::SetFactory(new SelectFileDialogExtensionFactory); | 79 ui::SelectFileDialog::SetFactory(new SelectFileDialogExtensionFactory); |
81 #endif | 80 #endif |
82 } | 81 } |
83 | 82 |
84 void ChromeBrowserMainExtraPartsAsh::PostProfileInit() { | 83 void ChromeBrowserMainExtraPartsAsh::PostProfileInit() { |
| 84 // Initialize TabScrubber after the Ash Shell has been initialized. |
| 85 if (ash::Shell::HasInstance() && |
| 86 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 87 switches::kAshDisableTabScrubbing)) { |
| 88 TabScrubber::GetInstance(); |
| 89 } |
85 } | 90 } |
86 | 91 |
87 void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() { | 92 void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() { |
| 93 // For OS_CHROMEOS, CloseAsh is called from ChromeBrowserMainPartsChromeos. |
| 94 #if !defined(OS_CHROMEOS) |
88 chrome::CloseAsh(); | 95 chrome::CloseAsh(); |
| 96 #endif |
89 } | 97 } |
90 | 98 |
91 namespace chrome { | 99 namespace chrome { |
92 | 100 |
93 void AddAshToolkitExtraParts(ChromeBrowserMainParts* main_parts) { | 101 void AddAshToolkitExtraParts(ChromeBrowserMainParts* main_parts) { |
94 main_parts->AddParts(new ChromeBrowserMainExtraPartsAsh()); | 102 main_parts->AddParts(new ChromeBrowserMainExtraPartsAsh()); |
95 } | 103 } |
96 | 104 |
97 } // namespace chrome | 105 } // namespace chrome |
OLD | NEW |