| 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_SHOWN_SECTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_SHOWN_SECTIONS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_NTP_SHOWN_SECTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_NTP_SHOWN_SECTIONS_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/prefs/pref_change_registrar.h" | 9 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 10 #include "content/browser/webui/web_ui.h" | 10 #include "content/browser/webui/web_ui.h" |
| 11 #include "content/common/notification_observer.h" | 11 #include "content/common/notification_observer.h" |
| 12 | 12 |
| 13 class Extension; | 13 class Extension; |
| 14 class PrefService; |
| 15 |
| 16 namespace base { |
| 14 class Value; | 17 class Value; |
| 15 class PrefService; | 18 } |
| 16 | 19 |
| 17 // Use for the shown sections bitmask. | 20 // Use for the shown sections bitmask. |
| 18 // Currently, only the THUMB and APPS sections can be toggled by the user. Other | 21 // Currently, only the THUMB and APPS sections can be toggled by the user. Other |
| 19 // sections are shown automatically if they have data, and hidden otherwise. | 22 // sections are shown automatically if they have data, and hidden otherwise. |
| 20 enum Section { | 23 enum Section { |
| 21 // If one of these is set, the corresponding section shows large thumbnails, | 24 // If one of these is set, the corresponding section shows large thumbnails, |
| 22 // else it shows only a small overview list. | 25 // else it shows only a small overview list. |
| 23 THUMB = 1 << 0, | 26 THUMB = 1 << 0, |
| 24 APPS = 1 << 6, | 27 APPS = 1 << 6, |
| 25 | 28 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 48 | 51 |
| 49 // WebUIMessageHandler implementation. | 52 // WebUIMessageHandler implementation. |
| 50 virtual void RegisterMessages(); | 53 virtual void RegisterMessages(); |
| 51 | 54 |
| 52 // NotificationObserver implementation. | 55 // NotificationObserver implementation. |
| 53 virtual void Observe(int type, | 56 virtual void Observe(int type, |
| 54 const NotificationSource& source, | 57 const NotificationSource& source, |
| 55 const NotificationDetails& details); | 58 const NotificationDetails& details); |
| 56 | 59 |
| 57 // Callback for "getShownSections" message. | 60 // Callback for "getShownSections" message. |
| 58 void HandleGetShownSections(const ListValue* args); | 61 void HandleGetShownSections(const base::ListValue* args); |
| 59 | 62 |
| 60 // Callback for "setShownSections" message. | 63 // Callback for "setShownSections" message. |
| 61 void HandleSetShownSections(const ListValue* args); | 64 void HandleSetShownSections(const base::ListValue* args); |
| 62 | 65 |
| 63 static void RegisterUserPrefs(PrefService* pref_service); | 66 static void RegisterUserPrefs(PrefService* pref_service); |
| 64 | 67 |
| 65 static void MigrateUserPrefs(PrefService* pref_service, | 68 static void MigrateUserPrefs(PrefService* pref_service, |
| 66 int old_pref_version, | 69 int old_pref_version, |
| 67 int new_pref_version); | 70 int new_pref_version); |
| 68 | 71 |
| 69 static void OnExtensionInstalled(PrefService* prefs, | 72 static void OnExtensionInstalled(PrefService* prefs, |
| 70 const Extension* extension); | 73 const Extension* extension); |
| 71 | 74 |
| 72 private: | 75 private: |
| 73 PrefService* pref_service_; | 76 PrefService* pref_service_; |
| 74 PrefChangeRegistrar pref_registrar_; | 77 PrefChangeRegistrar pref_registrar_; |
| 75 | 78 |
| 76 DISALLOW_COPY_AND_ASSIGN(ShownSectionsHandler); | 79 DISALLOW_COPY_AND_ASSIGN(ShownSectionsHandler); |
| 77 }; | 80 }; |
| 78 | 81 |
| 79 #endif // CHROME_BROWSER_UI_WEBUI_NTP_SHOWN_SECTIONS_HANDLER_H_ | 82 #endif // CHROME_BROWSER_UI_WEBUI_NTP_SHOWN_SECTIONS_HANDLER_H_ |
| OLD | NEW |