OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ash/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/accessibility_delegate.h" | 9 #include "ash/accessibility_delegate.h" |
10 #include "ash/media_delegate.h" | 10 #include "ash/media_delegate.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // IPC which carries the search string create the browser and initiate | 192 // IPC which carries the search string create the browser and initiate |
193 // the navigation. | 193 // the navigation. |
194 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 194 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
195 switches::kWindows8Search)) | 195 switches::kWindows8Search)) |
196 break; | 196 break; |
197 #endif | 197 #endif |
198 // If Chrome ASH is launched when no browser is open in the desktop, | 198 // If Chrome ASH is launched when no browser is open in the desktop, |
199 // we should execute the startup code. | 199 // we should execute the startup code. |
200 // If there are browsers open in the desktop, we create a browser window | 200 // If there are browsers open in the desktop, we create a browser window |
201 // and open a new tab page, if session restore is not on. | 201 // and open a new tab page, if session restore is not on. |
202 BrowserList* desktop_list = BrowserList::GetInstance( | 202 BrowserList* desktop_list = |
203 chrome::HOST_DESKTOP_TYPE_NATIVE); | 203 BrowserList::GetInstance(ui::HOST_DESKTOP_TYPE_NATIVE); |
204 if (desktop_list->empty()) { | 204 if (desktop_list->empty()) { |
205 // We pass a dummy command line here, because the browser is launched in | 205 // We pass a dummy command line here, because the browser is launched in |
206 // silent-mode by the metro viewer process, which causes the | 206 // silent-mode by the metro viewer process, which causes the |
207 // StartupBrowserCreatorImpl class to not create any browsers which is | 207 // StartupBrowserCreatorImpl class to not create any browsers which is |
208 // not the behavior we want. | 208 // not the behavior we want. |
209 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); | 209 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); |
210 StartupBrowserCreatorImpl startup_impl( | 210 StartupBrowserCreatorImpl startup_impl( |
211 base::FilePath(), | 211 base::FilePath(), |
212 dummy, | 212 dummy, |
213 chrome::startup::IS_NOT_FIRST_RUN); | 213 chrome::startup::IS_NOT_FIRST_RUN); |
214 startup_impl.Launch( | 214 startup_impl.Launch(ProfileManager::GetActiveUserProfile(), |
215 ProfileManager::GetActiveUserProfile(), | 215 std::vector<GURL>(), true, |
216 std::vector<GURL>(), | 216 ui::HOST_DESKTOP_TYPE_ASH); |
217 true, | |
218 chrome::HOST_DESKTOP_TYPE_ASH); | |
219 } else { | 217 } else { |
220 Browser* browser = | 218 Browser* browser = |
221 chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()); | 219 chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()); |
222 if (browser && browser->is_type_tabbed()) { | 220 if (browser && browser->is_type_tabbed()) { |
223 chrome::AddTabAt(browser, GURL(), -1, true); | 221 chrome::AddTabAt(browser, GURL(), -1, true); |
224 return; | 222 return; |
225 } | 223 } |
226 | 224 |
227 chrome::ScopedTabbedBrowserDisplayer displayer( | 225 chrome::ScopedTabbedBrowserDisplayer displayer( |
228 ProfileManager::GetActiveUserProfile(), | 226 ProfileManager::GetActiveUserProfile(), ui::HOST_DESKTOP_TYPE_ASH); |
229 chrome::HOST_DESKTOP_TYPE_ASH); | |
230 chrome::AddTabAt(displayer.browser(), GURL(), -1, true); | 227 chrome::AddTabAt(displayer.browser(), GURL(), -1, true); |
231 } | 228 } |
232 break; | 229 break; |
233 } | 230 } |
234 case chrome::NOTIFICATION_ASH_SESSION_ENDED: | 231 case chrome::NOTIFICATION_ASH_SESSION_ENDED: |
235 break; | 232 break; |
236 default: | 233 default: |
237 NOTREACHED() << "Unexpected notification " << type; | 234 NOTREACHED() << "Unexpected notification " << type; |
238 } | 235 } |
239 } | 236 } |
240 | 237 |
241 void ChromeShellDelegate::PlatformInit() { | 238 void ChromeShellDelegate::PlatformInit() { |
242 #if defined(OS_WIN) | 239 #if defined(OS_WIN) |
243 registrar_.Add(this, | 240 registrar_.Add(this, |
244 chrome::NOTIFICATION_PROFILE_ADDED, | 241 chrome::NOTIFICATION_PROFILE_ADDED, |
245 content::NotificationService::AllSources()); | 242 content::NotificationService::AllSources()); |
246 registrar_.Add(this, | 243 registrar_.Add(this, |
247 chrome::NOTIFICATION_ASH_SESSION_STARTED, | 244 chrome::NOTIFICATION_ASH_SESSION_STARTED, |
248 content::NotificationService::AllSources()); | 245 content::NotificationService::AllSources()); |
249 registrar_.Add(this, | 246 registrar_.Add(this, |
250 chrome::NOTIFICATION_ASH_SESSION_ENDED, | 247 chrome::NOTIFICATION_ASH_SESSION_ENDED, |
251 content::NotificationService::AllSources()); | 248 content::NotificationService::AllSources()); |
252 #endif | 249 #endif |
253 } | 250 } |
OLD | NEW |