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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 248013003: Remove WebHistoryItem child usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 1377
1378 // Sends the last committed session history state to the browser so it will be 1378 // Sends the last committed session history state to the browser so it will be
1379 // saved before we navigate to a new page. This must be called *before* the 1379 // saved before we navigate to a new page. This must be called *before* the
1380 // page ID has been updated so we know what it was. 1380 // page ID has been updated so we know what it was.
1381 void RenderViewImpl::UpdateSessionHistory(WebFrame* frame) { 1381 void RenderViewImpl::UpdateSessionHistory(WebFrame* frame) {
1382 // If we have a valid page ID at this point, then it corresponds to the page 1382 // If we have a valid page ID at this point, then it corresponds to the page
1383 // we are navigating away from. Otherwise, this is the first navigation, so 1383 // we are navigating away from. Otherwise, this is the first navigation, so
1384 // there is no past session history to record. 1384 // there is no past session history to record.
1385 if (page_id_ == -1) 1385 if (page_id_ == -1)
1386 return; 1386 return;
1387 1387 SendUpdateState(history_controller_->GetPreviousEntry());
1388 WebHistoryItem item = history_controller_->GetPreviousItemForExport();
1389 SendUpdateState(item);
1390 } 1388 }
1391 1389
1392 void RenderViewImpl::SendUpdateState(const WebHistoryItem& item) { 1390 void RenderViewImpl::SendUpdateState(HistoryEntry* entry) {
1393 if (item.isNull()) 1391 if (!entry)
1394 return; 1392 return;
1395 1393
1396 // Don't send state updates for kSwappedOutURL. 1394 // Don't send state updates for kSwappedOutURL.
1397 if (item.urlString() == WebString::fromUTF8(kSwappedOutURL)) 1395 if (entry->root().urlString() == WebString::fromUTF8(kSwappedOutURL))
1398 return; 1396 return;
1399 1397
1400 Send(new ViewHostMsg_UpdateState( 1398 Send(new ViewHostMsg_UpdateState(
1401 routing_id_, page_id_, HistoryItemToPageState(item))); 1399 routing_id_, page_id_, HistoryEntryToPageState(entry)));
1402 } 1400 }
1403 1401
1404 // WebViewDelegate ------------------------------------------------------------ 1402 // WebViewDelegate ------------------------------------------------------------
1405 1403
1406 void RenderViewImpl::LoadNavigationErrorPage( 1404 void RenderViewImpl::LoadNavigationErrorPage(
1407 WebFrame* frame, 1405 WebFrame* frame,
1408 const WebURLRequest& failed_request, 1406 const WebURLRequest& failed_request,
1409 const WebURLError& error, 1407 const WebURLError& error,
1410 bool replace) { 1408 bool replace) {
1411 std::string error_html; 1409 std::string error_html;
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2718 routing_id_, reinterpret_cast<int64>(player))); 2716 routing_id_, reinterpret_cast<int64>(player)));
2719 } 2717 }
2720 2718
2721 void RenderViewImpl::PlayerGone(blink::WebMediaPlayer* player) { 2719 void RenderViewImpl::PlayerGone(blink::WebMediaPlayer* player) {
2722 DidPause(player); 2720 DidPause(player);
2723 } 2721 }
2724 2722
2725 void RenderViewImpl::SyncNavigationState() { 2723 void RenderViewImpl::SyncNavigationState() {
2726 if (!webview()) 2724 if (!webview())
2727 return; 2725 return;
2728 2726 SendUpdateState(history_controller_->GetCurrentEntry());
2729 WebHistoryItem item = history_controller_->GetCurrentItemForExport();
2730 SendUpdateState(item);
2731 } 2727 }
2732 2728
2733 GURL RenderViewImpl::GetLoadingUrl(blink::WebFrame* frame) const { 2729 GURL RenderViewImpl::GetLoadingUrl(blink::WebFrame* frame) const {
2734 WebDataSource* ds = frame->dataSource(); 2730 WebDataSource* ds = frame->dataSource();
2735 if (ds->hasUnreachableURL()) 2731 if (ds->hasUnreachableURL())
2736 return ds->unreachableURL(); 2732 return ds->unreachableURL();
2737 2733
2738 const WebURLRequest& request = ds->request(); 2734 const WebURLRequest& request = ds->request();
2739 return request.url(); 2735 return request.url();
2740 } 2736 }
(...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after
4439 std::vector<gfx::Size> sizes; 4435 std::vector<gfx::Size> sizes;
4440 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4436 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4441 if (!url.isEmpty()) 4437 if (!url.isEmpty())
4442 urls.push_back( 4438 urls.push_back(
4443 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4439 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4444 } 4440 }
4445 SendUpdateFaviconURL(urls); 4441 SendUpdateFaviconURL(urls);
4446 } 4442 }
4447 4443
4448 } // namespace content 4444 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698