Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: chrome/browser/ui/webui/signin/sync_confirmation_handler.h

Issue 2784823002: Reland "Use the same browser instance in the sync confirmation dialog. (Closed)
Patch Set: Rebase and fix conflicts Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 12 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
12 #include "components/signin/core/browser/account_tracker_service.h" 13 #include "components/signin/core/browser/account_tracker_service.h"
13 #include "content/public/browser/web_ui_message_handler.h" 14 #include "content/public/browser/web_ui_message_handler.h"
14 15
15 namespace base { 16 namespace base {
16 class ListValue; 17 class ListValue;
17 } 18 }
18 19
19 class SyncConfirmationHandler : public content::WebUIMessageHandler, 20 class SyncConfirmationHandler : public content::WebUIMessageHandler,
20 public AccountTrackerService::Observer { 21 public AccountTrackerService::Observer,
22 public chrome::BrowserListObserver {
21 public: 23 public:
22 SyncConfirmationHandler(); 24 explicit SyncConfirmationHandler(Browser* browser);
23 ~SyncConfirmationHandler() override; 25 ~SyncConfirmationHandler() override;
24 26
25 // content::WebUIMessageHandler: 27 // content::WebUIMessageHandler:
26 void RegisterMessages() override; 28 void RegisterMessages() override;
27 29
28 // AccountTrackerService::Observer: 30 // AccountTrackerService::Observer:
29 void OnAccountUpdated(const AccountInfo& info) override; 31 void OnAccountUpdated(const AccountInfo& info) override;
30 32
33 // chrome::BrowserListObserver:
34 void OnBrowserRemoved(Browser* browser) override;
35
31 protected: 36 protected:
32 // Handles "confirm" message from the page. No arguments. 37 // Handles "confirm" message from the page. No arguments.
33 // This message is sent when the user confirms that they want complete sign in 38 // This message is sent when the user confirms that they want complete sign in
34 // with default sync settings. 39 // with default sync settings.
35 virtual void HandleConfirm(const base::ListValue* args); 40 virtual void HandleConfirm(const base::ListValue* args);
36 41
37 // Handles "undo" message from the page. No arguments. 42 // Handles "undo" message from the page. No arguments.
38 // This message is sent when the user clicks "undo" on the sync confirmation 43 // This message is sent when the user clicks "undo" on the sync confirmation
39 // dialog, which aborts signin and prevents sync from starting. 44 // dialog, which aborts signin and prevents sync from starting.
40 virtual void HandleUndo(const base::ListValue* args); 45 virtual void HandleUndo(const base::ListValue* args);
(...skipping 12 matching lines...) Expand all
53 // Sets the profile picture shown in the dialog to the image at |url|. 58 // Sets the profile picture shown in the dialog to the image at |url|.
54 virtual void SetUserImageURL(const std::string& url); 59 virtual void SetUserImageURL(const std::string& url);
55 60
56 // Closes the modal signin window and calls 61 // Closes the modal signin window and calls
57 // LoginUIService::SyncConfirmationUIClosed with |result|. |result| indicates 62 // LoginUIService::SyncConfirmationUIClosed with |result|. |result| indicates
58 // the option chosen by the user in the confirmation UI. 63 // the option chosen by the user in the confirmation UI.
59 void CloseModalSigninWindow( 64 void CloseModalSigninWindow(
60 LoginUIService::SyncConfirmationUIClosedResult result); 65 LoginUIService::SyncConfirmationUIClosedResult result);
61 66
62 private: 67 private:
68 Profile* profile_;
69
70 // Weak reference to the browser that showed the sync confirmation dialog.
71 Browser* browser_;
72
63 // Records whether the user clicked on Undo, Ok, or Settings. 73 // Records whether the user clicked on Undo, Ok, or Settings.
64 bool did_user_explicitly_interact; 74 bool did_user_explicitly_interact;
65 75
66 DISALLOW_COPY_AND_ASSIGN(SyncConfirmationHandler); 76 DISALLOW_COPY_AND_ASSIGN(SyncConfirmationHandler);
67 }; 77 };
68 78
69 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SYNC_CONFIRMATION_HANDLER_H_ 79 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SYNC_CONFIRMATION_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/signin/signin_utils.cc ('k') | chrome/browser/ui/webui/signin/sync_confirmation_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698