Chromium Code Reviews| Index: chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.h |
| diff --git a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.h b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.h |
| index 41871dde0650cd555c942837cb825cf9b71e3246..a155f7ae0a3613c775bcb9d82997002f8a25783b 100644 |
| --- a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.h |
| +++ b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.h |
| @@ -5,58 +5,34 @@ |
| #ifndef CHROME_BROWSER_CHROMEOS_ARC_OPTIN_ARC_TERMS_OF_SERVICE_NEGOTIATOR_H_ |
| #define CHROME_BROWSER_CHROMEOS_ARC_OPTIN_ARC_TERMS_OF_SERVICE_NEGOTIATOR_H_ |
| -#include <memory> |
| -#include <string> |
| - |
| #include "base/callback.h" |
| #include "base/macros.h" |
| -#include "chrome/browser/chromeos/arc/arc_support_host.h" |
| -#include "chrome/browser/chromeos/arc/optin/arc_optin_preference_handler_observer.h" |
| - |
| -class PrefService; |
| namespace arc { |
| -class ArcOptInPreferenceHandler; |
| - |
| -// Handles the Terms-of-service agreement user action. |
| -class ArcTermsOfServiceNegotiator : public ArcSupportHost::Observer, |
| - public ArcOptInPreferenceHandlerObserver { |
| +// Interface to handle the Terms-of-service agreement user action. |
| +class ArcTermsOfServiceNegotiator { |
| public: |
| - ArcTermsOfServiceNegotiator(PrefService* pref_service, |
| - ArcSupportHost* support_host); |
| - ~ArcTermsOfServiceNegotiator() override; |
| + ArcTermsOfServiceNegotiator(); |
| + virtual ~ArcTermsOfServiceNegotiator(); |
| - // Shows "Terms of service" page on ARC support Chrome App. Invokes the |
| - // |callback| asynchronously with "|agreed| = true" if user agrees it. |
| - // Otherwise (e.g., user clicks "Cancel" or closes the window), invokes |
| - // |callback| with |agreed| = false. |
| - // Deleting this instance cancels the operation, so |callback| will never |
| - // be invoked then. |
| + // Invokes the|callback| asynchronously with "|agreed| = true" if user accepts |
|
hidehiko
2017/01/30 10:12:35
nit: s/agreed/accepted/g (for only what you actual
khmel
2017/01/31 02:47:08
Done.
|
| + // ToS. If user explicitly rejects ToS, invokes |callback| with |agreed| = |
| + // false. Deleting this instance cancels the operation, so |callback| will |
| + // never be invoked then. |
| using NegotiationCallback = base::Callback<void(bool accepted)>; |
| void StartNegotiation(const NegotiationCallback& callback); |
| - private: |
| - // ArcSupportHost::Observer: |
| - void OnWindowClosed() override; |
| - void OnTermsAgreed(bool is_metrics_enabled, |
| - bool is_backup_and_restore_enabled, |
| - bool is_location_service_enabled) override; |
| - void OnAuthSucceeded(const std::string& auth_code) override; |
| - void OnRetryClicked() override; |
| - void OnSendFeedbackClicked() override; |
| - |
| - // ArcOptInPreferenceHandlerObserver: |
| - void OnMetricsModeChanged(bool enabled, bool managed) override; |
| - void OnBackupAndRestoreModeChanged(bool enabled, bool managed) override; |
| - void OnLocationServicesModeChanged(bool enabled, bool managed) override; |
| + protected: |
| + // Reports result of negotiation via callback and then resets it. If |
| + // |accepted| is true then this means terms of service were accepted. |
| + void ReportResult(bool accepted); |
| - PrefService* const pref_service_; |
| - // Owned by ArcSessionManager. |
| - ArcSupportHost* const support_host_; |
| + private: |
| + // Performs implementation specific action on starting negotiation. |
|
hidehiko
2017/01/30 10:12:36
Maybe: s/on starting negotiation/to start negotiat
khmel
2017/01/31 02:47:09
Done.
|
| + virtual void StartNegotiationImpl() = 0; |
| NegotiationCallback pending_callback_; |
| - std::unique_ptr<ArcOptInPreferenceHandler> preference_handler_; |
| DISALLOW_COPY_AND_ASSIGN(ArcTermsOfServiceNegotiator); |
| }; |