| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| 158 |
| 158 void NewTabUI::RenderViewCreated(RenderViewHost* render_view_host) { | 159 void NewTabUI::RenderViewCreated(RenderViewHost* render_view_host) { |
| 159 StartTimingPaint(render_view_host); | 160 StartTimingPaint(render_view_host); |
| 161 ChromeWebUI::RenderViewCreated(render_view_host); |
| 160 } | 162 } |
| 161 | 163 |
| 162 void NewTabUI::RenderViewReused(RenderViewHost* render_view_host) { | 164 void NewTabUI::RenderViewReused(RenderViewHost* render_view_host) { |
| 163 StartTimingPaint(render_view_host); | 165 StartTimingPaint(render_view_host); |
| 166 ChromeWebUI::RenderViewReused(render_view_host); |
| 164 } | 167 } |
| 165 | 168 |
| 166 bool NewTabUI::CanShowBookmarkBar() const { | 169 bool NewTabUI::CanShowBookmarkBar() const { |
| 167 PrefService* prefs = GetProfile()->GetPrefs(); | 170 PrefService* prefs = GetProfile()->GetPrefs(); |
| 168 bool disabled_by_policy = | 171 bool disabled_by_policy = |
| 169 prefs->IsManagedPreference(prefs::kShowBookmarkBar) && | 172 prefs->IsManagedPreference(prefs::kShowBookmarkBar) && |
| 170 !prefs->GetBoolean(prefs::kShowBookmarkBar); | 173 !prefs->GetBoolean(prefs::kShowBookmarkBar); |
| 171 return browser_defaults::bookmarks_enabled && | 174 return browser_defaults::bookmarks_enabled && |
| 172 !disabled_by_policy && | 175 !disabled_by_policy && |
| 173 !NTP4BookmarkFeaturesEnabled(); | 176 !NTP4BookmarkFeaturesEnabled(); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 SendResponse(request_id, html_bytes); | 282 SendResponse(request_id, html_bytes); |
| 280 } | 283 } |
| 281 | 284 |
| 282 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { | 285 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { |
| 283 return "text/html"; | 286 return "text/html"; |
| 284 } | 287 } |
| 285 | 288 |
| 286 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const { | 289 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const { |
| 287 return false; | 290 return false; |
| 288 } | 291 } |
| OLD | NEW |