| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 NewTabUI::NewTabUI(content::WebUI* web_ui) | 83 NewTabUI::NewTabUI(content::WebUI* web_ui) |
| 84 : WebUIController(web_ui), | 84 : WebUIController(web_ui), |
| 85 WebContentsObserver(web_ui->GetWebContents()), | 85 WebContentsObserver(web_ui->GetWebContents()), |
| 86 showing_sync_bubble_(false) { | 86 showing_sync_bubble_(false) { |
| 87 g_live_new_tabs.Pointer()->insert(this); | 87 g_live_new_tabs.Pointer()->insert(this); |
| 88 web_ui->OverrideTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); | 88 web_ui->OverrideTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
| 89 | 89 |
| 90 // We count all link clicks as AUTO_BOOKMARK, so that site can be ranked more | 90 // We count all link clicks as AUTO_BOOKMARK, so that site can be ranked more |
| 91 // highly. Note this means we're including clicks on not only most visited | 91 // highly. Note this means we're including clicks on not only most visited |
| 92 // thumbnails, but also clicks on recently bookmarked. | 92 // thumbnails, but also clicks on recently bookmarked. |
| 93 web_ui->SetLinkTransitionType(content::PAGE_TRANSITION_AUTO_BOOKMARK); | 93 web_ui->SetLinkTransitionType(ui::PAGE_TRANSITION_AUTO_BOOKMARK); |
| 94 | 94 |
| 95 Profile* profile = GetProfile(); | 95 Profile* profile = GetProfile(); |
| 96 if (!profile->IsOffTheRecord()) { | 96 if (!profile->IsOffTheRecord()) { |
| 97 web_ui->AddMessageHandler(new browser_sync::ForeignSessionHandler()); | 97 web_ui->AddMessageHandler(new browser_sync::ForeignSessionHandler()); |
| 98 web_ui->AddMessageHandler(new MetricsHandler()); | 98 web_ui->AddMessageHandler(new MetricsHandler()); |
| 99 web_ui->AddMessageHandler(new MostVisitedHandler()); | 99 web_ui->AddMessageHandler(new MostVisitedHandler()); |
| 100 web_ui->AddMessageHandler(new RecentlyClosedTabsHandler()); | 100 web_ui->AddMessageHandler(new RecentlyClosedTabsHandler()); |
| 101 web_ui->AddMessageHandler(new FaviconWebUIHandler()); | 101 web_ui->AddMessageHandler(new FaviconWebUIHandler()); |
| 102 web_ui->AddMessageHandler(new NewTabPageHandler()); | 102 web_ui->AddMessageHandler(new NewTabPageHandler()); |
| 103 web_ui->AddMessageHandler(new CoreAppLauncherHandler()); | 103 web_ui->AddMessageHandler(new CoreAppLauncherHandler()); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, | 370 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, |
| 371 const char* mime_type, | 371 const char* mime_type, |
| 372 int resource_id) { | 372 int resource_id) { |
| 373 DCHECK(resource); | 373 DCHECK(resource); |
| 374 DCHECK(mime_type); | 374 DCHECK(mime_type); |
| 375 resource_map_[std::string(resource)] = | 375 resource_map_[std::string(resource)] = |
| 376 std::make_pair(std::string(mime_type), resource_id); | 376 std::make_pair(std::string(mime_type), resource_id); |
| 377 } | 377 } |
| 378 | 378 |
| 379 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} | 379 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} |
| OLD | NEW |