| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 if (!GetProfile()->IsOffTheRecord()) { | 498 if (!GetProfile()->IsOffTheRecord()) { |
| 499 AddMessageHandler((new ShownSectionsHandler())->Attach(this)); | 499 AddMessageHandler((new ShownSectionsHandler())->Attach(this)); |
| 500 AddMessageHandler((new MostVisitedHandler())->Attach(this)); | 500 AddMessageHandler((new MostVisitedHandler())->Attach(this)); |
| 501 AddMessageHandler((new RecentlyClosedTabsHandler())->Attach(this)); | 501 AddMessageHandler((new RecentlyClosedTabsHandler())->Attach(this)); |
| 502 AddMessageHandler((new MetricsHandler())->Attach(this)); | 502 AddMessageHandler((new MetricsHandler())->Attach(this)); |
| 503 if (WebResourcesEnabled()) | 503 if (WebResourcesEnabled()) |
| 504 AddMessageHandler((new TipsHandler())->Attach(this)); | 504 AddMessageHandler((new TipsHandler())->Attach(this)); |
| 505 if (ProfileSyncService::IsSyncEnabled()) { | 505 if (ProfileSyncService::IsSyncEnabled()) { |
| 506 AddMessageHandler((new NewTabPageSyncHandler())->Attach(this)); | 506 AddMessageHandler((new NewTabPageSyncHandler())->Attach(this)); |
| 507 } | 507 } |
| 508 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableApps)) { | 508 if (Extension::AppsAreEnabled()) { |
| 509 ExtensionsService* service = GetProfile()->GetExtensionsService(); | 509 ExtensionsService* service = GetProfile()->GetExtensionsService(); |
| 510 AddMessageHandler((new AppLauncherHandler(service))->Attach(this)); | 510 // We might not have an ExtensionsService (on ChromeOS when not logged in |
| 511 // for example). |
| 512 if (service) |
| 513 AddMessageHandler((new AppLauncherHandler(service))->Attach(this)); |
| 511 } | 514 } |
| 512 | 515 |
| 513 AddMessageHandler((new NewTabPageSetHomePageHandler())->Attach(this)); | 516 AddMessageHandler((new NewTabPageSetHomePageHandler())->Attach(this)); |
| 514 AddMessageHandler((new PromotionalMessageHandler())->Attach(this)); | 517 AddMessageHandler((new PromotionalMessageHandler())->Attach(this)); |
| 515 } | 518 } |
| 516 | 519 |
| 517 // Initializing the CSS and HTML can require some CPU, so do it after | 520 // Initializing the CSS and HTML can require some CPU, so do it after |
| 518 // we've hooked up the most visited handler. This allows the DB query | 521 // we've hooked up the most visited handler. This allows the DB query |
| 519 // for the new tab thumbs to happen earlier. | 522 // for the new tab thumbs to happen earlier. |
| 520 InitializeCSSCaches(); | 523 InitializeCSSCaches(); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 // URL from the new tab page, but in any case it's an error. | 688 // URL from the new tab page, but in any case it's an error. |
| 686 NOTREACHED(); | 689 NOTREACHED(); |
| 687 return; | 690 return; |
| 688 } | 691 } |
| 689 | 692 |
| 690 scoped_refptr<RefCountedBytes> html_bytes = | 693 scoped_refptr<RefCountedBytes> html_bytes = |
| 691 profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record); | 694 profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record); |
| 692 | 695 |
| 693 SendResponse(request_id, html_bytes); | 696 SendResponse(request_id, html_bytes); |
| 694 } | 697 } |
| OLD | NEW |