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

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

Issue 196128: Hook up WebViewClient, part 1.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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/dragclient_impl.cc ('k') | webkit/glue/webview_delegate.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 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "Chrome.h" 10 #include "Chrome.h"
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 expected_client_redirect_dest_, 497 expected_client_redirect_dest_,
498 static_cast<unsigned int>(interval), 498 static_cast<unsigned int>(interval),
499 static_cast<unsigned int>(fire_date)); 499 static_cast<unsigned int>(fire_date));
500 } 500 }
501 } 501 }
502 502
503 void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() { 503 void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() {
504 // Anchor fragment navigations are not normal loads, so we need to synthesize 504 // Anchor fragment navigations are not normal loads, so we need to synthesize
505 // some events for our delegate. 505 // some events for our delegate.
506 WebViewImpl* webview = webframe_->GetWebViewImpl(); 506 WebViewImpl* webview = webframe_->GetWebViewImpl();
507 WebViewDelegate* d = webview->delegate(); 507 if (webview->client())
508 if (d) 508 webview->client()->didStartLoading();
509 d->DidStartLoading(webview);
510 509
511 WebDataSourceImpl* ds = webframe_->GetDataSourceImpl(); 510 WebDataSourceImpl* ds = webframe_->GetDataSourceImpl();
512 DCHECK(ds) << "DataSource NULL when navigating to reference fragment"; 511 DCHECK(ds) << "DataSource NULL when navigating to reference fragment";
513 if (ds) { 512 if (ds) {
514 GURL url = ds->request().url(); 513 GURL url = ds->request().url();
515 GURL chain_end = ds->endOfRedirectChain(); 514 GURL chain_end = ds->endOfRedirectChain();
516 ds->clearRedirectChain(); 515 ds->clearRedirectChain();
517 516
518 // Figure out if this location change is because of a JS-initiated client 517 // Figure out if this location change is because of a JS-initiated client
519 // redirect (e.g onload/setTimeout document.location.href=). 518 // redirect (e.g onload/setTimeout document.location.href=).
(...skipping 23 matching lines...) Expand all
543 ds->appendRedirect(url); 542 ds->appendRedirect(url);
544 } 543 }
545 544
546 bool is_new_navigation; 545 bool is_new_navigation;
547 webview->DidCommitLoad(&is_new_navigation); 546 webview->DidCommitLoad(&is_new_navigation);
548 if (webframe_->client()) { 547 if (webframe_->client()) {
549 webframe_->client()->didChangeLocationWithinPage( 548 webframe_->client()->didChangeLocationWithinPage(
550 webframe_, is_new_navigation); 549 webframe_, is_new_navigation);
551 } 550 }
552 551
553 if (d) 552 if (webview->client())
554 d->DidStopLoading(webview); 553 webview->client()->didStopLoading();
555 } 554 }
556 555
557 void WebFrameLoaderClient::dispatchWillClose() { 556 void WebFrameLoaderClient::dispatchWillClose() {
558 if (webframe_->client()) 557 if (webframe_->client())
559 webframe_->client()->willClose(webframe_); 558 webframe_->client()->willClose(webframe_);
560 } 559 }
561 560
562 void WebFrameLoaderClient::dispatchDidReceiveIcon() { 561 void WebFrameLoaderClient::dispatchDidReceiveIcon() {
563 // The icon database is disabled, so this should never be called. 562 // The icon database is disabled, so this should never be called.
564 ASSERT_NOT_REACHED(); 563 ASSERT_NOT_REACHED();
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 if (plugin_widget_.get()) { 877 if (plugin_widget_.get()) {
879 if (sent_initial_response_to_plugin_) { 878 if (sent_initial_response_to_plugin_) {
880 plugin_widget_->didFailLoading(error); 879 plugin_widget_->didFailLoading(error);
881 sent_initial_response_to_plugin_ = false; 880 sent_initial_response_to_plugin_ = false;
882 } 881 }
883 plugin_widget_ = NULL; 882 plugin_widget_ = NULL;
884 } 883 }
885 } 884 }
886 885
887 void WebFrameLoaderClient::postProgressStartedNotification() { 886 void WebFrameLoaderClient::postProgressStartedNotification() {
888 if (hasWebView()) { 887 WebViewImpl* webview = webframe_->GetWebViewImpl();
889 WebViewImpl* web_view = webframe_->GetWebViewImpl(); 888 if (webview && webview->client())
890 WebViewDelegate* d = web_view->delegate(); 889 webview->client()->didStartLoading();
891 if (d)
892 d->DidStartLoading(web_view);
893 }
894 } 890 }
895 891
896 void WebFrameLoaderClient::postProgressEstimateChangedNotification() { 892 void WebFrameLoaderClient::postProgressEstimateChangedNotification() {
897 // FIXME 893 // FIXME
898 } 894 }
899 895
900 void WebFrameLoaderClient::postProgressFinishedNotification() { 896 void WebFrameLoaderClient::postProgressFinishedNotification() {
901 // TODO(ericroman): why might webframe_->webview_impl be null? 897 // TODO(ericroman): why might the webview be null?
902 // http://b/1234461 898 // http://b/1234461
903 if (hasWebView()) { 899 WebViewImpl* webview = webframe_->GetWebViewImpl();
904 WebViewImpl* web_view = webframe_->GetWebViewImpl(); 900 if (webview && webview->client())
905 WebViewDelegate* d = web_view->delegate(); 901 webview->client()->didStopLoading();
906 if (d)
907 d->DidStopLoading(web_view);
908 }
909 } 902 }
910 903
911 void WebFrameLoaderClient::setMainFrameDocumentReady(bool ready) { 904 void WebFrameLoaderClient::setMainFrameDocumentReady(bool ready) {
912 // FIXME 905 // FIXME
913 } 906 }
914 907
915 // Creates a new connection and begins downloading from that (contrast this 908 // Creates a new connection and begins downloading from that (contrast this
916 // with |download|). 909 // with |download|).
917 void WebFrameLoaderClient::startDownload(const ResourceRequest& request) { 910 void WebFrameLoaderClient::startDownload(const ResourceRequest& request) {
918 if (webframe_->client()) { 911 if (webframe_->client()) {
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 } 1321 }
1329 1322
1330 void WebFrameLoaderClient::HandleBackForwardNavigation(const GURL& url) { 1323 void WebFrameLoaderClient::HandleBackForwardNavigation(const GURL& url) {
1331 DCHECK(url.SchemeIs(webkit_glue::kBackForwardNavigationScheme)); 1324 DCHECK(url.SchemeIs(webkit_glue::kBackForwardNavigationScheme));
1332 1325
1333 std::string offset_str = url.ExtractFileName(); 1326 std::string offset_str = url.ExtractFileName();
1334 int offset; 1327 int offset;
1335 if (!StringToInt(offset_str, &offset)) 1328 if (!StringToInt(offset_str, &offset))
1336 return; 1329 return;
1337 1330
1338 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate(); 1331 WebViewImpl* webview = webframe_->GetWebViewImpl();
1339 if (d) 1332 if (webview->client())
1340 d->NavigateBackForwardSoon(offset); 1333 webview->client()->navigateBackForwardSoon(offset);
1341 } 1334 }
1342 1335
1343 PassOwnPtr<WebPluginLoadObserver> WebFrameLoaderClient::GetPluginLoadObserver() { 1336 PassOwnPtr<WebPluginLoadObserver> WebFrameLoaderClient::GetPluginLoadObserver() {
1344 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader( 1337 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader(
1345 webframe_->frame()->loader()->activeDocumentLoader()); 1338 webframe_->frame()->loader()->activeDocumentLoader());
1346 return ds->releasePluginLoadObserver(); 1339 return ds->releasePluginLoadObserver();
1347 } 1340 }
OLDNEW
« no previous file with comments | « webkit/glue/dragclient_impl.cc ('k') | webkit/glue/webview_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698