Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: chrome/browser/ui/webui/ntp/new_tab_ui.cc

Issue 7031078: Retry r88137: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for test failures Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 12 matching lines...) Expand all
23 #include "chrome/browser/sessions/session_types.h" 23 #include "chrome/browser/sessions/session_types.h"
24 #include "chrome/browser/sessions/tab_restore_service.h" 24 #include "chrome/browser/sessions/tab_restore_service.h"
25 #include "chrome/browser/sessions/tab_restore_service_delegate.h" 25 #include "chrome/browser/sessions/tab_restore_service_delegate.h"
26 #include "chrome/browser/sessions/tab_restore_service_factory.h" 26 #include "chrome/browser/sessions/tab_restore_service_factory.h"
27 #include "chrome/browser/sessions/tab_restore_service_observer.h" 27 #include "chrome/browser/sessions/tab_restore_service_observer.h"
28 #include "chrome/browser/sync/profile_sync_service.h" 28 #include "chrome/browser/sync/profile_sync_service.h"
29 #include "chrome/browser/themes/theme_service.h" 29 #include "chrome/browser/themes/theme_service.h"
30 #include "chrome/browser/themes/theme_service_factory.h" 30 #include "chrome/browser/themes/theme_service_factory.h"
31 #include "chrome/browser/ui/browser.h" 31 #include "chrome/browser/ui/browser.h"
32 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" 32 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
33 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h"
33 #include "chrome/browser/ui/webui/ntp/foreign_session_handler.h" 34 #include "chrome/browser/ui/webui/ntp/foreign_session_handler.h"
34 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" 35 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h"
35 #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"
36 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" 37 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h"
37 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" 38 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
38 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" 39 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h"
39 #include "chrome/browser/ui/webui/ntp/value_helper.h" 40 #include "chrome/browser/ui/webui/ntp/value_helper.h"
40 #include "chrome/browser/ui/webui/theme_source.h" 41 #include "chrome/browser/ui/webui/theme_source.h"
41 #include "chrome/common/chrome_switches.h" 42 #include "chrome/common/chrome_switches.h"
42 #include "chrome/common/extensions/extension.h" 43 #include "chrome/common/extensions/extension.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 static bool first_view = true; 341 static bool first_view = true;
341 if (first_view) { 342 if (first_view) {
342 first_view = false; 343 first_view = false;
343 } 344 }
344 345
345 if (!GetProfile()->IsOffTheRecord()) { 346 if (!GetProfile()->IsOffTheRecord()) {
346 PrefService* pref_service = GetProfile()->GetPrefs(); 347 PrefService* pref_service = GetProfile()->GetPrefs();
347 AddMessageHandler((new NTPLoginHandler())->Attach(this)); 348 AddMessageHandler((new NTPLoginHandler())->Attach(this));
348 AddMessageHandler((new ShownSectionsHandler(pref_service))->Attach(this)); 349 AddMessageHandler((new ShownSectionsHandler(pref_service))->Attach(this));
349 AddMessageHandler((new browser_sync::ForeignSessionHandler())-> 350 AddMessageHandler((new browser_sync::ForeignSessionHandler())->
350 Attach(this)); 351 Attach(this));
351 AddMessageHandler((new MostVisitedHandler())->Attach(this)); 352 AddMessageHandler((new MostVisitedHandler())->Attach(this));
352 AddMessageHandler((new RecentlyClosedTabsHandler())->Attach(this)); 353 AddMessageHandler((new RecentlyClosedTabsHandler())->Attach(this));
353 AddMessageHandler((new MetricsHandler())->Attach(this)); 354 AddMessageHandler((new MetricsHandler())->Attach(this));
354 if (GetProfile()->IsSyncAccessible()) 355 if (GetProfile()->IsSyncAccessible())
355 AddMessageHandler((new NewTabPageSyncHandler())->Attach(this)); 356 AddMessageHandler((new NewTabPageSyncHandler())->Attach(this));
356 ExtensionService* service = GetProfile()->GetExtensionService(); 357 ExtensionService* service = GetProfile()->GetExtensionService();
357 // We might not have an ExtensionService (on ChromeOS when not logged in 358 // We might not have an ExtensionService (on ChromeOS when not logged in
358 // for example). 359 // for example).
359 if (service) 360 if (service)
360 AddMessageHandler((new AppLauncherHandler(service))->Attach(this)); 361 AddMessageHandler((new AppLauncherHandler(service))->Attach(this));
361 362
362 AddMessageHandler((new NewTabPageSetHomePageHandler())->Attach(this)); 363 AddMessageHandler((new NewTabPageSetHomePageHandler())->Attach(this));
363 AddMessageHandler((new NewTabPageClosePromoHandler())->Attach(this)); 364 AddMessageHandler((new NewTabPageClosePromoHandler())->Attach(this));
365 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4))
366 AddMessageHandler((new FaviconWebUIHandler())->Attach(this));
364 } 367 }
365 368
366 // Initializing the CSS and HTML can require some CPU, so do it after 369 // Initializing the CSS and HTML can require some CPU, so do it after
367 // we've hooked up the most visited handler. This allows the DB query 370 // we've hooked up the most visited handler. This allows the DB query
368 // for the new tab thumbs to happen earlier. 371 // for the new tab thumbs to happen earlier.
369 InitializeCSSCaches(); 372 InitializeCSSCaches();
370 NewTabHTMLSource* html_source = 373 NewTabHTMLSource* html_source =
371 new NewTabHTMLSource(GetProfile()->GetOriginalProfile()); 374 new NewTabHTMLSource(GetProfile()->GetOriginalProfile());
372 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); 375 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source);
373 376
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 SendResponse(request_id, html_bytes); 633 SendResponse(request_id, html_bytes);
631 } 634 }
632 635
633 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { 636 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const {
634 return "text/html"; 637 return "text/html";
635 } 638 }
636 639
637 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const { 640 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const {
638 return false; 641 return false;
639 } 642 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698