Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(648)

Side by Side Diff: chrome/browser/ui/webui/ntp/new_tab_ui.cc

Issue 9188056: Start splitting out WebUI into an implementation class and an interface that each page implements... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_ui.h ('k') | chrome/browser/ui/webui/options/options_ui.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <set> 9 #include <set>
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 const char kLTRHtmlTextDirection[] = "ltr"; 68 const char kLTRHtmlTextDirection[] = "ltr";
69 69
70 static base::LazyInstance<std::set<const WebUI*> > g_live_new_tabs; 70 static base::LazyInstance<std::set<const WebUI*> > g_live_new_tabs;
71 71
72 } // namespace 72 } // namespace
73 73
74 /////////////////////////////////////////////////////////////////////////////// 74 ///////////////////////////////////////////////////////////////////////////////
75 // NewTabUI 75 // NewTabUI
76 76
77 NewTabUI::NewTabUI(WebContents* contents) 77 NewTabUI::NewTabUI(WebContents* contents)
78 : WebUI(contents) { 78 : WebUI(contents, this) {
79 g_live_new_tabs.Pointer()->insert(this); 79 g_live_new_tabs.Pointer()->insert(this);
80 // Override some options on the Web UI. 80 // Override some options on the Web UI.
81 hide_favicon_ = true; 81 hide_favicon_ = true;
82 82
83 focus_location_bar_by_default_ = true; 83 focus_location_bar_by_default_ = true;
84 should_hide_url_ = true; 84 should_hide_url_ = true;
85 overridden_title_ = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE); 85 overridden_title_ = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE);
86 86
87 // We count all link clicks as AUTO_BOOKMARK, so that site can be ranked more 87 // We count all link clicks as AUTO_BOOKMARK, so that site can be ranked more
88 // highly. Note this means we're including clicks on not only most visited 88 // highly. Note this means we're including clicks on not only most visited
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 bool NewTabUI::CanShowBookmarkBar() const { 165 bool NewTabUI::CanShowBookmarkBar() const {
166 PrefService* prefs = GetProfile()->GetPrefs(); 166 PrefService* prefs = GetProfile()->GetPrefs();
167 bool disabled_by_policy = 167 bool disabled_by_policy =
168 prefs->IsManagedPreference(prefs::kShowBookmarkBar) && 168 prefs->IsManagedPreference(prefs::kShowBookmarkBar) &&
169 !prefs->GetBoolean(prefs::kShowBookmarkBar); 169 !prefs->GetBoolean(prefs::kShowBookmarkBar);
170 return browser_defaults::bookmarks_enabled && !disabled_by_policy; 170 return browser_defaults::bookmarks_enabled && !disabled_by_policy;
171 } 171 }
172 172
173 void NewTabUI::RenderViewCreated(RenderViewHost* render_view_host) { 173 void NewTabUI::RenderViewCreated(RenderViewHost* render_view_host) {
174 StartTimingPaint(render_view_host); 174 StartTimingPaint(render_view_host);
175 WebUI::RenderViewCreated(render_view_host);
176 } 175 }
177 176
178 void NewTabUI::RenderViewReused(RenderViewHost* render_view_host) { 177 void NewTabUI::RenderViewReused(RenderViewHost* render_view_host) {
179 StartTimingPaint(render_view_host); 178 StartTimingPaint(render_view_host);
180 WebUI::RenderViewReused(render_view_host);
181 } 179 }
182 180
183 void NewTabUI::Observe(int type, 181 void NewTabUI::Observe(int type,
184 const content::NotificationSource& source, 182 const content::NotificationSource& source,
185 const content::NotificationDetails& details) { 183 const content::NotificationDetails& details) {
186 switch (type) { 184 switch (type) {
187 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: { 185 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: {
188 InitializeCSSCaches(); 186 InitializeCSSCaches();
189 ListValue args; 187 ListValue args;
190 args.Append(Value::CreateStringValue( 188 args.Append(Value::CreateStringValue(
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 SendResponse(request_id, html_bytes); 288 SendResponse(request_id, html_bytes);
291 } 289 }
292 290
293 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { 291 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const {
294 return "text/html"; 292 return "text/html";
295 } 293 }
296 294
297 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const { 295 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const {
298 return false; 296 return false;
299 } 297 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_ui.h ('k') | chrome/browser/ui/webui/options/options_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698