OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef COMPONENTS_SESSIONS_SERIALIZED_NAVIGATION_ENTRY_H_ | 5 #ifndef COMPONENTS_SESSIONS_SERIALIZED_NAVIGATION_ENTRY_H_ |
6 #define COMPONENTS_SESSIONS_SERIALIZED_NAVIGATION_ENTRY_H_ | 6 #define COMPONENTS_SESSIONS_SERIALIZED_NAVIGATION_ENTRY_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "components/sessions/sessions_export.h" | 16 #include "components/sessions/sessions_export.h" |
17 #include "ui/base/page_transition_types.h" | 17 #include "ui/base/page_transition_types.h" |
18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
19 | 19 |
| 20 namespace base { |
20 class Pickle; | 21 class Pickle; |
21 class PickleIterator; | 22 class PickleIterator; |
| 23 } |
22 | 24 |
23 namespace sync_pb { | 25 namespace sync_pb { |
24 class TabNavigation; | 26 class TabNavigation; |
25 } | 27 } |
26 | 28 |
27 namespace sessions { | 29 namespace sessions { |
28 | 30 |
29 class SerializedNavigationEntryTestHelper; | 31 class SerializedNavigationEntryTestHelper; |
30 | 32 |
31 // The key used to store search terms data in the NavigationEntry. | 33 // The key used to store search terms data in the NavigationEntry. |
(...skipping 21 matching lines...) Expand all Loading... |
53 // protocol buffer. Note that the sync protocol buffer doesn't contain all | 55 // protocol buffer. Note that the sync protocol buffer doesn't contain all |
54 // SerializedNavigationEntry fields. Also, the timestamp of the returned | 56 // SerializedNavigationEntry fields. Also, the timestamp of the returned |
55 // SerializedNavigationEntry is nulled out, as we assume that the protocol | 57 // SerializedNavigationEntry is nulled out, as we assume that the protocol |
56 // buffer is from a foreign session. | 58 // buffer is from a foreign session. |
57 static SerializedNavigationEntry FromSyncData( | 59 static SerializedNavigationEntry FromSyncData( |
58 int index, | 60 int index, |
59 const sync_pb::TabNavigation& sync_data); | 61 const sync_pb::TabNavigation& sync_data); |
60 | 62 |
61 // Note that not all SerializedNavigationEntry fields are preserved. | 63 // Note that not all SerializedNavigationEntry fields are preserved. |
62 // |max_size| is the max number of bytes to write. | 64 // |max_size| is the max number of bytes to write. |
63 void WriteToPickle(int max_size, Pickle* pickle) const; | 65 void WriteToPickle(int max_size, base::Pickle* pickle) const; |
64 bool ReadFromPickle(PickleIterator* iterator); | 66 bool ReadFromPickle(base::PickleIterator* iterator); |
65 | 67 |
66 // Convert this navigation into its sync protocol buffer equivalent. Note | 68 // Convert this navigation into its sync protocol buffer equivalent. Note |
67 // that the protocol buffer doesn't contain all SerializedNavigationEntry | 69 // that the protocol buffer doesn't contain all SerializedNavigationEntry |
68 // fields. | 70 // fields. |
69 sync_pb::TabNavigation ToSyncData() const; | 71 sync_pb::TabNavigation ToSyncData() const; |
70 | 72 |
71 // The index in the NavigationController. This SerializedNavigationEntry is | 73 // The index in the NavigationController. This SerializedNavigationEntry is |
72 // valid only when the index is non-negative. | 74 // valid only when the index is non-negative. |
73 int index() const { return index_; } | 75 int index() const { return index_; } |
74 void set_index(int index) { index_ = index; } | 76 void set_index(int index) { index_ = index; } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 std::vector<GURL> redirect_chain_; // Not persisted. | 137 std::vector<GURL> redirect_chain_; // Not persisted. |
136 | 138 |
137 // Additional information. | 139 // Additional information. |
138 BlockedState blocked_state_; | 140 BlockedState blocked_state_; |
139 std::set<std::string> content_pack_categories_; | 141 std::set<std::string> content_pack_categories_; |
140 }; | 142 }; |
141 | 143 |
142 } // namespace sessions | 144 } // namespace sessions |
143 | 145 |
144 #endif // COMPONENTS_SESSIONS_SERIALIZED_NAVIGATION_ENTRY_H_ | 146 #endif // COMPONENTS_SESSIONS_SERIALIZED_NAVIGATION_ENTRY_H_ |
OLD | NEW |