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

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

Issue 14142009: Remove Apple's unused implementation of private browsing from WebCore (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 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/WebCore/html/HTMLMediaElement.cpp ('k') | Source/WebCore/loader/icon/IconDatabase.h » ('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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // 1) Back/forward: The m_currentItem is part of this mechanism. 345 // 1) Back/forward: The m_currentItem is part of this mechanism.
346 // 2) Global history: Handled by the client. 346 // 2) Global history: Handled by the client.
347 // 3) Visited links: Handled by the PageGroup. 347 // 3) Visited links: Handled by the PageGroup.
348 348
349 void HistoryController::updateForStandardLoad(HistoryUpdateType updateType) 349 void HistoryController::updateForStandardLoad(HistoryUpdateType updateType)
350 { 350 {
351 LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s ", m_frame->loader()->documentLoader()->url().string().ascii().data()); 351 LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s ", m_frame->loader()->documentLoader()->url().string().ascii().data());
352 352
353 FrameLoader* frameLoader = m_frame->loader(); 353 FrameLoader* frameLoader = m_frame->loader();
354 354
355 Settings* settings = m_frame->settings();
356 bool needPrivacy = !settings || settings->privateBrowsingEnabled();
357 const KURL& historyURL = frameLoader->documentLoader()->urlForHistory(); 355 const KURL& historyURL = frameLoader->documentLoader()->urlForHistory();
358 356
359 if (!frameLoader->documentLoader()->isClientRedirect()) { 357 if (!frameLoader->documentLoader()->isClientRedirect()) {
360 if (!historyURL.isEmpty()) { 358 if (!historyURL.isEmpty()) {
361 if (updateType != UpdateAllExceptBackForwardList) 359 if (updateType != UpdateAllExceptBackForwardList)
362 updateBackForwardListClippedAtTarget(true); 360 updateBackForwardListClippedAtTarget(true);
363 } 361 }
364 } else { 362 } else {
365 // The client redirect replaces the current history item. 363 // The client redirect replaces the current history item.
366 updateCurrentItem(); 364 updateCurrentItem();
367 } 365 }
368 366
369 if (!historyURL.isEmpty() && !needPrivacy) { 367 if (!historyURL.isEmpty()) {
370 if (Page* page = m_frame->page()) 368 if (Page* page = m_frame->page())
371 addVisitedLink(page, historyURL); 369 addVisitedLink(page, historyURL);
372 } 370 }
373 } 371 }
374 372
375 void HistoryController::updateForRedirectWithLockedBackForwardList() 373 void HistoryController::updateForRedirectWithLockedBackForwardList()
376 { 374 {
377 #if !LOG_DISABLED 375 #if !LOG_DISABLED
378 if (m_frame->loader()->documentLoader()) 376 if (m_frame->loader()->documentLoader())
379 LOG(History, "WebCoreHistory: Updating History for redirect load in fram e %s", m_frame->loader()->documentLoader()->title().string().utf8().data()); 377 LOG(History, "WebCoreHistory: Updating History for redirect load in fram e %s", m_frame->loader()->documentLoader()->title().string().utf8().data());
380 #endif 378 #endif
381 379
382 Settings* settings = m_frame->settings();
383 bool needPrivacy = !settings || settings->privateBrowsingEnabled();
384 const KURL& historyURL = m_frame->loader()->documentLoader()->urlForHistory( ); 380 const KURL& historyURL = m_frame->loader()->documentLoader()->urlForHistory( );
385 381
386 if (m_frame->loader()->documentLoader()->isClientRedirect()) { 382 if (m_frame->loader()->documentLoader()->isClientRedirect()) {
387 if (!m_currentItem && !m_frame->tree()->parent()) { 383 if (!m_currentItem && !m_frame->tree()->parent()) {
388 if (!historyURL.isEmpty()) 384 if (!historyURL.isEmpty())
389 updateBackForwardListClippedAtTarget(true); 385 updateBackForwardListClippedAtTarget(true);
390 } 386 }
391 // The client redirect replaces the current history item. 387 // The client redirect replaces the current history item.
392 updateCurrentItem(); 388 updateCurrentItem();
393 } else { 389 } else {
394 Frame* parentFrame = m_frame->tree()->parent(); 390 Frame* parentFrame = m_frame->tree()->parent();
395 if (parentFrame && parentFrame->loader()->history()->m_currentItem) 391 if (parentFrame && parentFrame->loader()->history()->m_currentItem)
396 parentFrame->loader()->history()->m_currentItem->setChildItem(create Item()); 392 parentFrame->loader()->history()->m_currentItem->setChildItem(create Item());
397 } 393 }
398 394
399 if (!historyURL.isEmpty() && !needPrivacy) { 395 if (!historyURL.isEmpty()) {
400 if (Page* page = m_frame->page()) 396 if (Page* page = m_frame->page())
401 addVisitedLink(page, historyURL); 397 addVisitedLink(page, historyURL);
402 } 398 }
403 } 399 }
404 400
405 void HistoryController::updateForClientRedirect() 401 void HistoryController::updateForClientRedirect()
406 { 402 {
407 #if !LOG_DISABLED 403 #if !LOG_DISABLED
408 if (m_frame->loader()->documentLoader()) 404 if (m_frame->loader()->documentLoader())
409 LOG(History, "WebCoreHistory: Updating History for client redirect in fr ame %s", m_frame->loader()->documentLoader()->title().string().utf8().data()); 405 LOG(History, "WebCoreHistory: Updating History for client redirect in fr ame %s", m_frame->loader()->documentLoader()->title().string().utf8().data());
410 #endif 406 #endif
411 407
412 // Clear out form data so we don't try to restore it into the incoming page. Must happen after 408 // Clear out form data so we don't try to restore it into the incoming page. Must happen after
413 // webcore has closed the URL and saved away the form state. 409 // webcore has closed the URL and saved away the form state.
414 if (m_currentItem) { 410 if (m_currentItem) {
415 m_currentItem->clearDocumentState(); 411 m_currentItem->clearDocumentState();
416 m_currentItem->clearScrollPoint(); 412 m_currentItem->clearScrollPoint();
417 } 413 }
418 414
419 Settings* settings = m_frame->settings();
420 bool needPrivacy = !settings || settings->privateBrowsingEnabled();
421 const KURL& historyURL = m_frame->loader()->documentLoader()->urlForHistory( ); 415 const KURL& historyURL = m_frame->loader()->documentLoader()->urlForHistory( );
422 416
423 if (!historyURL.isEmpty() && !needPrivacy) { 417 if (!historyURL.isEmpty()) {
424 if (Page* page = m_frame->page()) 418 if (Page* page = m_frame->page())
425 addVisitedLink(page, historyURL); 419 addVisitedLink(page, historyURL);
426 } 420 }
427 } 421 }
428 422
429 void HistoryController::updateForCommit() 423 void HistoryController::updateForCommit()
430 { 424 {
431 FrameLoader* frameLoader = m_frame->loader(); 425 FrameLoader* frameLoader = m_frame->loader();
432 #if !LOG_DISABLED 426 #if !LOG_DISABLED
433 if (frameLoader->documentLoader()) 427 if (frameLoader->documentLoader())
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // Iterate over the rest of the tree 496 // Iterate over the rest of the tree
503 for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tre e()->nextSibling()) 497 for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tre e()->nextSibling())
504 child->loader()->history()->recursiveUpdateForCommit(); 498 child->loader()->history()->recursiveUpdateForCommit();
505 } 499 }
506 500
507 void HistoryController::updateForSameDocumentNavigation() 501 void HistoryController::updateForSameDocumentNavigation()
508 { 502 {
509 if (m_frame->document()->url().isEmpty()) 503 if (m_frame->document()->url().isEmpty())
510 return; 504 return;
511 505
512 Settings* settings = m_frame->settings();
513 if (!settings || settings->privateBrowsingEnabled())
514 return;
515
516 Page* page = m_frame->page(); 506 Page* page = m_frame->page();
517 if (!page) 507 if (!page)
518 return; 508 return;
519 509
520 addVisitedLink(page, m_frame->document()->url()); 510 addVisitedLink(page, m_frame->document()->url());
521 page->mainFrame()->loader()->history()->recursiveUpdateForSameDocumentNaviga tion(); 511 page->mainFrame()->loader()->history()->recursiveUpdateForSameDocumentNaviga tion();
522 512
523 if (m_currentItem) 513 if (m_currentItem)
524 m_currentItem->setURL(m_frame->document()->url()); 514 m_currentItem->setURL(m_frame->document()->url());
525 } 515 }
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 RefPtr<HistoryItem> topItem = page->mainFrame()->loader()->history()->create ItemTree(m_frame, false); 816 RefPtr<HistoryItem> topItem = page->mainFrame()->loader()->history()->create ItemTree(m_frame, false);
827 817
828 // Override data in the current item (created by createItemTree) to reflect 818 // Override data in the current item (created by createItemTree) to reflect
829 // the pushState() arguments. 819 // the pushState() arguments.
830 m_currentItem->setTitle(title); 820 m_currentItem->setTitle(title);
831 m_currentItem->setStateObject(stateObject); 821 m_currentItem->setStateObject(stateObject);
832 m_currentItem->setURLString(urlString); 822 m_currentItem->setURLString(urlString);
833 823
834 page->backForward()->addItem(topItem.release()); 824 page->backForward()->addItem(topItem.release());
835 825
836 Settings* settings = m_frame->settings();
837 if (!settings || settings->privateBrowsingEnabled())
838 return;
839
840 addVisitedLink(page, KURL(ParsedURLString, urlString)); 826 addVisitedLink(page, KURL(ParsedURLString, urlString));
841 } 827 }
842 828
843 void HistoryController::replaceState(PassRefPtr<SerializedScriptValue> stateObje ct, const String& title, const String& urlString) 829 void HistoryController::replaceState(PassRefPtr<SerializedScriptValue> stateObje ct, const String& title, const String& urlString)
844 { 830 {
845 if (!m_currentItem) 831 if (!m_currentItem)
846 return; 832 return;
847 833
848 if (!urlString.isEmpty()) 834 if (!urlString.isEmpty())
849 m_currentItem->setURLString(urlString); 835 m_currentItem->setURLString(urlString);
850 m_currentItem->setTitle(title); 836 m_currentItem->setTitle(title);
851 m_currentItem->setStateObject(stateObject); 837 m_currentItem->setStateObject(stateObject);
852 m_currentItem->setFormData(0); 838 m_currentItem->setFormData(0);
853 m_currentItem->setFormContentType(String()); 839 m_currentItem->setFormContentType(String());
854 840
855 Settings* settings = m_frame->settings();
856 if (!settings || settings->privateBrowsingEnabled())
857 return;
858
859 ASSERT(m_frame->page()); 841 ASSERT(m_frame->page());
860 addVisitedLink(m_frame->page(), KURL(ParsedURLString, urlString)); 842 addVisitedLink(m_frame->page(), KURL(ParsedURLString, urlString));
861 } 843 }
862 844
863 } // namespace WebCore 845 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/html/HTMLMediaElement.cpp ('k') | Source/WebCore/loader/icon/IconDatabase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698