OLD | NEW |
1 // Copyright (c) 2006-2009 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 |
11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 } | 458 } |
459 | 459 |
460 if (!GetProfile()->IsOffTheRecord()) { | 460 if (!GetProfile()->IsOffTheRecord()) { |
461 PrefService* pref_service = GetProfile()->GetPrefs(); | 461 PrefService* pref_service = GetProfile()->GetPrefs(); |
462 AddMessageHandler((new ShownSectionsHandler(pref_service))->Attach(this)); | 462 AddMessageHandler((new ShownSectionsHandler(pref_service))->Attach(this)); |
463 AddMessageHandler((new MostVisitedHandler())->Attach(this)); | 463 AddMessageHandler((new MostVisitedHandler())->Attach(this)); |
464 AddMessageHandler((new RecentlyClosedTabsHandler())->Attach(this)); | 464 AddMessageHandler((new RecentlyClosedTabsHandler())->Attach(this)); |
465 AddMessageHandler((new MetricsHandler())->Attach(this)); | 465 AddMessageHandler((new MetricsHandler())->Attach(this)); |
466 if (WebResourcesEnabled()) | 466 if (WebResourcesEnabled()) |
467 AddMessageHandler((new TipsHandler())->Attach(this)); | 467 AddMessageHandler((new TipsHandler())->Attach(this)); |
468 if (ProfileSyncService::IsSyncEnabled()) { | 468 if (GetProfile()->IsSyncAccessible()) |
469 AddMessageHandler((new NewTabPageSyncHandler())->Attach(this)); | 469 AddMessageHandler((new NewTabPageSyncHandler())->Attach(this)); |
470 } | |
471 if (Extension::AppsAreEnabled()) { | 470 if (Extension::AppsAreEnabled()) { |
472 ExtensionsService* service = GetProfile()->GetExtensionsService(); | 471 ExtensionsService* service = GetProfile()->GetExtensionsService(); |
473 // We might not have an ExtensionsService (on ChromeOS when not logged in | 472 // We might not have an ExtensionsService (on ChromeOS when not logged in |
474 // for example). | 473 // for example). |
475 if (service) | 474 if (service) |
476 AddMessageHandler((new AppLauncherHandler(service))->Attach(this)); | 475 AddMessageHandler((new AppLauncherHandler(service))->Attach(this)); |
477 } | 476 } |
478 | 477 |
479 AddMessageHandler((new NewTabPageSetHomePageHandler())->Attach(this)); | 478 AddMessageHandler((new NewTabPageSetHomePageHandler())->Attach(this)); |
480 } | 479 } |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 // URL from the new tab page, but in any case it's an error. | 649 // URL from the new tab page, but in any case it's an error. |
651 NOTREACHED(); | 650 NOTREACHED(); |
652 return; | 651 return; |
653 } | 652 } |
654 | 653 |
655 scoped_refptr<RefCountedBytes> html_bytes = | 654 scoped_refptr<RefCountedBytes> html_bytes = |
656 profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record); | 655 profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record); |
657 | 656 |
658 SendResponse(request_id, html_bytes); | 657 SendResponse(request_id, html_bytes); |
659 } | 658 } |
OLD | NEW |