Chromium Code Reviews| Index: chrome/browser/chromeos/arc/arc_support_host.h |
| diff --git a/chrome/browser/chromeos/arc/arc_support_host.h b/chrome/browser/chromeos/arc/arc_support_host.h |
| index c645e59073561f2a658f440d7f8590944b432354..3f8556a083eff96b26a2d8adbe44f5e084ad83c4 100644 |
| --- a/chrome/browser/chromeos/arc/arc_support_host.h |
| +++ b/chrome/browser/chromeos/arc/arc_support_host.h |
| @@ -44,30 +44,60 @@ class ArcSupportHost : public arc::ArcSupportMessageHost::Observer, |
| SIGN_IN_UNKNOWN_ERROR, |
| }; |
| - // Observer to notify UI event. |
| - class Observer { |
| + // Delegate to handle manual authentication related events. |
| + class AuthDelegate { |
| public: |
| - virtual ~Observer() = default; |
| + virtual ~AuthDelegate() = default; |
| - // Called when the ARC support window is closed. |
| - virtual void OnWindowClosed() {} |
| + // Called when LSO auth token fetch is successfully completed. |
| + virtual void OnAuthSucceeded(const std::string& auth_code) = 0; |
| + |
| + // Called when LSO auth token fetch has failed. |
| + virtual void OnAuthFailed() = 0; |
| + |
| + // Called when "RETRY" button on the error page is clicked during |
| + // authentication. |
| + virtual void OnAuthRetryClicked() = 0; |
| + }; |
| + |
| + // Delegate to handle manual authentication related events. |
| + class TermsOfServiceDelegate { |
| + public: |
| + virtual ~TermsOfServiceDelegate() = default; |
| - // Called when the user press AGREE button on ToS page. |
| + // Called when the user press AGREE button on terms of service page. |
| virtual void OnTermsAgreed(bool is_metrics_enabled, |
| bool is_backup_and_restore_enabled, |
| - bool is_location_service_enabled) {} |
| + bool is_location_service_enabled) = 0; |
| - // Called when LSO auth token fetch is successfully completed. |
| - virtual void OnAuthSucceeded(const std::string& auth_code) {} |
| + // Called when the user rejects the terms of service or close the page. |
| + virtual void OnTermsRejected() = 0; |
| - // Called when LSO auth token fetch has failed. |
| - virtual void OnAuthFailed() {} |
| + // Called when "RETRY" button on the error page is clicked during terms of |
| + // service negotiation. |
| + virtual void OnTermsRetryClicked() = 0; |
| + }; |
| - // Called when "RETRY" button on the error page is clicked. |
| - virtual void OnRetryClicked() {} |
| + // Delegate to handle general error events. Note that some of the callback |
| + // will only be called when more the specific callback in the other delegate |
| + // is not appropriate. |
| + class ErrorDelegate { |
| + public: |
| + virtual ~ErrorDelegate() = default; |
| + |
| + // Called when the opt-in process is aborted. This currently happens when |
| + // the ARC support window is closed (except when when the terms of service |
|
hidehiko
2017/05/15 09:05:44
nit: s/when when/when/
victorhsieh0
2017/05/15 22:31:53
Done.
|
| + // negotiation is ongoing, the most specific function in |
| + // TermsOfServiceDelegate is called). |
| + virtual void OnOptInAborted() = 0; |
| + |
| + // Called when "RETRY" button on the error page is clicked, except when |
| + // terms of service negotiation or manual authentication is onging. In those |
| + // cases, the more specific retry function in the other delegates is called. |
| + virtual void OnRetryClicked() = 0; |
| // Called when send feedback button on error page is clicked. |
| - virtual void OnSendFeedbackClicked() {} |
| + virtual void OnSendFeedbackClicked() = 0; |
| }; |
| static const char kHostAppId[]; |
| @@ -82,6 +112,10 @@ class ArcSupportHost : public arc::ArcSupportMessageHost::Observer, |
| void RemoveObserver(Observer* observer); |
| bool HasObserver(Observer* observer); |
| + void SetAuthDelegate(AuthDelegate* delegate); |
| + void SetTermsOfServiceDelegate(TermsOfServiceDelegate* delegate); |
| + void SetErrorDelegate(ErrorDelegate* delegate); |
| + |
| // Called when the communication to arc_support Chrome App is ready. |
| void SetMessageHost(arc::ArcSupportMessageHost* message_host); |
| @@ -166,6 +200,9 @@ class ArcSupportHost : public arc::ArcSupportMessageHost::Observer, |
| RequestOpenAppCallback request_open_app_callback_; |
| base::ObserverList<Observer> observer_list_; |
| + AuthDelegate* auth_delegate_ = nullptr; // not owned |
| + TermsOfServiceDelegate* tos_delegate_ = nullptr; // not owned |
| + ErrorDelegate* error_delegate_ = nullptr; // not owned |
| // True, if ARC support app is requested to start, but the connection is not |
| // yet established. Reset to false, when the app is started and the |