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

Side by Side Diff: content/browser/frame_host/navigation_entry_impl.cc

Issue 2648053002: Remove old session history logic. (Closed)
Patch Set: Remove comment. Created 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/browser/frame_host/navigation_entry_impl.h" 5 #include "content/browser/frame_host/navigation_entry_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <queue> 9 #include <queue>
10 #include <utility> 10 #include <utility>
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 void NavigationEntryImpl::SetTitle(const base::string16& title) { 348 void NavigationEntryImpl::SetTitle(const base::string16& title) {
349 title_ = title; 349 title_ = title;
350 cached_display_title_.clear(); 350 cached_display_title_.clear();
351 } 351 }
352 352
353 const base::string16& NavigationEntryImpl::GetTitle() const { 353 const base::string16& NavigationEntryImpl::GetTitle() const {
354 return title_; 354 return title_;
355 } 355 }
356 356
357 void NavigationEntryImpl::SetPageState(const PageState& state) { 357 void NavigationEntryImpl::SetPageState(const PageState& state) {
358 if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) {
359 frame_tree_->frame_entry->SetPageState(state);
360 return;
361 }
362
363 // SetPageState should only be called before the NavigationEntry has been 358 // SetPageState should only be called before the NavigationEntry has been
364 // loaded, such as for restore (when there are no subframe 359 // loaded, such as for restore (when there are no subframe
365 // FrameNavigationEntries yet). However, some callers expect to call this 360 // FrameNavigationEntries yet). However, some callers expect to call this
366 // after a Clone but before loading the page. Clone will copy over the 361 // after a Clone but before loading the page. Clone will copy over the
367 // subframe entries, and we should reset them before setting the state again. 362 // subframe entries, and we should reset them before setting the state again.
368 // 363 //
369 // TODO(creis): It would be good to verify that this NavigationEntry hasn't 364 // TODO(creis): It would be good to verify that this NavigationEntry hasn't
370 // been loaded yet in cases that SetPageState is called while subframe 365 // been loaded yet in cases that SetPageState is called while subframe
371 // entries exist, but there's currently no way to check that. 366 // entries exist, but there's currently no way to check that.
372 if (!frame_tree_->children.empty()) 367 if (!frame_tree_->children.empty())
373 frame_tree_->children.clear(); 368 frame_tree_->children.clear();
374 369
375 // If the PageState can't be parsed or has no children, just store it on the 370 // If the PageState can't be parsed or has no children, just store it on the
376 // main frame's FrameNavigationEntry without recursively creating subframe 371 // main frame's FrameNavigationEntry without recursively creating subframe
377 // entries. 372 // entries.
378 ExplodedPageState exploded_state; 373 ExplodedPageState exploded_state;
379 if (!DecodePageState(state.ToEncodedData(), &exploded_state) || 374 if (!DecodePageState(state.ToEncodedData(), &exploded_state) ||
380 exploded_state.top.children.size() == 0U) { 375 exploded_state.top.children.size() == 0U) {
381 frame_tree_->frame_entry->SetPageState(state); 376 frame_tree_->frame_entry->SetPageState(state);
382 return; 377 return;
383 } 378 }
384 379
385 RecursivelyGenerateFrameEntries( 380 RecursivelyGenerateFrameEntries(
386 exploded_state.top, exploded_state.referenced_files, frame_tree_.get()); 381 exploded_state.top, exploded_state.referenced_files, frame_tree_.get());
387 } 382 }
388 383
389 PageState NavigationEntryImpl::GetPageState() const { 384 PageState NavigationEntryImpl::GetPageState() const {
390 // Just return the main frame's PageState in default Chrome, or if there are 385 // Just return the main frame's state if there are no subframe
391 // no subframe FrameNavigationEntries. 386 // FrameNavigationEntries.
392 if (!SiteIsolationPolicy::UseSubframeNavigationEntries() || 387 if (frame_tree_->children.size() == 0U)
393 frame_tree_->children.size() == 0U)
394 return frame_tree_->frame_entry->page_state(); 388 return frame_tree_->frame_entry->page_state();
395 389
396 // When we're using subframe entries, each FrameNavigationEntry has a 390 // When we're using subframe entries, each FrameNavigationEntry has a
397 // frame-specific PageState. We combine these into an ExplodedPageState tree 391 // frame-specific PageState. We combine these into an ExplodedPageState tree
398 // and generate a full PageState from it. 392 // and generate a full PageState from it.
399 ExplodedPageState exploded_state; 393 ExplodedPageState exploded_state;
400 RecursivelyGenerateFrameState(frame_tree_.get(), &exploded_state.top, 394 RecursivelyGenerateFrameState(frame_tree_.get(), &exploded_state.top,
401 &exploded_state.referenced_files); 395 &exploded_state.referenced_files);
402 396
403 std::string encoded_data; 397 std::string encoded_data;
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 return node; 951 return node;
958 952
959 // Enqueue any children and keep looking. 953 // Enqueue any children and keep looking.
960 for (auto* child : node->children) 954 for (auto* child : node->children)
961 work_queue.push(child); 955 work_queue.push(child);
962 } 956 }
963 return nullptr; 957 return nullptr;
964 } 958 }
965 959
966 } // namespace content 960 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl.cc ('k') | content/browser/frame_host/navigator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698