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

Side by Side Diff: chrome/browser/bookmarks/chrome_bookmark_client.cc

Issue 2537223008: Add TitledUrlIndex for indexing arbitrary title/URL pairs (Closed)
Patch Set: refactor in-place to preserve history 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/bookmarks/chrome_bookmark_client.h" 5 #include "chrome/browser/bookmarks/chrome_bookmark_client.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/favicon/favicon_service_factory.h" 10 #include "chrome/browser/favicon/favicon_service_factory.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 profile_, ServiceAccessType::EXPLICIT_ACCESS); 71 profile_, ServiceAccessType::EXPLICIT_ACCESS);
72 history::URLDatabase* url_db = 72 history::URLDatabase* url_db =
73 history_service ? history_service->InMemoryDatabase() : nullptr; 73 history_service ? history_service->InMemoryDatabase() : nullptr;
74 for (NodeSet::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { 74 for (NodeSet::const_iterator i = nodes.begin(); i != nodes.end(); ++i) {
75 int typed_count = 0; 75 int typed_count = 0;
76 76
77 // If |url_db| is the InMemoryDatabase, it might not cache all URLRows, but 77 // If |url_db| is the InMemoryDatabase, it might not cache all URLRows, but
78 // it guarantees to contain those with |typed_count| > 0. Thus, if we cannot 78 // it guarantees to contain those with |typed_count| > 0. Thus, if we cannot
79 // fetch the URLRow, it is safe to assume that its |typed_count| is 0. 79 // fetch the URLRow, it is safe to assume that its |typed_count| is 0.
80 history::URLRow url; 80 history::URLRow url;
81 if (url_db && url_db->GetRowForURL((*i)->url(), &url)) 81 if (url_db && url_db->GetRowForURL((*i)->GetTitledUrlNodeUrl(), &url))
82 typed_count = url.typed_count(); 82 typed_count = url.typed_count();
83 83
84 NodeTypedCountPair pair(*i, typed_count); 84 NodeTypedCountPair pair(*i, typed_count);
85 node_typed_count_pairs->push_back(pair); 85 node_typed_count_pairs->push_back(pair);
86 } 86 }
87 } 87 }
88 88
89 bool ChromeBookmarkClient::IsPermanentNodeVisible( 89 bool ChromeBookmarkClient::IsPermanentNodeVisible(
90 const bookmarks::BookmarkPermanentNode* node) { 90 const bookmarks::BookmarkPermanentNode* node) {
91 DCHECK(bookmarks::IsPermanentNode(node, managed_bookmark_service_)); 91 DCHECK(bookmarks::IsPermanentNode(node, managed_bookmark_service_));
(...skipping 30 matching lines...) Expand all
122 ? true 122 ? true
123 : managed_bookmark_service_->CanSyncNode(node); 123 : managed_bookmark_service_->CanSyncNode(node);
124 } 124 }
125 125
126 bool ChromeBookmarkClient::CanBeEditedByUser( 126 bool ChromeBookmarkClient::CanBeEditedByUser(
127 const bookmarks::BookmarkNode* node) { 127 const bookmarks::BookmarkNode* node) {
128 return !managed_bookmark_service_ 128 return !managed_bookmark_service_
129 ? true 129 ? true
130 : managed_bookmark_service_->CanBeEditedByUser(node); 130 : managed_bookmark_service_->CanBeEditedByUser(node);
131 } 131 }
OLDNEW
« no previous file with comments | « no previous file | components/bookmarks/browser/BUILD.gn » ('j') | components/bookmarks/browser/bookmark_client.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698