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

Side by Side Diff: chrome/browser/dom_ui/new_tab_page_sync_handler.h

Issue 160598: Add files to browser/sync. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifdef CHROME_PERSONALIZATION
6
7 #ifndef CHROME_BROWSER_DOM_UI_NEW_TAB_PAGE_SYNC_HANDLER_H_
8 #define CHROME_BROWSER_DOM_UI_NEW_TAB_PAGE_SYNC_HANDLER_H_
9
10 #include <string>
11
12 #include "chrome/browser/dom_ui/dom_ui.h"
13 #include "chrome/browser/sync/profile_sync_service.h"
14 #include "chrome/browser/sync/sync_status_ui_helper.h"
15
16 class Value;
17
18 // Sends sync-state changes to the New Tab Page for UI updating and forwards
19 // link clicks on the page to the sync service.
20 class NewTabPageSyncHandler : public DOMMessageHandler,
21 public ProfileSyncServiceObserver {
22 public:
23 NewTabPageSyncHandler();
24 virtual ~NewTabPageSyncHandler();
25
26 // DOMMessageHandler implementation.
27 virtual DOMMessageHandler* Attach(DOMUI* dom_ui);
28 virtual void RegisterMessages();
29
30 // Callback for "GetSyncMessage".
31 void HandleGetSyncMessage(const Value* value);
32 // Callback for "SyncLinkClicked".
33 void HandleSyncLinkClicked(const Value* value);
34 // Callback for "ResizeP13N"
35 void HandleResizeP13N(const Value* value);
36
37 // ProfileSyncServiceObserver
38 virtual void OnStateChanged();
39
40 private:
41 // Helper to invoke |renderSyncMessage| JS function on the new tab page.
42 void SendSyncMessageToPage(SyncStatusUIHelper::MessageType type,
43 std::string msg, const std::string& linktext);
44
45 // Helper to query the sync service and figure out what to send to
46 // the page, and send it via SendSyncMessageToPage.
47 // NOTE: precondition: sync must be enabled.
48 void BuildAndSendSyncStatus();
49
50 // Cached pointer to ProfileSyncService.
51 ProfileSyncService* sync_service_;
52
53 // Used to make sure we don't register ourselves twice if the user refreshes
54 // the new tab page.
55 bool waiting_for_initial_page_load_;
56
57 DISALLOW_COPY_AND_ASSIGN(NewTabPageSyncHandler);
58 };
59
60 #endif // CHROME_BROWSER_DOM_UI_NEW_TAB_PAGE_SYNC_HANDLER_H_
61 #endif // CHROME_PERSONALIZATION
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_factory.cc ('k') | chrome/browser/dom_ui/new_tab_page_sync_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698