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

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

Issue 99283: Add a BeforeDestroyFrame notification method to WebViewDelegate (Closed) Base URL: http://src.chromium.org/svn/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.cc ('k') | webkit/glue/webplugin_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "config.h" 5 #include "config.h"
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 10
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // When the WebFrame was created, it had an extra reference given to it on 93 // When the WebFrame was created, it had an extra reference given to it on
94 // behalf of the Frame. Since the WebFrame owns us, this extra ref also 94 // behalf of the Frame. Since the WebFrame owns us, this extra ref also
95 // serves to keep us alive until the FrameLoader is done with us. The 95 // serves to keep us alive until the FrameLoader is done with us. The
96 // FrameLoader calls this method when it's going away. Therefore, we balance 96 // FrameLoader calls this method when it's going away. Therefore, we balance
97 // out that extra reference, which may cause 'this' to be deleted. 97 // out that extra reference, which may cause 'this' to be deleted.
98 webframe_->Closing(); 98 webframe_->Closing();
99 webframe_->Release(); 99 webframe_->Release();
100 } 100 }
101 101
102 void WebFrameLoaderClient::windowObjectCleared() { 102 void WebFrameLoaderClient::windowObjectCleared() {
103 WebViewImpl* webview = webframe_->webview_impl(); 103 WebViewImpl* webview = webframe_->GetWebViewImpl();
104 WebViewDelegate* d = webview->delegate(); 104 WebViewDelegate* d = webview->delegate();
105 if (d) 105 if (d)
106 d->WindowObjectCleared(webframe_); 106 d->WindowObjectCleared(webframe_);
107 } 107 }
108 108
109 void WebFrameLoaderClient::documentElementAvailable() { 109 void WebFrameLoaderClient::documentElementAvailable() {
110 WebViewImpl* webview = webframe_->webview_impl(); 110 WebViewImpl* webview = webframe_->GetWebViewImpl();
111 WebViewDelegate* d = webview->delegate(); 111 WebViewDelegate* d = webview->delegate();
112 if (d) 112 if (d)
113 d->DocumentElementAvailable(webframe_); 113 d->DocumentElementAvailable(webframe_);
114 } 114 }
115 115
116 void WebFrameLoaderClient::didPerformFirstNavigation() const { 116 void WebFrameLoaderClient::didPerformFirstNavigation() const {
117 } 117 }
118 118
119 void WebFrameLoaderClient::registerForIconNotification(bool listen){ 119 void WebFrameLoaderClient::registerForIconNotification(bool listen){
120 } 120 }
121 121
122 bool WebFrameLoaderClient::hasWebView() const { 122 bool WebFrameLoaderClient::hasWebView() const {
123 return webframe_->webview_impl() != NULL; 123 return webframe_->GetWebViewImpl() != NULL;
124 } 124 }
125 125
126 bool WebFrameLoaderClient::hasFrameView() const { 126 bool WebFrameLoaderClient::hasFrameView() const {
127 // The Mac port has this notion of a WebFrameView, which seems to be 127 // The Mac port has this notion of a WebFrameView, which seems to be
128 // some wrapper around an NSView. Since our equivalent is HWND, I guess 128 // some wrapper around an NSView. Since our equivalent is HWND, I guess
129 // we have a "frameview" whenever we have the toplevel HWND. 129 // we have a "frameview" whenever we have the toplevel HWND.
130 return webframe_->webview_impl() != NULL; 130 return webframe_->GetWebViewImpl() != NULL;
131 } 131 }
132 132
133 void WebFrameLoaderClient::makeDocumentView() { 133 void WebFrameLoaderClient::makeDocumentView() {
134 webframe_->CreateFrameView(); 134 webframe_->CreateFrameView();
135 } 135 }
136 136
137 void WebFrameLoaderClient::makeRepresentation(DocumentLoader*) { 137 void WebFrameLoaderClient::makeRepresentation(DocumentLoader*) {
138 has_representation_ = true; 138 has_representation_ = true;
139 } 139 }
140 140
(...skipping 22 matching lines...) Expand all
163 webframe_->frame()->script()->proxy()->clearForClose(); 163 webframe_->frame()->script()->proxy()->clearForClose();
164 } 164 }
165 165
166 // This function is responsible for associating the |identifier| with a given 166 // This function is responsible for associating the |identifier| with a given
167 // subresource load. The following functions that accept an |identifier| are 167 // subresource load. The following functions that accept an |identifier| are
168 // called for each subresource, so they should not be dispatched to the 168 // called for each subresource, so they should not be dispatched to the
169 // WebFrame. 169 // WebFrame.
170 void WebFrameLoaderClient::assignIdentifierToInitialRequest( 170 void WebFrameLoaderClient::assignIdentifierToInitialRequest(
171 unsigned long identifier, DocumentLoader* loader, 171 unsigned long identifier, DocumentLoader* loader,
172 const ResourceRequest& request) { 172 const ResourceRequest& request) {
173 WebViewImpl* webview = webframe_->webview_impl(); 173 WebViewImpl* webview = webframe_->GetWebViewImpl();
174 WebViewDelegate* d = webview->delegate(); 174 WebViewDelegate* d = webview->delegate();
175 if (d) { 175 if (d) {
176 WebRequestImpl webreq(request); 176 WebRequestImpl webreq(request);
177 d->AssignIdentifierToRequest(webview, identifier, webreq); 177 d->AssignIdentifierToRequest(webview, identifier, webreq);
178 } 178 }
179 NetAgentImpl* net_agent = GetNetAgentImpl(); 179 NetAgentImpl* net_agent = GetNetAgentImpl();
180 if (net_agent) { 180 if (net_agent) {
181 net_agent->AssignIdentifierToRequest(loader, identifier, request); 181 net_agent->AssignIdentifierToRequest(loader, identifier, request);
182 } 182 }
183 } 183 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 223 }
224 224
225 // FrameLoader::loadEmptyDocumentSynchronously() creates an empty document 225 // FrameLoader::loadEmptyDocumentSynchronously() creates an empty document
226 // with no URL. We don't like that, so we'll rename it to about:blank. 226 // with no URL. We don't like that, so we'll rename it to about:blank.
227 if (request.url().isEmpty()) 227 if (request.url().isEmpty())
228 request.setURL(KURL("about:blank")); 228 request.setURL(KURL("about:blank"));
229 if (request.mainDocumentURL().isEmpty()) 229 if (request.mainDocumentURL().isEmpty())
230 request.setMainDocumentURL(KURL("about:blank")); 230 request.setMainDocumentURL(KURL("about:blank"));
231 231
232 // Give the delegate a crack at the request. 232 // Give the delegate a crack at the request.
233 WebViewImpl* webview = webframe_->webview_impl(); 233 WebViewImpl* webview = webframe_->GetWebViewImpl();
234 WebViewDelegate* d = webview->delegate(); 234 WebViewDelegate* d = webview->delegate();
235 if (d) { 235 if (d) {
236 WebRequestImpl webreq(request); 236 WebRequestImpl webreq(request);
237 d->WillSendRequest(webview, identifier, &webreq); 237 d->WillSendRequest(webview, identifier, &webreq);
238 request = webreq.frame_load_request().resourceRequest(); 238 request = webreq.frame_load_request().resourceRequest();
239 } 239 }
240 NetAgentImpl* net_agent = GetNetAgentImpl(); 240 NetAgentImpl* net_agent = GetNetAgentImpl();
241 if (net_agent) { 241 if (net_agent) {
242 net_agent->WillSendRequest(loader, identifier, request); 242 net_agent->WillSendRequest(loader, identifier, request);
243 } 243 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 if (postpone_loading_data_) { 331 if (postpone_loading_data_) {
332 // The server returned a 404 and the content was < 512 bytes (which we 332 // The server returned a 404 and the content was < 512 bytes (which we
333 // suppressed). Go ahead and fetch the alternate page content. 333 // suppressed). Go ahead and fetch the alternate page content.
334 const GURL& url = GetAlt404PageUrl(loader); 334 const GURL& url = GetAlt404PageUrl(loader);
335 DCHECK(url.is_valid()) << 335 DCHECK(url.is_valid()) <<
336 "URL changed? It was valid in dispatchDidReceiveResponse."; 336 "URL changed? It was valid in dispatchDidReceiveResponse.";
337 alt_404_page_fetcher_.reset(new Alt404PageResourceFetcher(this, 337 alt_404_page_fetcher_.reset(new Alt404PageResourceFetcher(this,
338 webframe_->frame(), loader, url)); 338 webframe_->frame(), loader, url));
339 } 339 }
340 340
341 WebViewImpl* webview = webframe_->webview_impl(); 341 WebViewImpl* webview = webframe_->GetWebViewImpl();
342 WebViewDelegate* d = webview->delegate(); 342 WebViewDelegate* d = webview->delegate();
343 if (d) 343 if (d)
344 d->DidFinishLoading(webview, identifier); 344 d->DidFinishLoading(webview, identifier);
345 345
346 NetAgentImpl* net_agent = GetNetAgentImpl(); 346 NetAgentImpl* net_agent = GetNetAgentImpl();
347 if (net_agent) { 347 if (net_agent) {
348 net_agent->DidFinishLoading(loader, identifier); 348 net_agent->DidFinishLoading(loader, identifier);
349 } 349 }
350 } 350 }
351 351
352 GURL WebFrameLoaderClient::GetAlt404PageUrl(DocumentLoader* loader) { 352 GURL WebFrameLoaderClient::GetAlt404PageUrl(DocumentLoader* loader) {
353 WebViewImpl* webview = webframe_->webview_impl(); 353 WebViewImpl* webview = webframe_->GetWebViewImpl();
354 WebViewDelegate* d = webview->delegate(); 354 WebViewDelegate* d = webview->delegate();
355 if (!d) 355 if (!d)
356 return GURL(); 356 return GURL();
357 357
358 const GURL& failedURL = webkit_glue::KURLToGURL(loader->url()); 358 const GURL& failedURL = webkit_glue::KURLToGURL(loader->url());
359 359
360 // If trying to view source on a 404 page, just show the original page 360 // If trying to view source on a 404 page, just show the original page
361 // content. 361 // content.
362 if (webframe_->frame()->inViewSourceMode()) 362 if (webframe_->frame()->inViewSourceMode())
363 return GURL(); 363 return GURL();
(...skipping 12 matching lines...) Expand all
376 } else { 376 } else {
377 // Fall back on original text 377 // Fall back on original text
378 webframe_->LoadHTMLString(postponed_data_, 378 webframe_->LoadHTMLString(postponed_data_,
379 webkit_glue::KURLToGURL(loader->url())); 379 webkit_glue::KURLToGURL(loader->url()));
380 } 380 }
381 } 381 }
382 382
383 void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader* loader, 383 void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader* loader,
384 unsigned long identifier, 384 unsigned long identifier,
385 const ResourceError& error) { 385 const ResourceError& error) {
386 WebViewImpl* webview = webframe_->webview_impl(); 386 WebViewImpl* webview = webframe_->GetWebViewImpl();
387 if (webview && webview->delegate()) { 387 if (webview && webview->delegate()) {
388 webview->delegate()->DidFailLoadingWithError(webview, identifier, 388 webview->delegate()->DidFailLoadingWithError(webview, identifier,
389 WebErrorImpl(error)); 389 WebErrorImpl(error));
390 } 390 }
391 NetAgentImpl* net_agent = GetNetAgentImpl(); 391 NetAgentImpl* net_agent = GetNetAgentImpl();
392 if (net_agent) { 392 if (net_agent) {
393 net_agent->DidFailLoading(loader, identifier, error); 393 net_agent->DidFailLoading(loader, identifier, error);
394 } 394 }
395 } 395 }
396 396
397 void WebFrameLoaderClient::dispatchDidFinishDocumentLoad() { 397 void WebFrameLoaderClient::dispatchDidFinishDocumentLoad() {
398 WebViewImpl* webview = webframe_->webview_impl(); 398 WebViewImpl* webview = webframe_->GetWebViewImpl();
399 WebViewDelegate* d = webview->delegate(); 399 WebViewDelegate* d = webview->delegate();
400 DocumentLoader* documentLoader = 400 DocumentLoader* documentLoader =
401 webframe_->frame()->loader()->activeDocumentLoader(); 401 webframe_->frame()->loader()->activeDocumentLoader();
402 WebDataSourceImpl* data_source = 402 WebDataSourceImpl* data_source =
403 WebDataSourceImpl::FromLoader(documentLoader); 403 WebDataSourceImpl::FromLoader(documentLoader);
404 404
405 // A frame may be reused. This call ensures we don't hold on to our password 405 // A frame may be reused. This call ensures we don't hold on to our password
406 // listeners and their associated HTMLInputElements. 406 // listeners and their associated HTMLInputElements.
407 webframe_->ClearPasswordListeners(); 407 webframe_->ClearPasswordListeners();
408 408
(...skipping 29 matching lines...) Expand all
438 if (d) 438 if (d)
439 d->DidFinishDocumentLoadForFrame(webview, webframe_); 439 d->DidFinishDocumentLoadForFrame(webview, webframe_);
440 data_source->set_finish_document_load_time(base::Time::Now()); 440 data_source->set_finish_document_load_time(base::Time::Now());
441 } 441 }
442 442
443 bool WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache( 443 bool WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(
444 DocumentLoader* loader, 444 DocumentLoader* loader,
445 const ResourceRequest& request, 445 const ResourceRequest& request,
446 const ResourceResponse& response, 446 const ResourceResponse& response,
447 int length) { 447 int length) {
448 WebViewImpl* webview = webframe_->webview_impl(); 448 WebViewImpl* webview = webframe_->GetWebViewImpl();
449 WebViewDelegate* d = webview->delegate(); 449 WebViewDelegate* d = webview->delegate();
450 450
451 bool result = false; 451 bool result = false;
452 if (d) { 452 if (d) {
453 WebRequestImpl webreq(request); 453 WebRequestImpl webreq(request);
454 WebResponseImpl webresp(response); 454 WebResponseImpl webresp(response);
455 result = d->DidLoadResourceFromMemoryCache(webview, webreq, webresp, 455 result = d->DidLoadResourceFromMemoryCache(webview, webreq, webresp,
456 webframe_); 456 webframe_);
457 } 457 }
458 NetAgentImpl* net_agent = GetNetAgentImpl(); 458 NetAgentImpl* net_agent = GetNetAgentImpl();
(...skipping 17 matching lines...) Expand all
476 source); 476 source);
477 } 477 }
478 } 478 }
479 479
480 void WebFrameLoaderClient::dispatchDidHandleOnloadEvents() { 480 void WebFrameLoaderClient::dispatchDidHandleOnloadEvents() {
481 // During the onload event of a subframe, the subframe can be removed. In 481 // During the onload event of a subframe, the subframe can be removed. In
482 // that case, it has no page. This is covered by 482 // that case, it has no page. This is covered by
483 // LayoutTests/fast/dom/replaceChild.html 483 // LayoutTests/fast/dom/replaceChild.html
484 if (!webframe_->frame()->page()) 484 if (!webframe_->frame()->page())
485 return; 485 return;
486 WebViewImpl* webview = webframe_->webview_impl(); 486 WebViewImpl* webview = webframe_->GetWebViewImpl();
487 WebViewDelegate* d = webview->delegate(); 487 WebViewDelegate* d = webview->delegate();
488 if (d) 488 if (d)
489 d->DidHandleOnloadEventsForFrame(webview, webframe_); 489 d->DidHandleOnloadEventsForFrame(webview, webframe_);
490 } 490 }
491 491
492 // Redirect Tracking 492 // Redirect Tracking
493 // ================= 493 // =================
494 // We want to keep track of the chain of redirects that occur during page 494 // We want to keep track of the chain of redirects that occur during page
495 // loading. There are two types of redirects, server redirects which are HTTP 495 // loading. There are two types of redirects, server redirects which are HTTP
496 // response codes, and client redirects which are document.location= and meta 496 // response codes, and client redirects which are document.location= and meta
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 // entry in our redirect chain. 580 // entry in our redirect chain.
581 DCHECK(!ds->GetRedirectChain().empty()); 581 DCHECK(!ds->GetRedirectChain().empty());
582 582
583 // The URL of the destination is on the provisional data source. We also need 583 // The URL of the destination is on the provisional data source. We also need
584 // to update the redirect chain to account for this addition (we do this 584 // to update the redirect chain to account for this addition (we do this
585 // before the callback so the callback can look at the redirect chain to see 585 // before the callback so the callback can look at the redirect chain to see
586 // what happened). 586 // what happened).
587 ds->AppendRedirect(ds->GetRequest().GetURL()); 587 ds->AppendRedirect(ds->GetRequest().GetURL());
588 588
589 // Dispatch callback 589 // Dispatch callback
590 WebViewImpl* webview = webframe_->webview_impl(); 590 WebViewImpl* webview = webframe_->GetWebViewImpl();
591 WebViewDelegate* d = webview->delegate(); 591 WebViewDelegate* d = webview->delegate();
592 if (d) 592 if (d)
593 d->DidReceiveProvisionalLoadServerRedirect(webview, webframe_); 593 d->DidReceiveProvisionalLoadServerRedirect(webview, webframe_);
594 } 594 }
595 595
596 // Called on both success and failure of a client redirect. 596 // Called on both success and failure of a client redirect.
597 void WebFrameLoaderClient::dispatchDidCancelClientRedirect() { 597 void WebFrameLoaderClient::dispatchDidCancelClientRedirect() {
598 // No longer expecting a client redirect. 598 // No longer expecting a client redirect.
599 WebViewImpl* webview = webframe_->webview_impl(); 599 WebViewImpl* webview = webframe_->GetWebViewImpl();
600 WebViewDelegate* d = webview ? webview->delegate() : NULL; 600 WebViewDelegate* d = webview ? webview->delegate() : NULL;
601 if (d) { 601 if (d) {
602 expected_client_redirect_src_ = GURL(); 602 expected_client_redirect_src_ = GURL();
603 expected_client_redirect_dest_ = GURL(); 603 expected_client_redirect_dest_ = GURL();
604 604
605 d->DidCancelClientRedirect(webview, webframe_); 605 d->DidCancelClientRedirect(webview, webframe_);
606 } 606 }
607 607
608 // No need to clear the redirect chain, since that data source has already 608 // No need to clear the redirect chain, since that data source has already
609 // been deleted by the time this function is called. 609 // been deleted by the time this function is called.
610 } 610 }
611 611
612 void WebFrameLoaderClient::dispatchWillPerformClientRedirect(const KURL& url, 612 void WebFrameLoaderClient::dispatchWillPerformClientRedirect(const KURL& url,
613 double interval, 613 double interval,
614 double fire_date) { 614 double fire_date) {
615 // Tells dispatchDidStartProvisionalLoad that if it sees this item it is a 615 // Tells dispatchDidStartProvisionalLoad that if it sees this item it is a
616 // redirect and the source item should be added as the start of the chain. 616 // redirect and the source item should be added as the start of the chain.
617 WebViewImpl* webview = webframe_->webview_impl(); 617 WebViewImpl* webview = webframe_->GetWebViewImpl();
618 WebViewDelegate* d = webview ? webview->delegate() : NULL; 618 WebViewDelegate* d = webview ? webview->delegate() : NULL;
619 if (d) { 619 if (d) {
620 expected_client_redirect_src_ = webframe_->GetURL(); 620 expected_client_redirect_src_ = webframe_->GetURL();
621 expected_client_redirect_dest_ = webkit_glue::KURLToGURL(url); 621 expected_client_redirect_dest_ = webkit_glue::KURLToGURL(url);
622 622
623 // TODO(timsteele): bug 1135512. Webkit does not properly notify us of 623 // TODO(timsteele): bug 1135512. Webkit does not properly notify us of
624 // cancelling http > file client redirects. Since the FrameLoader's policy 624 // cancelling http > file client redirects. Since the FrameLoader's policy
625 // is to never carry out such a navigation anyway, the best thing we can do 625 // is to never carry out such a navigation anyway, the best thing we can do
626 // for now to not get confused is ignore this notification. 626 // for now to not get confused is ignore this notification.
627 if (expected_client_redirect_dest_.SchemeIsFile() && 627 if (expected_client_redirect_dest_.SchemeIsFile() &&
628 (expected_client_redirect_src_.SchemeIs("http") || 628 (expected_client_redirect_src_.SchemeIs("http") ||
629 expected_client_redirect_src_.SchemeIsSecure())) { 629 expected_client_redirect_src_.SchemeIsSecure())) {
630 expected_client_redirect_src_ = GURL(); 630 expected_client_redirect_src_ = GURL();
631 expected_client_redirect_dest_ = GURL(); 631 expected_client_redirect_dest_ = GURL();
632 return; 632 return;
633 } 633 }
634 634
635 d->WillPerformClientRedirect(webview, 635 d->WillPerformClientRedirect(webview,
636 webframe_, 636 webframe_,
637 expected_client_redirect_src_, 637 expected_client_redirect_src_,
638 expected_client_redirect_dest_, 638 expected_client_redirect_dest_,
639 static_cast<unsigned int>(interval), 639 static_cast<unsigned int>(interval),
640 static_cast<unsigned int>(fire_date)); 640 static_cast<unsigned int>(fire_date));
641 } 641 }
642 } 642 }
643 643
644 void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() { 644 void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() {
645 // Anchor fragment navigations are not normal loads, so we need to synthesize 645 // Anchor fragment navigations are not normal loads, so we need to synthesize
646 // some events for our delegate. 646 // some events for our delegate.
647 WebViewImpl* webview = webframe_->webview_impl(); 647 WebViewImpl* webview = webframe_->GetWebViewImpl();
648 WebViewDelegate* d = webview->delegate(); 648 WebViewDelegate* d = webview->delegate();
649 if (d) 649 if (d)
650 d->DidStartLoading(webview); 650 d->DidStartLoading(webview);
651 651
652 WebDataSourceImpl* ds = webframe_->GetDataSourceImpl(); 652 WebDataSourceImpl* ds = webframe_->GetDataSourceImpl();
653 DCHECK(ds) << "DataSource NULL when navigating to reference fragment"; 653 DCHECK(ds) << "DataSource NULL when navigating to reference fragment";
654 if (ds) { 654 if (ds) {
655 GURL url = ds->GetRequest().GetURL(); 655 GURL url = ds->GetRequest().GetURL();
656 GURL chain_end = ds->GetRedirectChain().back(); 656 GURL chain_end = ds->GetRedirectChain().back();
657 ds->ClearRedirectChain(); 657 ds->ClearRedirectChain();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 if (d) { 695 if (d) {
696 d->DidChangeLocationWithinPageForFrame(webview, webframe_, 696 d->DidChangeLocationWithinPageForFrame(webview, webframe_,
697 is_new_navigation); 697 is_new_navigation);
698 } 698 }
699 699
700 if (d) 700 if (d)
701 d->DidStopLoading(webview); 701 d->DidStopLoading(webview);
702 } 702 }
703 703
704 void WebFrameLoaderClient::dispatchWillClose() { 704 void WebFrameLoaderClient::dispatchWillClose() {
705 WebViewImpl* webview = webframe_->webview_impl(); 705 WebViewImpl* webview = webframe_->GetWebViewImpl();
706 // Make sure WebViewImpl releases the references it uses to restore focus. 706 // Make sure WebViewImpl releases the references it uses to restore focus.
707 // If we didn't do this, WebViewImpl might try to restore focus to an invalid 707 // If we didn't do this, WebViewImpl might try to restore focus to an invalid
708 // element. 708 // element.
709 webview->ReleaseFocusReferences(); 709 webview->ReleaseFocusReferences();
710 WebViewDelegate* d = webview->delegate(); 710 WebViewDelegate* d = webview->delegate();
711 if (d) 711 if (d)
712 d->WillCloseFrame(webview, webframe_); 712 d->WillCloseFrame(webview, webframe_);
713 } 713 }
714 714
715 void WebFrameLoaderClient::dispatchDidReceiveIcon() { 715 void WebFrameLoaderClient::dispatchDidReceiveIcon() {
716 WebViewImpl* webview = webframe_->webview_impl(); 716 WebViewImpl* webview = webframe_->GetWebViewImpl();
717 WebViewDelegate* d = webview->delegate(); 717 WebViewDelegate* d = webview->delegate();
718 if (d) 718 if (d)
719 d->DidReceiveIconForFrame(webview, webframe_); 719 d->DidReceiveIconForFrame(webview, webframe_);
720 } 720 }
721 721
722 void WebFrameLoaderClient::dispatchDidStartProvisionalLoad() { 722 void WebFrameLoaderClient::dispatchDidStartProvisionalLoad() {
723 // In case a redirect occurs, we need this to be set so that the redirect 723 // In case a redirect occurs, we need this to be set so that the redirect
724 // handling code can tell where the redirect came from. Server redirects 724 // handling code can tell where the redirect came from. Server redirects
725 // will occur on the provisional load, so we need to keep track of the most 725 // will occur on the provisional load, so we need to keep track of the most
726 // recent provisional load URL. 726 // recent provisional load URL.
727 // See dispatchDidReceiveServerRedirectForProvisionalLoad. 727 // See dispatchDidReceiveServerRedirectForProvisionalLoad.
728 WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl(); 728 WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl();
729 if (!ds) { 729 if (!ds) {
730 NOTREACHED() << "Attempting to provisional load but there isn't one"; 730 NOTREACHED() << "Attempting to provisional load but there isn't one";
731 return; 731 return;
732 } 732 }
733 const GURL& url = ds->GetRequest().GetURL(); 733 const GURL& url = ds->GetRequest().GetURL();
734 734
735 // Since the provisional load just started, we should have not gotten 735 // Since the provisional load just started, we should have not gotten
736 // any redirects yet. 736 // any redirects yet.
737 DCHECK(ds->GetRedirectChain().empty()); 737 DCHECK(ds->GetRedirectChain().empty());
738 738
739 WebViewImpl* webview = webframe_->webview_impl(); 739 WebViewImpl* webview = webframe_->GetWebViewImpl();
740 WebViewDelegate* d = webview->delegate(); 740 WebViewDelegate* d = webview->delegate();
741 // If this load is what we expected from a client redirect, treat it as a 741 // If this load is what we expected from a client redirect, treat it as a
742 // redirect from that original page. The expected redirect urls will be 742 // redirect from that original page. The expected redirect urls will be
743 // cleared by DidCancelClientRedirect. 743 // cleared by DidCancelClientRedirect.
744 bool completing_client_redirect = false; 744 bool completing_client_redirect = false;
745 if (expected_client_redirect_src_.is_valid()) { 745 if (expected_client_redirect_src_.is_valid()) {
746 // expected_client_redirect_dest_ could be something like 746 // expected_client_redirect_dest_ could be something like
747 // "javascript:history.go(-1)" thus we need to exclude url starts with 747 // "javascript:history.go(-1)" thus we need to exclude url starts with
748 // "javascript:". See bug: 1080873 748 // "javascript:". See bug: 1080873
749 DCHECK(expected_client_redirect_dest_.SchemeIs("javascript") || 749 DCHECK(expected_client_redirect_dest_.SchemeIs("javascript") ||
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 // TODO(timsteele): userGestureHint returns too many false positives 790 // TODO(timsteele): userGestureHint returns too many false positives
791 // (see bug 1051891) to trust it and assign NavigationGestureUser, so 791 // (see bug 1051891) to trust it and assign NavigationGestureUser, so
792 // for now we assign Unknown in those cases and Auto otherwise. 792 // for now we assign Unknown in those cases and Auto otherwise.
793 // (Issue 874811 known false negative as well). 793 // (Issue 874811 known false negative as well).
794 return webframe_->frame()->loader()->userGestureHint() ? 794 return webframe_->frame()->loader()->userGestureHint() ?
795 NavigationGestureUnknown : 795 NavigationGestureUnknown :
796 NavigationGestureAuto; 796 NavigationGestureAuto;
797 } 797 }
798 798
799 void WebFrameLoaderClient::dispatchDidReceiveTitle(const String& title) { 799 void WebFrameLoaderClient::dispatchDidReceiveTitle(const String& title) {
800 WebViewImpl* webview = webframe_->webview_impl(); 800 WebViewImpl* webview = webframe_->GetWebViewImpl();
801 WebViewDelegate* d = webview->delegate(); 801 WebViewDelegate* d = webview->delegate();
802 if (d) { 802 if (d) {
803 d->DidReceiveTitle(webview, webkit_glue::StringToStdWString(title), 803 d->DidReceiveTitle(webview, webkit_glue::StringToStdWString(title),
804 webframe_); 804 webframe_);
805 } 805 }
806 } 806 }
807 807
808 void WebFrameLoaderClient::dispatchDidCommitLoad() { 808 void WebFrameLoaderClient::dispatchDidCommitLoad() {
809 webframe_->SelectAppCacheWithoutManifest(); 809 webframe_->SelectAppCacheWithoutManifest();
810 810
811 WebViewImpl* webview = webframe_->webview_impl(); 811 WebViewImpl* webview = webframe_->GetWebViewImpl();
812 bool is_new_navigation; 812 bool is_new_navigation;
813 webview->DidCommitLoad(&is_new_navigation); 813 webview->DidCommitLoad(&is_new_navigation);
814 WebViewDelegate* d = webview->delegate(); 814 WebViewDelegate* d = webview->delegate();
815 if (d) 815 if (d)
816 d->DidCommitLoadForFrame(webview, webframe_, is_new_navigation); 816 d->DidCommitLoadForFrame(webview, webframe_, is_new_navigation);
817 817
818 WebDevToolsAgentImpl* tools_agent = webview->GetWebDevToolsAgentImpl(); 818 WebDevToolsAgentImpl* tools_agent = webview->GetWebDevToolsAgentImpl();
819 if (tools_agent) { 819 if (tools_agent) {
820 tools_agent->DidCommitLoadForFrame(webview, webframe_, is_new_navigation); 820 tools_agent->DidCommitLoadForFrame(webview, webframe_, is_new_navigation);
821 } 821 }
(...skipping 24 matching lines...) Expand all
846 // Don't clear the redirect chain, this will happen in the middle of client 846 // Don't clear the redirect chain, this will happen in the middle of client
847 // redirects, and we need the context. The chain will be cleared when the 847 // redirects, and we need the context. The chain will be cleared when the
848 // provisional load succeeds or fails, not the "real" one. 848 // provisional load succeeds or fails, not the "real" one.
849 } 849 }
850 850
851 void WebFrameLoaderClient::dispatchDidFinishLoad() { 851 void WebFrameLoaderClient::dispatchDidFinishLoad() {
852 DocumentLoader* documentLoader = 852 DocumentLoader* documentLoader =
853 webframe_->frame()->loader()->activeDocumentLoader(); 853 webframe_->frame()->loader()->activeDocumentLoader();
854 WebDataSourceImpl* dataSource = 854 WebDataSourceImpl* dataSource =
855 WebDataSourceImpl::FromLoader(documentLoader); 855 WebDataSourceImpl::FromLoader(documentLoader);
856 WebViewImpl* webview = webframe_->webview_impl(); 856 WebViewImpl* webview = webframe_->GetWebViewImpl();
857 WebViewDelegate* d = webview->delegate(); 857 WebViewDelegate* d = webview->delegate();
858 dataSource->set_finish_load_time(base::Time::Now()); 858 dataSource->set_finish_load_time(base::Time::Now());
859 if (d) 859 if (d)
860 d->DidFinishLoadForFrame(webview, webframe_); 860 d->DidFinishLoadForFrame(webview, webframe_);
861 WebPluginDelegate* plg_delegate = webframe_->plugin_delegate(); 861 WebPluginDelegate* plg_delegate = webframe_->plugin_delegate();
862 if (plg_delegate) 862 if (plg_delegate)
863 plg_delegate->DidFinishLoadWithReason(NPRES_DONE); 863 plg_delegate->DidFinishLoadWithReason(NPRES_DONE);
864 864
865 // Don't clear the redirect chain, this will happen in the middle of client 865 // Don't clear the redirect chain, this will happen in the middle of client
866 // redirects, and we need the context. The chain will be cleared when the 866 // redirects, and we need the context. The chain will be cleared when the
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 898
899 // createWindow can return NULL (e.g., popup blocker denies the window). 899 // createWindow can return NULL (e.g., popup blocker denies the window).
900 if (!new_page) 900 if (!new_page)
901 return NULL; 901 return NULL;
902 902
903 WebViewImpl::FromPage(new_page)->set_window_open_disposition(disp); 903 WebViewImpl::FromPage(new_page)->set_window_open_disposition(disp);
904 return new_page->mainFrame(); 904 return new_page->mainFrame();
905 } 905 }
906 906
907 void WebFrameLoaderClient::dispatchShow() { 907 void WebFrameLoaderClient::dispatchShow() {
908 WebViewImpl* webview = webframe_->webview_impl(); 908 WebViewImpl* webview = webframe_->GetWebViewImpl();
909 WebViewDelegate* d = webview->delegate(); 909 WebViewDelegate* d = webview->delegate();
910 if (d) 910 if (d)
911 d->Show(webview, webview->window_open_disposition()); 911 d->Show(webview, webview->window_open_disposition());
912 } 912 }
913 913
914 static bool TreatAsAttachment(const ResourceResponse& response) { 914 static bool TreatAsAttachment(const ResourceResponse& response) {
915 const String& content_disposition = 915 const String& content_disposition =
916 response.httpHeaderField("Content-Disposition"); 916 response.httpHeaderField("Content-Disposition");
917 if (content_disposition.isEmpty()) 917 if (content_disposition.isEmpty())
918 return false; 918 return false;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 (webframe_->frame()->loader()->*function)(policy_action); 997 (webframe_->frame()->loader()->*function)(policy_action);
998 } 998 }
999 999
1000 void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction( 1000 void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(
1001 WebCore::FramePolicyFunction function, 1001 WebCore::FramePolicyFunction function,
1002 const WebCore::NavigationAction& action, 1002 const WebCore::NavigationAction& action,
1003 const WebCore::ResourceRequest& request, 1003 const WebCore::ResourceRequest& request,
1004 PassRefPtr<WebCore::FormState> form_state) { 1004 PassRefPtr<WebCore::FormState> form_state) {
1005 PolicyAction policy_action = PolicyUse; 1005 PolicyAction policy_action = PolicyUse;
1006 1006
1007 WebViewImpl* wv = webframe_->webview_impl(); 1007 WebViewImpl* wv = webframe_->GetWebViewImpl();
1008 WebViewDelegate* d = wv->delegate(); 1008 WebViewDelegate* d = wv->delegate();
1009 // It is valid for this function to be invoked in code paths where the 1009 // It is valid for this function to be invoked in code paths where the
1010 // the webview is closed. 1010 // the webview is closed.
1011 // The NULL check here is to fix a crash that seems strange 1011 // The NULL check here is to fix a crash that seems strange
1012 // (see - https://bugs.webkit.org/show_bug.cgi?id=23554). 1012 // (see - https://bugs.webkit.org/show_bug.cgi?id=23554).
1013 if (d && !request.url().isNull()) { 1013 if (d && !request.url().isNull()) {
1014 WindowOpenDisposition disposition = CURRENT_TAB; 1014 WindowOpenDisposition disposition = CURRENT_TAB;
1015 ActionSpecifiesDisposition(action, &disposition); 1015 ActionSpecifiesDisposition(action, &disposition);
1016 1016
1017 // Give the delegate a chance to change the disposition. When we do not 1017 // Give the delegate a chance to change the disposition. When we do not
(...skipping 12 matching lines...) Expand all
1030 1030
1031 if (disposition != IGNORE_ACTION) { 1031 if (disposition != IGNORE_ACTION) {
1032 if (disposition == CURRENT_TAB) { 1032 if (disposition == CURRENT_TAB) {
1033 policy_action = PolicyUse; 1033 policy_action = PolicyUse;
1034 } else if (disposition == SAVE_TO_DISK) { 1034 } else if (disposition == SAVE_TO_DISK) {
1035 policy_action = PolicyDownload; 1035 policy_action = PolicyDownload;
1036 } else { 1036 } else {
1037 GURL referrer = webkit_glue::StringToGURL( 1037 GURL referrer = webkit_glue::StringToGURL(
1038 request.httpHeaderField("Referer")); 1038 request.httpHeaderField("Referer"));
1039 1039
1040 d->OpenURL(webframe_->webview_impl(), 1040 d->OpenURL(webframe_->GetWebViewImpl(),
1041 webkit_glue::KURLToGURL(request.url()), 1041 webkit_glue::KURLToGURL(request.url()),
1042 referrer, 1042 referrer,
1043 disposition); 1043 disposition);
1044 policy_action = PolicyIgnore; 1044 policy_action = PolicyIgnore;
1045 } 1045 }
1046 } else { 1046 } else {
1047 policy_action = PolicyIgnore; 1047 policy_action = PolicyIgnore;
1048 } 1048 }
1049 } 1049 }
1050 } else { 1050 } else {
(...skipping 17 matching lines...) Expand all
1068 WebDataSourceImpl* ds = WebDataSourceImpl::FromLoader( 1068 WebDataSourceImpl* ds = WebDataSourceImpl::FromLoader(
1069 webframe_->frame()->loader()->provisionalDocumentLoader()); 1069 webframe_->frame()->loader()->provisionalDocumentLoader());
1070 // Don't free the SearchableFormData, the datasource will do that. 1070 // Don't free the SearchableFormData, the datasource will do that.
1071 ds->set_searchable_form_data(form_data); 1071 ds->set_searchable_form_data(form_data);
1072 1072
1073 PasswordForm* pass_data = 1073 PasswordForm* pass_data =
1074 PasswordFormDomManager::CreatePasswordForm(form_ref->form()); 1074 PasswordFormDomManager::CreatePasswordForm(form_ref->form());
1075 // Don't free the PasswordFormData, the datasource will do that. 1075 // Don't free the PasswordFormData, the datasource will do that.
1076 ds->set_password_form_data(pass_data); 1076 ds->set_password_form_data(pass_data);
1077 1077
1078 WebViewImpl* webview = webframe_->webview_impl(); 1078 WebViewImpl* webview = webframe_->GetWebViewImpl();
1079 WebViewDelegate* d = webview->delegate(); 1079 WebViewDelegate* d = webview->delegate();
1080 1080
1081 // Unless autocomplete=off, record what the user put in it for future 1081 // Unless autocomplete=off, record what the user put in it for future
1082 // autofilling. 1082 // autofilling.
1083 if (form_ref->form()->autoComplete()) { 1083 if (form_ref->form()->autoComplete()) {
1084 scoped_ptr<AutofillForm> autofill_form( 1084 scoped_ptr<AutofillForm> autofill_form(
1085 AutofillForm::CreateAutofillForm(form_ref->form())); 1085 AutofillForm::CreateAutofillForm(form_ref->form()));
1086 if (autofill_form.get()) { 1086 if (autofill_form.get()) {
1087 d->OnAutofillFormSubmitted(webview, *autofill_form); 1087 d->OnAutofillFormSubmitted(webview, *autofill_form);
1088 } 1088 }
(...skipping 18 matching lines...) Expand all
1107 if (sent_initial_response_to_plugin_) { 1107 if (sent_initial_response_to_plugin_) {
1108 plugin_widget_->didFail(error); 1108 plugin_widget_->didFail(error);
1109 sent_initial_response_to_plugin_ = false; 1109 sent_initial_response_to_plugin_ = false;
1110 } 1110 }
1111 plugin_widget_ = NULL; 1111 plugin_widget_ = NULL;
1112 } 1112 }
1113 } 1113 }
1114 1114
1115 void WebFrameLoaderClient::postProgressStartedNotification() { 1115 void WebFrameLoaderClient::postProgressStartedNotification() {
1116 if (hasWebView()) { 1116 if (hasWebView()) {
1117 WebViewDelegate* d = webframe_->webview_impl()->delegate(); 1117 WebViewImpl* web_view = webframe_->GetWebViewImpl();
1118 WebViewDelegate* d = web_view->delegate();
1118 if (d) 1119 if (d)
1119 d->DidStartLoading(webframe_->webview_impl()); 1120 d->DidStartLoading(web_view);
1120 } 1121 }
1121 } 1122 }
1122 1123
1123 void WebFrameLoaderClient::postProgressEstimateChangedNotification() { 1124 void WebFrameLoaderClient::postProgressEstimateChangedNotification() {
1124 // FIXME 1125 // FIXME
1125 } 1126 }
1126 1127
1127 void WebFrameLoaderClient::postProgressFinishedNotification() { 1128 void WebFrameLoaderClient::postProgressFinishedNotification() {
1128 // TODO(ericroman): why might webframe_->webview_impl be null? 1129 // TODO(ericroman): why might webframe_->webview_impl be null?
1129 // http://b/1234461 1130 // http://b/1234461
1130 if (hasWebView()) { 1131 if (hasWebView()) {
1131 WebViewDelegate* d = webframe_->webview_impl()->delegate(); 1132 WebViewImpl* web_view = webframe_->GetWebViewImpl();
1132 1133 WebViewDelegate* d = web_view->delegate();
1133 if (d) 1134 if (d)
1134 d->DidStopLoading(webframe_->webview_impl()); 1135 d->DidStopLoading(web_view);
1135 } 1136 }
1136 } 1137 }
1137 1138
1138 void WebFrameLoaderClient::setMainFrameDocumentReady(bool ready) { 1139 void WebFrameLoaderClient::setMainFrameDocumentReady(bool ready) {
1139 WebViewImpl* web_view = webframe_->webview_impl(); 1140 WebViewImpl* web_view = webframe_->GetWebViewImpl();
1140 if (!web_view) 1141 if (!web_view)
1141 return; 1142 return;
1142 WebDevToolsAgentImpl* tools_agent = web_view->GetWebDevToolsAgentImpl(); 1143 WebDevToolsAgentImpl* tools_agent = web_view->GetWebDevToolsAgentImpl();
1143 if (!tools_agent) 1144 if (!tools_agent)
1144 return; 1145 return;
1145 1146
1146 if (webframe_ == web_view->GetMainFrame()) { 1147 if (webframe_ == web_view->GetMainFrame()) {
1147 tools_agent->SetMainFrameDocumentReady(ready); 1148 tools_agent->SetMainFrameDocumentReady(ready);
1148 } 1149 }
1149 } 1150 }
1150 1151
1151 // Creates a new connection and begins downloading from that (contrast this 1152 // Creates a new connection and begins downloading from that (contrast this
1152 // with |download|). 1153 // with |download|).
1153 void WebFrameLoaderClient::startDownload(const ResourceRequest& request) { 1154 void WebFrameLoaderClient::startDownload(const ResourceRequest& request) {
1154 WebViewDelegate* d = webframe_->webview_impl()->delegate(); 1155 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate();
1155 if (d) { 1156 if (d) {
1156 const GURL url(webkit_glue::KURLToGURL(request.url())); 1157 const GURL url(webkit_glue::KURLToGURL(request.url()));
1157 const GURL referrer(webkit_glue::StringToStdString(request.httpReferrer())); 1158 const GURL referrer(webkit_glue::StringToStdString(request.httpReferrer()));
1158 d->DownloadUrl(url, referrer); 1159 d->DownloadUrl(url, referrer);
1159 } 1160 }
1160 } 1161 }
1161 1162
1162 void WebFrameLoaderClient::willChangeTitle(DocumentLoader*) { 1163 void WebFrameLoaderClient::willChangeTitle(DocumentLoader*) {
1163 // FIXME 1164 // FIXME
1164 } 1165 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 } 1351 }
1351 1352
1352 void WebFrameLoaderClient::setTitle(const String& title, const KURL& url) { 1353 void WebFrameLoaderClient::setTitle(const String& title, const KURL& url) {
1353 // FIXME: monitor for changes in WebFrameLoaderClient.mm 1354 // FIXME: monitor for changes in WebFrameLoaderClient.mm
1354 // FIXME: Set the title of the current history item. HistoryItemImpl's setter 1355 // FIXME: Set the title of the current history item. HistoryItemImpl's setter
1355 // will notify its clients (e.g. the history database) that the title 1356 // will notify its clients (e.g. the history database) that the title
1356 // has changed. 1357 // has changed.
1357 // 1358 //
1358 // e.g.: 1359 // e.g.:
1359 // WebHistoryItem* item = 1360 // WebHistoryItem* item =
1360 // webframe_->webview_impl()->GetBackForwardList()->GetCurrentItem(); 1361 // webframe_->GetWebViewImpl()->GetBackForwardList()->GetCurrentItem();
1361 // WebHistoryItemImpl* item_impl = static_cast<WebHistoryItemImpl*>(item); 1362 // WebHistoryItemImpl* item_impl = static_cast<WebHistoryItemImpl*>(item);
1362 // 1363 //
1363 // item_impl->SetTitle(webkit_glue::StringToStdWString(title)); 1364 // item_impl->SetTitle(webkit_glue::StringToStdWString(title));
1364 } 1365 }
1365 1366
1366 String WebFrameLoaderClient::userAgent(const KURL& url) { 1367 String WebFrameLoaderClient::userAgent(const KURL& url) {
1367 return webkit_glue::StdStringToString( 1368 return webkit_glue::StdStringToString(
1368 webkit_glue::GetUserAgent(webkit_glue::KURLToGURL(url))); 1369 webkit_glue::GetUserAgent(webkit_glue::KURLToGURL(url)));
1369 } 1370 }
1370 1371
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 delete [] arr; 1434 delete [] arr;
1434 } 1435 }
1435 1436
1436 Widget* WebFrameLoaderClient::createPlugin(const IntSize& size, // TODO(erikkay) : how do we use this? 1437 Widget* WebFrameLoaderClient::createPlugin(const IntSize& size, // TODO(erikkay) : how do we use this?
1437 HTMLPlugInElement* element, 1438 HTMLPlugInElement* element,
1438 const KURL&url, 1439 const KURL&url,
1439 const Vector<String>& param_names, 1440 const Vector<String>& param_names,
1440 const Vector<String>& param_values, 1441 const Vector<String>& param_values,
1441 const String& mime_type, 1442 const String& mime_type,
1442 bool load_manually) { 1443 bool load_manually) {
1443 WebViewImpl* webview = webframe_->webview_impl(); 1444 WebViewImpl* webview = webframe_->GetWebViewImpl();
1444 WebViewDelegate* d = webview->delegate(); 1445 WebViewDelegate* d = webview->delegate();
1445 if (!d) 1446 if (!d)
1446 return NULL; 1447 return NULL;
1447 1448
1448 GURL gurl = webkit_glue::KURLToGURL(url); 1449 GURL gurl = webkit_glue::KURLToGURL(url);
1449 std::string my_mime_type = 1450 std::string my_mime_type =
1450 webkit_glue::CStringToStdString(mime_type.latin1()); 1451 webkit_glue::CStringToStdString(mime_type.latin1());
1451 StringToLowerASCII(&my_mime_type); 1452 StringToLowerASCII(&my_mime_type);
1452 1453
1453 // Get the classid and version from attributes of the object. 1454 // Get the classid and version from attributes of the object.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 // need to return NULL here rather than going through all the 1494 // need to return NULL here rather than going through all the
1494 // plugin-creation IPCs only to discover we don't have a plugin 1495 // plugin-creation IPCs only to discover we don't have a plugin
1495 // registered, which causes a crash. 1496 // registered, which causes a crash.
1496 // TODO(evanm): remove me once we have a default plugin. 1497 // TODO(evanm): remove me once we have a default plugin.
1497 if (objectContentType(url, mime_type) != ObjectContentNetscapePlugin) 1498 if (objectContentType(url, mime_type) != ObjectContentNetscapePlugin)
1498 return NULL; 1499 return NULL;
1499 #endif 1500 #endif
1500 1501
1501 std::string actual_mime_type; 1502 std::string actual_mime_type;
1502 WebPluginDelegate* plugin_delegate = 1503 WebPluginDelegate* plugin_delegate =
1503 d->CreatePluginDelegate(webframe_->webview_impl(), gurl, my_mime_type, 1504 d->CreatePluginDelegate(webframe_->GetWebViewImpl(), gurl, my_mime_type,
1504 combined_clsid, &actual_mime_type); 1505 combined_clsid, &actual_mime_type);
1505 if (!plugin_delegate) 1506 if (!plugin_delegate)
1506 return NULL; 1507 return NULL;
1507 1508
1508 if (!actual_mime_type.empty()) 1509 if (!actual_mime_type.empty())
1509 my_mime_type = actual_mime_type; 1510 my_mime_type = actual_mime_type;
1510 1511
1511 DCHECK(param_names.size() == param_values.size()); 1512 DCHECK(param_names.size() == param_values.size());
1512 1513
1513 char **argn = NULL; 1514 char **argn = NULL;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 1630
1630 DCHECK(disposition); 1631 DCHECK(disposition);
1631 if (new_tab_modifier) 1632 if (new_tab_modifier)
1632 *disposition = shift ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; 1633 *disposition = shift ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB;
1633 else 1634 else
1634 *disposition = shift ? NEW_WINDOW : SAVE_TO_DISK; 1635 *disposition = shift ? NEW_WINDOW : SAVE_TO_DISK;
1635 return true; 1636 return true;
1636 } 1637 }
1637 1638
1638 NetAgentImpl* WebFrameLoaderClient::GetNetAgentImpl() { 1639 NetAgentImpl* WebFrameLoaderClient::GetNetAgentImpl() {
1639 WebViewImpl* web_view = webframe_->webview_impl(); 1640 WebViewImpl* web_view = webframe_->GetWebViewImpl();
1640 if (!web_view) { 1641 if (!web_view) {
1641 return NULL; 1642 return NULL;
1642 } 1643 }
1643 WebDevToolsAgentImpl* tools_agent = web_view->GetWebDevToolsAgentImpl(); 1644 WebDevToolsAgentImpl* tools_agent = web_view->GetWebDevToolsAgentImpl();
1644 if (tools_agent) { 1645 if (tools_agent) {
1645 return tools_agent->net_agent_impl(); 1646 return tools_agent->net_agent_impl();
1646 } else { 1647 } else {
1647 return NULL; 1648 return NULL;
1648 } 1649 }
1649 } 1650 }
OLDNEW
« no previous file with comments | « webkit/glue/webframe_impl.cc ('k') | webkit/glue/webplugin_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698