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

Side by Side Diff: components/ntp_snippets/sessions/foreign_sessions_suggestions_provider.cc

Issue 2520853002: [NTP] Cleanup: add brackets in components/ntp_snippets. [2/2] (Closed)
Patch Set: "else if". Created 4 years 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
OLDNEW
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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 const DismissedFilter& suggestions_filter) { 362 const DismissedFilter& suggestions_filter) {
363 const std::vector<const SyncedSession*>& foreign_sessions = 363 const std::vector<const SyncedSession*>& foreign_sessions =
364 foreign_sessions_provider_->GetAllForeignSessions(); 364 foreign_sessions_provider_->GetAllForeignSessions();
365 const TimeDelta max_foreign_tab_age = GetMaxForeignTabAge(); 365 const TimeDelta max_foreign_tab_age = GetMaxForeignTabAge();
366 std::vector<SessionData> suggestion_candidates; 366 std::vector<SessionData> suggestion_candidates;
367 for (const SyncedSession* session : foreign_sessions) { 367 for (const SyncedSession* session : foreign_sessions) {
368 for (const std::pair<const SessionID::id_type, 368 for (const std::pair<const SessionID::id_type,
369 std::unique_ptr<sessions::SessionWindow>>& key_value : 369 std::unique_ptr<sessions::SessionWindow>>& key_value :
370 session->windows) { 370 session->windows) {
371 for (const std::unique_ptr<SessionTab>& tab : key_value.second->tabs) { 371 for (const std::unique_ptr<SessionTab>& tab : key_value.second->tabs) {
372 if (tab->navigations.empty()) 372 if (tab->navigations.empty()) {
373 continue; 373 continue;
374 }
374 375
375 const SerializedNavigationEntry& navigation = tab->navigations.back(); 376 const SerializedNavigationEntry& navigation = tab->navigations.back();
376 const std::string id = navigation.virtual_url().spec(); 377 const std::string id = navigation.virtual_url().spec();
377 // TODO(skym): Filter out internal pages. Tabs that contain only 378 // TODO(skym): Filter out internal pages. Tabs that contain only
378 // non-syncable content should never reach the local client. However, 379 // non-syncable content should never reach the local client. However,
379 // sync will let tabs through whose current navigation entry is 380 // sync will let tabs through whose current navigation entry is
380 // internal, as long as a back or forward navigation entry is valid. We 381 // internal, as long as a back or forward navigation entry is valid. We
381 // however, are only currently exposing the current entry, and so we 382 // however, are only currently exposing the current entry, and so we
382 // should ideally exclude these. 383 // should ideally exclude these.
383 TimeDelta tab_age = Time::Now() - tab->timestamp; 384 TimeDelta tab_age = Time::Now() - tab->timestamp;
(...skipping 13 matching lines...) Expand all
397 data.navigation->virtual_url().spec(), 398 data.navigation->virtual_url().spec(),
398 data.navigation->virtual_url()); 399 data.navigation->virtual_url());
399 suggestion.set_title(data.navigation->title()); 400 suggestion.set_title(data.navigation->title());
400 suggestion.set_publish_date(data.tab->timestamp); 401 suggestion.set_publish_date(data.tab->timestamp);
401 suggestion.set_publisher_name( 402 suggestion.set_publisher_name(
402 base::UTF8ToUTF16(data.navigation->virtual_url().host())); 403 base::UTF8ToUTF16(data.navigation->virtual_url().host()));
403 return suggestion; 404 return suggestion;
404 } 405 }
405 406
406 } // namespace ntp_snippets 407 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698