OLD | NEW |
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* ***** BEGIN LICENSE BLOCK ***** | 2 /* ***** BEGIN LICENSE BLOCK ***** |
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
4 * | 4 * |
5 * The contents of this file are subject to the Mozilla Public License Version | 5 * The contents of this file are subject to the Mozilla Public License Version |
6 * 1.1 (the "License"); you may not use this file except in compliance with | 6 * 1.1 (the "License"); you may not use this file except in compliance with |
7 * the License. You may obtain a copy of the License at | 7 * the License. You may obtain a copy of the License at |
8 * http://www.mozilla.org/MPL/ | 8 * http://www.mozilla.org/MPL/ |
9 * | 9 * |
10 * Software distributed under the License is distributed on an "AS IS" basis, | 10 * Software distributed under the License is distributed on an "AS IS" basis, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #include "base/i18n/icu_string_conversions.h" | 48 #include "base/i18n/icu_string_conversions.h" |
49 #include "base/logging.h" | 49 #include "base/logging.h" |
50 #include "base/message_loop.h" | 50 #include "base/message_loop.h" |
51 #include "base/string_number_conversions.h" | 51 #include "base/string_number_conversions.h" |
52 #include "base/string_util.h" | 52 #include "base/string_util.h" |
53 #include "base/values.h" | 53 #include "base/values.h" |
54 #include "chrome/browser/history/history_types.h" | 54 #include "chrome/browser/history/history_types.h" |
55 #include "chrome/browser/importer/firefox_importer_utils.h" | 55 #include "chrome/browser/importer/firefox_importer_utils.h" |
56 #include "chrome/browser/importer/importer_bridge.h" | 56 #include "chrome/browser/importer/importer_bridge.h" |
57 | 57 |
58 using base::Time; | |
59 | |
60 namespace { | 58 namespace { |
61 | 59 |
62 // Convert a hex character (0-9, A-F) to its corresponding byte value. | 60 // Convert a hex character (0-9, A-F) to its corresponding byte value. |
63 // Returns -1 if the character is invalid. | 61 // Returns -1 if the character is invalid. |
64 inline int HexCharToInt(char c) { | 62 inline int HexCharToInt(char c) { |
65 if ('0' <= c && c <= '9') | 63 if ('0' <= c && c <= '9') |
66 return c - '0'; | 64 return c - '0'; |
67 if ('A' <= c && c <= 'F') | 65 if ('A' <= c && c <= 'F') |
68 return c - 'A' + 10; | 66 return c - 'A' + 10; |
69 return -1; | 67 return -1; |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 row.set_title(title); | 525 row.set_title(title); |
528 | 526 |
529 int count = atoi(values[kVisitCountColumn].c_str()); | 527 int count = atoi(values[kVisitCountColumn].c_str()); |
530 if (count == 0) | 528 if (count == 0) |
531 count = 1; | 529 count = 1; |
532 row.set_visit_count(count); | 530 row.set_visit_count(count); |
533 | 531 |
534 int64 date; | 532 int64 date; |
535 base::StringToInt64(values[kLastVisitColumn], &date); | 533 base::StringToInt64(values[kLastVisitColumn], &date); |
536 if (date != 0) | 534 if (date != 0) |
537 row.set_last_visit(Time::FromTimeT(date / 1000000)); | 535 row.set_last_visit(base::Time::FromTimeT(date / 1000000)); |
538 | 536 |
539 bool is_typed = (values[kTypedColumn] == "1"); | 537 bool is_typed = (values[kTypedColumn] == "1"); |
540 if (is_typed) | 538 if (is_typed) |
541 row.set_typed_count(1); | 539 row.set_typed_count(1); |
542 | 540 |
543 rows->push_back(row); | 541 rows->push_back(row); |
544 } | 542 } |
545 } | 543 } |
546 | 544 |
547 // It sets up the file stream and loops over the lines in the file to | 545 // It sets up the file stream and loops over the lines in the file to |
(...skipping 30 matching lines...) Expand all Loading... |
578 data.swap_bytes = (byte_order_value == "BE"); | 576 data.swap_bytes = (byte_order_value == "BE"); |
579 } | 577 } |
580 } | 578 } |
581 | 579 |
582 std::vector<history::URLRow> rows; | 580 std::vector<history::URLRow> rows; |
583 for (MorkReader::iterator i = reader.begin(); i != reader.end(); ++i) | 581 for (MorkReader::iterator i = reader.begin(); i != reader.end(); ++i) |
584 AddToHistory(i->second, data, &rows); | 582 AddToHistory(i->second, data, &rows); |
585 if (!rows.empty()) | 583 if (!rows.empty()) |
586 bridge->SetHistoryItems(rows, history::SOURCE_FIREFOX_IMPORTED); | 584 bridge->SetHistoryItems(rows, history::SOURCE_FIREFOX_IMPORTED); |
587 } | 585 } |
OLD | NEW |