| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const GURL& gurl); | 55 const GURL& gurl); |
| 56 | 56 |
| 57 // Returns a pointer to a NewTabUI if the WebUIController object is a new tab | 57 // Returns a pointer to a NewTabUI if the WebUIController object is a new tab |
| 58 // page. | 58 // page. |
| 59 static NewTabUI* FromWebUIController(content::WebUIController* ui); | 59 static NewTabUI* FromWebUIController(content::WebUIController* ui); |
| 60 | 60 |
| 61 // The current preference version. | 61 // The current preference version. |
| 62 static int current_pref_version() { return current_pref_version_; } | 62 static int current_pref_version() { return current_pref_version_; } |
| 63 | 63 |
| 64 // WebUIController implementation: | 64 // WebUIController implementation: |
| 65 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; | 65 virtual void RenderViewCreated( |
| 66 virtual void RenderViewReused(RenderViewHost* render_view_host) OVERRIDE; | 66 content::RenderViewHost* render_view_host) OVERRIDE; |
| 67 virtual void RenderViewReused( |
| 68 content::RenderViewHost* render_view_host) OVERRIDE; |
| 67 | 69 |
| 68 // Returns true if the bookmark bar can be displayed over this webui, detached | 70 // Returns true if the bookmark bar can be displayed over this webui, detached |
| 69 // from the location bar. | 71 // from the location bar. |
| 70 bool CanShowBookmarkBar() const; | 72 bool CanShowBookmarkBar() const; |
| 71 | 73 |
| 72 bool showing_sync_bubble() { return showing_sync_bubble_; } | 74 bool showing_sync_bubble() { return showing_sync_bubble_; } |
| 73 void set_showing_sync_bubble(bool showing) { showing_sync_bubble_ = showing; } | 75 void set_showing_sync_bubble(bool showing) { showing_sync_bubble_ = showing; } |
| 74 | 76 |
| 75 class NewTabHTMLSource : public ChromeURLDataManager::DataSource { | 77 class NewTabHTMLSource : public ChromeURLDataManager::DataSource { |
| 76 public: | 78 public: |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 private: | 110 private: |
| 109 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion); | 111 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion); |
| 110 | 112 |
| 111 virtual void Observe(int type, | 113 virtual void Observe(int type, |
| 112 const content::NotificationSource& source, | 114 const content::NotificationSource& source, |
| 113 const content::NotificationDetails& details) OVERRIDE; | 115 const content::NotificationDetails& details) OVERRIDE; |
| 114 | 116 |
| 115 // Reset the CSS caches. | 117 // Reset the CSS caches. |
| 116 void InitializeCSSCaches(); | 118 void InitializeCSSCaches(); |
| 117 | 119 |
| 118 void StartTimingPaint(RenderViewHost* render_view_host); | 120 void StartTimingPaint(content::RenderViewHost* render_view_host); |
| 119 void PaintTimeout(); | 121 void PaintTimeout(); |
| 120 | 122 |
| 121 Profile* GetProfile() const; | 123 Profile* GetProfile() const; |
| 122 | 124 |
| 123 content::NotificationRegistrar registrar_; | 125 content::NotificationRegistrar registrar_; |
| 124 | 126 |
| 125 // The time when we started benchmarking. | 127 // The time when we started benchmarking. |
| 126 base::TimeTicks start_; | 128 base::TimeTicks start_; |
| 127 // The last time we got a paint notification. | 129 // The last time we got a paint notification. |
| 128 base::TimeTicks last_paint_; | 130 base::TimeTicks last_paint_; |
| 129 // Scoping so we can be sure our timeouts don't outlive us. | 131 // Scoping so we can be sure our timeouts don't outlive us. |
| 130 base::OneShotTimer<NewTabUI> timer_; | 132 base::OneShotTimer<NewTabUI> timer_; |
| 131 // The preference version. This used for migrating prefs of the NTP. | 133 // The preference version. This used for migrating prefs of the NTP. |
| 132 static const int current_pref_version_ = 3; | 134 static const int current_pref_version_ = 3; |
| 133 | 135 |
| 134 // If the sync promo NTP bubble is being shown. | 136 // If the sync promo NTP bubble is being shown. |
| 135 bool showing_sync_bubble_; | 137 bool showing_sync_bubble_; |
| 136 | 138 |
| 137 PrefChangeRegistrar pref_change_registrar_; | 139 PrefChangeRegistrar pref_change_registrar_; |
| 138 | 140 |
| 139 DISALLOW_COPY_AND_ASSIGN(NewTabUI); | 141 DISALLOW_COPY_AND_ASSIGN(NewTabUI); |
| 140 }; | 142 }; |
| 141 | 143 |
| 142 extern const char kWebStoreLinkExperiment[]; | 144 extern const char kWebStoreLinkExperiment[]; |
| 143 | 145 |
| 144 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ | 146 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ |
| OLD | NEW |