| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/new_tab_ui.h" | 7 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 if (!GetProfile()->IsOffTheRecord()) { | 434 if (!GetProfile()->IsOffTheRecord()) { |
| 435 PrefService* pref_service = GetProfile()->GetPrefs(); | 435 PrefService* pref_service = GetProfile()->GetPrefs(); |
| 436 AddMessageHandler((new ShownSectionsHandler(pref_service))->Attach(this)); | 436 AddMessageHandler((new ShownSectionsHandler(pref_service))->Attach(this)); |
| 437 AddMessageHandler((new browser_sync::ForeignSessionHandler())-> | 437 AddMessageHandler((new browser_sync::ForeignSessionHandler())-> |
| 438 Attach(this)); | 438 Attach(this)); |
| 439 AddMessageHandler((new MostVisitedHandler())->Attach(this)); | 439 AddMessageHandler((new MostVisitedHandler())->Attach(this)); |
| 440 AddMessageHandler((new RecentlyClosedTabsHandler())->Attach(this)); | 440 AddMessageHandler((new RecentlyClosedTabsHandler())->Attach(this)); |
| 441 AddMessageHandler((new MetricsHandler())->Attach(this)); | 441 AddMessageHandler((new MetricsHandler())->Attach(this)); |
| 442 if (GetProfile()->IsSyncAccessible()) | 442 if (GetProfile()->IsSyncAccessible()) |
| 443 AddMessageHandler((new NewTabPageSyncHandler())->Attach(this)); | 443 AddMessageHandler((new NewTabPageSyncHandler())->Attach(this)); |
| 444 if (Extension::AppsAreEnabled()) { | 444 ExtensionsService* service = GetProfile()->GetExtensionsService(); |
| 445 ExtensionsService* service = GetProfile()->GetExtensionsService(); | 445 // We might not have an ExtensionsService (on ChromeOS when not logged in |
| 446 // We might not have an ExtensionsService (on ChromeOS when not logged in | 446 // for example). |
| 447 // for example). | 447 if (service) |
| 448 if (service) | 448 AddMessageHandler((new AppLauncherHandler(service))->Attach(this)); |
| 449 AddMessageHandler((new AppLauncherHandler(service))->Attach(this)); | |
| 450 } | |
| 451 | 449 |
| 452 AddMessageHandler((new NewTabPageSetHomePageHandler())->Attach(this)); | 450 AddMessageHandler((new NewTabPageSetHomePageHandler())->Attach(this)); |
| 453 } | 451 } |
| 454 | 452 |
| 455 // Initializing the CSS and HTML can require some CPU, so do it after | 453 // Initializing the CSS and HTML can require some CPU, so do it after |
| 456 // we've hooked up the most visited handler. This allows the DB query | 454 // we've hooked up the most visited handler. This allows the DB query |
| 457 // for the new tab thumbs to happen earlier. | 455 // for the new tab thumbs to happen earlier. |
| 458 InitializeCSSCaches(); | 456 InitializeCSSCaches(); |
| 459 NewTabHTMLSource* html_source = | 457 NewTabHTMLSource* html_source = |
| 460 new NewTabHTMLSource(GetProfile()->GetOriginalProfile()); | 458 new NewTabHTMLSource(GetProfile()->GetOriginalProfile()); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 | 627 |
| 630 scoped_refptr<RefCountedBytes> html_bytes = | 628 scoped_refptr<RefCountedBytes> html_bytes = |
| 631 profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record); | 629 profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record); |
| 632 | 630 |
| 633 SendResponse(request_id, html_bytes); | 631 SendResponse(request_id, html_bytes); |
| 634 } | 632 } |
| 635 | 633 |
| 636 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { | 634 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { |
| 637 return "text/html"; | 635 return "text/html"; |
| 638 } | 636 } |
| OLD | NEW |