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_util.h" | 10 #include "base/string_util.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 list->Append(dict); | 42 list->Append(dict); |
43 } | 43 } |
44 | 44 |
45 void GetVisitInfoDictionary(const history::VisitRow& row, | 45 void GetVisitInfoDictionary(const history::VisitRow& row, |
46 DictionaryValue* value) { | 46 DictionaryValue* value) { |
47 value->SetString(keys::kIdKey, Int64ToString(row.url_id)); | 47 value->SetString(keys::kIdKey, Int64ToString(row.url_id)); |
48 value->SetString(keys::kVisitId, Int64ToString(row.visit_id)); | 48 value->SetString(keys::kVisitId, Int64ToString(row.visit_id)); |
49 value->SetReal(keys::kVisitTime, MilliSecondsFromTime(row.visit_time)); | 49 value->SetReal(keys::kVisitTime, MilliSecondsFromTime(row.visit_time)); |
50 value->SetString(keys::kReferringVisitId, | 50 value->SetString(keys::kReferringVisitId, |
51 Int64ToString(row.referring_visit)); | 51 Int64ToString(row.referring_visit)); |
52 value->SetInteger(keys::kTransition, | 52 |
53 row.transition && PageTransition::CORE_MASK); | 53 const char* trans = PageTransition::CoreTransitionString(row.transition); |
| 54 DCHECK(trans) << "Invalid transition."; |
| 55 value->SetString(keys::kTransition, trans); |
54 } | 56 } |
55 | 57 |
56 void AddVisitNode(const history::VisitRow& row, ListValue* list) { | 58 void AddVisitNode(const history::VisitRow& row, ListValue* list) { |
57 DictionaryValue* dict = new DictionaryValue(); | 59 DictionaryValue* dict = new DictionaryValue(); |
58 GetVisitInfoDictionary(row, dict); | 60 GetVisitInfoDictionary(row, dict); |
59 list->Append(dict); | 61 list->Append(dict); |
60 } | 62 } |
61 | 63 |
62 } // namespace | 64 } // namespace |
63 | 65 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 base::Time::Now(), // To the current time. | 366 base::Time::Now(), // To the current time. |
365 &cancelable_consumer_, | 367 &cancelable_consumer_, |
366 NewCallback(this, &DeleteAllHistoryFunction::DeleteComplete)); | 368 NewCallback(this, &DeleteAllHistoryFunction::DeleteComplete)); |
367 | 369 |
368 return true; | 370 return true; |
369 } | 371 } |
370 | 372 |
371 void DeleteAllHistoryFunction::DeleteComplete() { | 373 void DeleteAllHistoryFunction::DeleteComplete() { |
372 SendAsyncResponse(); | 374 SendAsyncResponse(); |
373 } | 375 } |
OLD | NEW |