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

Side by Side Diff: components/sync_sessions/revisit/page_revisit_broadcaster.cc

Issue 2257793002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/sync_sessions/revisit/page_revisit_broadcaster.h" 5 #include "components/sync_sessions/revisit/page_revisit_broadcaster.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 PageRevisitBroadcaster::PageRevisitBroadcaster( 48 PageRevisitBroadcaster::PageRevisitBroadcaster(
49 SessionsSyncManager* manager, 49 SessionsSyncManager* manager,
50 sync_sessions::SyncSessionsClient* sessions_client) 50 sync_sessions::SyncSessionsClient* sessions_client)
51 : sessions_client_(sessions_client) { 51 : sessions_client_(sessions_client) {
52 const std::string group_name = 52 const std::string group_name =
53 base::FieldTrialList::FindFullName("PageRevisitInstrumentation"); 53 base::FieldTrialList::FindFullName("PageRevisitInstrumentation");
54 bool shouldInstrument = group_name == "Enabled"; 54 bool shouldInstrument = group_name == "Enabled";
55 if (shouldInstrument) { 55 if (shouldInstrument) {
56 revisit_observers_.push_back(new sync_sessions::SessionsPageRevisitObserver( 56 revisit_observers_.push_back(new sync_sessions::SessionsPageRevisitObserver(
57 base::WrapUnique(new SessionsSyncManagerWrapper(manager)))); 57 base::MakeUnique<SessionsSyncManagerWrapper>(manager)));
58 58
59 history::HistoryService* history = sessions_client_->GetHistoryService(); 59 history::HistoryService* history = sessions_client_->GetHistoryService();
60 if (history) { 60 if (history) {
61 revisit_observers_.push_back( 61 revisit_observers_.push_back(
62 new sync_sessions::TypedUrlPageRevisitObserver(history)); 62 new sync_sessions::TypedUrlPageRevisitObserver(history));
63 } 63 }
64 64
65 bookmarks::BookmarkModel* bookmarks = sessions_client_->GetBookmarkModel(); 65 bookmarks::BookmarkModel* bookmarks = sessions_client_->GetBookmarkModel();
66 if (bookmarks) { 66 if (bookmarks) {
67 revisit_observers_.push_back( 67 revisit_observers_.push_back(
68 new sync_sessions::BookmarksPageRevisitObserver(base::WrapUnique( 68 new sync_sessions::BookmarksPageRevisitObserver(
69 new sync_sessions::BookmarksByUrlProviderImpl(bookmarks)))); 69 base::MakeUnique<sync_sessions::BookmarksByUrlProviderImpl>(
70 bookmarks)));
70 } 71 }
71 } 72 }
72 } 73 }
73 74
74 PageRevisitBroadcaster::~PageRevisitBroadcaster() {} 75 PageRevisitBroadcaster::~PageRevisitBroadcaster() {}
75 76
76 void PageRevisitBroadcaster::OnPageVisit(const GURL& url, 77 void PageRevisitBroadcaster::OnPageVisit(const GURL& url,
77 const ui::PageTransition transition) { 78 const ui::PageTransition transition) {
78 if (sessions_client_->ShouldSyncURL(url)) { 79 if (sessions_client_->ShouldSyncURL(url)) {
79 sync_sessions::PageVisitObserver::TransitionType converted( 80 sync_sessions::PageVisitObserver::TransitionType converted(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 case ui::PAGE_TRANSITION_KEYWORD: 128 case ui::PAGE_TRANSITION_KEYWORD:
128 case ui::PAGE_TRANSITION_KEYWORD_GENERATED: 129 case ui::PAGE_TRANSITION_KEYWORD_GENERATED:
129 return sync_sessions::PageVisitObserver::kTransitionOmniboxTemplateSearch; 130 return sync_sessions::PageVisitObserver::kTransitionOmniboxTemplateSearch;
130 131
131 default: 132 default:
132 return sync_sessions::PageVisitObserver::kTransitionUnknown; 133 return sync_sessions::PageVisitObserver::kTransitionUnknown;
133 } 134 }
134 } 135 }
135 136
136 } // namespace browser_sync 137 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698