| 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 "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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // We might not have an ExtensionService (on ChromeOS when not logged in | 129 // We might not have an ExtensionService (on ChromeOS when not logged in |
| 130 // for example). | 130 // for example). |
| 131 if (service) | 131 if (service) |
| 132 web_ui->AddMessageHandler(new AppLauncherHandler(service)); | 132 web_ui->AddMessageHandler(new AppLauncherHandler(service)); |
| 133 } | 133 } |
| 134 | 134 |
| 135 web_ui->AddMessageHandler(new NewTabPageHandler()); | 135 web_ui->AddMessageHandler(new NewTabPageHandler()); |
| 136 web_ui->AddMessageHandler(new FaviconWebUIHandler()); | 136 web_ui->AddMessageHandler(new FaviconWebUIHandler()); |
| 137 } | 137 } |
| 138 | 138 |
| 139 #if !defined(OS_ANDROID) |
| 140 // Android uses native UI for sync setup. |
| 139 if (NTPLoginHandler::ShouldShow(GetProfile())) | 141 if (NTPLoginHandler::ShouldShow(GetProfile())) |
| 140 web_ui->AddMessageHandler(new NTPLoginHandler()); | 142 web_ui->AddMessageHandler(new NTPLoginHandler()); |
| 143 #endif |
| 141 | 144 |
| 142 // Initializing the CSS and HTML can require some CPU, so do it after | 145 // Initializing the CSS and HTML can require some CPU, so do it after |
| 143 // we've hooked up the most visited handler. This allows the DB query | 146 // we've hooked up the most visited handler. This allows the DB query |
| 144 // for the new tab thumbs to happen earlier. | 147 // for the new tab thumbs to happen earlier. |
| 145 InitializeCSSCaches(); | 148 InitializeCSSCaches(); |
| 146 NewTabHTMLSource* html_source = | 149 NewTabHTMLSource* html_source = |
| 147 new NewTabHTMLSource(GetProfile()->GetOriginalProfile()); | 150 new NewTabHTMLSource(GetProfile()->GetOriginalProfile()); |
| 148 // These two resources should be loaded only if suggestions NTP is enabled. | 151 // These two resources should be loaded only if suggestions NTP is enabled. |
| 149 html_source->AddResource("suggestions_page.css", "text/css", | 152 html_source->AddResource("suggestions_page.css", "text/css", |
| 150 NewTabUI::IsSuggestionsPageEnabled() ? IDR_SUGGESTIONS_PAGE_CSS : 0); | 153 NewTabUI::IsSuggestionsPageEnabled() ? IDR_SUGGESTIONS_PAGE_CSS : 0); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 } | 417 } |
| 415 | 418 |
| 416 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, | 419 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, |
| 417 const char* mime_type, | 420 const char* mime_type, |
| 418 int resource_id) { | 421 int resource_id) { |
| 419 DCHECK(resource); | 422 DCHECK(resource); |
| 420 DCHECK(mime_type); | 423 DCHECK(mime_type); |
| 421 resource_map_[std::string(resource)] = | 424 resource_map_[std::string(resource)] = |
| 422 std::make_pair(std::string(mime_type), resource_id); | 425 std::make_pair(std::string(mime_type), resource_id); |
| 423 } | 426 } |
| OLD | NEW |