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/browser_plugin/browser_plugin_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "content/browser/browser_plugin/browser_plugin_guest_helper.h" | 10 #include "content/browser/browser_plugin/browser_plugin_guest_helper.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 namespace { | 34 namespace { |
35 const int kGuestHangTimeoutMs = 5000; | 35 const int kGuestHangTimeoutMs = 5000; |
36 } | 36 } |
37 | 37 |
38 BrowserPluginGuest::BrowserPluginGuest(int instance_id, | 38 BrowserPluginGuest::BrowserPluginGuest(int instance_id, |
39 WebContentsImpl* web_contents, | 39 WebContentsImpl* web_contents, |
40 RenderViewHost* render_view_host) | 40 RenderViewHost* render_view_host) |
41 : WebContentsObserver(web_contents), | 41 : WebContentsObserver(web_contents), |
42 embedder_render_process_host_(NULL), | 42 embedder_render_process_host_(NULL), |
| 43 embedder_web_contents_(NULL), |
43 instance_id_(instance_id), | 44 instance_id_(instance_id), |
44 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
45 damage_buffer_size_(0), | 46 damage_buffer_size_(0), |
46 #endif | 47 #endif |
47 damage_buffer_scale_factor_(1.0f), | 48 damage_buffer_scale_factor_(1.0f), |
48 pending_update_counter_(0), | 49 pending_update_counter_(0), |
49 guest_hang_timeout_( | 50 guest_hang_timeout_( |
50 base::TimeDelta::FromMilliseconds(kGuestHangTimeoutMs)), | 51 base::TimeDelta::FromMilliseconds(kGuestHangTimeoutMs)), |
51 visible_(true) { | 52 visible_(true) { |
52 DCHECK(web_contents); | 53 DCHECK(web_contents); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return true; | 125 return true; |
125 } | 126 } |
126 | 127 |
127 void BrowserPluginGuest::RendererUnresponsive(WebContents* source) { | 128 void BrowserPluginGuest::RendererUnresponsive(WebContents* source) { |
128 base::ProcessHandle process_handle = | 129 base::ProcessHandle process_handle = |
129 web_contents()->GetRenderProcessHost()->GetHandle(); | 130 web_contents()->GetRenderProcessHost()->GetHandle(); |
130 base::KillProcess(process_handle, RESULT_CODE_HUNG, false); | 131 base::KillProcess(process_handle, RESULT_CODE_HUNG, false); |
131 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Hung")); | 132 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Hung")); |
132 } | 133 } |
133 | 134 |
| 135 void BrowserPluginGuest::RunFileChooser(WebContents* web_contents, |
| 136 const FileChooserParams& params) { |
| 137 embedder_web_contents_->GetDelegate()->RunFileChooser(web_contents, params); |
| 138 } |
| 139 |
134 void BrowserPluginGuest::SetIsAcceptingTouchEvents(bool accept) { | 140 void BrowserPluginGuest::SetIsAcceptingTouchEvents(bool accept) { |
135 SendMessageToEmbedder( | 141 SendMessageToEmbedder( |
136 new BrowserPluginMsg_ShouldAcceptTouchEvents(instance_id(), accept)); | 142 new BrowserPluginMsg_ShouldAcceptTouchEvents(instance_id(), accept)); |
137 } | 143 } |
138 | 144 |
139 void BrowserPluginGuest::SetVisibility(bool embedder_visible, bool visible) { | 145 void BrowserPluginGuest::SetVisibility(bool embedder_visible, bool visible) { |
140 visible_ = visible; | 146 visible_ = visible; |
141 if (embedder_visible && visible) | 147 if (embedder_visible && visible) |
142 web_contents()->WasShown(); | 148 web_contents()->WasShown(); |
143 else | 149 else |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 break; | 428 break; |
423 } | 429 } |
424 } | 430 } |
425 | 431 |
426 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { | 432 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { |
427 DCHECK(embedder_render_process_host()); | 433 DCHECK(embedder_render_process_host()); |
428 embedder_render_process_host()->Send(msg); | 434 embedder_render_process_host()->Send(msg); |
429 } | 435 } |
430 | 436 |
431 } // namespace content | 437 } // namespace content |
OLD | NEW |