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 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 explicit NewTabHTMLSource(Profile* profile); | 56 explicit NewTabHTMLSource(Profile* profile); |
57 | 57 |
58 // Called when the network layer has requested a resource underneath | 58 // Called when the network layer has requested a resource underneath |
59 // the path we registered. | 59 // the path we registered. |
60 virtual void StartDataRequest(const std::string& path, | 60 virtual void StartDataRequest(const std::string& path, |
61 bool is_incognito, | 61 bool is_incognito, |
62 int request_id) OVERRIDE; | 62 int request_id) OVERRIDE; |
63 | 63 |
64 virtual std::string GetMimeType(const std::string&) const OVERRIDE; | 64 virtual std::string GetMimeType(const std::string&) const OVERRIDE; |
65 | 65 |
66 virtual bool ShouldReplaceExistingSource() const; | 66 virtual bool ShouldReplaceExistingSource() const OVERRIDE; |
67 | 67 |
68 private: | 68 private: |
69 virtual ~NewTabHTMLSource() {} | 69 virtual ~NewTabHTMLSource() {} |
70 | 70 |
71 // Pointer back to the original profile. | 71 // Pointer back to the original profile. |
72 Profile* profile_; | 72 Profile* profile_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(NewTabHTMLSource); | 74 DISALLOW_COPY_AND_ASSIGN(NewTabHTMLSource); |
75 }; | 75 }; |
76 | 76 |
77 private: | 77 private: |
78 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion); | 78 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion); |
79 | 79 |
80 virtual void Observe(int type, | 80 virtual void Observe(int type, |
81 const content::NotificationSource& source, | 81 const content::NotificationSource& source, |
82 const content::NotificationDetails& details); | 82 const content::NotificationDetails& details) OVERRIDE; |
83 | 83 |
84 // Reset the CSS caches. | 84 // Reset the CSS caches. |
85 void InitializeCSSCaches(); | 85 void InitializeCSSCaches(); |
86 | 86 |
87 void StartTimingPaint(RenderViewHost* render_view_host); | 87 void StartTimingPaint(RenderViewHost* render_view_host); |
88 void PaintTimeout(); | 88 void PaintTimeout(); |
89 | 89 |
90 // Overridden from ChromeWebUI. Determines if the bookmarks bar can be shown | 90 // Overridden from ChromeWebUI. Determines if the bookmarks bar can be shown |
91 // detached from the location bar. | 91 // detached from the location bar. |
92 virtual bool CanShowBookmarkBar() const OVERRIDE; | 92 virtual bool CanShowBookmarkBar() const OVERRIDE; |
93 | 93 |
94 content::NotificationRegistrar registrar_; | 94 content::NotificationRegistrar registrar_; |
95 | 95 |
96 // Tracks updates of the kShowBookmarkBar preference. | 96 // Tracks updates of the kShowBookmarkBar preference. |
97 PrefChangeRegistrar pref_change_registrar_; | 97 PrefChangeRegistrar pref_change_registrar_; |
98 // The time when we started benchmarking. | 98 // The time when we started benchmarking. |
99 base::TimeTicks start_; | 99 base::TimeTicks start_; |
100 // The last time we got a paint notification. | 100 // The last time we got a paint notification. |
101 base::TimeTicks last_paint_; | 101 base::TimeTicks last_paint_; |
102 // Scoping so we can be sure our timeouts don't outlive us. | 102 // Scoping so we can be sure our timeouts don't outlive us. |
103 base::OneShotTimer<NewTabUI> timer_; | 103 base::OneShotTimer<NewTabUI> timer_; |
104 // The preference version. This used for migrating prefs of the NTP. | 104 // The preference version. This used for migrating prefs of the NTP. |
105 static const int current_pref_version_ = 3; | 105 static const int current_pref_version_ = 3; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(NewTabUI); | 107 DISALLOW_COPY_AND_ASSIGN(NewTabUI); |
108 }; | 108 }; |
109 | 109 |
110 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ | 110 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ |
OLD | NEW |