| OLD | NEW |
| 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/extensions/extension_history_api.h" | 5 #include "chrome/browser/extensions/extension_history_api.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 result_.reset(list); | 241 result_.reset(list); |
| 242 SendAsyncResponse(); | 242 SendAsyncResponse(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 bool SearchHistoryFunction::RunAsyncImpl() { | 245 bool SearchHistoryFunction::RunAsyncImpl() { |
| 246 DictionaryValue* json; | 246 DictionaryValue* json; |
| 247 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &json)); | 247 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &json)); |
| 248 | 248 |
| 249 // Initialize the HistoryQuery | 249 // Initialize the HistoryQuery |
| 250 string16 search_text; | 250 string16 search_text; |
| 251 EXTENSION_FUNCTION_VALIDATE(json->GetStringAsUTF16(keys::kTextKey, | 251 EXTENSION_FUNCTION_VALIDATE(json->GetString(keys::kTextKey, &search_text)); |
| 252 &search_text)); | |
| 253 | 252 |
| 254 history::QueryOptions options; | 253 history::QueryOptions options; |
| 255 options.SetRecentDayRange(1); | 254 options.SetRecentDayRange(1); |
| 256 options.max_count = 100; | 255 options.max_count = 100; |
| 257 | 256 |
| 258 if (json->HasKey(keys::kStartTimeKey)) { // Optional. | 257 if (json->HasKey(keys::kStartTimeKey)) { // Optional. |
| 259 Value* value; | 258 Value* value; |
| 260 EXTENSION_FUNCTION_VALIDATE(json->Get(keys::kStartTimeKey, &value)); | 259 EXTENSION_FUNCTION_VALIDATE(json->Get(keys::kStartTimeKey, &value)); |
| 261 EXTENSION_FUNCTION_VALIDATE(GetTimeFromValue(value, &options.begin_time)); | 260 EXTENSION_FUNCTION_VALIDATE(GetTimeFromValue(value, &options.begin_time)); |
| 262 } | 261 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 base::Time::Now(), // To the current time. | 366 base::Time::Now(), // To the current time. |
| 368 &cancelable_consumer_, | 367 &cancelable_consumer_, |
| 369 NewCallback(this, &DeleteAllHistoryFunction::DeleteComplete)); | 368 NewCallback(this, &DeleteAllHistoryFunction::DeleteComplete)); |
| 370 | 369 |
| 371 return true; | 370 return true; |
| 372 } | 371 } |
| 373 | 372 |
| 374 void DeleteAllHistoryFunction::DeleteComplete() { | 373 void DeleteAllHistoryFunction::DeleteComplete() { |
| 375 SendAsyncResponse(); | 374 SendAsyncResponse(); |
| 376 } | 375 } |
| OLD | NEW |