| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "third_party/skia/include/core/SkBitmap.h" | 54 #include "third_party/skia/include/core/SkBitmap.h" |
| 55 #if defined(OS_WIN) | 55 #if defined(OS_WIN) |
| 56 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact
ory.h" | 56 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact
ory.h" |
| 57 #endif | 57 #endif |
| 58 #include "ui/gfx/native_widget_types.h" | 58 #include "ui/gfx/native_widget_types.h" |
| 59 #include "webkit/fileapi/isolated_context.h" | 59 #include "webkit/fileapi/isolated_context.h" |
| 60 #include "webkit/glue/webaccessibility.h" | 60 #include "webkit/glue/webaccessibility.h" |
| 61 #include "webkit/glue/webdropdata.h" | 61 #include "webkit/glue/webdropdata.h" |
| 62 | 62 |
| 63 using base::TimeDelta; | 63 using base::TimeDelta; |
| 64 using content::BrowserContext; | |
| 65 using content::BrowserMessageFilter; | |
| 66 using content::BrowserThread; | |
| 67 using content::DomOperationNotificationDetails; | |
| 68 using content::DOMStorageContext; | |
| 69 using content::HostZoomMap; | |
| 70 using content::RenderViewHostDelegate; | |
| 71 using content::SessionStorageNamespace; | |
| 72 using content::SiteInstance; | |
| 73 using content::UserMetricsAction; | |
| 74 using WebKit::WebConsoleMessage; | 64 using WebKit::WebConsoleMessage; |
| 75 using WebKit::WebDragOperation; | 65 using WebKit::WebDragOperation; |
| 76 using WebKit::WebDragOperationNone; | 66 using WebKit::WebDragOperationNone; |
| 77 using WebKit::WebDragOperationsMask; | 67 using WebKit::WebDragOperationsMask; |
| 78 using WebKit::WebInputEvent; | 68 using WebKit::WebInputEvent; |
| 79 using WebKit::WebMediaPlayerAction; | 69 using WebKit::WebMediaPlayerAction; |
| 80 using WebKit::WebPluginAction; | 70 using WebKit::WebPluginAction; |
| 81 | 71 |
| 82 namespace { | 72 namespace { |
| 83 | 73 |
| 84 // Delay to wait on closing the tab for a beforeunload/unload handler to fire. | 74 // Delay to wait on closing the tab for a beforeunload/unload handler to fire. |
| 85 const int kUnloadTimeoutMS = 1000; | 75 const int kUnloadTimeoutMS = 1000; |
| 86 | 76 |
| 87 // Translate a WebKit text direction into a base::i18n one. | 77 // Translate a WebKit text direction into a base::i18n one. |
| 88 base::i18n::TextDirection WebTextDirectionToChromeTextDirection( | 78 base::i18n::TextDirection WebTextDirectionToChromeTextDirection( |
| 89 WebKit::WebTextDirection dir) { | 79 WebKit::WebTextDirection dir) { |
| 90 switch (dir) { | 80 switch (dir) { |
| 91 case WebKit::WebTextDirectionLeftToRight: | 81 case WebKit::WebTextDirectionLeftToRight: |
| 92 return base::i18n::LEFT_TO_RIGHT; | 82 return base::i18n::LEFT_TO_RIGHT; |
| 93 case WebKit::WebTextDirectionRightToLeft: | 83 case WebKit::WebTextDirectionRightToLeft: |
| 94 return base::i18n::RIGHT_TO_LEFT; | 84 return base::i18n::RIGHT_TO_LEFT; |
| 95 default: | 85 default: |
| 96 NOTREACHED(); | 86 NOTREACHED(); |
| 97 return base::i18n::UNKNOWN_DIRECTION; | 87 return base::i18n::UNKNOWN_DIRECTION; |
| 98 } | 88 } |
| 99 } | 89 } |
| 100 | 90 |
| 101 } // namespace | 91 } // namespace |
| 102 | 92 |
| 93 namespace content { |
| 94 |
| 103 /////////////////////////////////////////////////////////////////////////////// | 95 /////////////////////////////////////////////////////////////////////////////// |
| 104 // RenderViewHost, public: | 96 // RenderViewHost, public: |
| 105 | 97 |
| 106 // static | 98 // static |
| 107 RenderViewHost* RenderViewHost::FromID(int render_process_id, | 99 RenderViewHost* RenderViewHost::FromID(int render_process_id, |
| 108 int render_view_id) { | 100 int render_view_id) { |
| 109 content::RenderProcessHost* process = | 101 RenderProcessHost* process = RenderProcessHost::FromID(render_process_id); |
| 110 content::RenderProcessHost::FromID(render_process_id); | |
| 111 if (!process) | 102 if (!process) |
| 112 return NULL; | 103 return NULL; |
| 113 RenderWidgetHost* widget = RenderWidgetHost::FromIPCChannelListener( | 104 RenderWidgetHost* widget = RenderWidgetHost::FromIPCChannelListener( |
| 114 process->GetListenerByID(render_view_id)); | 105 process->GetListenerByID(render_view_id)); |
| 115 if (!widget || !widget->IsRenderView()) | 106 if (!widget || !widget->IsRenderView()) |
| 116 return NULL; | 107 return NULL; |
| 117 return static_cast<RenderViewHostImpl*>(RenderWidgetHostImpl::From(widget)); | 108 return static_cast<RenderViewHostImpl*>(RenderWidgetHostImpl::From(widget)); |
| 118 } | 109 } |
| 119 | 110 |
| 120 // static | 111 // static |
| (...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1662 // Whenever we change swap out state, we should not be waiting for | 1653 // Whenever we change swap out state, we should not be waiting for |
| 1663 // beforeunload or unload acks. We clear them here to be safe, since they | 1654 // beforeunload or unload acks. We clear them here to be safe, since they |
| 1664 // can cause navigations to be ignored in OnMsgNavigate. | 1655 // can cause navigations to be ignored in OnMsgNavigate. |
| 1665 is_waiting_for_beforeunload_ack_ = false; | 1656 is_waiting_for_beforeunload_ack_ = false; |
| 1666 is_waiting_for_unload_ack_ = false; | 1657 is_waiting_for_unload_ack_ = false; |
| 1667 } | 1658 } |
| 1668 | 1659 |
| 1669 void RenderViewHostImpl::ClearPowerSaveBlockers() { | 1660 void RenderViewHostImpl::ClearPowerSaveBlockers() { |
| 1670 STLDeleteValues(&power_save_blockers_); | 1661 STLDeleteValues(&power_save_blockers_); |
| 1671 } | 1662 } |
| 1663 |
| 1664 } // namespace content |
| OLD | NEW |