Chromium Code Reviews| 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/android/ntp/most_visited_sites.h" | 5 #include "chrome/browser/android/ntp/most_visited_sites.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/metrics/sparse_histogram.h" | 13 #include "base/metrics/sparse_histogram.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "chrome/browser/history/top_sites_factory.h" | 19 #include "chrome/browser/history/top_sites_factory.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/search/suggestions/suggestions_service_factory.h" | 21 #include "chrome/browser/search/suggestions/suggestions_service_factory.h" |
| 22 #include "chrome/browser/supervised_user/supervised_user_service.h" | 22 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 23 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 23 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 24 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 24 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
| 25 #include "chrome/browser/thumbnails/thumbnail_list_source.h" | 25 #include "chrome/browser/thumbnails/thumbnail_list_source.h" |
| 26 #include "chrome/common/chrome_switches.h" | |
| 27 #include "chrome/common/pref_names.h" | |
| 28 #include "components/history/core/browser/top_sites.h" | 26 #include "components/history/core/browser/top_sites.h" |
| 27 #include "components/ntp_tiles/pref_names.h" | |
| 28 #include "components/ntp_tiles/switches.h" | |
| 29 #include "components/pref_registry/pref_registry_syncable.h" | 29 #include "components/pref_registry/pref_registry_syncable.h" |
| 30 #include "components/prefs/pref_service.h" | 30 #include "components/prefs/pref_service.h" |
| 31 #include "components/variations/variations_associated_data.h" | 31 #include "components/variations/variations_associated_data.h" |
| 32 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
| 33 #include "content/public/browser/url_data_source.h" | 33 #include "content/public/browser/url_data_source.h" |
| 34 #include "third_party/skia/include/core/SkBitmap.h" | 34 #include "third_party/skia/include/core/SkBitmap.h" |
| 35 #include "ui/gfx/codec/jpeg_codec.h" | 35 #include "ui/gfx/codec/jpeg_codec.h" |
| 36 #include "url/gurl.h" | 36 #include "url/gurl.h" |
| 37 | 37 |
| 38 using content::BrowserThread; | 38 using content::BrowserThread; |
| 39 using history::TopSites; | 39 using history::TopSites; |
| 40 using suggestions::ChromeSuggestion; | 40 using suggestions::ChromeSuggestion; |
| 41 using suggestions::SuggestionsProfile; | 41 using suggestions::SuggestionsProfile; |
| 42 using suggestions::SuggestionsService; | 42 using suggestions::SuggestionsService; |
| 43 using suggestions::SuggestionsServiceFactory; | 43 using suggestions::SuggestionsServiceFactory; |
| 44 namespace prefs = ntp_tiles::prefs; | |
| 45 namespace switches = ntp_tiles::switches; | |
|
jochen (gone - plz use gerrit)
2016/04/28 15:46:37
I don't see this pattern anywhere else, and it loo
sfiera
2016/04/28 16:11:04
Done.
| |
| 44 | 46 |
| 45 namespace { | 47 namespace { |
| 46 | 48 |
| 47 // Identifiers for the various tile sources. | 49 // Identifiers for the various tile sources. |
| 48 const char kHistogramClientName[] = "client"; | 50 const char kHistogramClientName[] = "client"; |
| 49 const char kHistogramServerName[] = "server"; | 51 const char kHistogramServerName[] = "server"; |
| 50 const char kHistogramServerFormat[] = "server%d"; | 52 const char kHistogramServerFormat[] = "server%d"; |
| 51 const char kHistogramPopularName[] = "popular"; | 53 const char kHistogramPopularName[] = "popular"; |
| 52 const char kHistogramWhitelistName[] = "whitelist"; | 54 const char kHistogramWhitelistName[] = "whitelist"; |
| 53 | 55 |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 786 | 788 |
| 787 void MostVisitedSites::TopSitesLoaded(TopSites* top_sites) {} | 789 void MostVisitedSites::TopSitesLoaded(TopSites* top_sites) {} |
| 788 | 790 |
| 789 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, | 791 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, |
| 790 ChangeReason change_reason) { | 792 ChangeReason change_reason) { |
| 791 if (mv_source_ == TOP_SITES) { | 793 if (mv_source_ == TOP_SITES) { |
| 792 // The displayed suggestions are invalidated. | 794 // The displayed suggestions are invalidated. |
| 793 InitiateTopSitesQuery(); | 795 InitiateTopSitesQuery(); |
| 794 } | 796 } |
| 795 } | 797 } |
| OLD | NEW |