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/webui/options/chromeos/core_chromeos_options_handler
.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler
.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "ash/common/session/session_state_delegate.h" | 11 #include "ash/common/session/session_state_delegate.h" |
12 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ptr_util.h" |
16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
18 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
19 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
20 #include "base/sys_info.h" | 21 #include "base/sys_info.h" |
21 #include "base/threading/thread_task_runner_handle.h" | 22 #include "base/threading/thread_task_runner_handle.h" |
22 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/chrome_notification_types.h" | 24 #include "chrome/browser/chrome_notification_types.h" |
24 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" | 25 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" |
25 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact
ory.h" | 26 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact
ory.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 } | 63 } |
63 | 64 |
64 // Returns true if |pref| is shared (controlled by the primary user). | 65 // Returns true if |pref| is shared (controlled by the primary user). |
65 bool IsSettingShared(const std::string& pref) { | 66 bool IsSettingShared(const std::string& pref) { |
66 const char** end = kPrimaryUserSettings + arraysize(kPrimaryUserSettings); | 67 const char** end = kPrimaryUserSettings + arraysize(kPrimaryUserSettings); |
67 return std::find(kPrimaryUserSettings, end, pref) != end; | 68 return std::find(kPrimaryUserSettings, end, pref) != end; |
68 } | 69 } |
69 | 70 |
70 // Creates a user info dictionary to be stored in the |ListValue| that is | 71 // Creates a user info dictionary to be stored in the |ListValue| that is |
71 // passed to Javascript for the |kAccountsPrefUsers| preference. | 72 // passed to Javascript for the |kAccountsPrefUsers| preference. |
72 base::DictionaryValue* CreateUserInfo(const std::string& username, | 73 std::unique_ptr<base::DictionaryValue> CreateUserInfo( |
73 const std::string& display_email, | 74 const std::string& username, |
74 const std::string& display_name) { | 75 const std::string& display_email, |
75 base::DictionaryValue* user_dict = new base::DictionaryValue; | 76 const std::string& display_name) { |
| 77 auto user_dict = base::MakeUnique<base::DictionaryValue>(); |
76 user_dict->SetString("username", username); | 78 user_dict->SetString("username", username); |
77 user_dict->SetString("name", display_email); | 79 user_dict->SetString("name", display_email); |
78 user_dict->SetString("email", display_name); | 80 user_dict->SetString("email", display_name); |
79 | 81 |
80 const bool is_owner = | 82 const bool is_owner = |
81 user_manager::UserManager::Get()->GetOwnerAccountId().GetUserEmail() == | 83 user_manager::UserManager::Get()->GetOwnerAccountId().GetUserEmail() == |
82 username; | 84 username; |
83 user_dict->SetBoolean("owner", is_owner); | 85 user_dict->SetBoolean("owner", is_owner); |
84 return user_dict; | 86 return user_dict; |
85 } | 87 } |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 proxy_cros_settings_parser::GetProxyPrefValue( | 421 proxy_cros_settings_parser::GetProxyPrefValue( |
420 proxy_config_service_, kProxySettings[i], &value); | 422 proxy_config_service_, kProxySettings[i], &value); |
421 DCHECK(value); | 423 DCHECK(value); |
422 std::unique_ptr<base::Value> ptr(value); | 424 std::unique_ptr<base::Value> ptr(value); |
423 DispatchPrefChangeNotification(kProxySettings[i], std::move(ptr)); | 425 DispatchPrefChangeNotification(kProxySettings[i], std::move(ptr)); |
424 } | 426 } |
425 } | 427 } |
426 | 428 |
427 } // namespace options | 429 } // namespace options |
428 } // namespace chromeos | 430 } // namespace chromeos |
OLD | NEW |