| 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_HISTORY_LOGIN_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_HISTORY_LOGIN_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_HISTORY_LOGIN_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_HISTORY_LOGIN_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "content/public/browser/web_ui_message_handler.h" | 12 #include "content/public/browser/web_ui_message_handler.h" |
| 12 | 13 |
| 13 class ProfileInfoWatcher; | 14 class ProfileInfoWatcher; |
| 14 | 15 |
| 15 // The handler for login-related messages from chrome://history. | 16 // The handler for login-related messages from chrome://history. |
| 16 class HistoryLoginHandler : public content::WebUIMessageHandler { | 17 class HistoryLoginHandler : public content::WebUIMessageHandler { |
| 17 public: | 18 public: |
| 18 HistoryLoginHandler(); | 19 explicit HistoryLoginHandler(const base::Closure& signin_callback); |
| 19 ~HistoryLoginHandler() override; | 20 ~HistoryLoginHandler() override; |
| 20 | 21 |
| 21 // WebUIMessageHandler implementation. | 22 // WebUIMessageHandler implementation. |
| 22 void RegisterMessages() override; | 23 void RegisterMessages() override; |
| 23 | 24 |
| 24 private: | 25 private: |
| 25 // Handler for the "otherDevicesInitialized" message. No args. | 26 // Handler for the "otherDevicesInitialized" message. No args. |
| 26 void HandleOtherDevicesInitialized(const base::ListValue* args); | 27 void HandleOtherDevicesInitialized(const base::ListValue* args); |
| 27 | 28 |
| 28 // Handler for the "startSignInFlow" message. No args. | 29 // Handler for the "startSignInFlow" message. No args. |
| 29 void HandleStartSignInFlow(const base::ListValue* args); | 30 void HandleStartSignInFlow(const base::ListValue* args); |
| 30 | 31 |
| 31 // Called by |profile_info_watcher_| on desktop if profile info changes. | 32 // Called by |profile_info_watcher_| on desktop if profile info changes. |
| 32 void ProfileInfoChanged(); | 33 void ProfileInfoChanged(); |
| 33 | 34 |
| 34 // Watches this web UI's profile for info changes (e.g. authenticated username | 35 // Watches this web UI's profile for info changes (e.g. authenticated username |
| 35 // changes). | 36 // changes). |
| 36 std::unique_ptr<ProfileInfoWatcher> profile_info_watcher_; | 37 std::unique_ptr<ProfileInfoWatcher> profile_info_watcher_; |
| 37 | 38 |
| 39 base::Closure signin_callback_; |
| 40 |
| 38 DISALLOW_COPY_AND_ASSIGN(HistoryLoginHandler); | 41 DISALLOW_COPY_AND_ASSIGN(HistoryLoginHandler); |
| 39 }; | 42 }; |
| 40 | 43 |
| 41 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_LOGIN_HANDLER_H_ | 44 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_LOGIN_HANDLER_H_ |
| OLD | NEW |