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

Side by Side Diff: chrome/browser/dom_ui/history_ui.cc

Issue 341087: Eliminate QueryOptions::most_recent_visit_only. All non-unittest consumers o... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/dom_ui/history_ui.h" 5 #include "chrome/browser/dom_ui/history_ui.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/i18n/time_formatting.h" 9 #include "base/i18n/time_formatting.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/singleton.h" 11 #include "base/singleton.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 int day = 0; 141 int day = 0;
142 ExtractIntegerValue(value, &day); 142 ExtractIntegerValue(value, &day);
143 143
144 // Set our query options. 144 // Set our query options.
145 history::QueryOptions options; 145 history::QueryOptions options;
146 options.begin_time = base::Time::Now().LocalMidnight(); 146 options.begin_time = base::Time::Now().LocalMidnight();
147 options.begin_time -= base::TimeDelta::FromDays(day); 147 options.begin_time -= base::TimeDelta::FromDays(day);
148 options.end_time = base::Time::Now().LocalMidnight(); 148 options.end_time = base::Time::Now().LocalMidnight();
149 options.end_time -= base::TimeDelta::FromDays(day - 1); 149 options.end_time -= base::TimeDelta::FromDays(day - 1);
150 150
151 // As we're querying per-day, we can turn entry repeats off.
152 options.most_recent_visit_only = true;
153
154 // Need to remember the query string for our results. 151 // Need to remember the query string for our results.
155 search_text_ = std::wstring(); 152 search_text_ = std::wstring();
156 153
157 HistoryService* hs = 154 HistoryService* hs =
158 dom_ui_->GetProfile()->GetHistoryService(Profile::EXPLICIT_ACCESS); 155 dom_ui_->GetProfile()->GetHistoryService(Profile::EXPLICIT_ACCESS);
159 hs->QueryHistory(search_text_, 156 hs->QueryHistory(search_text_,
160 options, 157 options,
161 &cancelable_consumer_, 158 &cancelable_consumer_,
162 NewCallback(this, &BrowsingHistoryHandler::QueryComplete)); 159 NewCallback(this, &BrowsingHistoryHandler::QueryComplete));
163 } 160 }
164 161
165 void BrowsingHistoryHandler::HandleSearchHistory(const Value* value) { 162 void BrowsingHistoryHandler::HandleSearchHistory(const Value* value) {
166 // Anything in-flight is invalid. 163 // Anything in-flight is invalid.
167 cancelable_consumer_.CancelAllRequests(); 164 cancelable_consumer_.CancelAllRequests();
168 165
169 // Get arguments (if any). 166 // Get arguments (if any).
170 int month = 0; 167 int month = 0;
171 std::wstring query; 168 std::wstring query;
172 ExtractSearchHistoryArguments(value, &month, &query); 169 ExtractSearchHistoryArguments(value, &month, &query);
173 170
174 // Set the query ranges for the given month. 171 // Set the query ranges for the given month.
175 history::QueryOptions options = CreateMonthQueryOptions(month); 172 history::QueryOptions options = CreateMonthQueryOptions(month);
176 173
177 // When searching, limit the number of results returned and only show the 174 // When searching, limit the number of results returned.
178 // most recent matches.
179 options.max_count = kMaxSearchResults; 175 options.max_count = kMaxSearchResults;
180 options.most_recent_visit_only = true;
181 176
182 // Need to remember the query string for our results. 177 // Need to remember the query string for our results.
183 search_text_ = query; 178 search_text_ = query;
184 HistoryService* hs = 179 HistoryService* hs =
185 dom_ui_->GetProfile()->GetHistoryService(Profile::EXPLICIT_ACCESS); 180 dom_ui_->GetProfile()->GetHistoryService(Profile::EXPLICIT_ACCESS);
186 hs->QueryHistory(search_text_, 181 hs->QueryHistory(search_text_,
187 options, 182 options,
188 &cancelable_consumer_, 183 &cancelable_consumer_,
189 NewCallback(this, &BrowsingHistoryHandler::QueryComplete)); 184 NewCallback(this, &BrowsingHistoryHandler::QueryComplete));
190 } 185 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 const GURL HistoryUI::GetHistoryURLWithSearchText(const std::wstring& text) { 378 const GURL HistoryUI::GetHistoryURLWithSearchText(const std::wstring& text) {
384 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + 379 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" +
385 EscapeQueryParamValue(WideToUTF8(text))); 380 EscapeQueryParamValue(WideToUTF8(text)));
386 } 381 }
387 382
388 // static 383 // static
389 RefCountedMemory* HistoryUI::GetFaviconResourceBytes() { 384 RefCountedMemory* HistoryUI::GetFaviconResourceBytes() {
390 return ResourceBundle::GetSharedInstance(). 385 return ResourceBundle::GetSharedInstance().
391 LoadImageResourceBytes(IDR_HISTORY_FAVICON); 386 LoadImageResourceBytes(IDR_HISTORY_FAVICON);
392 } 387 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_contents_provider.cc ('k') | chrome/browser/extensions/extension_history_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698