OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CONTENT_CONTENT_SERIALIZED_NAVIGATION_BUILDER_H_ | 5 #ifndef COMPONENTS_SESSIONS_CONTENT_CONTENT_SERIALIZED_NAVIGATION_BUILDER_H_ |
6 #define COMPONENTS_SESSIONS_CONTENT_CONTENT_SERIALIZED_NAVIGATION_BUILDER_H_ | 6 #define COMPONENTS_SESSIONS_CONTENT_CONTENT_SERIALIZED_NAVIGATION_BUILDER_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "components/sessions/core/sessions_export.h" | 11 #include "components/sessions/core/sessions_export.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class BrowserContext; | 14 class BrowserContext; |
15 class NavigationEntry; | 15 class NavigationEntry; |
16 } | 16 } |
17 | 17 |
18 namespace sessions { | 18 namespace sessions { |
19 class SerializedNavigationEntry; | 19 class SerializedNavigationEntry; |
20 | 20 |
21 // Provides methods to convert between SerializedNavigationEntry and content | 21 // Provides methods to convert between SerializedNavigationEntry and content |
22 // classes. | 22 // classes. |
23 class SESSIONS_EXPORT ContentSerializedNavigationBuilder { | 23 class SESSIONS_EXPORT ContentSerializedNavigationBuilder { |
24 public: | 24 public: |
25 // Construct a SerializedNavigationEntry for a particular index from the given | 25 // Construct a SerializedNavigationEntry for a particular index from the given |
26 // NavigationEntry. | 26 // NavigationEntry. |
27 static SerializedNavigationEntry FromNavigationEntry( | 27 static SerializedNavigationEntry FromNavigationEntry( |
28 int index, | 28 int index, |
29 const content::NavigationEntry& entry); | 29 const content::NavigationEntry& entry); |
30 | 30 |
31 // Convert the given SerializedNavigationEntry into a NavigationEntry with the | 31 // Convert the given SerializedNavigationEntry into a NavigationEntry with the |
32 // given page ID and context. The NavigationEntry will have a transition type | 32 // given page ID and context. The NavigationEntry will have a transition type |
33 // of PAGE_TRANSITION_RELOAD and a new unique ID. | 33 // of PAGE_TRANSITION_RELOAD and a new unique ID. |
34 static scoped_ptr<content::NavigationEntry> ToNavigationEntry( | 34 static std::unique_ptr<content::NavigationEntry> ToNavigationEntry( |
35 const SerializedNavigationEntry* navigation, | 35 const SerializedNavigationEntry* navigation, |
36 int page_id, | 36 int page_id, |
37 content::BrowserContext* browser_context); | 37 content::BrowserContext* browser_context); |
38 | 38 |
39 // Converts a set of SerializedNavigationEntrys into a list of | 39 // Converts a set of SerializedNavigationEntrys into a list of |
40 // NavigationEntrys with sequential page IDs and the given context. | 40 // NavigationEntrys with sequential page IDs and the given context. |
41 static std::vector<scoped_ptr<content::NavigationEntry>> ToNavigationEntries( | 41 static std::vector<std::unique_ptr<content::NavigationEntry>> |
42 const std::vector<SerializedNavigationEntry>& navigations, | 42 ToNavigationEntries(const std::vector<SerializedNavigationEntry>& navigations, |
43 content::BrowserContext* browser_context); | 43 content::BrowserContext* browser_context); |
44 }; | 44 }; |
45 | 45 |
46 } // namespace sessions | 46 } // namespace sessions |
47 | 47 |
48 #endif // COMPONENTS_SESSIONS_CONTENT_CONTENT_SERIALIZED_NAVIGATION_BUILDER_H_ | 48 #endif // COMPONENTS_SESSIONS_CONTENT_CONTENT_SERIALIZED_NAVIGATION_BUILDER_H_ |
OLD | NEW |