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.
6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
8 * (http://www.torchmobile.com/)
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
20 * its contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #ifndef CONTENT_RENDERER_HISTORY_ENTRY_H_
36 #define CONTENT_RENDERER_HISTORY_ENTRY_H_
38 #include "base/containers/hash_tables.h"
39 #include "base/memory/scoped_ptr.h"
40 #include "base/memory/scoped_vector.h"
41 #include "content/common/content_export.h"
42 #include "third_party/WebKit/public/platform/WebURLRequest.h"
43 #include "third_party/WebKit/public/web/WebHistoryItem.h"
50 class RenderFrameImpl
;
53 const int kInvalidFrameRoutingID
= -1;
55 class CONTENT_EXPORT HistoryEntry
{
59 HistoryNode(HistoryEntry
* entry
,
60 const blink::WebHistoryItem
& item
,
64 HistoryNode
* AddChild(const blink::WebHistoryItem
& item
, int64_t frame_id
);
65 HistoryNode
* AddChild();
66 HistoryNode
* CloneAndReplace(HistoryEntry
* new_entry
,
67 const blink::WebHistoryItem
& new_item
,
68 bool clone_children_of_target
,
69 RenderFrameImpl
* target_frame
,
70 RenderFrameImpl
* current_frame
);
71 blink::WebHistoryItem
& item() { return item_
; }
72 void set_item(const blink::WebHistoryItem
& item
);
73 std::vector
<HistoryNode
*>& children() const { return children_
->get(); }
74 void RemoveChildren();
78 scoped_ptr
<ScopedVector
<HistoryNode
> > children_
;
79 blink::WebHistoryItem item_
;
82 HistoryEntry(const blink::WebHistoryItem
& root
, int64_t frame_id
);
86 HistoryEntry
* CloneAndReplace(const blink::WebHistoryItem
& newItem
,
87 bool clone_children_of_target
,
88 RenderFrameImpl
* target_frame
,
89 RenderViewImpl
* render_view
);
91 HistoryNode
* GetHistoryNodeForFrame(RenderFrameImpl
* frame
);
92 blink::WebHistoryItem
GetItemForFrame(RenderFrameImpl
* frame
);
93 const blink::WebHistoryItem
& root() const { return root_
->item(); }
94 HistoryNode
* root_history_node() const { return root_
.get(); }
98 scoped_ptr
<HistoryNode
> root_
;
100 typedef base::hash_map
<uint64_t, HistoryNode
*> FramesToItems
;
101 FramesToItems frames_to_items_
;
103 typedef base::hash_map
<std::string
, HistoryNode
*> UniqueNamesToItems
;
104 UniqueNamesToItems unique_names_to_items_
;
107 } // namespace content
109 #endif // CONTENT_RENDERER_HISTORY_ENTRY_H_