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

Side by Side Diff: Source/core/loader/HistoryController.cpp

Issue 14787005: Simply FrameLoaderStateMachine and FrameLoader::transitionToCommitted(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merge to trunk for landing Created 7 years, 7 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
« no previous file with comments | « Source/core/loader/HistoryController.h ('k') | Source/core/loader/ProgressTracker.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 // When reloading the page, we may end up redirecting to a different URL 301 // When reloading the page, we may end up redirecting to a different URL
302 // this time (e.g., due to cookies). See http://webkit.org/b/4072. 302 // this time (e.g., due to cookies). See http://webkit.org/b/4072.
303 updateCurrentItem(); 303 updateCurrentItem();
304 } 304 }
305 305
306 // There are 2 things you might think of as "history", all of which are handled by these functions. 306 // There are 2 things you might think of as "history", all of which are handled by these functions.
307 // 307 //
308 // 1) Back/forward: The m_currentItem is part of this mechanism. 308 // 1) Back/forward: The m_currentItem is part of this mechanism.
309 // 2) Global history: Handled by the client. 309 // 2) Global history: Handled by the client.
310 // 310 //
311 void HistoryController::updateForStandardLoad(HistoryUpdateType updateType) 311 void HistoryController::updateForStandardLoad()
312 { 312 {
313 LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s ", m_frame->loader()->documentLoader()->url().string().ascii().data()); 313 LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s ", m_frame->loader()->documentLoader()->url().string().ascii().data());
314 314
315 FrameLoader* frameLoader = m_frame->loader(); 315 FrameLoader* frameLoader = m_frame->loader();
316 316
317 const KURL& historyURL = frameLoader->documentLoader()->urlForHistory(); 317 const KURL& historyURL = frameLoader->documentLoader()->urlForHistory();
318 318
319 if (!frameLoader->documentLoader()->isClientRedirect()) { 319 if (!frameLoader->documentLoader()->isClientRedirect()) {
320 if (!historyURL.isEmpty()) { 320 if (!historyURL.isEmpty())
321 if (updateType != UpdateAllExceptBackForwardList) 321 updateBackForwardListClippedAtTarget(true);
322 updateBackForwardListClippedAtTarget(true);
323 }
324 } else { 322 } else {
325 // The client redirect replaces the current history item. 323 // The client redirect replaces the current history item.
326 updateCurrentItem(); 324 updateCurrentItem();
327 } 325 }
328 } 326 }
329 327
330 void HistoryController::updateForRedirectWithLockedBackForwardList() 328 void HistoryController::updateForRedirectWithLockedBackForwardList()
331 { 329 {
332 #if !LOG_DISABLED 330 #if !LOG_DISABLED
333 if (m_frame->loader()->documentLoader()) 331 if (m_frame->loader()->documentLoader())
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 void HistoryController::updateForCommit() 366 void HistoryController::updateForCommit()
369 { 367 {
370 FrameLoader* frameLoader = m_frame->loader(); 368 FrameLoader* frameLoader = m_frame->loader();
371 #if !LOG_DISABLED 369 #if !LOG_DISABLED
372 if (frameLoader->documentLoader()) 370 if (frameLoader->documentLoader())
373 LOG(History, "WebCoreHistory: Updating History for commit in frame %s", frameLoader->documentLoader()->title().string().utf8().data()); 371 LOG(History, "WebCoreHistory: Updating History for commit in frame %s", frameLoader->documentLoader()->title().string().utf8().data());
374 #endif 372 #endif
375 FrameLoadType type = frameLoader->loadType(); 373 FrameLoadType type = frameLoader->loadType();
376 if (isBackForwardLoadType(type) 374 if (isBackForwardLoadType(type)
377 || isReplaceLoadTypeWithProvisionalItem(type) 375 || isReplaceLoadTypeWithProvisionalItem(type)
378 || (isReloadTypeWithProvisionalItem(type) && !frameLoader->provisionalDo cumentLoader()->unreachableURL().isEmpty())) { 376 || (isReloadTypeWithProvisionalItem(type) && !frameLoader->documentLoade r()->unreachableURL().isEmpty())) {
379 // Once committed, we want to use current item for saving DocState, and 377 // Once committed, we want to use current item for saving DocState, and
380 // the provisional item for restoring state. 378 // the provisional item for restoring state.
381 // Note previousItem must be set before we close the URL, which will 379 // Note previousItem must be set before we close the URL, which will
382 // happen when the data source is made non-provisional below 380 // happen when the data source is made non-provisional below
383 m_frameLoadComplete = false; 381 m_frameLoadComplete = false;
384 m_previousItem = m_currentItem; 382 m_previousItem = m_currentItem;
385 ASSERT(m_provisionalItem); 383 ASSERT(m_provisionalItem);
386 m_currentItem = m_provisionalItem; 384 m_currentItem = m_provisionalItem;
387 m_provisionalItem = 0; 385 m_provisionalItem = 0;
388 386
389 // Tell all other frames in the tree to commit their provisional items a nd 387 // Tell all other frames in the tree to commit their provisional items a nd
390 // restore their scroll position. We'll avoid this frame (which has alr eady 388 // restore their scroll position. We'll avoid this frame (which has alr eady
391 // committed) and its children (which will be replaced). 389 // committed) and its children (which will be replaced).
392 Page* page = m_frame->page(); 390 Page* page = m_frame->page();
393 ASSERT(page); 391 ASSERT(page);
394 page->mainFrame()->loader()->history()->recursiveUpdateForCommit(); 392 page->mainFrame()->loader()->history()->recursiveUpdateForCommit();
395 } 393 }
394
395 switch (type) {
396 case FrameLoadTypeForward:
397 case FrameLoadTypeBack:
398 case FrameLoadTypeIndexedBackForward:
399 updateForBackForwardNavigation();
400 return;
401 case FrameLoadTypeReload:
402 case FrameLoadTypeReloadFromOrigin:
403 case FrameLoadTypeSame:
404 case FrameLoadTypeReplace:
405 updateForReload();
406 return;
407 case FrameLoadTypeStandard:
408 updateForStandardLoad();
409 return;
410 case FrameLoadTypeRedirectWithLockedBackForwardList:
411 updateForRedirectWithLockedBackForwardList();
412 return;
413 default:
414 ASSERT_NOT_REACHED();
415 }
396 } 416 }
397 417
398 bool HistoryController::isReplaceLoadTypeWithProvisionalItem(FrameLoadType type) 418 bool HistoryController::isReplaceLoadTypeWithProvisionalItem(FrameLoadType type)
399 { 419 {
400 // Going back to an error page in a subframe can trigger a FrameLoadTypeRepl ace 420 // Going back to an error page in a subframe can trigger a FrameLoadTypeRepl ace
401 // while m_provisionalItem is set, so we need to commit it. 421 // while m_provisionalItem is set, so we need to commit it.
402 return type == FrameLoadTypeReplace && m_provisionalItem; 422 return type == FrameLoadTypeReplace && m_provisionalItem;
403 } 423 }
404 424
405 bool HistoryController::isReloadTypeWithProvisionalItem(FrameLoadType type) 425 bool HistoryController::isReloadTypeWithProvisionalItem(FrameLoadType type)
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 m_currentItem->setURLString(urlString); 794 m_currentItem->setURLString(urlString);
775 m_currentItem->setTitle(title); 795 m_currentItem->setTitle(title);
776 m_currentItem->setStateObject(stateObject); 796 m_currentItem->setStateObject(stateObject);
777 m_currentItem->setFormData(0); 797 m_currentItem->setFormData(0);
778 m_currentItem->setFormContentType(String()); 798 m_currentItem->setFormContentType(String());
779 799
780 ASSERT(m_frame->page()); 800 ASSERT(m_frame->page());
781 } 801 }
782 802
783 } // namespace WebCore 803 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/loader/HistoryController.h ('k') | Source/core/loader/ProgressTracker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698