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

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

Issue 12086109: Prevent bindings escalation on an existing NavigationEntry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Catch another case where pending WebUI was set. 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // counted pointer to a shared site instance. 87 // counted pointer to a shared site instance.
85 // 88 //
86 // Note that the SiteInstance should usually not be changed after it is set, 89 // Note that the SiteInstance should usually not be changed after it is set,
87 // but this may happen if the NavigationEntry was cloned and needs to use a 90 // but this may happen if the NavigationEntry was cloned and needs to use a
88 // different SiteInstance. 91 // different SiteInstance.
89 void set_site_instance(SiteInstanceImpl* site_instance); 92 void set_site_instance(SiteInstanceImpl* site_instance);
90 SiteInstanceImpl* site_instance() const { 93 SiteInstanceImpl* site_instance() const {
91 return site_instance_.get(); 94 return site_instance_.get();
92 } 95 }
93 96
97 // Remember the set of bindings granted to this NavigationEntry at the time
98 // of commit, to ensure that we do not grant it additional bindings if we
99 // navigate back to it in the future. This can only be changed once.
100 void SetBindings(int bindings);
101 int bindings() const {
102 return bindings_;
103 }
104
94 void set_page_type(PageType page_type) { 105 void set_page_type(PageType page_type) {
95 page_type_ = page_type; 106 page_type_ = page_type;
96 } 107 }
97 108
98 bool has_virtual_url() const { 109 bool has_virtual_url() const {
99 return !virtual_url_.is_empty(); 110 return !virtual_url_.is_empty();
100 } 111 }
101 112
102 bool update_virtual_url_with_url() const { 113 bool update_virtual_url_with_url() const {
103 return update_virtual_url_with_url_; 114 return update_virtual_url_with_url_;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 189 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
179 // Session/Tab restore save portions of this class so that it can be recreated 190 // Session/Tab restore save portions of this class so that it can be recreated
180 // later. If you add a new field that needs to be persisted you'll have to 191 // later. If you add a new field that needs to be persisted you'll have to
181 // update SessionService/TabRestoreService and Android WebView 192 // update SessionService/TabRestoreService and Android WebView
182 // state_serializer.cc appropriately. 193 // state_serializer.cc appropriately.
183 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 194 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
184 195
185 // See the accessors above for descriptions. 196 // See the accessors above for descriptions.
186 int unique_id_; 197 int unique_id_;
187 scoped_refptr<SiteInstanceImpl> site_instance_; 198 scoped_refptr<SiteInstanceImpl> site_instance_;
199 // TODO(creis): Persist bindings_. http://crbug.com/173672.
200 int bindings_;
188 PageType page_type_; 201 PageType page_type_;
189 GURL url_; 202 GURL url_;
190 Referrer referrer_; 203 Referrer referrer_;
191 GURL virtual_url_; 204 GURL virtual_url_;
192 bool update_virtual_url_with_url_; 205 bool update_virtual_url_with_url_;
193 string16 title_; 206 string16 title_;
194 FaviconStatus favicon_; 207 FaviconStatus favicon_;
195 std::string content_state_; 208 std::string content_state_;
196 int32 page_id_; 209 int32 page_id_;
197 SSLStatus ssl_; 210 SSLStatus ssl_;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // If not empty, the name of the frame to navigate. This field is not 277 // If not empty, the name of the frame to navigate. This field is not
265 // persisted, because it is currently only used in tests. 278 // persisted, because it is currently only used in tests.
266 std::string frame_to_navigate_; 279 std::string frame_to_navigate_;
267 280
268 // Copy and assignment is explicitly allowed for this class. 281 // Copy and assignment is explicitly allowed for this class.
269 }; 282 };
270 283
271 } // namespace content 284 } // namespace content
272 285
273 #endif // CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_ 286 #endif // CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698