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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 1747015: Add support for new webkit capability allowing us to update (Closed)
Patch Set: Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/renderer/render_view.h" 5 #include "chrome/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 // Ignore all but top level navigations... 1344 // Ignore all but top level navigations...
1345 if (!frame->parent()) { 1345 if (!frame->parent()) {
1346 Send(new ViewHostMsg_UpdateTitle( 1346 Send(new ViewHostMsg_UpdateTitle(
1347 routing_id_, 1347 routing_id_,
1348 page_id_, 1348 page_id_,
1349 UTF16ToWideHack(title.length() > chrome::kMaxTitleChars ? 1349 UTF16ToWideHack(title.length() > chrome::kMaxTitleChars ?
1350 title.substr(0, chrome::kMaxTitleChars) : title))); 1350 title.substr(0, chrome::kMaxTitleChars) : title)));
1351 } 1351 }
1352 } 1352 }
1353 1353
1354 // Tell the embedding application that the icon of the active page has changed
1355 void RenderView::UpdateIconURL(WebFrame* frame, const GURL& icon_url) {
brettw 2010/04/26 23:28:33 I would probably put this code in didChangeIcons a
1356 // Ignore all but top level navigations...
1357 if (!frame->parent()) {
1358 Send(new ViewHostMsg_UpdateFavIconURL(
brettw 2010/04/26 23:28:33 I'd just put this on the same line if I was you, b
1359 routing_id_,
1360 page_id_,
1361 icon_url));
1362 }
1363 }
1364
1354 void RenderView::UpdateEncoding(WebFrame* frame, 1365 void RenderView::UpdateEncoding(WebFrame* frame,
1355 const std::string& encoding_name) { 1366 const std::string& encoding_name) {
1356 // Only update main frame's encoding_name. 1367 // Only update main frame's encoding_name.
1357 if (webview()->mainFrame() == frame && 1368 if (webview()->mainFrame() == frame &&
1358 last_encoding_name_ != encoding_name) { 1369 last_encoding_name_ != encoding_name) {
1359 // Save the encoding name for later comparing. 1370 // Save the encoding name for later comparing.
1360 last_encoding_name_ = encoding_name; 1371 last_encoding_name_ = encoding_name;
1361 1372
1362 Send(new ViewHostMsg_UpdateEncoding(routing_id_, last_encoding_name_)); 1373 Send(new ViewHostMsg_UpdateEncoding(routing_id_, last_encoding_name_));
1363 } 1374 }
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after
2656 } 2667 }
2657 } 2668 }
2658 2669
2659 void RenderView::didReceiveTitle(WebFrame* frame, const WebString& title) { 2670 void RenderView::didReceiveTitle(WebFrame* frame, const WebString& title) {
2660 UpdateTitle(frame, title); 2671 UpdateTitle(frame, title);
2661 2672
2662 // Also check whether we have new encoding name. 2673 // Also check whether we have new encoding name.
2663 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); 2674 UpdateEncoding(frame, frame->view()->pageEncoding().utf8());
2664 } 2675 }
2665 2676
2677 void RenderView::didChangeIcons(WebFrame* frame) {
2678 UpdateIconURL(frame, frame->favIconURL());
2679 }
2680
2666 void RenderView::didFinishDocumentLoad(WebFrame* frame) { 2681 void RenderView::didFinishDocumentLoad(WebFrame* frame) {
2667 WebDataSource* ds = frame->dataSource(); 2682 WebDataSource* ds = frame->dataSource();
2668 NavigationState* navigation_state = NavigationState::FromDataSource(ds); 2683 NavigationState* navigation_state = NavigationState::FromDataSource(ds);
2669 DCHECK(navigation_state); 2684 DCHECK(navigation_state);
2670 navigation_state->set_finish_document_load_time(Time::Now()); 2685 navigation_state->set_finish_document_load_time(Time::Now());
2671 2686
2672 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_)); 2687 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_));
2673 2688
2674 // The document has now been fully loaded. Scan for forms to be sent up to 2689 // The document has now been fully loaded. Scan for forms to be sent up to
2675 // the browser. 2690 // the browser.
(...skipping 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after
4963 4978
4964 if (last_top_level_navigation_page_id_ != page_id_ && 4979 if (last_top_level_navigation_page_id_ != page_id_ &&
4965 // Not interested in reloads. 4980 // Not interested in reloads.
4966 type != WebKit::WebNavigationTypeReload && 4981 type != WebKit::WebNavigationTypeReload &&
4967 type != WebKit::WebNavigationTypeFormSubmitted) { 4982 type != WebKit::WebNavigationTypeFormSubmitted) {
4968 return true; 4983 return true;
4969 } 4984 }
4970 } 4985 }
4971 return false; 4986 return false;
4972 } 4987 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698