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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 7 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 } | 147 } |
148 | 148 |
149 void NewTabUI::StartTimingPaint(RenderViewHost* render_view_host) { | 149 void NewTabUI::StartTimingPaint(RenderViewHost* render_view_host) { |
150 start_ = base::TimeTicks::Now(); | 150 start_ = base::TimeTicks::Now(); |
151 last_paint_ = start_; | 151 last_paint_ = start_; |
152 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, | 152 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, |
153 content::Source<RenderWidgetHost>(render_view_host)); | 153 content::Source<RenderWidgetHost>(render_view_host)); |
154 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kTimeoutMs), this, | 154 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kTimeoutMs), this, |
155 &NewTabUI::PaintTimeout); | 155 &NewTabUI::PaintTimeout); |
156 | 156 |
157 } | 157 } |
Evan Stade
2011/11/30 23:36:09
\n
Rick Byers
2011/12/01 01:29:24
Done.
| |
158 void NewTabUI::RenderViewCreated(RenderViewHost* render_view_host) { | 158 void NewTabUI::RenderViewCreated(RenderViewHost* render_view_host) { |
159 StartTimingPaint(render_view_host); | 159 StartTimingPaint(render_view_host); |
160 ChromeWebUI::RenderViewCreated(render_view_host); | |
160 } | 161 } |
161 | 162 |
162 void NewTabUI::RenderViewReused(RenderViewHost* render_view_host) { | 163 void NewTabUI::RenderViewReused(RenderViewHost* render_view_host) { |
163 StartTimingPaint(render_view_host); | 164 StartTimingPaint(render_view_host); |
165 ChromeWebUI::RenderViewReused(render_view_host); | |
164 } | 166 } |
165 | 167 |
166 bool NewTabUI::CanShowBookmarkBar() const { | 168 bool NewTabUI::CanShowBookmarkBar() const { |
167 PrefService* prefs = GetProfile()->GetPrefs(); | 169 PrefService* prefs = GetProfile()->GetPrefs(); |
168 bool disabled_by_policy = | 170 bool disabled_by_policy = |
169 prefs->IsManagedPreference(prefs::kShowBookmarkBar) && | 171 prefs->IsManagedPreference(prefs::kShowBookmarkBar) && |
170 !prefs->GetBoolean(prefs::kShowBookmarkBar); | 172 !prefs->GetBoolean(prefs::kShowBookmarkBar); |
171 return browser_defaults::bookmarks_enabled && | 173 return browser_defaults::bookmarks_enabled && |
172 !disabled_by_policy && | 174 !disabled_by_policy && |
173 !NTP4BookmarkFeaturesEnabled(); | 175 !NTP4BookmarkFeaturesEnabled(); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 SendResponse(request_id, html_bytes); | 281 SendResponse(request_id, html_bytes); |
280 } | 282 } |
281 | 283 |
282 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { | 284 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { |
283 return "text/html"; | 285 return "text/html"; |
284 } | 286 } |
285 | 287 |
286 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const { | 288 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const { |
287 return false; | 289 return false; |
288 } | 290 } |
OLD | NEW |