OLD | NEW |
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 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 // page ID has been updated so we know what it was. | 1281 // page ID has been updated so we know what it was. |
1282 void RenderViewImpl::UpdateSessionHistory(WebFrame* frame) { | 1282 void RenderViewImpl::UpdateSessionHistory(WebFrame* frame) { |
1283 // If we have a valid page ID at this point, then it corresponds to the page | 1283 // If we have a valid page ID at this point, then it corresponds to the page |
1284 // we are navigating away from. Otherwise, this is the first navigation, so | 1284 // we are navigating away from. Otherwise, this is the first navigation, so |
1285 // there is no past session history to record. | 1285 // there is no past session history to record. |
1286 if (page_id_ == -1) | 1286 if (page_id_ == -1) |
1287 return; | 1287 return; |
1288 | 1288 |
1289 const WebHistoryItem& item = | 1289 const WebHistoryItem& item = |
1290 webview()->mainFrame()->previousHistoryItem(); | 1290 webview()->mainFrame()->previousHistoryItem(); |
| 1291 SendUpdateState(item); |
| 1292 } |
| 1293 |
| 1294 void RenderViewImpl::SendUpdateState(const WebHistoryItem& item) { |
1291 if (item.isNull()) | 1295 if (item.isNull()) |
1292 return; | 1296 return; |
1293 | 1297 |
| 1298 // Don't send state updates for about:swappedout. |
| 1299 if (item.urlString() == WebString::fromUTF8("about:swappedout")) |
| 1300 return; |
| 1301 |
1294 Send(new ViewHostMsg_UpdateState( | 1302 Send(new ViewHostMsg_UpdateState( |
1295 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); | 1303 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); |
1296 } | 1304 } |
1297 | 1305 |
1298 void RenderViewImpl::OpenURL(WebFrame* frame, | 1306 void RenderViewImpl::OpenURL(WebFrame* frame, |
1299 const GURL& url, | 1307 const GURL& url, |
1300 const Referrer& referrer, | 1308 const Referrer& referrer, |
1301 WebNavigationPolicy policy) { | 1309 WebNavigationPolicy policy) { |
1302 Send(new ViewHostMsg_OpenURL( | 1310 Send(new ViewHostMsg_OpenURL( |
1303 routing_id_, | 1311 routing_id_, |
(...skipping 2198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3502 | 3510 |
3503 void RenderViewImpl::PlayerGone(webkit_media::WebMediaPlayerImpl* player) { | 3511 void RenderViewImpl::PlayerGone(webkit_media::WebMediaPlayerImpl* player) { |
3504 DidPause(player); | 3512 DidPause(player); |
3505 } | 3513 } |
3506 | 3514 |
3507 void RenderViewImpl::SyncNavigationState() { | 3515 void RenderViewImpl::SyncNavigationState() { |
3508 if (!webview()) | 3516 if (!webview()) |
3509 return; | 3517 return; |
3510 | 3518 |
3511 const WebHistoryItem& item = webview()->mainFrame()->currentHistoryItem(); | 3519 const WebHistoryItem& item = webview()->mainFrame()->currentHistoryItem(); |
3512 if (item.isNull()) | 3520 SendUpdateState(item); |
3513 return; | |
3514 | |
3515 Send(new ViewHostMsg_UpdateState( | |
3516 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); | |
3517 } | 3521 } |
3518 | 3522 |
3519 void RenderViewImpl::SyncSelectionIfRequired() { | 3523 void RenderViewImpl::SyncSelectionIfRequired() { |
3520 WebFrame* frame = webview()->focusedFrame(); | 3524 WebFrame* frame = webview()->focusedFrame(); |
3521 if (!frame) | 3525 if (!frame) |
3522 return; | 3526 return; |
3523 | 3527 |
3524 size_t location, length; | 3528 size_t location, length; |
3525 if (!webview()->caretOrSelectionRange(&location, &length)) | 3529 if (!webview()->caretOrSelectionRange(&location, &length)) |
3526 return; | 3530 return; |
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4982 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 4986 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
4983 return !!RenderThreadImpl::current()->compositor_thread(); | 4987 return !!RenderThreadImpl::current()->compositor_thread(); |
4984 } | 4988 } |
4985 | 4989 |
4986 void RenderViewImpl::OnJavaBridgeInit() { | 4990 void RenderViewImpl::OnJavaBridgeInit() { |
4987 DCHECK(!java_bridge_dispatcher_.get()); | 4991 DCHECK(!java_bridge_dispatcher_.get()); |
4988 #if defined(ENABLE_JAVA_BRIDGE) | 4992 #if defined(ENABLE_JAVA_BRIDGE) |
4989 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); | 4993 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); |
4990 #endif | 4994 #endif |
4991 } | 4995 } |
OLD | NEW |