| 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 /* | 5 /* |
| 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 8 * (http://www.torchmobile.com/) | 8 * (http://www.torchmobile.com/) |
| 9 * | 9 * |
| 10 * Redistribution and use in source and binary forms, with or without | 10 * Redistribution and use in source and binary forms, with or without |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 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. | 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 33 */ | 33 */ |
| 34 | 34 |
| 35 #ifndef CONTENT_RENDERER_HISTORY_ENTRY_H_ | 35 #ifndef CONTENT_RENDERER_HISTORY_ENTRY_H_ |
| 36 #define CONTENT_RENDERER_HISTORY_ENTRY_H_ | 36 #define CONTENT_RENDERER_HISTORY_ENTRY_H_ |
| 37 | 37 |
| 38 #include "base/containers/hash_tables.h" | 38 #include "base/containers/hash_tables.h" |
| 39 #include "base/memory/scoped_ptr.h" | 39 #include "base/memory/scoped_ptr.h" |
| 40 #include "base/memory/scoped_vector.h" | 40 #include "base/memory/scoped_vector.h" |
| 41 #include "content/common/content_export.h" |
| 41 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 42 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 42 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 43 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
| 43 | 44 |
| 44 namespace blink { | 45 namespace blink { |
| 45 class WebFrame; | 46 class WebFrame; |
| 46 } | 47 } |
| 47 | 48 |
| 48 namespace content { | 49 namespace content { |
| 49 class RenderFrameImpl; | 50 class RenderFrameImpl; |
| 50 class RenderViewImpl; | 51 class RenderViewImpl; |
| 51 | 52 |
| 52 const int kInvalidFrameRoutingID = -1; | 53 const int kInvalidFrameRoutingID = -1; |
| 53 | 54 |
| 54 class HistoryEntry { | 55 class CONTENT_EXPORT HistoryEntry { |
| 55 public: | 56 public: |
| 56 class HistoryNode { | 57 class HistoryNode { |
| 57 public: | 58 public: |
| 58 HistoryNode(HistoryEntry* entry, | 59 HistoryNode(HistoryEntry* entry, |
| 59 const blink::WebHistoryItem& item, | 60 const blink::WebHistoryItem& item, |
| 60 int64_t frame_id); | 61 int64_t frame_id); |
| 61 ~HistoryNode(); | 62 ~HistoryNode(); |
| 62 | 63 |
| 63 HistoryNode* AddChild(const blink::WebHistoryItem& item, int64_t frame_id); | 64 HistoryNode* AddChild(const blink::WebHistoryItem& item, int64_t frame_id); |
| 65 HistoryNode* AddChild(); |
| 64 HistoryNode* CloneAndReplace(HistoryEntry* new_entry, | 66 HistoryNode* CloneAndReplace(HistoryEntry* new_entry, |
| 65 const blink::WebHistoryItem& new_item, | 67 const blink::WebHistoryItem& new_item, |
| 66 bool clone_children_of_target, | 68 bool clone_children_of_target, |
| 67 RenderFrameImpl* target_frame, | 69 RenderFrameImpl* target_frame, |
| 68 RenderFrameImpl* current_frame); | 70 RenderFrameImpl* current_frame); |
| 69 blink::WebHistoryItem& item() { return item_; } | 71 blink::WebHistoryItem& item() { return item_; } |
| 70 void set_item(const blink::WebHistoryItem& item) { item_ = item; } | 72 void set_item(const blink::WebHistoryItem& item); |
| 71 std::vector<HistoryNode*>& children() const { return children_->get(); } | 73 std::vector<HistoryNode*>& children() const { return children_->get(); } |
| 72 void RemoveChildren(); | 74 void RemoveChildren(); |
| 73 | 75 |
| 74 private: | 76 private: |
| 75 HistoryEntry* entry_; | 77 HistoryEntry* entry_; |
| 76 scoped_ptr<ScopedVector<HistoryNode> > children_; | 78 scoped_ptr<ScopedVector<HistoryNode> > children_; |
| 77 blink::WebHistoryItem item_; | 79 blink::WebHistoryItem item_; |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 HistoryEntry(const blink::WebHistoryItem& root, int64_t frame_id); | 82 HistoryEntry(const blink::WebHistoryItem& root, int64_t frame_id); |
| 83 HistoryEntry(); |
| 81 ~HistoryEntry(); | 84 ~HistoryEntry(); |
| 82 | 85 |
| 83 HistoryEntry* CloneAndReplace(const blink::WebHistoryItem& newItem, | 86 HistoryEntry* CloneAndReplace(const blink::WebHistoryItem& newItem, |
| 84 bool clone_children_of_target, | 87 bool clone_children_of_target, |
| 85 RenderFrameImpl* target_frame, | 88 RenderFrameImpl* target_frame, |
| 86 RenderViewImpl* render_view); | 89 RenderViewImpl* render_view); |
| 87 | 90 |
| 88 HistoryNode* GetHistoryNodeForFrame(RenderFrameImpl* frame); | 91 HistoryNode* GetHistoryNodeForFrame(RenderFrameImpl* frame); |
| 89 blink::WebHistoryItem GetItemForFrame(RenderFrameImpl* frame); | 92 blink::WebHistoryItem GetItemForFrame(RenderFrameImpl* frame); |
| 90 const blink::WebHistoryItem& root() const { return root_->item(); } | 93 const blink::WebHistoryItem& root() const { return root_->item(); } |
| 91 HistoryNode* root_history_node() const { return root_.get(); } | 94 HistoryNode* root_history_node() const { return root_.get(); } |
| 92 | 95 |
| 93 private: | 96 private: |
| 94 HistoryEntry(); | |
| 95 | 97 |
| 96 scoped_ptr<HistoryNode> root_; | 98 scoped_ptr<HistoryNode> root_; |
| 97 | 99 |
| 98 typedef base::hash_map<uint64_t, HistoryNode*> FramesToItems; | 100 typedef base::hash_map<uint64_t, HistoryNode*> FramesToItems; |
| 99 FramesToItems frames_to_items_; | 101 FramesToItems frames_to_items_; |
| 100 | 102 |
| 101 typedef base::hash_map<std::string, HistoryNode*> UniqueNamesToItems; | 103 typedef base::hash_map<std::string, HistoryNode*> UniqueNamesToItems; |
| 102 UniqueNamesToItems unique_names_to_items_; | 104 UniqueNamesToItems unique_names_to_items_; |
| 103 }; | 105 }; |
| 104 | 106 |
| 105 } // namespace content | 107 } // namespace content |
| 106 | 108 |
| 107 #endif // CONTENT_RENDERER_HISTORY_ENTRY_H_ | 109 #endif // CONTENT_RENDERER_HISTORY_ENTRY_H_ |
| OLD | NEW |