Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/arc/arc_support_host.h" | 5 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/common/system/chromeos/devicetype_utils.h" | 9 #include "ash/common/system/chromeos/devicetype_utils.h" |
| 10 #include "base/i18n/timezone.h" | 10 #include "base/i18n/timezone.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 base::JSONWriter::Write(response, &response_string); | 223 base::JSONWriter::Write(response, &response_string); |
| 224 client_->PostMessageFromNativeHost(response_string); | 224 client_->PostMessageFromNativeHost(response_string); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void ArcSupportHost::EnableMetrics(bool is_enabled) { | 227 void ArcSupportHost::EnableMetrics(bool is_enabled) { |
| 228 InitiateMetricsReportingChange(is_enabled, OnMetricsReportingCallbackType()); | 228 InitiateMetricsReportingChange(is_enabled, OnMetricsReportingCallbackType()); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void ArcSupportHost::EnableBackupRestore(bool is_enabled) { | 231 void ArcSupportHost::EnableBackupRestore(bool is_enabled) { |
| 232 PrefService* pref_service = arc::ArcAuthService::Get()->profile()->GetPrefs(); | 232 PrefService* pref_service = arc::ArcAuthService::Get()->profile()->GetPrefs(); |
| 233 pref_service->SetBoolean(prefs::kArcBackupRestoreEnabled, is_enabled); | 233 if (!pref_service->GetBoolean(prefs::kArcBackupRestoreManaged)) { |
|
Yusuke Sato
2016/07/11 03:01:06
nit: omit {} to be consistent with other code in t
Sergey Poromov
2016/07/11 14:35:14
Done.
| |
| 234 pref_service->SetBoolean(prefs::kArcBackupRestoreEnabled, is_enabled); | |
| 235 } | |
| 234 } | 236 } |
| 235 | 237 |
| 236 void ArcSupportHost::OnMessage(const std::string& request_string) { | 238 void ArcSupportHost::OnMessage(const std::string& request_string) { |
| 237 std::unique_ptr<base::Value> request_value = | 239 std::unique_ptr<base::Value> request_value = |
| 238 base::JSONReader::Read(request_string); | 240 base::JSONReader::Read(request_string); |
| 239 base::DictionaryValue* request; | 241 base::DictionaryValue* request; |
| 240 if (!request_value || !request_value->GetAsDictionary(&request)) { | 242 if (!request_value || !request_value->GetAsDictionary(&request)) { |
| 241 NOTREACHED(); | 243 NOTREACHED(); |
| 242 return; | 244 return; |
| 243 } | 245 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 EnableBackupRestore(is_enabled); | 282 EnableBackupRestore(is_enabled); |
| 281 } else { | 283 } else { |
| 282 NOTREACHED(); | 284 NOTREACHED(); |
| 283 } | 285 } |
| 284 } | 286 } |
| 285 | 287 |
| 286 scoped_refptr<base::SingleThreadTaskRunner> ArcSupportHost::task_runner() | 288 scoped_refptr<base::SingleThreadTaskRunner> ArcSupportHost::task_runner() |
| 287 const { | 289 const { |
| 288 return base::ThreadTaskRunnerHandle::Get(); | 290 return base::ThreadTaskRunnerHandle::Get(); |
| 289 } | 291 } |
| OLD | NEW |