Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Side by Side Diff: content/browser/web_contents/navigation_entry_impl.h

Issue 12210048: Prevent bindings escalation on an existing NavigationEntry (attempt 2). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change URL in test. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "content/browser/site_instance_impl.h" 10 #include "content/browser/site_instance_impl.h"
11 #include "content/public/browser/favicon_status.h" 11 #include "content/public/browser/favicon_status.h"
12 #include "content/public/browser/global_request_id.h" 12 #include "content/public/browser/global_request_id.h"
13 #include "content/public/browser/navigation_entry.h" 13 #include "content/public/browser/navigation_entry.h"
14 #include "content/public/common/ssl_status.h" 14 #include "content/public/common/ssl_status.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 class CONTENT_EXPORT NavigationEntryImpl 18 class CONTENT_EXPORT NavigationEntryImpl
19 : public NON_EXPORTED_BASE(NavigationEntry) { 19 : public NON_EXPORTED_BASE(NavigationEntry) {
20 public: 20 public:
21 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry); 21 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry);
22 22
23 // The value of bindings() before it is set during commit.
24 static int kInvalidBindings;
25
23 NavigationEntryImpl(); 26 NavigationEntryImpl();
24 NavigationEntryImpl(SiteInstanceImpl* instance, 27 NavigationEntryImpl(SiteInstanceImpl* instance,
25 int page_id, 28 int page_id,
26 const GURL& url, 29 const GURL& url,
27 const Referrer& referrer, 30 const Referrer& referrer,
28 const string16& title, 31 const string16& title,
29 PageTransition transition_type, 32 PageTransition transition_type,
30 bool is_renderer_initiated); 33 bool is_renderer_initiated);
31 virtual ~NavigationEntryImpl(); 34 virtual ~NavigationEntryImpl();
32 35
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // counted pointer to a shared site instance. 92 // counted pointer to a shared site instance.
90 // 93 //
91 // Note that the SiteInstance should usually not be changed after it is set, 94 // Note that the SiteInstance should usually not be changed after it is set,
92 // but this may happen if the NavigationEntry was cloned and needs to use a 95 // but this may happen if the NavigationEntry was cloned and needs to use a
93 // different SiteInstance. 96 // different SiteInstance.
94 void set_site_instance(SiteInstanceImpl* site_instance); 97 void set_site_instance(SiteInstanceImpl* site_instance);
95 SiteInstanceImpl* site_instance() const { 98 SiteInstanceImpl* site_instance() const {
96 return site_instance_.get(); 99 return site_instance_.get();
97 } 100 }
98 101
102 // Remember the set of bindings granted to this NavigationEntry at the time
103 // of commit, to ensure that we do not grant it additional bindings if we
104 // navigate back to it in the future. This can only be changed once.
105 void SetBindings(int bindings);
106 int bindings() const {
107 return bindings_;
108 }
109
99 void set_page_type(PageType page_type) { 110 void set_page_type(PageType page_type) {
100 page_type_ = page_type; 111 page_type_ = page_type;
101 } 112 }
102 113
103 bool has_virtual_url() const { 114 bool has_virtual_url() const {
104 return !virtual_url_.is_empty(); 115 return !virtual_url_.is_empty();
105 } 116 }
106 117
107 bool update_virtual_url_with_url() const { 118 bool update_virtual_url_with_url() const {
108 return update_virtual_url_with_url_; 119 return update_virtual_url_with_url_;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 194 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
184 // Session/Tab restore save portions of this class so that it can be recreated 195 // Session/Tab restore save portions of this class so that it can be recreated
185 // later. If you add a new field that needs to be persisted you'll have to 196 // later. If you add a new field that needs to be persisted you'll have to
186 // update SessionService/TabRestoreService and Android WebView 197 // update SessionService/TabRestoreService and Android WebView
187 // state_serializer.cc appropriately. 198 // state_serializer.cc appropriately.
188 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 199 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
189 200
190 // See the accessors above for descriptions. 201 // See the accessors above for descriptions.
191 int unique_id_; 202 int unique_id_;
192 scoped_refptr<SiteInstanceImpl> site_instance_; 203 scoped_refptr<SiteInstanceImpl> site_instance_;
204 // TODO(creis): Persist bindings_. http://crbug.com/173672.
205 int bindings_;
193 PageType page_type_; 206 PageType page_type_;
194 GURL url_; 207 GURL url_;
195 Referrer referrer_; 208 Referrer referrer_;
196 GURL virtual_url_; 209 GURL virtual_url_;
197 bool update_virtual_url_with_url_; 210 bool update_virtual_url_with_url_;
198 string16 title_; 211 string16 title_;
199 FaviconStatus favicon_; 212 FaviconStatus favicon_;
200 std::string content_state_; 213 std::string content_state_;
201 int32 page_id_; 214 int32 page_id_;
202 SSLStatus ssl_; 215 SSLStatus ssl_;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 // persisted, unless specific data is taken out/put back in at save/restore 287 // persisted, unless specific data is taken out/put back in at save/restore
275 // time (see TabNavigation for an example of this). 288 // time (see TabNavigation for an example of this).
276 std::map<std::string, string16> extra_data_; 289 std::map<std::string, string16> extra_data_;
277 290
278 // Copy and assignment is explicitly allowed for this class. 291 // Copy and assignment is explicitly allowed for this class.
279 }; 292 };
280 293
281 } // namespace content 294 } // namespace content
282 295
283 #endif // CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_ 296 #endif // CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698