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_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 #pragma once | 7 #pragma once |
8 | 8 |
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/time.h" |
12 #include "base/timer.h" | 13 #include "base/timer.h" |
| 14 #include "chrome/browser/prefs/pref_change_registrar.h" |
13 #include "chrome/browser/sessions/tab_restore_service.h" | 15 #include "chrome/browser/sessions/tab_restore_service.h" |
14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
15 #include "chrome/browser/ui/webui/chrome_web_ui.h" | 17 #include "chrome/browser/ui/webui/chrome_web_ui.h" |
16 #include "content/common/notification_observer.h" | 18 #include "content/common/notification_observer.h" |
17 #include "content/common/notification_registrar.h" | 19 #include "content/common/notification_registrar.h" |
18 | 20 |
19 class GURL; | 21 class GURL; |
20 class MessageLoop; | |
21 class PrefService; | 22 class PrefService; |
22 class Profile; | 23 class Profile; |
23 | 24 |
24 // The TabContents used for the New Tab page. | 25 // The TabContents used for the New Tab page. |
25 class NewTabUI : public ChromeWebUI, | 26 class NewTabUI : public ChromeWebUI, |
26 public NotificationObserver { | 27 public NotificationObserver { |
27 public: | 28 public: |
28 explicit NewTabUI(TabContents* manager); | 29 explicit NewTabUI(TabContents* manager); |
29 virtual ~NewTabUI(); | 30 virtual ~NewTabUI(); |
30 | 31 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // Reset the CSS caches. | 86 // Reset the CSS caches. |
86 void InitializeCSSCaches(); | 87 void InitializeCSSCaches(); |
87 | 88 |
88 void StartTimingPaint(RenderViewHost* render_view_host); | 89 void StartTimingPaint(RenderViewHost* render_view_host); |
89 void PaintTimeout(); | 90 void PaintTimeout(); |
90 | 91 |
91 // Updates the user prefs version and calls |MigrateUserPrefs| if needed. | 92 // Updates the user prefs version and calls |MigrateUserPrefs| if needed. |
92 // Returns true if the version was updated. | 93 // Returns true if the version was updated. |
93 static bool UpdateUserPrefsVersion(PrefService* prefs); | 94 static bool UpdateUserPrefsVersion(PrefService* prefs); |
94 | 95 |
| 96 // Overridden from ChromeWebUI. Determines if the bookmarks bar can be shown |
| 97 // detached from the location bar. |
| 98 virtual bool CanShowBookmarkBar() const OVERRIDE; |
| 99 |
95 NotificationRegistrar registrar_; | 100 NotificationRegistrar registrar_; |
96 | 101 |
| 102 // Tracks updates of the kShowBookmarkBar preference. |
| 103 PrefChangeRegistrar pref_change_registrar_; |
97 // The time when we started benchmarking. | 104 // The time when we started benchmarking. |
98 base::TimeTicks start_; | 105 base::TimeTicks start_; |
99 // The last time we got a paint notification. | 106 // The last time we got a paint notification. |
100 base::TimeTicks last_paint_; | 107 base::TimeTicks last_paint_; |
101 // Scoping so we can be sure our timeouts don't outlive us. | 108 // Scoping so we can be sure our timeouts don't outlive us. |
102 base::OneShotTimer<NewTabUI> timer_; | 109 base::OneShotTimer<NewTabUI> timer_; |
103 // The preference version. This used for migrating prefs of the NTP. | 110 // The preference version. This used for migrating prefs of the NTP. |
104 static const int current_pref_version_ = 3; | 111 static const int current_pref_version_ = 3; |
105 | 112 |
106 DISALLOW_COPY_AND_ASSIGN(NewTabUI); | 113 DISALLOW_COPY_AND_ASSIGN(NewTabUI); |
107 }; | 114 }; |
108 | 115 |
109 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ | 116 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ |
OLD | NEW |