OLD | NEW |
1 // Copyright (c) 2009 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/extensions/extension_history_api.h" | 5 #include "chrome/browser/extensions/extension_history_api.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/task.h" | 10 #include "base/task.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 bool SearchHistoryFunction::RunAsyncImpl() { | 239 bool SearchHistoryFunction::RunAsyncImpl() { |
240 EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY)); | 240 EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY)); |
241 DictionaryValue* json = static_cast<DictionaryValue*>(args_); | 241 DictionaryValue* json = static_cast<DictionaryValue*>(args_); |
242 | 242 |
243 // Initialize the HistoryQuery | 243 // Initialize the HistoryQuery |
244 std::wstring search_text; | 244 std::wstring search_text; |
245 EXTENSION_FUNCTION_VALIDATE(json->GetString(keys::kSearchKey, &search_text)); | 245 EXTENSION_FUNCTION_VALIDATE(json->GetString(keys::kSearchKey, &search_text)); |
246 | 246 |
247 history::QueryOptions options; | 247 history::QueryOptions options; |
248 options.most_recent_visit_only = true; | |
249 options.SetRecentDayRange(1); | 248 options.SetRecentDayRange(1); |
250 options.max_count = 100; | 249 options.max_count = 100; |
251 | 250 |
252 if (json->HasKey(keys::kStartTimeKey)) { // Optional. | 251 if (json->HasKey(keys::kStartTimeKey)) { // Optional. |
253 Value* value; | 252 Value* value; |
254 EXTENSION_FUNCTION_VALIDATE(json->Get(keys::kStartTimeKey, &value)); | 253 EXTENSION_FUNCTION_VALIDATE(json->Get(keys::kStartTimeKey, &value)); |
255 EXTENSION_FUNCTION_VALIDATE(GetTimeFromValue(value, &options.begin_time)); | 254 EXTENSION_FUNCTION_VALIDATE(GetTimeFromValue(value, &options.begin_time)); |
256 } | 255 } |
257 if (json->HasKey(keys::kEndTimeKey)) { // Optional. | 256 if (json->HasKey(keys::kEndTimeKey)) { // Optional. |
258 Value* value; | 257 Value* value; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 base::Time::Now(), // To the current time. | 356 base::Time::Now(), // To the current time. |
358 &cancelable_consumer_, | 357 &cancelable_consumer_, |
359 NewCallback(this, &DeleteAllHistoryFunction::DeleteComplete)); | 358 NewCallback(this, &DeleteAllHistoryFunction::DeleteComplete)); |
360 | 359 |
361 return true; | 360 return true; |
362 } | 361 } |
363 | 362 |
364 void DeleteAllHistoryFunction::DeleteComplete() { | 363 void DeleteAllHistoryFunction::DeleteComplete() { |
365 SendAsyncResponse(); | 364 SendAsyncResponse(); |
366 } | 365 } |
OLD | NEW |