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/ash/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 PlatformInit(); | 329 PlatformInit(); |
330 } | 330 } |
331 | 331 |
332 ChromeShellDelegate::~ChromeShellDelegate() { | 332 ChromeShellDelegate::~ChromeShellDelegate() { |
333 } | 333 } |
334 | 334 |
335 service_manager::Connector* ChromeShellDelegate::GetShellConnector() const { | 335 service_manager::Connector* ChromeShellDelegate::GetShellConnector() const { |
336 return content::ServiceManagerConnection::GetForProcess()->GetConnector(); | 336 return content::ServiceManagerConnection::GetForProcess()->GetConnector(); |
337 } | 337 } |
338 | 338 |
339 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { | |
340 return base::CommandLine::ForCurrentProcess()->HasSwitch( | |
341 chromeos::switches::kFirstExecAfterBoot); | |
342 } | |
343 | |
344 bool ChromeShellDelegate::IsMultiProfilesEnabled() const { | 339 bool ChromeShellDelegate::IsMultiProfilesEnabled() const { |
345 if (!profiles::IsMultipleProfilesEnabled()) | 340 if (!profiles::IsMultipleProfilesEnabled()) |
346 return false; | 341 return false; |
347 // If there is a user manager, we need to see that we can at least have 2 | 342 // If there is a user manager, we need to see that we can at least have 2 |
348 // simultaneous users to allow this feature. | 343 // simultaneous users to allow this feature. |
349 if (!user_manager::UserManager::IsInitialized()) | 344 if (!user_manager::UserManager::IsInitialized()) |
350 return false; | 345 return false; |
351 size_t admitted_users_to_be_added = | 346 size_t admitted_users_to_be_added = |
352 user_manager::UserManager::Get()->GetUsersAllowedForMultiProfile().size(); | 347 user_manager::UserManager::Get()->GetUsersAllowedForMultiProfile().size(); |
353 size_t logged_in_users = | 348 size_t logged_in_users = |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 if (user) { | 380 if (user) { |
386 return chromeos::ProfileHelper::Get() | 381 return chromeos::ProfileHelper::Get() |
387 ->GetProfileByUser(user) | 382 ->GetProfileByUser(user) |
388 ->GetPrefs() | 383 ->GetPrefs() |
389 ->GetBoolean(prefs::kForceMaximizeOnFirstRun); | 384 ->GetBoolean(prefs::kForceMaximizeOnFirstRun); |
390 } | 385 } |
391 return false; | 386 return false; |
392 } | 387 } |
393 | 388 |
394 void ChromeShellDelegate::PreInit() { | 389 void ChromeShellDelegate::PreInit() { |
395 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); | 390 bool first_run_after_boot = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 391 chromeos::switches::kFirstExecAfterBoot); |
| 392 chromeos::LoadDisplayPreferences(first_run_after_boot); |
396 // Object owns itself, and deletes itself when Observer::OnShutdown is called: | 393 // Object owns itself, and deletes itself when Observer::OnShutdown is called: |
397 new policy::DisplayRotationDefaultHandler(); | 394 new policy::DisplayRotationDefaultHandler(); |
398 // Set the observer now so that we can save the initial state | 395 // Set the observer now so that we can save the initial state |
399 // in Shell::Init. | 396 // in Shell::Init. |
400 display_configuration_observer_.reset( | 397 display_configuration_observer_.reset( |
401 new chromeos::DisplayConfigurationObserver()); | 398 new chromeos::DisplayConfigurationObserver()); |
402 } | 399 } |
403 | 400 |
404 void ChromeShellDelegate::PreShutdown() { | 401 void ChromeShellDelegate::PreShutdown() { |
405 display_configuration_observer_.reset(); | 402 display_configuration_observer_.reset(); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 NOTREACHED() << "Unexpected notification " << type; | 552 NOTREACHED() << "Unexpected notification " << type; |
556 } | 553 } |
557 } | 554 } |
558 | 555 |
559 void ChromeShellDelegate::PlatformInit() { | 556 void ChromeShellDelegate::PlatformInit() { |
560 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 557 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
561 content::NotificationService::AllSources()); | 558 content::NotificationService::AllSources()); |
562 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED, | 559 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED, |
563 content::NotificationService::AllSources()); | 560 content::NotificationService::AllSources()); |
564 } | 561 } |
OLD | NEW |