Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_OPTIN_ARC_TERMS_OF_SERVICE_NEGOTIATOR_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_OPTIN_ARC_TERMS_OF_SERVICE_NEGOTIATOR_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/callback.h" | |
| 12 #include "base/macros.h" | |
| 13 #include "chrome/browser/chromeos/arc/arc_support_host.h" | |
| 14 #include "chrome/browser/chromeos/arc/optin/arc_optin_preference_handler_observe r.h" | |
| 15 | |
| 16 class PrefService; | |
| 17 | |
| 18 namespace arc { | |
| 19 | |
| 20 class ArcOptInPreferenceHandler; | |
| 21 | |
| 22 // Handles the Terms-of-service agreement user action. | |
| 23 class ArcTermsOfServiceNegotiator : public ArcSupportHost::Observer, | |
| 24 public ArcOptInPreferenceHandlerObserver { | |
| 25 public: | |
| 26 ArcTermsOfServiceNegotiator(PrefService* pref_service, | |
| 27 ArcSupportHost* support_host); | |
| 28 ~ArcTermsOfServiceNegotiator() override; | |
| 29 | |
| 30 // Shows "Terms of service" page on ARC support Chrome App. Invokes the | |
| 31 // |callback| asynchronously with "|agreed| = true" if user agrees it. | |
| 32 // Otherwise (e.g., user clicks "Cancel" or closes the window), invokes | |
| 33 // |callback| with |agreed| = false. | |
| 34 // Deleting this instance cancels the operation, so |callback| will never | |
| 35 // be invoked then. | |
| 36 using AgreementCallback = base::Callback<void(bool agreed)>; | |
|
Luis Héctor Chávez
2016/11/29 18:18:12
same here, s/agreed/accepted/. Maybe also rename A
hidehiko
2016/12/01 14:20:09
Done.
| |
| 37 void StartNegotiation(const AgreementCallback& callback); | |
| 38 | |
| 39 private: | |
| 40 // ArcSupportHost::Observer: | |
| 41 void OnWindowClosed() override; | |
| 42 void OnTermsAgreed(bool is_metrics_enabled, | |
| 43 bool is_backup_and_restore_enabled, | |
| 44 bool is_location_service_enabled) override; | |
| 45 void OnAuthSucceeded(const std::string& auth_code) override; | |
| 46 void OnRetryClicked() override; | |
| 47 void OnSendFeedbackClicked() override; | |
| 48 | |
| 49 // ArcOptInPreferenceHandlerObserver: | |
| 50 void OnMetricsModeChanged(bool enabled, bool managed) override; | |
| 51 void OnBackupAndRestoreModeChanged(bool enabled, bool managed) override; | |
| 52 void OnLocationServicesModeChanged(bool enabled, bool managed) override; | |
| 53 | |
| 54 PrefService* const pref_service_; | |
| 55 // Owned by ArcSessionManager. | |
| 56 ArcSupportHost* const support_host_; | |
| 57 | |
| 58 AgreementCallback callback_; | |
| 59 std::unique_ptr<ArcOptInPreferenceHandler> preference_handler_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(ArcTermsOfServiceNegotiator); | |
| 62 }; | |
| 63 | |
| 64 } // namespace arc | |
| 65 | |
| 66 #endif // CHROME_BROWSER_CHROMEOS_ARC_OPTIN_ARC_TERMS_OF_SERVICE_NEGOTIATOR_H_ | |
| OLD | NEW |