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 "webkit/glue/glue_serialize.h" | 5 #include "webkit/glue/glue_serialize.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 | 502 |
503 SerializeObject obj; | 503 SerializeObject obj; |
504 WriteHistoryItem(item, &obj); | 504 WriteHistoryItem(item, &obj); |
505 return obj.GetAsString(); | 505 return obj.GetAsString(); |
506 } | 506 } |
507 | 507 |
508 WebHistoryItem HistoryItemFromString(const std::string& serialized_item) { | 508 WebHistoryItem HistoryItemFromString(const std::string& serialized_item) { |
509 return HistoryItemFromString(serialized_item, ALWAYS_INCLUDE_FORM_DATA, true); | 509 return HistoryItemFromString(serialized_item, ALWAYS_INCLUDE_FORM_DATA, true); |
510 } | 510 } |
511 | 511 |
512 std::vector<FilePath> FilePathsFromHistoryState( | 512 std::vector<base::FilePath> FilePathsFromHistoryState( |
513 const std::string& content_state) { | 513 const std::string& content_state) { |
514 std::vector<FilePath> to_return; | 514 std::vector<base::FilePath> to_return; |
515 // TODO(darin): We should avoid using the WebKit API here, so that we do not | 515 // TODO(darin): We should avoid using the WebKit API here, so that we do not |
516 // need to have WebKit initialized before calling this method. | 516 // need to have WebKit initialized before calling this method. |
517 const WebHistoryItem& item = | 517 const WebHistoryItem& item = |
518 HistoryItemFromString(content_state, ALWAYS_INCLUDE_FORM_DATA, true); | 518 HistoryItemFromString(content_state, ALWAYS_INCLUDE_FORM_DATA, true); |
519 if (item.isNull()) { | 519 if (item.isNull()) { |
520 // Couldn't parse the string. | 520 // Couldn't parse the string. |
521 return to_return; | 521 return to_return; |
522 } | 522 } |
523 const WebVector<WebString> file_paths = item.getReferencedFilePaths(); | 523 const WebVector<WebString> file_paths = item.getReferencedFilePaths(); |
524 for (size_t i = 0; i < file_paths.size(); ++i) | 524 for (size_t i = 0; i < file_paths.size(); ++i) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 // serialization of the given URL with a dummy version number of -1. This | 597 // serialization of the given URL with a dummy version number of -1. This |
598 // will be interpreted by ReadHistoryItem as a request to create a default | 598 // will be interpreted by ReadHistoryItem as a request to create a default |
599 // WebHistoryItem. | 599 // WebHistoryItem. |
600 SerializeObject obj; | 600 SerializeObject obj; |
601 WriteInteger(-1, &obj); | 601 WriteInteger(-1, &obj); |
602 WriteGURL(url, &obj); | 602 WriteGURL(url, &obj); |
603 return obj.GetAsString(); | 603 return obj.GetAsString(); |
604 } | 604 } |
605 | 605 |
606 } // namespace webkit_glue | 606 } // namespace webkit_glue |
OLD | NEW |