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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 void NewTabUI::RenderViewReused(RenderViewHost* render_view_host) { | 168 void NewTabUI::RenderViewReused(RenderViewHost* render_view_host) { |
169 StartTimingPaint(render_view_host); | 169 StartTimingPaint(render_view_host); |
170 } | 170 } |
171 | 171 |
172 bool NewTabUI::CanShowBookmarkBar() const { | 172 bool NewTabUI::CanShowBookmarkBar() const { |
173 PrefService* prefs = GetProfile()->GetPrefs(); | 173 PrefService* prefs = GetProfile()->GetPrefs(); |
174 bool disabled_by_policy = | 174 bool disabled_by_policy = |
175 prefs->IsManagedPreference(prefs::kShowBookmarkBar) && | 175 prefs->IsManagedPreference(prefs::kShowBookmarkBar) && |
176 !prefs->GetBoolean(prefs::kShowBookmarkBar); | 176 !prefs->GetBoolean(prefs::kShowBookmarkBar); |
177 return | 177 return browser_defaults::bookmarks_enabled && |
178 browser_defaults::bookmarks_enabled && | |
179 !disabled_by_policy && | 178 !disabled_by_policy && |
180 !NTP4BookmarkFeaturesEnabled(); | 179 !NTP4BookmarkFeaturesEnabled(); |
181 } | 180 } |
182 | 181 |
183 void NewTabUI::Observe(int type, | 182 void NewTabUI::Observe(int type, |
184 const NotificationSource& source, | 183 const NotificationSource& source, |
185 const NotificationDetails& details) { | 184 const NotificationDetails& details) { |
186 switch (type) { | 185 switch (type) { |
187 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: { | 186 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: { |
188 InitializeCSSCaches(); | 187 InitializeCSSCaches(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 } | 290 } |
292 dictionary->SetString("title", title_to_set); | 291 dictionary->SetString("title", title_to_set); |
293 dictionary->SetString("direction", direction); | 292 dictionary->SetString("direction", direction); |
294 } | 293 } |
295 | 294 |
296 // static | 295 // static |
297 bool NewTabUI::NTP4Enabled() { | 296 bool NewTabUI::NTP4Enabled() { |
298 #if defined(TOUCH_UI) | 297 #if defined(TOUCH_UI) |
299 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage); | 298 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage); |
300 #else | 299 #else |
301 return !CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage); | 300 return true; |
302 #endif | 301 #endif |
303 } | 302 } |
304 | 303 |
305 // static | 304 // static |
306 bool NewTabUI::NTP4BookmarkFeaturesEnabled() { | 305 bool NewTabUI::NTP4BookmarkFeaturesEnabled() { |
307 CommandLine* cl = CommandLine::ForCurrentProcess(); | 306 CommandLine* cl = CommandLine::ForCurrentProcess(); |
308 return NTP4Enabled() && cl->HasSwitch(switches::kEnableNTPBookmarkFeatures); | 307 return NTP4Enabled() && cl->HasSwitch(switches::kEnableNTPBookmarkFeatures); |
309 } | 308 } |
310 | 309 |
311 /////////////////////////////////////////////////////////////////////////////// | 310 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 25 matching lines...) Expand all Loading... |
337 SendResponse(request_id, html_bytes); | 336 SendResponse(request_id, html_bytes); |
338 } | 337 } |
339 | 338 |
340 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { | 339 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { |
341 return "text/html"; | 340 return "text/html"; |
342 } | 341 } |
343 | 342 |
344 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const { | 343 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const { |
345 return false; | 344 return false; |
346 } | 345 } |
OLD | NEW |