OLD | NEW |
(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_VIEWS_OPTIONS_USER_DATA_PAGE_VIEW_H_ |
| 8 #define CHROME_BROWSER_VIEWS_OPTIONS_USER_DATA_PAGE_VIEW_H_ |
| 9 |
| 10 #include "chrome/browser/sync/profile_sync_service.h" |
| 11 #include "chrome/browser/views/options/options_page_view.h" |
| 12 #include "chrome/common/pref_member.h" |
| 13 #include "views/controls/button/button.h" |
| 14 #include "views/controls/link.h" |
| 15 #include "views/view.h" |
| 16 |
| 17 namespace views { |
| 18 class GroupboxView; |
| 19 class Label; |
| 20 class NativeButton; |
| 21 } |
| 22 |
| 23 // TODO(idana): once the p13n module becomes public, we should get rid of the |
| 24 // sync specific options dialog tab and just add a bookmark sync section to the |
| 25 // existing (and newly added) "Personal Stuff" tab. |
| 26 |
| 27 class OptionsGroupView; |
| 28 |
| 29 /////////////////////////////////////////////////////////////////////////////// |
| 30 // UserDataPageView |
| 31 |
| 32 class UserDataPageView : public OptionsPageView, |
| 33 public views::ButtonListener, |
| 34 public views::LinkController, |
| 35 public ProfileSyncServiceObserver { |
| 36 public: |
| 37 explicit UserDataPageView(Profile* profile); |
| 38 virtual ~UserDataPageView(); |
| 39 |
| 40 protected: |
| 41 // views::ButtonListener implementation: |
| 42 virtual void ButtonPressed(views::Button* sender); |
| 43 |
| 44 // views::LinkController method. |
| 45 virtual void LinkActivated(views::Link* source, int event_flags); |
| 46 |
| 47 // OptionsPageView implementation: |
| 48 virtual void InitControlLayout(); |
| 49 virtual void NotifyPrefChanged(const std::wstring* pref_name); |
| 50 virtual void HighlightGroup(OptionsGroup highlight_group); |
| 51 |
| 52 // views::View overrides: |
| 53 virtual void Layout(); |
| 54 |
| 55 // ProfileSyncServiceObserver methods. |
| 56 virtual void OnStateChanged(); |
| 57 |
| 58 private: |
| 59 // Updates various controls based on the current sync state. |
| 60 void UpdateControls(); |
| 61 // Returns whether initialization of controls is done or not. |
| 62 bool IsInitialized() const { |
| 63 // If initialization is already done, all the UI controls data members |
| 64 // should be non-NULL. So check for one of them to determine if controls |
| 65 // are already initialized or not. |
| 66 return sync_group_ != NULL; |
| 67 } |
| 68 // Helper to get status label for synced state. |
| 69 std::wstring GetSyncedStateStatusLabel() const; |
| 70 |
| 71 void InitSyncGroup(); |
| 72 |
| 73 // Controls for the Sync group. |
| 74 OptionsGroupView* sync_group_; |
| 75 views::Label* sync_status_label_; |
| 76 views::Link* sync_action_link_; |
| 77 views::NativeButton* sync_start_stop_button_; |
| 78 |
| 79 // Cached pointer to ProfileSyncService, if it exists. Kept up to date |
| 80 // and NULL-ed out on destruction. |
| 81 ProfileSyncService* sync_service_; |
| 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(UserDataPageView); |
| 84 }; |
| 85 |
| 86 #endif // CHROME_BROWSER_VIEWS_OPTIONS_USER_DATA_PAGE_VIEW_H_ |
| 87 |
| 88 #endif // CHROME_PERSONALIZATION |
OLD | NEW |