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

Side by Side Diff: webkit/glue/webframe_impl.cc

Issue 113758: Remove the HistoryState property of WebRequest.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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 | « webkit/glue/webframe_impl.h ('k') | webkit/glue/weburlrequest.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 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 401
402 // We must call init() after frame_ is assigned because it is referenced 402 // We must call init() after frame_ is assigned because it is referenced
403 // during init(). 403 // during init().
404 frame_->init(); 404 frame_->init();
405 405
406 // Inform the browser process of this top-level frame 406 // Inform the browser process of this top-level frame
407 app_cache_context_->Initialize(WebAppCacheContext::MAIN_FRAME, NULL); 407 app_cache_context_->Initialize(WebAppCacheContext::MAIN_FRAME, NULL);
408 } 408 }
409 409
410 void WebFrameImpl::LoadRequest(WebRequest* request) { 410 void WebFrameImpl::LoadRequest(WebRequest* request) {
411 SubstituteData data; 411 InternalLoadRequest(request, SubstituteData(), NULL, false);
412 InternalLoadRequest(request, data, false); 412 }
413
414 void WebFrameImpl::LoadHistoryState(const std::string& history_state) {
415 RefPtr<HistoryItem> history_item =
416 webkit_glue::HistoryItemFromString(history_state);
417 DCHECK(history_item.get());
418
419 WebRequestImpl dummy_request;
420 InternalLoadRequest(&dummy_request, SubstituteData(), history_item, false);
413 } 421 }
414 422
415 void WebFrameImpl::InternalLoadRequest(const WebRequest* request, 423 void WebFrameImpl::InternalLoadRequest(const WebRequest* request,
416 const SubstituteData& data, 424 const SubstituteData& data,
425 PassRefPtr<HistoryItem> history_item,
417 bool replace) { 426 bool replace) {
418 const WebRequestImpl* request_impl = 427 const WebRequestImpl* request_impl =
419 static_cast<const WebRequestImpl*>(request); 428 static_cast<const WebRequestImpl*>(request);
420 429
421 const ResourceRequest& resource_request = 430 const ResourceRequest& resource_request =
422 request_impl->frame_load_request().resourceRequest(); 431 request_impl->frame_load_request().resourceRequest();
423 432
424 // Special-case javascript URLs. Do not interrupt the existing load when 433 // Special-case javascript URLs. Do not interrupt the existing load when
425 // asked to load a javascript URL unless the script generates a result. 434 // asked to load a javascript URL unless the script generates a result.
426 // We can't just use FrameLoader::executeIfJavaScriptURL because it doesn't 435 // We can't just use FrameLoader::executeIfJavaScriptURL because it doesn't
(...skipping 26 matching lines...) Expand all
453 462
454 StopLoading(); // make sure existing activity stops 463 StopLoading(); // make sure existing activity stops
455 464
456 if (data.isValid()) { 465 if (data.isValid()) {
457 frame_->loader()->load(resource_request, data, false); 466 frame_->loader()->load(resource_request, data, false);
458 if (replace) { 467 if (replace) {
459 // Do this to force WebKit to treat the load as replacing the currently 468 // Do this to force WebKit to treat the load as replacing the currently
460 // loaded page. 469 // loaded page.
461 frame_->loader()->setReplacing(); 470 frame_->loader()->setReplacing();
462 } 471 }
463 } else if (request_impl->history_item()) { 472 } else if (history_item.get()) {
464 // Use the history item if we have one, otherwise fall back to standard 473 // Use the history item if we have one, otherwise fall back to standard
465 // load. 474 // load.
466 RefPtr<HistoryItem> current_item = frame_->loader()->currentHistoryItem(); 475 RefPtr<HistoryItem> current_item = frame_->loader()->currentHistoryItem();
467 476
468 // If there is no current_item, which happens when we are navigating in 477 // If there is no current_item, which happens when we are navigating in
469 // session history after a crash, we need to manufacture one otherwise 478 // session history after a crash, we need to manufacture one otherwise
470 // WebKit hoarks. This is probably the wrong thing to do, but it seems to 479 // WebKit hoarks. This is probably the wrong thing to do, but it seems to
471 // work. 480 // work.
472 if (!current_item) { 481 if (!current_item) {
473 current_item = HistoryItem::create(); 482 current_item = HistoryItem::create();
474 current_item->setLastVisitWasFailure(true); 483 current_item->setLastVisitWasFailure(true);
475 frame_->loader()->setCurrentHistoryItem(current_item); 484 frame_->loader()->setCurrentHistoryItem(current_item);
476 GetWebViewImpl()->SetCurrentHistoryItem(current_item.get()); 485 GetWebViewImpl()->SetCurrentHistoryItem(current_item.get());
477 } 486 }
478 487
479 frame_->loader()->goToItem(request_impl->history_item().get(), 488 frame_->loader()->goToItem(history_item.get(),
480 WebCore::FrameLoadTypeIndexedBackForward); 489 WebCore::FrameLoadTypeIndexedBackForward);
481 } else if (resource_request.cachePolicy() == ReloadIgnoringCacheData) { 490 } else if (resource_request.cachePolicy() == ReloadIgnoringCacheData) {
482 frame_->loader()->reload(); 491 frame_->loader()->reload();
483 } else { 492 } else {
484 frame_->loader()->load(resource_request, false); 493 frame_->loader()->load(resource_request, false);
485 } 494 }
486 } 495 }
487 496
488 void WebFrameImpl::LoadHTMLString(const std::string& html_text, 497 void WebFrameImpl::LoadHTMLString(const std::string& html_text,
489 const GURL& base_url) { 498 const GURL& base_url) {
490 WebRequestImpl request(base_url); 499 WebRequestImpl request(base_url);
491 LoadAlternateHTMLString(&request, html_text, GURL(), false); 500 LoadAlternateHTMLString(&request, html_text, GURL(), false);
492 } 501 }
493 502
494 void WebFrameImpl::LoadAlternateHTMLString(const WebRequest* request, 503 void WebFrameImpl::LoadAlternateHTMLString(const WebRequest* request,
495 const std::string& html_text, 504 const std::string& html_text,
496 const GURL& display_url, 505 const GURL& display_url,
497 bool replace) { 506 bool replace) {
498 int len = static_cast<int>(html_text.size()); 507 int len = static_cast<int>(html_text.size());
499 RefPtr<SharedBuffer> buf = SharedBuffer::create(html_text.data(), len); 508 RefPtr<SharedBuffer> buf = SharedBuffer::create(html_text.data(), len);
500 509
501 SubstituteData subst_data( 510 SubstituteData subst_data(
502 buf, String("text/html"), String("UTF-8"), 511 buf, String("text/html"), String("UTF-8"),
503 webkit_glue::GURLToKURL(display_url)); 512 webkit_glue::GURLToKURL(display_url));
504 DCHECK(subst_data.isValid()); 513 DCHECK(subst_data.isValid());
505 514
506 InternalLoadRequest(request, subst_data, replace); 515 InternalLoadRequest(request, subst_data, NULL, replace);
507 } 516 }
508 517
509 GURL WebFrameImpl::GetURL() const { 518 GURL WebFrameImpl::GetURL() const {
510 const WebDataSource* ds = GetDataSource(); 519 const WebDataSource* ds = GetDataSource();
511 if (!ds) 520 if (!ds)
512 return GURL(); 521 return GURL();
513 return ds->GetRequest().GetURL(); 522 return ds->GetRequest().GetURL();
514 } 523 }
515 524
516 GURL WebFrameImpl::GetFavIconURL() const { 525 GURL WebFrameImpl::GetFavIconURL() const {
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 return password_listeners_.get(input_element); 1898 return password_listeners_.get(input_element);
1890 } 1899 }
1891 1900
1892 void WebFrameImpl::ClearPasswordListeners() { 1901 void WebFrameImpl::ClearPasswordListeners() {
1893 for (PasswordListenerMap::iterator iter = password_listeners_.begin(); 1902 for (PasswordListenerMap::iterator iter = password_listeners_.begin();
1894 iter != password_listeners_.end(); ++iter) { 1903 iter != password_listeners_.end(); ++iter) {
1895 delete iter->second; 1904 delete iter->second;
1896 } 1905 }
1897 password_listeners_.clear(); 1906 password_listeners_.clear();
1898 } 1907 }
OLDNEW
« no previous file with comments | « webkit/glue/webframe_impl.h ('k') | webkit/glue/weburlrequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698