OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_NEW_TAB_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/prefs/public/pref_change_registrar.h" | 12 #include "base/prefs/public/pref_change_registrar.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
14 #include "base/timer.h" | 14 #include "base/timer.h" |
15 #include "chrome/browser/sessions/tab_restore_service.h" | 15 #include "chrome/browser/sessions/tab_restore_service.h" |
16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
17 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
19 #include "content/public/browser/web_ui_controller.h" | 19 #include "content/public/browser/web_ui_controller.h" |
20 | 20 |
21 class GURL; | 21 class GURL; |
22 class PrefService; | 22 class PrefServiceSyncable; |
23 class Profile; | 23 class Profile; |
24 | 24 |
25 // The WebContents used for the New Tab page. | 25 // The WebContents used for the New Tab page. |
26 class NewTabUI : public content::WebUIController, | 26 class NewTabUI : public content::WebUIController, |
27 public content::NotificationObserver { | 27 public content::NotificationObserver { |
28 public: | 28 public: |
29 explicit NewTabUI(content::WebUI* web_ui); | 29 explicit NewTabUI(content::WebUI* web_ui); |
30 virtual ~NewTabUI(); | 30 virtual ~NewTabUI(); |
31 | 31 |
32 static void RegisterUserPrefs(PrefService* prefs); | 32 static void RegisterUserPrefs(PrefServiceSyncable* prefs); |
33 | 33 |
34 // Returns whether or not to show apps pages. | 34 // Returns whether or not to show apps pages. |
35 static bool ShouldShowApps(); | 35 static bool ShouldShowApps(); |
36 | 36 |
37 // Returns whether or not "Discovery" in the NTP is Enabled. | 37 // Returns whether or not "Discovery" in the NTP is Enabled. |
38 static bool IsDiscoveryInNTPEnabled(); | 38 static bool IsDiscoveryInNTPEnabled(); |
39 | 39 |
40 // Adds "url", "title", and "direction" keys on incoming dictionary, setting | 40 // Adds "url", "title", and "direction" keys on incoming dictionary, setting |
41 // title as the url as a fallback on empty title. | 41 // title as the url as a fallback on empty title. |
42 static void SetUrlTitleAndDirection(base::DictionaryValue* dictionary, | 42 static void SetUrlTitleAndDirection(base::DictionaryValue* dictionary, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 // If the sync promo NTP bubble is being shown. | 128 // If the sync promo NTP bubble is being shown. |
129 bool showing_sync_bubble_; | 129 bool showing_sync_bubble_; |
130 | 130 |
131 PrefChangeRegistrar pref_change_registrar_; | 131 PrefChangeRegistrar pref_change_registrar_; |
132 | 132 |
133 DISALLOW_COPY_AND_ASSIGN(NewTabUI); | 133 DISALLOW_COPY_AND_ASSIGN(NewTabUI); |
134 }; | 134 }; |
135 | 135 |
136 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ | 136 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ |
OLD | NEW |