| 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 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_SYNC_CONFIRMATION_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_SYNC_CONFIRMATION_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_SYNC_CONFIRMATION_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_SYNC_CONFIRMATION_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/ui/browser_list_observer.h" | |
| 12 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 11 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 13 #include "components/signin/core/browser/account_tracker_service.h" | 12 #include "components/signin/core/browser/account_tracker_service.h" |
| 14 #include "content/public/browser/web_ui_message_handler.h" | 13 #include "content/public/browser/web_ui_message_handler.h" |
| 15 | 14 |
| 16 namespace base { | 15 namespace base { |
| 17 class ListValue; | 16 class ListValue; |
| 18 } | 17 } |
| 19 | 18 |
| 20 class SyncConfirmationHandler : public content::WebUIMessageHandler, | 19 class SyncConfirmationHandler : public content::WebUIMessageHandler, |
| 21 public AccountTrackerService::Observer, | 20 public AccountTrackerService::Observer { |
| 22 public chrome::BrowserListObserver { | |
| 23 public: | 21 public: |
| 24 explicit SyncConfirmationHandler(Browser* browser); | 22 SyncConfirmationHandler(); |
| 25 ~SyncConfirmationHandler() override; | 23 ~SyncConfirmationHandler() override; |
| 26 | 24 |
| 27 // content::WebUIMessageHandler: | 25 // content::WebUIMessageHandler: |
| 28 void RegisterMessages() override; | 26 void RegisterMessages() override; |
| 29 | 27 |
| 30 // AccountTrackerService::Observer: | 28 // AccountTrackerService::Observer: |
| 31 void OnAccountUpdated(const AccountInfo& info) override; | 29 void OnAccountUpdated(const AccountInfo& info) override; |
| 32 | 30 |
| 33 // chrome::BrowserListObserver: | |
| 34 void OnBrowserRemoved(Browser* browser) override; | |
| 35 | |
| 36 protected: | 31 protected: |
| 37 // Handles "confirm" message from the page. No arguments. | 32 // Handles "confirm" message from the page. No arguments. |
| 38 // This message is sent when the user confirms that they want complete sign in | 33 // This message is sent when the user confirms that they want complete sign in |
| 39 // with default sync settings. | 34 // with default sync settings. |
| 40 virtual void HandleConfirm(const base::ListValue* args); | 35 virtual void HandleConfirm(const base::ListValue* args); |
| 41 | 36 |
| 42 // Handles "undo" message from the page. No arguments. | 37 // Handles "undo" message from the page. No arguments. |
| 43 // This message is sent when the user clicks "undo" on the sync confirmation | 38 // This message is sent when the user clicks "undo" on the sync confirmation |
| 44 // dialog, which aborts signin and prevents sync from starting. | 39 // dialog, which aborts signin and prevents sync from starting. |
| 45 virtual void HandleUndo(const base::ListValue* args); | 40 virtual void HandleUndo(const base::ListValue* args); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 58 // Sets the profile picture shown in the dialog to the image at |url|. | 53 // Sets the profile picture shown in the dialog to the image at |url|. |
| 59 virtual void SetUserImageURL(const std::string& url); | 54 virtual void SetUserImageURL(const std::string& url); |
| 60 | 55 |
| 61 // Closes the modal signin window and calls | 56 // Closes the modal signin window and calls |
| 62 // LoginUIService::SyncConfirmationUIClosed with |result|. |result| indicates | 57 // LoginUIService::SyncConfirmationUIClosed with |result|. |result| indicates |
| 63 // the option chosen by the user in the confirmation UI. | 58 // the option chosen by the user in the confirmation UI. |
| 64 void CloseModalSigninWindow( | 59 void CloseModalSigninWindow( |
| 65 LoginUIService::SyncConfirmationUIClosedResult result); | 60 LoginUIService::SyncConfirmationUIClosedResult result); |
| 66 | 61 |
| 67 private: | 62 private: |
| 68 Profile* profile_; | |
| 69 | |
| 70 // Weak reference to the browser that showed the sync confirmation dialog. | |
| 71 Browser* browser_; | |
| 72 | |
| 73 // Records whether the user clicked on Undo, Ok, or Settings. | 63 // Records whether the user clicked on Undo, Ok, or Settings. |
| 74 bool did_user_explicitly_interact; | 64 bool did_user_explicitly_interact; |
| 75 | 65 |
| 76 DISALLOW_COPY_AND_ASSIGN(SyncConfirmationHandler); | 66 DISALLOW_COPY_AND_ASSIGN(SyncConfirmationHandler); |
| 77 }; | 67 }; |
| 78 | 68 |
| 79 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SYNC_CONFIRMATION_HANDLER_H_ | 69 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SYNC_CONFIRMATION_HANDLER_H_ |
| OLD | NEW |