| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/intent_helper/arc_settings_service.h" | 5 #include "chrome/browser/chromeos/arc/intent_helper/arc_settings_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 void ArcSettingsServiceImpl::SyncReportingConsent() const { | 491 void ArcSettingsServiceImpl::SyncReportingConsent() const { |
| 492 bool consent = false; | 492 bool consent = false; |
| 493 CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, &consent); | 493 CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, &consent); |
| 494 base::DictionaryValue extras; | 494 base::DictionaryValue extras; |
| 495 extras.SetBoolean("reportingConsent", consent); | 495 extras.SetBoolean("reportingConsent", consent); |
| 496 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_REPORTING_CONSENT", | 496 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_REPORTING_CONSENT", |
| 497 extras); | 497 extras); |
| 498 } | 498 } |
| 499 | 499 |
| 500 void ArcSettingsServiceImpl::SyncSpokenFeedbackEnabled() const { | 500 void ArcSettingsServiceImpl::SyncSpokenFeedbackEnabled() const { |
| 501 // Chrome spoken feedback triggers enabling of Android spoken feedback. | 501 SendBoolPrefSettingsBroadcast( |
| 502 // There are two types of spoken feedback from Android: | 502 prefs::kAccessibilitySpokenFeedbackEnabled, |
| 503 // 1. Talkback (default) | 503 "org.chromium.arc.intent_helper.SET_SPOKEN_FEEDBACK_ENABLED"); |
| 504 // 2. accessibility helper (experimental, works through ChromeVox). | |
| 505 // These two features are mutually exclusive. | |
| 506 | |
| 507 const PrefService::Preference* pref = registrar_.prefs()->FindPreference( | |
| 508 prefs::kAccessibilitySpokenFeedbackEnabled); | |
| 509 DCHECK(pref); | |
| 510 bool enabled = false; | |
| 511 bool value_exists = pref->GetValue()->GetAsBoolean(&enabled); | |
| 512 CHECK(value_exists); | |
| 513 bool managed = | |
| 514 IsBooleanPrefManaged(prefs::kAccessibilitySpokenFeedbackEnabled); | |
| 515 | |
| 516 std::string talkback_setting = | |
| 517 "org.chromium.arc.intent_helper.SET_SPOKEN_FEEDBACK_ENABLED"; | |
| 518 std::string accessibility_helper_setting = | |
| 519 "org.chromium.arc.intent_helper.SET_ACCESSIBILITY_HELPER_ENABLED"; | |
| 520 | |
| 521 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 522 chromeos::switches::kEnableChromeVoxArcSupport)) { | |
| 523 // Make sure if ChromeVox is on, TalkBack is off. | |
| 524 if (enabled) | |
| 525 SendBoolValueSettingsBroadcast(false, managed, talkback_setting); | |
| 526 | |
| 527 SendBoolValueSettingsBroadcast(enabled, managed, | |
| 528 accessibility_helper_setting); | |
| 529 | |
| 530 return; | |
| 531 } | |
| 532 | |
| 533 SendBoolValueSettingsBroadcast(enabled, managed, talkback_setting); | |
| 534 } | 504 } |
| 535 | 505 |
| 536 void ArcSettingsServiceImpl::SyncTimeZone() const { | 506 void ArcSettingsServiceImpl::SyncTimeZone() const { |
| 537 TimezoneSettings* timezone_settings = TimezoneSettings::GetInstance(); | 507 TimezoneSettings* timezone_settings = TimezoneSettings::GetInstance(); |
| 538 base::string16 timezoneID = timezone_settings->GetCurrentTimezoneID(); | 508 base::string16 timezoneID = timezone_settings->GetCurrentTimezoneID(); |
| 539 base::DictionaryValue extras; | 509 base::DictionaryValue extras; |
| 540 extras.SetString("olsonTimeZone", timezoneID); | 510 extras.SetString("olsonTimeZone", timezoneID); |
| 541 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_TIME_ZONE", extras); | 511 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_TIME_ZONE", extras); |
| 542 } | 512 } |
| 543 | 513 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 | 620 |
| 651 void ArcSettingsService::OnInstanceReady() { | 621 void ArcSettingsService::OnInstanceReady() { |
| 652 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service())); | 622 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service())); |
| 653 } | 623 } |
| 654 | 624 |
| 655 void ArcSettingsService::OnInstanceClosed() { | 625 void ArcSettingsService::OnInstanceClosed() { |
| 656 impl_.reset(); | 626 impl_.reset(); |
| 657 } | 627 } |
| 658 | 628 |
| 659 } // namespace arc | 629 } // namespace arc |
| OLD | NEW |