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 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1369 // page ID has been updated so we know what it was. | 1369 // page ID has been updated so we know what it was. |
1370 void RenderViewImpl::UpdateSessionHistory(WebFrame* frame) { | 1370 void RenderViewImpl::UpdateSessionHistory(WebFrame* frame) { |
1371 // If we have a valid page ID at this point, then it corresponds to the page | 1371 // If we have a valid page ID at this point, then it corresponds to the page |
1372 // we are navigating away from. Otherwise, this is the first navigation, so | 1372 // we are navigating away from. Otherwise, this is the first navigation, so |
1373 // there is no past session history to record. | 1373 // there is no past session history to record. |
1374 if (page_id_ == -1) | 1374 if (page_id_ == -1) |
1375 return; | 1375 return; |
1376 | 1376 |
1377 const WebHistoryItem& item = | 1377 const WebHistoryItem& item = |
1378 webview()->mainFrame()->previousHistoryItem(); | 1378 webview()->mainFrame()->previousHistoryItem(); |
| 1379 SendUpdateState(item); |
| 1380 } |
| 1381 |
| 1382 void RenderViewImpl::SendUpdateState(const WebHistoryItem& item) { |
1379 if (item.isNull()) | 1383 if (item.isNull()) |
1380 return; | 1384 return; |
1381 | 1385 |
| 1386 // Don't send state updates for chrome::kSwappedOutURL. |
| 1387 if (item.urlString() == WebString::fromUTF8(chrome::kSwappedOutURL)) |
| 1388 return; |
| 1389 |
1382 Send(new ViewHostMsg_UpdateState( | 1390 Send(new ViewHostMsg_UpdateState( |
1383 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); | 1391 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); |
1384 } | 1392 } |
1385 | 1393 |
1386 void RenderViewImpl::OpenURL(WebFrame* frame, | 1394 void RenderViewImpl::OpenURL(WebFrame* frame, |
1387 const GURL& url, | 1395 const GURL& url, |
1388 const Referrer& referrer, | 1396 const Referrer& referrer, |
1389 WebNavigationPolicy policy) { | 1397 WebNavigationPolicy policy) { |
1390 Send(new ViewHostMsg_OpenURL( | 1398 Send(new ViewHostMsg_OpenURL( |
1391 routing_id_, | 1399 routing_id_, |
(...skipping 2253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3645 | 3653 |
3646 void RenderViewImpl::PlayerGone(webkit_media::WebMediaPlayerImpl* player) { | 3654 void RenderViewImpl::PlayerGone(webkit_media::WebMediaPlayerImpl* player) { |
3647 DidPause(player); | 3655 DidPause(player); |
3648 } | 3656 } |
3649 | 3657 |
3650 void RenderViewImpl::SyncNavigationState() { | 3658 void RenderViewImpl::SyncNavigationState() { |
3651 if (!webview()) | 3659 if (!webview()) |
3652 return; | 3660 return; |
3653 | 3661 |
3654 const WebHistoryItem& item = webview()->mainFrame()->currentHistoryItem(); | 3662 const WebHistoryItem& item = webview()->mainFrame()->currentHistoryItem(); |
3655 if (item.isNull()) | 3663 SendUpdateState(item); |
3656 return; | |
3657 | |
3658 Send(new ViewHostMsg_UpdateState( | |
3659 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); | |
3660 } | 3664 } |
3661 | 3665 |
3662 void RenderViewImpl::SyncSelectionIfRequired() { | 3666 void RenderViewImpl::SyncSelectionIfRequired() { |
3663 WebFrame* frame = webview()->focusedFrame(); | 3667 WebFrame* frame = webview()->focusedFrame(); |
3664 if (!frame) | 3668 if (!frame) |
3665 return; | 3669 return; |
3666 | 3670 |
3667 string16 text; | 3671 string16 text; |
3668 size_t offset; | 3672 size_t offset; |
3669 ui::Range range; | 3673 ui::Range range; |
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5194 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5198 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
5195 return !!RenderThreadImpl::current()->compositor_thread(); | 5199 return !!RenderThreadImpl::current()->compositor_thread(); |
5196 } | 5200 } |
5197 | 5201 |
5198 void RenderViewImpl::OnJavaBridgeInit() { | 5202 void RenderViewImpl::OnJavaBridgeInit() { |
5199 DCHECK(!java_bridge_dispatcher_.get()); | 5203 DCHECK(!java_bridge_dispatcher_.get()); |
5200 #if defined(ENABLE_JAVA_BRIDGE) | 5204 #if defined(ENABLE_JAVA_BRIDGE) |
5201 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); | 5205 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); |
5202 #endif | 5206 #endif |
5203 } | 5207 } |
OLD | NEW |