1 // Copyright (c) 2013 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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_WELCOME_HANDLER_ANDROID_H_
6 #define CHROME_BROWSER_UI_WEBUI_WELCOME_HANDLER_ANDROID_H_
8 #include "base/scoped_observer.h"
9 #include "chrome/browser/sync/profile_sync_service.h"
10 #include "chrome/browser/sync/profile_sync_service_observer.h"
11 #include "content/public/browser/web_ui_message_handler.h"
17 // Handler class for chrome://welcome page.
18 class WelcomeHandler
: public content::WebUIMessageHandler
,
19 public ProfileSyncServiceObserver
{
22 virtual ~WelcomeHandler();
24 // content::WebUIMessageHandler implementation.
25 virtual void RegisterMessages() OVERRIDE
;
27 // Callback for the "updateSyncFooterVisibility" message. This makes the sync
28 // footer in the page visible if sync is enabled.
29 void HandleUpdateSyncFooterVisibility(const base::ListValue
* args
);
31 // Callback for the "showSyncSettings" message. This opens the sync settings
33 void HandleShowSyncSettings(const base::ListValue
* args
);
35 // Callback for the "showTermsOfService" message. This opens the terms of
37 void HandleShowTermsOfService(const base::ListValue
* args
);
39 // ProfileSyncServiceObserver implementation
40 virtual void OnStateChanged() OVERRIDE
;
43 // Update the sync footer visibility. Set |forced| if you want to force to
44 // send an update to the renderer regardless of whether we assume the state
45 // is up to date or not.
46 void UpdateSyncFooterVisibility(bool forced
);
48 // Cached pointer to the sync service for this profile.
49 ProfileSyncService
* sync_service_
;
51 ScopedObserver
<ProfileSyncService
, WelcomeHandler
> observer_manager_
;
53 // Whether the sync footer is visible on the page.
54 bool is_sync_footer_visible_
;
56 DISALLOW_COPY_AND_ASSIGN(WelcomeHandler
);
59 #endif // CHROME_BROWSER_UI_WEBUI_WELCOME_HANDLER_ANDROID_H_