| 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 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 5 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } | 221 } |
| 222 | 222 |
| 223 void NewTabUI::OnShowBookmarkBarChanged() { | 223 void NewTabUI::OnShowBookmarkBarChanged() { |
| 224 StringValue attached( | 224 StringValue attached( |
| 225 GetProfile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) ? | 225 GetProfile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) ? |
| 226 "true" : "false"); | 226 "true" : "false"); |
| 227 web_ui()->CallJavascriptFunction("ntp.setBookmarkBarAttached", attached); | 227 web_ui()->CallJavascriptFunction("ntp.setBookmarkBarAttached", attached); |
| 228 } | 228 } |
| 229 | 229 |
| 230 // static | 230 // static |
| 231 void NewTabUI::RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry) { | 231 void NewTabUI::RegisterProfilePrefs( |
| 232 user_prefs::PrefRegistrySyncable* registry) { |
| 232 #if !defined(OS_ANDROID) | 233 #if !defined(OS_ANDROID) |
| 233 AppLauncherHandler::RegisterUserPrefs(registry); | 234 AppLauncherHandler::RegisterProfilePrefs(registry); |
| 234 NewTabPageHandler::RegisterUserPrefs(registry); | 235 NewTabPageHandler::RegisterProfilePrefs(registry); |
| 235 if (NewTabUI::IsDiscoveryInNTPEnabled()) | 236 if (NewTabUI::IsDiscoveryInNTPEnabled()) |
| 236 SuggestionsHandler::RegisterUserPrefs(registry); | 237 SuggestionsHandler::RegisterProfilePrefs(registry); |
| 237 #endif | 238 #endif |
| 238 MostVisitedHandler::RegisterUserPrefs(registry); | 239 MostVisitedHandler::RegisterProfilePrefs(registry); |
| 239 browser_sync::ForeignSessionHandler::RegisterUserPrefs(registry); | 240 browser_sync::ForeignSessionHandler::RegisterProfilePrefs(registry); |
| 240 } | 241 } |
| 241 | 242 |
| 242 // static | 243 // static |
| 243 bool NewTabUI::ShouldShowApps() { | 244 bool NewTabUI::ShouldShowApps() { |
| 244 // Ash shows apps in app list thus should not show apps page in NTP4. | 245 // Ash shows apps in app list thus should not show apps page in NTP4. |
| 245 // Android does not have apps. | 246 // Android does not have apps. |
| 246 #if defined(OS_ANDROID) | 247 #if defined(OS_ANDROID) |
| 247 return false; | 248 return false; |
| 248 #elif defined(USE_ASH) | 249 #elif defined(USE_ASH) |
| 249 return chrome::GetActiveDesktop() != chrome::HOST_DESKTOP_TYPE_ASH; | 250 return chrome::GetActiveDesktop() != chrome::HOST_DESKTOP_TYPE_ASH; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, | 382 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, |
| 382 const char* mime_type, | 383 const char* mime_type, |
| 383 int resource_id) { | 384 int resource_id) { |
| 384 DCHECK(resource); | 385 DCHECK(resource); |
| 385 DCHECK(mime_type); | 386 DCHECK(mime_type); |
| 386 resource_map_[std::string(resource)] = | 387 resource_map_[std::string(resource)] = |
| 387 std::make_pair(std::string(mime_type), resource_id); | 388 std::make_pair(std::string(mime_type), resource_id); |
| 388 } | 389 } |
| 389 | 390 |
| 390 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} | 391 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} |
| OLD | NEW |