OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_NTP_NEW_TAB_PAGE_SYNC_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_SYNC_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_SYNC_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_SYNC_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "chrome/browser/sync/profile_sync_service.h" | 11 #include "chrome/browser/sync/profile_sync_service.h" |
12 #include "chrome/browser/sync/sync_ui_util.h" | 12 #include "chrome/browser/sync/sync_ui_util.h" |
13 #include "content/browser/webui/web_ui.h" | 13 #include "content/browser/webui/web_ui.h" |
14 | 14 |
| 15 namespace base { |
15 class ListValue; | 16 class ListValue; |
| 17 } |
16 | 18 |
17 // Sends sync-state changes to the New Tab Page for UI updating and forwards | 19 // Sends sync-state changes to the New Tab Page for UI updating and forwards |
18 // link clicks on the page to the sync service. | 20 // link clicks on the page to the sync service. |
19 class NewTabPageSyncHandler : public WebUIMessageHandler, | 21 class NewTabPageSyncHandler : public WebUIMessageHandler, |
20 public ProfileSyncServiceObserver { | 22 public ProfileSyncServiceObserver { |
21 public: | 23 public: |
22 NewTabPageSyncHandler(); | 24 NewTabPageSyncHandler(); |
23 virtual ~NewTabPageSyncHandler(); | 25 virtual ~NewTabPageSyncHandler(); |
24 | 26 |
25 // WebUIMessageHandler implementation. | 27 // WebUIMessageHandler implementation. |
26 virtual WebUIMessageHandler* Attach(WebUI* web_ui); | 28 virtual WebUIMessageHandler* Attach(WebUI* web_ui); |
27 virtual void RegisterMessages(); | 29 virtual void RegisterMessages(); |
28 | 30 |
29 // Callback for "GetSyncMessage". | 31 // Callback for "GetSyncMessage". |
30 void HandleGetSyncMessage(const ListValue* args); | 32 void HandleGetSyncMessage(const base::ListValue* args); |
31 // Callback for "SyncLinkClicked". | 33 // Callback for "SyncLinkClicked". |
32 void HandleSyncLinkClicked(const ListValue* args); | 34 void HandleSyncLinkClicked(const base::ListValue* args); |
33 | 35 |
34 // ProfileSyncServiceObserver | 36 // ProfileSyncServiceObserver |
35 virtual void OnStateChanged(); | 37 virtual void OnStateChanged(); |
36 | 38 |
37 private: | 39 private: |
38 enum MessageType { | 40 enum MessageType { |
39 HIDE, | 41 HIDE, |
40 SYNC_ERROR, | 42 SYNC_ERROR, |
41 SYNC_PROMO | 43 SYNC_PROMO |
42 }; | 44 }; |
(...skipping 17 matching lines...) Expand all Loading... |
60 ProfileSyncService* sync_service_; | 62 ProfileSyncService* sync_service_; |
61 | 63 |
62 // Used to make sure we don't register ourselves twice if the user refreshes | 64 // Used to make sure we don't register ourselves twice if the user refreshes |
63 // the new tab page. | 65 // the new tab page. |
64 bool waiting_for_initial_page_load_; | 66 bool waiting_for_initial_page_load_; |
65 | 67 |
66 DISALLOW_COPY_AND_ASSIGN(NewTabPageSyncHandler); | 68 DISALLOW_COPY_AND_ASSIGN(NewTabPageSyncHandler); |
67 }; | 69 }; |
68 | 70 |
69 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_SYNC_HANDLER_H_ | 71 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_SYNC_HANDLER_H_ |
OLD | NEW |