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

Side by Side Diff: chrome/browser/history/in_memory_history_backend.cc

Issue 6135001: Makes the in memory db update rows that have search terms associated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improve comments and forward declare Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/history/in_memory_history_backend.h" 5 #include "chrome/browser/history/in_memory_history_backend.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 void InMemoryHistoryBackend::Observe(NotificationType type, 84 void InMemoryHistoryBackend::Observe(NotificationType type,
85 const NotificationSource& source, 85 const NotificationSource& source,
86 const NotificationDetails& details) { 86 const NotificationDetails& details) {
87 switch (type.value) { 87 switch (type.value) {
88 case NotificationType::HISTORY_URL_VISITED: { 88 case NotificationType::HISTORY_URL_VISITED: {
89 Details<history::URLVisitedDetails> visited_details(details); 89 Details<history::URLVisitedDetails> visited_details(details);
90 PageTransition::Type primary_type = 90 PageTransition::Type primary_type =
91 PageTransition::StripQualifier(visited_details->transition); 91 PageTransition::StripQualifier(visited_details->transition);
92 if (visited_details->row.typed_count() > 0 || 92 if (visited_details->row.typed_count() > 0 ||
93 primary_type == PageTransition::KEYWORD) { 93 primary_type == PageTransition::KEYWORD ||
94 HasKeyword(visited_details->row.url())) {
brettw 2011/01/06 20:43:34 Doesn't the row here have the keyword details as w
94 URLsModifiedDetails modified_details; 95 URLsModifiedDetails modified_details;
95 modified_details.changed_urls.push_back(visited_details->row); 96 modified_details.changed_urls.push_back(visited_details->row);
96 OnTypedURLsModified(modified_details); 97 OnTypedURLsModified(modified_details);
97 } 98 }
98 break; 99 break;
99 } 100 }
100 case NotificationType::HISTORY_KEYWORD_SEARCH_TERM_UPDATED: 101 case NotificationType::HISTORY_KEYWORD_SEARCH_TERM_UPDATED:
101 OnKeywordSearchTermUpdated( 102 OnKeywordSearchTermUpdated(
102 *Details<history::KeywordSearchTermDetails>(details).ptr()); 103 *Details<history::KeywordSearchTermDetails>(details).ptr());
103 break; 104 break;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 url_id = db_->AddURL(new_row); 180 url_id = db_->AddURL(new_row);
180 if (!url_id) 181 if (!url_id)
181 return; // Error adding. 182 return; // Error adding.
182 } else { 183 } else {
183 url_id = url_row.id(); 184 url_id = url_row.id();
184 } 185 }
185 186
186 db_->SetKeywordSearchTermsForURL(url_id, details.keyword_id, details.term); 187 db_->SetKeywordSearchTermsForURL(url_id, details.keyword_id, details.term);
187 } 188 }
188 189
190 bool InMemoryHistoryBackend::HasKeyword(const GURL& url) {
191 URLID id = db_->GetRowForURL(url, NULL);
192 if (!id)
193 return false;
194
195 return db_->GetKeywordSearchTermRow(id, NULL);
196 }
197
189 } // namespace history 198 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/in_memory_history_backend.h ('k') | chrome/browser/history/url_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698