| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/search/instant_service.h" | 5 #include "chrome/browser/search/instant_service.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/browser/history/history_notifications.h" | 12 #include "chrome/browser/history/history_notifications.h" |
| 13 #include "chrome/browser/history/most_visited_tiles_experiment.h" | 13 #include "chrome/browser/history/most_visited_tiles_experiment.h" |
| 14 #include "chrome/browser/history/top_sites.h" | 14 #include "chrome/browser/history/top_sites.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/search/instant_io_context.h" | 16 #include "chrome/browser/search/instant_io_context.h" |
| 17 #include "chrome/browser/search/instant_service_factory.h" | 17 #include "chrome/browser/search/instant_service_factory.h" |
| 18 #include "chrome/browser/search/instant_service_observer.h" | 18 #include "chrome/browser/search/instant_service_observer.h" |
| 19 #include "chrome/browser/search/local_ntp_source.h" | 19 #include "chrome/browser/search/local_ntp_source.h" |
| 20 #include "chrome/browser/search/most_visited_iframe_source.h" | 20 #include "chrome/browser/search/most_visited_iframe_source.h" |
| 21 #include "chrome/browser/search/search.h" | 21 #include "chrome/browser/search/search.h" |
| 22 #include "chrome/browser/themes/theme_properties.h" | 22 #include "chrome/browser/themes/theme_properties.h" |
| 23 #include "chrome/browser/themes/theme_service.h" | 23 #include "chrome/browser/themes/theme_service.h" |
| 24 #include "chrome/browser/themes/theme_service_factory.h" | 24 #include "chrome/browser/themes/theme_service_factory.h" |
| 25 #include "chrome/browser/ui/webui/favicon_source.h" | 25 #include "chrome/browser/ui/webui/favicon_source.h" |
| 26 #include "chrome/browser/ui/webui/ntp/thumbnail_list_source.h" |
| 26 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" | 27 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" |
| 27 #include "chrome/browser/ui/webui/theme_source.h" | 28 #include "chrome/browser/ui/webui/theme_source.h" |
| 28 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
| 29 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
| 30 #include "content/public/browser/notification_types.h" | 31 #include "content/public/browser/notification_types.h" |
| 31 #include "content/public/browser/render_process_host.h" | 32 #include "content/public/browser/render_process_host.h" |
| 32 #include "content/public/browser/url_data_source.h" | 33 #include "content/public/browser/url_data_source.h" |
| 33 #include "grit/theme_resources.h" | 34 #include "grit/theme_resources.h" |
| 34 #include "net/url_request/url_request.h" | 35 #include "net/url_request/url_request.h" |
| 35 #include "ui/gfx/color_utils.h" | 36 #include "ui/gfx/color_utils.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // Listen for theme installation. | 89 // Listen for theme installation. |
| 89 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 90 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 90 content::Source<ThemeService>( | 91 content::Source<ThemeService>( |
| 91 ThemeServiceFactory::GetForProfile(profile_))); | 92 ThemeServiceFactory::GetForProfile(profile_))); |
| 92 | 93 |
| 93 content::URLDataSource::Add(profile, new ThemeSource(profile)); | 94 content::URLDataSource::Add(profile, new ThemeSource(profile)); |
| 94 #endif // defined(ENABLE_THEMES) | 95 #endif // defined(ENABLE_THEMES) |
| 95 | 96 |
| 96 content::URLDataSource::Add(profile, new ThumbnailSource(profile, false)); | 97 content::URLDataSource::Add(profile, new ThumbnailSource(profile, false)); |
| 97 content::URLDataSource::Add(profile, new ThumbnailSource(profile, true)); | 98 content::URLDataSource::Add(profile, new ThumbnailSource(profile, true)); |
| 99 content::URLDataSource::Add(profile, new ThumbnailListSource(profile)); |
| 98 content::URLDataSource::Add(profile, new FaviconSource( | 100 content::URLDataSource::Add(profile, new FaviconSource( |
| 99 profile, FaviconSource::FAVICON)); | 101 profile, FaviconSource::FAVICON)); |
| 100 content::URLDataSource::Add(profile, new LocalNtpSource(profile)); | 102 content::URLDataSource::Add(profile, new LocalNtpSource(profile)); |
| 101 content::URLDataSource::Add(profile, new MostVisitedIframeSource()); | 103 content::URLDataSource::Add(profile, new MostVisitedIframeSource()); |
| 102 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, | 104 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
| 103 content::Source<Profile>(profile_)); | 105 content::Source<Profile>(profile_)); |
| 104 } | 106 } |
| 105 | 107 |
| 106 InstantService::~InstantService() { | 108 InstantService::~InstantService() { |
| 107 } | 109 } |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 theme_service->HasCustomImage(IDR_THEME_NTP_ATTRIBUTION); | 389 theme_service->HasCustomImage(IDR_THEME_NTP_ATTRIBUTION); |
| 388 } | 390 } |
| 389 | 391 |
| 390 FOR_EACH_OBSERVER(InstantServiceObserver, observers_, | 392 FOR_EACH_OBSERVER(InstantServiceObserver, observers_, |
| 391 ThemeInfoChanged(*theme_info_)); | 393 ThemeInfoChanged(*theme_info_)); |
| 392 } | 394 } |
| 393 | 395 |
| 394 InstantNTPPrerenderer* InstantService::ntp_prerenderer() { | 396 InstantNTPPrerenderer* InstantService::ntp_prerenderer() { |
| 395 return &ntp_prerenderer_; | 397 return &ntp_prerenderer_; |
| 396 } | 398 } |
| OLD | NEW |