OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/history_extension_api.h" | 5 #include "chrome/browser/history/history_extension_api.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "base/time.h" |
14 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
15 #include "base/values.h" | 16 #include "base/values.h" |
16 #include "chrome/browser/extensions/event_router.h" | 17 #include "chrome/browser/extensions/event_router.h" |
17 #include "chrome/browser/history/history.h" | 18 #include "chrome/browser/history/history.h" |
18 #include "chrome/browser/history/history_service_factory.h" | 19 #include "chrome/browser/history/history_service_factory.h" |
19 #include "chrome/browser/history/history_types.h" | 20 #include "chrome/browser/history/history_types.h" |
20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
22 #include "content/public/browser/notification_details.h" | 23 #include "content/public/browser/notification_details.h" |
23 #include "content/public/browser/notification_source.h" | 24 #include "content/public/browser/notification_source.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 scoped_ptr<AddUrl::Params> params(AddUrl::Params::Create(*args_)); | 325 scoped_ptr<AddUrl::Params> params(AddUrl::Params::Create(*args_)); |
325 EXTENSION_FUNCTION_VALIDATE(params.get()); | 326 EXTENSION_FUNCTION_VALIDATE(params.get()); |
326 | 327 |
327 GURL url; | 328 GURL url; |
328 if (!ValidateUrl(params->details.url, &url)) | 329 if (!ValidateUrl(params->details.url, &url)) |
329 return false; | 330 return false; |
330 | 331 |
331 HistoryService* hs = | 332 HistoryService* hs = |
332 HistoryServiceFactory::GetForProfile(profile(), | 333 HistoryServiceFactory::GetForProfile(profile(), |
333 Profile::EXPLICIT_ACCESS); | 334 Profile::EXPLICIT_ACCESS); |
334 hs->AddPage(url, history::SOURCE_EXTENSION); | 335 hs->AddPage(url, base::Time::Now(), history::SOURCE_EXTENSION); |
335 | 336 |
336 SendResponse(true); | 337 SendResponse(true); |
337 return true; | 338 return true; |
338 } | 339 } |
339 | 340 |
340 bool DeleteUrlHistoryFunction::RunImpl() { | 341 bool DeleteUrlHistoryFunction::RunImpl() { |
341 scoped_ptr<DeleteUrl::Params> params(DeleteUrl::Params::Create(*args_)); | 342 scoped_ptr<DeleteUrl::Params> params(DeleteUrl::Params::Create(*args_)); |
342 EXTENSION_FUNCTION_VALIDATE(params.get()); | 343 EXTENSION_FUNCTION_VALIDATE(params.get()); |
343 | 344 |
344 GURL url; | 345 GURL url; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 &cancelable_consumer_, | 393 &cancelable_consumer_, |
393 base::Bind(&DeleteAllHistoryFunction::DeleteComplete, | 394 base::Bind(&DeleteAllHistoryFunction::DeleteComplete, |
394 base::Unretained(this))); | 395 base::Unretained(this))); |
395 | 396 |
396 return true; | 397 return true; |
397 } | 398 } |
398 | 399 |
399 void DeleteAllHistoryFunction::DeleteComplete() { | 400 void DeleteAllHistoryFunction::DeleteComplete() { |
400 SendAsyncResponse(); | 401 SendAsyncResponse(); |
401 } | 402 } |
OLD | NEW |