OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/ntp_snippets/sessions/foreign_sessions_suggestions_provider
.h" | 5 #include "components/ntp_snippets/sessions/foreign_sessions_suggestions_provider
.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <tuple> | 9 #include <tuple> |
10 #include <utility> | 10 #include <utility> |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 foreign_sessions_provider_(std::move(foreign_sessions_provider)), | 92 foreign_sessions_provider_(std::move(foreign_sessions_provider)), |
93 pref_service_(pref_service) { | 93 pref_service_(pref_service) { |
94 foreign_sessions_provider_->SubscribeForForeignTabChange( | 94 foreign_sessions_provider_->SubscribeForForeignTabChange( |
95 base::Bind(&ForeignSessionsSuggestionsProvider::OnForeignTabChange, | 95 base::Bind(&ForeignSessionsSuggestionsProvider::OnForeignTabChange, |
96 base::Unretained(this))); | 96 base::Unretained(this))); |
97 | 97 |
98 // If sync is already initialzed, try suggesting now, though this is unlikely. | 98 // If sync is already initialzed, try suggesting now, though this is unlikely. |
99 OnForeignTabChange(); | 99 OnForeignTabChange(); |
100 } | 100 } |
101 | 101 |
102 ForeignSessionsSuggestionsProvider::~ForeignSessionsSuggestionsProvider() {} | 102 ForeignSessionsSuggestionsProvider::~ForeignSessionsSuggestionsProvider() = |
| 103 default; |
103 | 104 |
104 // static | 105 // static |
105 void ForeignSessionsSuggestionsProvider::RegisterProfilePrefs( | 106 void ForeignSessionsSuggestionsProvider::RegisterProfilePrefs( |
106 PrefRegistrySimple* registry) { | 107 PrefRegistrySimple* registry) { |
107 registry->RegisterListPref(prefs::kDismissedForeignSessionsSuggestions); | 108 registry->RegisterListPref(prefs::kDismissedForeignSessionsSuggestions); |
108 } | 109 } |
109 | 110 |
110 CategoryStatus ForeignSessionsSuggestionsProvider::GetCategoryStatus( | 111 CategoryStatus ForeignSessionsSuggestionsProvider::GetCategoryStatus( |
111 Category category) { | 112 Category category) { |
112 DCHECK_EQ(category, provided_category_); | 113 DCHECK_EQ(category, provided_category_); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 // This field is sandwiched between the url's favicon, which is on the left, | 306 // This field is sandwiched between the url's favicon, which is on the left, |
306 // and the |publish_date|, which is to the right. The domain should always | 307 // and the |publish_date|, which is to the right. The domain should always |
307 // appear next to the favicon. | 308 // appear next to the favicon. |
308 suggestion.set_publisher_name( | 309 suggestion.set_publisher_name( |
309 base::UTF8ToUTF16(data.navigation->virtual_url().host() + " - " + | 310 base::UTF8ToUTF16(data.navigation->virtual_url().host() + " - " + |
310 data.session->session_name)); | 311 data.session->session_name)); |
311 return suggestion; | 312 return suggestion; |
312 } | 313 } |
313 | 314 |
314 } // namespace ntp_snippets | 315 } // namespace ntp_snippets |
OLD | NEW |