| 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/chromeos/display/display_preferences.h" | 5 #include "chrome/browser/chromeos/display/display_preferences.h" |
| 6 | 6 |
| 7 #include "ash/display/display_layout_store.h" | 7 #include "ash/display/display_layout_store.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/display/display_pref_util.h" | 9 #include "ash/display/display_pref_util.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "base/prefs/pref_registry_simple.h" | 11 #include "base/prefs/pref_registry_simple.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/prefs/scoped_user_pref_update.h" | 13 #include "base/prefs/scoped_user_pref_update.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/values.h" | 18 #include "base/values.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 21 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 21 #include "components/user_manager/user_manager.h" |
| 22 #include "third_party/cros_system_api/dbus/service_constants.h" | 22 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 23 #include "ui/gfx/display.h" | 23 #include "ui/gfx/display.h" |
| 24 #include "ui/gfx/insets.h" | 24 #include "ui/gfx/insets.h" |
| 25 #include "ui/gfx/screen.h" | 25 #include "ui/gfx/screen.h" |
| 26 #include "url/url_canon.h" | 26 #include "url/url_canon.h" |
| 27 #include "url/url_util.h" | 27 #include "url/url_util.h" |
| 28 | 28 |
| 29 namespace chromeos { | 29 namespace chromeos { |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 return ui::COLOR_PROFILE_STANDARD; | 91 return ui::COLOR_PROFILE_STANDARD; |
| 92 } | 92 } |
| 93 | 93 |
| 94 ash::DisplayManager* GetDisplayManager() { | 94 ash::DisplayManager* GetDisplayManager() { |
| 95 return ash::Shell::GetInstance()->display_manager(); | 95 return ash::Shell::GetInstance()->display_manager(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 // Returns true id the current user can write display preferences to | 98 // Returns true id the current user can write display preferences to |
| 99 // Local State. | 99 // Local State. |
| 100 bool UserCanSaveDisplayPreference() { | 100 bool UserCanSaveDisplayPreference() { |
| 101 UserManager* user_manager = UserManager::Get(); | 101 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 102 return user_manager->IsUserLoggedIn() && | 102 return user_manager->IsUserLoggedIn() && |
| 103 (user_manager->IsLoggedInAsRegularUser() || | 103 (user_manager->IsLoggedInAsRegularUser() || |
| 104 user_manager->IsLoggedInAsSupervisedUser() || | 104 user_manager->IsLoggedInAsSupervisedUser() || |
| 105 user_manager->IsLoggedInAsKioskApp()); | 105 user_manager->IsLoggedInAsKioskApp()); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void LoadDisplayLayouts() { | 108 void LoadDisplayLayouts() { |
| 109 PrefService* local_state = g_browser_process->local_state(); | 109 PrefService* local_state = g_browser_process->local_state(); |
| 110 ash::DisplayLayoutStore* layout_store = GetDisplayManager()->layout_store(); | 110 ash::DisplayLayoutStore* layout_store = GetDisplayManager()->layout_store(); |
| 111 | 111 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 const ash::DisplayLayout& layout) { | 346 const ash::DisplayLayout& layout) { |
| 347 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); | 347 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); |
| 348 } | 348 } |
| 349 | 349 |
| 350 // Stores the given |power_state|. | 350 // Stores the given |power_state|. |
| 351 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { | 351 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { |
| 352 StoreDisplayPowerState(power_state); | 352 StoreDisplayPowerState(power_state); |
| 353 } | 353 } |
| 354 | 354 |
| 355 } // namespace chromeos | 355 } // namespace chromeos |
| OLD | NEW |