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 17 matching lines...) Expand all Loading... |
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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 <memory> |
| 39 |
38 #include "base/containers/hash_tables.h" | 40 #include "base/containers/hash_tables.h" |
39 #include "base/memory/scoped_ptr.h" | |
40 #include "base/memory/scoped_vector.h" | 41 #include "base/memory/scoped_vector.h" |
41 #include "base/memory/weak_ptr.h" | 42 #include "base/memory/weak_ptr.h" |
42 #include "content/common/content_export.h" | 43 #include "content/common/content_export.h" |
43 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 44 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
44 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 45 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
45 | 46 |
46 namespace blink { | 47 namespace blink { |
47 class WebFrame; | 48 class WebFrame; |
48 } | 49 } |
49 | 50 |
(...skipping 20 matching lines...) Expand all Loading... |
70 void set_item(const blink::WebHistoryItem& item); | 71 void set_item(const blink::WebHistoryItem& item); |
71 std::vector<HistoryNode*>& children() const { return children_->get(); } | 72 std::vector<HistoryNode*>& children() const { return children_->get(); } |
72 void RemoveChildren(); | 73 void RemoveChildren(); |
73 | 74 |
74 private: | 75 private: |
75 // When a HistoryEntry is destroyed, it takes all its HistoryNodes with it. | 76 // When a HistoryEntry is destroyed, it takes all its HistoryNodes with it. |
76 // Use a WeakPtr to ensure that HistoryNodes don't try to illegally access | 77 // Use a WeakPtr to ensure that HistoryNodes don't try to illegally access |
77 // a dying HistoryEntry, or do unnecessary work when the whole entry is | 78 // a dying HistoryEntry, or do unnecessary work when the whole entry is |
78 // being destroyed. | 79 // being destroyed. |
79 base::WeakPtr<HistoryEntry> entry_; | 80 base::WeakPtr<HistoryEntry> entry_; |
80 scoped_ptr<ScopedVector<HistoryNode> > children_; | 81 std::unique_ptr<ScopedVector<HistoryNode>> children_; |
81 blink::WebHistoryItem item_; | 82 blink::WebHistoryItem item_; |
82 // We need to track multiple names because the name of a frame can change | 83 // We need to track multiple names because the name of a frame can change |
83 // over its lifetime. This allows us to clean up all of the names this node | 84 // over its lifetime. This allows us to clean up all of the names this node |
84 // has ever known by when it is destroyed. | 85 // has ever known by when it is destroyed. |
85 std::vector<std::string> unique_names_; | 86 std::vector<std::string> unique_names_; |
86 }; | 87 }; |
87 | 88 |
88 HistoryEntry(const blink::WebHistoryItem& root); | 89 HistoryEntry(const blink::WebHistoryItem& root); |
89 HistoryEntry(); | 90 HistoryEntry(); |
90 ~HistoryEntry(); | 91 ~HistoryEntry(); |
91 | 92 |
92 HistoryEntry* CloneAndReplace(const blink::WebHistoryItem& newItem, | 93 HistoryEntry* CloneAndReplace(const blink::WebHistoryItem& newItem, |
93 bool clone_children_of_target, | 94 bool clone_children_of_target, |
94 RenderFrameImpl* target_frame, | 95 RenderFrameImpl* target_frame, |
95 RenderViewImpl* render_view); | 96 RenderViewImpl* render_view); |
96 | 97 |
97 HistoryNode* GetHistoryNodeForFrame(RenderFrameImpl* frame); | 98 HistoryNode* GetHistoryNodeForFrame(RenderFrameImpl* frame); |
98 blink::WebHistoryItem GetItemForFrame(RenderFrameImpl* frame); | 99 blink::WebHistoryItem GetItemForFrame(RenderFrameImpl* frame); |
99 const blink::WebHistoryItem& root() const { return root_->item(); } | 100 const blink::WebHistoryItem& root() const { return root_->item(); } |
100 HistoryNode* root_history_node() const { return root_.get(); } | 101 HistoryNode* root_history_node() const { return root_.get(); } |
101 | 102 |
102 private: | 103 private: |
103 scoped_ptr<HistoryNode> root_; | 104 std::unique_ptr<HistoryNode> root_; |
104 | 105 |
105 typedef base::hash_map<std::string, HistoryNode*> UniqueNamesToItems; | 106 typedef base::hash_map<std::string, HistoryNode*> UniqueNamesToItems; |
106 UniqueNamesToItems unique_names_to_items_; | 107 UniqueNamesToItems unique_names_to_items_; |
107 | 108 |
108 base::WeakPtrFactory<HistoryEntry> weak_ptr_factory_; | 109 base::WeakPtrFactory<HistoryEntry> weak_ptr_factory_; |
109 }; | 110 }; |
110 | 111 |
111 } // namespace content | 112 } // namespace content |
112 | 113 |
113 #endif // CONTENT_RENDERER_HISTORY_ENTRY_H_ | 114 #endif // CONTENT_RENDERER_HISTORY_ENTRY_H_ |
OLD | NEW |