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/browser/renderer_host/render_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 using WebKit::WebConsoleMessage; | 67 using WebKit::WebConsoleMessage; |
68 using WebKit::WebDragOperation; | 68 using WebKit::WebDragOperation; |
69 using WebKit::WebDragOperationNone; | 69 using WebKit::WebDragOperationNone; |
70 using WebKit::WebDragOperationsMask; | 70 using WebKit::WebDragOperationsMask; |
71 using WebKit::WebInputEvent; | 71 using WebKit::WebInputEvent; |
72 using WebKit::WebMediaPlayerAction; | 72 using WebKit::WebMediaPlayerAction; |
73 using WebKit::WebPluginAction; | 73 using WebKit::WebPluginAction; |
74 | 74 |
75 namespace { | 75 namespace { |
76 | 76 |
77 // Delay to wait on closing the tab for a beforeunload/unload handler to fire. | 77 // Delay to wait on closing the WebContents for a beforeunload/unload handler to |
| 78 // fire. |
78 const int kUnloadTimeoutMS = 1000; | 79 const int kUnloadTimeoutMS = 1000; |
79 | 80 |
80 // Translate a WebKit text direction into a base::i18n one. | 81 // Translate a WebKit text direction into a base::i18n one. |
81 base::i18n::TextDirection WebTextDirectionToChromeTextDirection( | 82 base::i18n::TextDirection WebTextDirectionToChromeTextDirection( |
82 WebKit::WebTextDirection dir) { | 83 WebKit::WebTextDirection dir) { |
83 switch (dir) { | 84 switch (dir) { |
84 case WebKit::WebTextDirectionLeftToRight: | 85 case WebKit::WebTextDirectionLeftToRight: |
85 return base::i18n::LEFT_TO_RIGHT; | 86 return base::i18n::LEFT_TO_RIGHT; |
86 case WebKit::WebTextDirectionRightToLeft: | 87 case WebKit::WebTextDirectionRightToLeft: |
87 return base::i18n::RIGHT_TO_LEFT; | 88 return base::i18n::RIGHT_TO_LEFT; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( | 281 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( |
281 GetProcess()->GetID(), params.url); | 282 GetProcess()->GetID(), params.url); |
282 | 283 |
283 ViewMsg_Navigate* nav_message = new ViewMsg_Navigate(GetRoutingID(), params); | 284 ViewMsg_Navigate* nav_message = new ViewMsg_Navigate(GetRoutingID(), params); |
284 | 285 |
285 // Only send the message if we aren't suspended at the start of a cross-site | 286 // Only send the message if we aren't suspended at the start of a cross-site |
286 // request. | 287 // request. |
287 if (navigations_suspended_) { | 288 if (navigations_suspended_) { |
288 // Shouldn't be possible to have a second navigation while suspended, since | 289 // Shouldn't be possible to have a second navigation while suspended, since |
289 // navigations will only be suspended during a cross-site request. If a | 290 // navigations will only be suspended during a cross-site request. If a |
290 // second navigation occurs, TabContents will cancel this pending RVH | 291 // second navigation occurs, WebContentsImpl will cancel this pending RVH |
291 // create a new pending RVH. | 292 // create a new pending RVH. |
292 DCHECK(!suspended_nav_message_.get()); | 293 DCHECK(!suspended_nav_message_.get()); |
293 suspended_nav_message_.reset(nav_message); | 294 suspended_nav_message_.reset(nav_message); |
294 } else { | 295 } else { |
295 // Get back to a clean state, in case we start a new navigation without | 296 // Get back to a clean state, in case we start a new navigation without |
296 // completing a RVH swap or unload handler. | 297 // completing a RVH swap or unload handler. |
297 SetSwappedOut(false); | 298 SetSwappedOut(false); |
298 | 299 |
299 Send(nav_message); | 300 Send(nav_message); |
300 } | 301 } |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1471 *url = GURL(chrome::kAboutBlankURL); | 1472 *url = GURL(chrome::kAboutBlankURL); |
1472 } | 1473 } |
1473 } | 1474 } |
1474 | 1475 |
1475 void RenderViewHostImpl::SetAltErrorPageURL(const GURL& url) { | 1476 void RenderViewHostImpl::SetAltErrorPageURL(const GURL& url) { |
1476 Send(new ViewMsg_SetAltErrorPageURL(GetRoutingID(), url)); | 1477 Send(new ViewMsg_SetAltErrorPageURL(GetRoutingID(), url)); |
1477 } | 1478 } |
1478 | 1479 |
1479 void RenderViewHostImpl::ExitFullscreen() { | 1480 void RenderViewHostImpl::ExitFullscreen() { |
1480 RejectMouseLockOrUnlockIfNecessary(); | 1481 RejectMouseLockOrUnlockIfNecessary(); |
1481 // We need to notify the tab that its fullscreen state has changed. This | 1482 // We need to notify the contents that its fullscreen state has changed. This |
1482 // is done as part of the resize message. | 1483 // is done as part of the resize message. |
1483 WasResized(); | 1484 WasResized(); |
1484 } | 1485 } |
1485 | 1486 |
1486 void RenderViewHostImpl::UpdateWebkitPreferences(const WebPreferences& prefs) { | 1487 void RenderViewHostImpl::UpdateWebkitPreferences(const WebPreferences& prefs) { |
1487 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs)); | 1488 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs)); |
1488 } | 1489 } |
1489 | 1490 |
1490 void RenderViewHostImpl::ClearFocusedNode() { | 1491 void RenderViewHostImpl::ClearFocusedNode() { |
1491 Send(new ViewMsg_ClearFocusedNode(GetRoutingID())); | 1492 Send(new ViewMsg_ClearFocusedNode(GetRoutingID())); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 // can cause navigations to be ignored in OnMsgNavigate. | 1727 // can cause navigations to be ignored in OnMsgNavigate. |
1727 is_waiting_for_beforeunload_ack_ = false; | 1728 is_waiting_for_beforeunload_ack_ = false; |
1728 is_waiting_for_unload_ack_ = false; | 1729 is_waiting_for_unload_ack_ = false; |
1729 } | 1730 } |
1730 | 1731 |
1731 void RenderViewHostImpl::ClearPowerSaveBlockers() { | 1732 void RenderViewHostImpl::ClearPowerSaveBlockers() { |
1732 STLDeleteValues(&power_save_blockers_); | 1733 STLDeleteValues(&power_save_blockers_); |
1733 } | 1734 } |
1734 | 1735 |
1735 } // namespace content | 1736 } // namespace content |
OLD | NEW |