Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 26 #include "chrome/browser/sync/profile_sync_service.h" | 26 #include "chrome/browser/sync/profile_sync_service.h" |
| 27 #include "chrome/browser/themes/theme_service_factory.h" | 27 #include "chrome/browser/themes/theme_service_factory.h" |
| 28 #include "chrome/browser/themes/theme_service.h" | 28 #include "chrome/browser/themes/theme_service.h" |
| 29 #include "chrome/browser/ui/browser.h" | 29 #include "chrome/browser/ui/browser.h" |
| 30 #include "chrome/browser/ui/webui/metrics_handler.h" | 30 #include "chrome/browser/ui/webui/metrics_handler.h" |
| 31 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 31 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 32 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h" | 32 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h" |
| 33 #include "chrome/browser/ui/webui/ntp/foreign_session_handler.h" | 33 #include "chrome/browser/ui/webui/ntp/foreign_session_handler.h" |
| 34 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" | 34 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" |
| 35 #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h" | 35 #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h" |
| 36 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h" | 36 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h" |
|
Jesse Greenwald
2012/03/01 21:10:16
#ifdef out this include?
Yaron
2012/03/01 21:16:48
Done.
| |
| 37 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" | 37 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" |
| 38 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h" | 38 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h" |
| 39 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" | 39 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" |
| 40 #include "chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.h" | 40 #include "chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.h" |
| 41 #include "chrome/browser/ui/webui/ntp/suggestions_page_handler.h" | 41 #include "chrome/browser/ui/webui/ntp/suggestions_page_handler.h" |
| 42 #include "chrome/browser/ui/webui/theme_source.h" | 42 #include "chrome/browser/ui/webui/theme_source.h" |
| 43 #include "chrome/common/chrome_notification_types.h" | 43 #include "chrome/common/chrome_notification_types.h" |
| 44 #include "chrome/common/chrome_switches.h" | 44 #include "chrome/common/chrome_switches.h" |
| 45 #include "chrome/common/extensions/extension.h" | 45 #include "chrome/common/extensions/extension.h" |
| 46 #include "chrome/common/pref_names.h" | 46 #include "chrome/common/pref_names.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 // thumbnails, but also clicks on recently bookmarked. | 107 // thumbnails, but also clicks on recently bookmarked. |
| 108 web_ui->SetLinkTransitionType(content::PAGE_TRANSITION_AUTO_BOOKMARK); | 108 web_ui->SetLinkTransitionType(content::PAGE_TRANSITION_AUTO_BOOKMARK); |
| 109 | 109 |
| 110 if (!GetProfile()->IsOffTheRecord()) { | 110 if (!GetProfile()->IsOffTheRecord()) { |
| 111 web_ui->AddMessageHandler(new browser_sync::ForeignSessionHandler()); | 111 web_ui->AddMessageHandler(new browser_sync::ForeignSessionHandler()); |
| 112 web_ui->AddMessageHandler(new MostVisitedHandler()); | 112 web_ui->AddMessageHandler(new MostVisitedHandler()); |
| 113 if (NewTabUI::IsSuggestionsPageEnabled()) | 113 if (NewTabUI::IsSuggestionsPageEnabled()) |
| 114 web_ui->AddMessageHandler(new SuggestionsHandler()); | 114 web_ui->AddMessageHandler(new SuggestionsHandler()); |
| 115 web_ui->AddMessageHandler(new RecentlyClosedTabsHandler()); | 115 web_ui->AddMessageHandler(new RecentlyClosedTabsHandler()); |
| 116 web_ui->AddMessageHandler(new MetricsHandler()); | 116 web_ui->AddMessageHandler(new MetricsHandler()); |
| 117 #if !defined(OS_ANDROID) | |
| 118 // Android does't have a sync promo/username on NTP | |
| 117 if (GetProfile()->IsSyncAccessible()) | 119 if (GetProfile()->IsSyncAccessible()) |
| 118 web_ui->AddMessageHandler(new NewTabPageSyncHandler()); | 120 web_ui->AddMessageHandler(new NewTabPageSyncHandler()); |
| 121 #endif | |
| 119 ExtensionService* service = GetProfile()->GetExtensionService(); | 122 ExtensionService* service = GetProfile()->GetExtensionService(); |
| 120 // We might not have an ExtensionService (on ChromeOS when not logged in | 123 // We might not have an ExtensionService (on ChromeOS when not logged in |
| 121 // for example). | 124 // for example). |
| 122 if (service) | 125 if (service) |
| 123 web_ui->AddMessageHandler(new AppLauncherHandler(service)); | 126 web_ui->AddMessageHandler(new AppLauncherHandler(service)); |
| 124 | 127 |
| 125 web_ui->AddMessageHandler(new NewTabPageHandler()); | 128 web_ui->AddMessageHandler(new NewTabPageHandler()); |
| 126 web_ui->AddMessageHandler(new FaviconWebUIHandler()); | 129 web_ui->AddMessageHandler(new FaviconWebUIHandler()); |
| 127 } | 130 } |
| 128 | 131 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 } | 390 } |
| 388 | 391 |
| 389 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, | 392 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, |
| 390 const char* mime_type, | 393 const char* mime_type, |
| 391 int resource_id) { | 394 int resource_id) { |
| 392 DCHECK(resource); | 395 DCHECK(resource); |
| 393 DCHECK(mime_type); | 396 DCHECK(mime_type); |
| 394 resource_map_[std::string(resource)] = | 397 resource_map_[std::string(resource)] = |
| 395 std::make_pair(std::string(mime_type), resource_id); | 398 std::make_pair(std::string(mime_type), resource_id); |
| 396 } | 399 } |
| OLD | NEW |