OLD | NEW |
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/bookmarks_page_revisit_observer.h" | 5 #include "components/sync_sessions/revisit/bookmarks_page_revisit_observer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
11 #include "components/bookmarks/browser/bookmark_model.h" | 12 #include "components/bookmarks/browser/bookmark_model.h" |
12 #include "components/bookmarks/browser/bookmark_node.h" | 13 #include "components/bookmarks/browser/bookmark_node.h" |
13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
14 | 15 |
15 namespace sync_sessions { | 16 namespace sync_sessions { |
16 | 17 |
17 BookmarksPageRevisitObserver::BookmarksPageRevisitObserver( | 18 BookmarksPageRevisitObserver::BookmarksPageRevisitObserver( |
18 scoped_ptr<BookmarksByUrlProvider> provider) | 19 scoped_ptr<BookmarksByUrlProvider> provider) |
19 : provider_(provider.Pass()) {} | 20 : provider_(std::move(provider)) {} |
20 | 21 |
21 BookmarksPageRevisitObserver::~BookmarksPageRevisitObserver() {} | 22 BookmarksPageRevisitObserver::~BookmarksPageRevisitObserver() {} |
22 | 23 |
23 void BookmarksPageRevisitObserver::OnPageVisit( | 24 void BookmarksPageRevisitObserver::OnPageVisit( |
24 const GURL& url, | 25 const GURL& url, |
25 const TransitionType transition) { | 26 const TransitionType transition) { |
26 base::TimeTicks start(base::TimeTicks::Now()); | 27 base::TimeTicks start(base::TimeTicks::Now()); |
27 | 28 |
28 std::vector<const bookmarks::BookmarkNode*> nodes; | 29 std::vector<const bookmarks::BookmarkNode*> nodes; |
29 provider_->GetNodesByURL(url, &nodes); | 30 provider_->GetNodesByURL(url, &nodes); |
(...skipping 12 matching lines...) Expand all Loading... |
42 UMA_HISTOGRAM_ENUMERATION("Sync.PageRevisitBookmarksMatchTransition", | 43 UMA_HISTOGRAM_ENUMERATION("Sync.PageRevisitBookmarksMatchTransition", |
43 transition, | 44 transition, |
44 PageVisitObserver::kTransitionTypeLast); | 45 PageVisitObserver::kTransitionTypeLast); |
45 } | 46 } |
46 | 47 |
47 base::TimeDelta duration(base::TimeTicks::Now() - start); | 48 base::TimeDelta duration(base::TimeTicks::Now() - start); |
48 UMA_HISTOGRAM_TIMES("Sync.PageRevisitBookmarksDuration", duration); | 49 UMA_HISTOGRAM_TIMES("Sync.PageRevisitBookmarksDuration", duration); |
49 } | 50 } |
50 | 51 |
51 } // namespace sync_sessions | 52 } // namespace sync_sessions |
OLD | NEW |