Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / components / sessions / content / content_serialized_navigation_builder.h
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_SESSIONS_CONTENT_CONTENT_SERIALIZED_NAVIGATION_BUILDER_H_
6 #define COMPONENTS_SESSIONS_CONTENT_CONTENT_SERIALIZED_NAVIGATION_BUILDER_H_
7
8 #include <vector>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/scoped_vector.h"
12 #include "components/sessions/sessions_export.h"
13
14 namespace content {
15 class BrowserContext;
16 class NavigationEntry;
17 }
18
19 namespace sessions {
20 class SerializedNavigationEntry;
21
22 // Provides methods to convert between SerializedNavigationEntry and content
23 // classes.
24 class SESSIONS_EXPORT ContentSerializedNavigationBuilder {
25  public:
26   // Construct a SerializedNavigationEntry for a particular index from the given
27   // NavigationEntry.
28   static SerializedNavigationEntry FromNavigationEntry(
29       int index,
30       const content::NavigationEntry& entry);
31
32   // Convert the given SerializedNavigationEntry into a NavigationEntry with the
33   // given page ID and context.  The NavigationEntry will have a transition type
34   // of PAGE_TRANSITION_RELOAD and a new unique ID.
35   static scoped_ptr<content::NavigationEntry> ToNavigationEntry(
36       const SerializedNavigationEntry* navigation,
37       int page_id,
38       content::BrowserContext* browser_context);
39
40   // Converts a set of SerializedNavigationEntrys into a list of
41   // NavigationEntrys with sequential page IDs and the given context.
42   static ScopedVector<content::NavigationEntry> ToNavigationEntries(
43       const std::vector<SerializedNavigationEntry>& navigations,
44       content::BrowserContext* browser_context);
45 };
46
47 }  // namespace sessions
48
49 #endif  // COMPONENTS_SESSIONS_CONTENT_CONTENT_SERIALIZED_NAVIGATION_BUILDER_H_