| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DOM_UI_SHOWN_SECTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_SHOWN_SECTIONS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_DOM_UI_SHOWN_SECTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_DOM_UI_SHOWN_SECTIONS_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/dom_ui/dom_ui.h" | 9 #include "chrome/browser/dom_ui/dom_ui.h" |
| 10 #include "chrome/common/notification_observer.h" | 10 #include "chrome/common/notification_observer.h" |
| 11 #include "chrome/browser/prefs/pref_change_registrar.h" | 11 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 12 | 12 |
| 13 class DOMUI; | 13 class DOMUI; |
| 14 class Extension; | 14 class Extension; |
| 15 class Value; | 15 class Value; |
| 16 class PrefService; | 16 class PrefService; |
| 17 | 17 |
| 18 // Use for the shown sections bitmask. | 18 // Use for the shown sections bitmask. |
| 19 // Currently, only the THUMB and APPS sections can be toggled by the user. Other | 19 // Currently, only the THUMB and APPS sections can be toggled by the user. Other |
| 20 // sections are shown automatically if they have data, and hidden otherwise. | 20 // sections are shown automatically if they have data, and hidden otherwise. |
| 21 enum Section { | 21 enum Section { |
| 22 // If one of these is set, the corresponding section shows large thumbnails, | 22 // If one of these is set, the corresponding section shows large thumbnails, |
| 23 // else it shows only a small overview list. | 23 // else it shows only a small overview list. |
| 24 THUMB = 1 << 0, | 24 THUMB = 1 << 0, |
| 25 APPS = 1 << 6, | 25 APPS = 1 << 6, |
| 26 | 26 |
| 27 // We use the low 16 bits for sections, the high 16 bits for minimized state. | 27 // We use the low 16 bits for sections, the high 16 bits for menu mode. |
| 28 ALL_SECTIONS_MASK = 0x0000FFFF, | 28 ALL_SECTIONS_MASK = 0x0000FFFF, |
| 29 | 29 |
| 30 // If one of these is set, then the corresponding section is shown minimized | 30 // If one of these is set, then the corresponding section is shown in a menu |
| 31 // at the bottom of the NTP and no data is directly visible on the NTP. | 31 // at the bottom of the NTP and no data is directly visible on the NTP. |
| 32 MINIMIZED_THUMB = 1 << (0 + 16), | 32 MENU_THUMB = 1 << (0 + 16), |
| 33 MINIMIZED_RECENT = 1 << (2 + 16), | 33 MENU_RECENT = 1 << (2 + 16), |
| 34 MINIMIZED_APPS = 1 << (6 + 16), | 34 MENU_APPS = 1 << (6 + 16), |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 class ShownSectionsHandler : public DOMMessageHandler, | 37 class ShownSectionsHandler : public DOMMessageHandler, |
| 38 public NotificationObserver { | 38 public NotificationObserver { |
| 39 public: | 39 public: |
| 40 explicit ShownSectionsHandler(PrefService* pref_service); | 40 explicit ShownSectionsHandler(PrefService* pref_service); |
| 41 virtual ~ShownSectionsHandler() {} | 41 virtual ~ShownSectionsHandler() {} |
| 42 | 42 |
| 43 // Helper to get the current shown sections. | 43 // Helper to get the current shown sections. |
| 44 static int GetShownSections(PrefService* pref_service); | 44 static int GetShownSections(PrefService* pref_service); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 71 const Extension* extension); | 71 const Extension* extension); |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 PrefService* pref_service_; | 74 PrefService* pref_service_; |
| 75 PrefChangeRegistrar pref_registrar_; | 75 PrefChangeRegistrar pref_registrar_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(ShownSectionsHandler); | 77 DISALLOW_COPY_AND_ASSIGN(ShownSectionsHandler); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 #endif // CHROME_BROWSER_DOM_UI_SHOWN_SECTIONS_HANDLER_H_ | 80 #endif // CHROME_BROWSER_DOM_UI_SHOWN_SECTIONS_HANDLER_H_ |
| OLD | NEW |