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 "ios/chrome/browser/bookmarks/bookmark_client_impl.h" | 5 #include "ios/chrome/browser/bookmarks/bookmark_client_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/user_metrics.h" | 8 #include "base/metrics/user_metrics.h" |
9 #include "base/task/cancelable_task_tracker.h" | 9 #include "base/task/cancelable_task_tracker.h" |
10 #include "components/bookmarks/browser/bookmark_node.h" | 10 #include "components/bookmarks/browser/bookmark_node.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 ios::HistoryServiceFactory::GetForBrowserState( | 49 ios::HistoryServiceFactory::GetForBrowserState( |
50 browser_state_, ServiceAccessType::EXPLICIT_ACCESS); | 50 browser_state_, ServiceAccessType::EXPLICIT_ACCESS); |
51 history::URLDatabase* url_db = | 51 history::URLDatabase* url_db = |
52 history_service ? history_service->InMemoryDatabase() : nullptr; | 52 history_service ? history_service->InMemoryDatabase() : nullptr; |
53 for (const auto* node : nodes) { | 53 for (const auto* node : nodes) { |
54 // If |url_db| is the InMemoryDatabase, it might not cache all URLRows, but | 54 // If |url_db| is the InMemoryDatabase, it might not cache all URLRows, but |
55 // it guarantees to contain those with |typed_count| > 0. Thus, if fetching | 55 // it guarantees to contain those with |typed_count| > 0. Thus, if fetching |
56 // the URLRow fails, it is safe to assume that its |typed_count| is 0. | 56 // the URLRow fails, it is safe to assume that its |typed_count| is 0. |
57 int typed_count = 0; | 57 int typed_count = 0; |
58 history::URLRow url; | 58 history::URLRow url; |
59 if (url_db && url_db->GetRowForURL(node->url(), &url)) | 59 if (url_db && url_db->GetRowForURL(node->GetTitledUrlNodeUrl(), &url)) |
60 typed_count = url.typed_count(); | 60 typed_count = url.typed_count(); |
61 | 61 |
62 NodeTypedCountPair pair(node, typed_count); | 62 NodeTypedCountPair pair(node, typed_count); |
63 node_typed_count_pairs->push_back(pair); | 63 node_typed_count_pairs->push_back(pair); |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 bool BookmarkClientImpl::IsPermanentNodeVisible( | 67 bool BookmarkClientImpl::IsPermanentNodeVisible( |
68 const bookmarks::BookmarkPermanentNode* node) { | 68 const bookmarks::BookmarkPermanentNode* node) { |
69 return node->type() == bookmarks::BookmarkNode::MOBILE; | 69 return node->type() == bookmarks::BookmarkNode::MOBILE; |
(...skipping 13 matching lines...) Expand all Loading... |
83 } | 83 } |
84 | 84 |
85 bool BookmarkClientImpl::CanSyncNode(const bookmarks::BookmarkNode* node) { | 85 bool BookmarkClientImpl::CanSyncNode(const bookmarks::BookmarkNode* node) { |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
89 bool BookmarkClientImpl::CanBeEditedByUser( | 89 bool BookmarkClientImpl::CanBeEditedByUser( |
90 const bookmarks::BookmarkNode* node) { | 90 const bookmarks::BookmarkNode* node) { |
91 return true; | 91 return true; |
92 } | 92 } |
OLD | NEW |