OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "content/renderer/render_view.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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 WebFileChooserCompletion* c) | 337 WebFileChooserCompletion* c) |
338 : params(p), | 338 : params(p), |
339 completion(c) { | 339 completion(c) { |
340 } | 340 } |
341 ViewHostMsg_RunFileChooser_Params params; | 341 ViewHostMsg_RunFileChooser_Params params; |
342 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. | 342 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. |
343 }; | 343 }; |
344 | 344 |
345 RenderView::RenderView(RenderThreadBase* render_thread, | 345 RenderView::RenderView(RenderThreadBase* render_thread, |
346 gfx::NativeViewId parent_hwnd, | 346 gfx::NativeViewId parent_hwnd, |
| 347 gfx::PluginWindowHandle compositing_surface, |
347 int32 opener_id, | 348 int32 opener_id, |
348 const RendererPreferences& renderer_prefs, | 349 const RendererPreferences& renderer_prefs, |
349 const WebPreferences& webkit_prefs, | 350 const WebPreferences& webkit_prefs, |
350 SharedRenderViewCounter* counter, | 351 SharedRenderViewCounter* counter, |
351 int32 routing_id, | 352 int32 routing_id, |
352 int64 session_storage_namespace_id, | 353 int64 session_storage_namespace_id, |
353 const string16& frame_name) | 354 const string16& frame_name) |
354 : RenderWidget(render_thread, WebKit::WebPopupTypeNone), | 355 : RenderWidget(render_thread, WebKit::WebPopupTypeNone), |
355 webkit_preferences_(webkit_prefs), | 356 webkit_preferences_(webkit_prefs), |
356 send_content_state_immediately_(false), | 357 send_content_state_immediately_(false), |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 | 407 |
407 render_thread_->AddRoute(routing_id_, this); | 408 render_thread_->AddRoute(routing_id_, this); |
408 // Take a reference on behalf of the RenderThread. This will be balanced | 409 // Take a reference on behalf of the RenderThread. This will be balanced |
409 // when we receive ViewMsg_Close. | 410 // when we receive ViewMsg_Close. |
410 AddRef(); | 411 AddRef(); |
411 | 412 |
412 // If this is a popup, we must wait for the CreatingNew_ACK message before | 413 // If this is a popup, we must wait for the CreatingNew_ACK message before |
413 // completing initialization. Otherwise, we can finish it now. | 414 // completing initialization. Otherwise, we can finish it now. |
414 if (opener_id == MSG_ROUTING_NONE) { | 415 if (opener_id == MSG_ROUTING_NONE) { |
415 did_show_ = true; | 416 did_show_ = true; |
416 CompleteInit(parent_hwnd); | 417 CompleteInit(parent_hwnd, compositing_surface); |
417 } | 418 } |
418 | 419 |
419 host_window_ = parent_hwnd; | 420 host_window_ = parent_hwnd; |
420 | 421 |
421 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 422 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
422 if (command_line.HasSwitch(switches::kEnableAccessibility)) | 423 if (command_line.HasSwitch(switches::kEnableAccessibility)) |
423 WebAccessibilityCache::enableAccessibility(); | 424 WebAccessibilityCache::enableAccessibility(); |
424 | 425 |
425 audio_message_filter_ = new AudioMessageFilter(routing_id_); | 426 audio_message_filter_ = new AudioMessageFilter(routing_id_); |
426 render_thread_->AddFilter(audio_message_filter_); | 427 render_thread_->AddFilter(audio_message_filter_); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 RenderView* RenderView::FromWebView(WebView* webview) { | 481 RenderView* RenderView::FromWebView(WebView* webview) { |
481 ViewMap* views = g_view_map.Pointer(); | 482 ViewMap* views = g_view_map.Pointer(); |
482 ViewMap::iterator it = views->find(webview); | 483 ViewMap::iterator it = views->find(webview); |
483 return it == views->end() ? NULL : it->second; | 484 return it == views->end() ? NULL : it->second; |
484 } | 485 } |
485 | 486 |
486 /*static*/ | 487 /*static*/ |
487 RenderView* RenderView::Create( | 488 RenderView* RenderView::Create( |
488 RenderThreadBase* render_thread, | 489 RenderThreadBase* render_thread, |
489 gfx::NativeViewId parent_hwnd, | 490 gfx::NativeViewId parent_hwnd, |
| 491 gfx::PluginWindowHandle compositing_surface, |
490 int32 opener_id, | 492 int32 opener_id, |
491 const RendererPreferences& renderer_prefs, | 493 const RendererPreferences& renderer_prefs, |
492 const WebPreferences& webkit_prefs, | 494 const WebPreferences& webkit_prefs, |
493 SharedRenderViewCounter* counter, | 495 SharedRenderViewCounter* counter, |
494 int32 routing_id, | 496 int32 routing_id, |
495 int64 session_storage_namespace_id, | 497 int64 session_storage_namespace_id, |
496 const string16& frame_name) { | 498 const string16& frame_name) { |
497 DCHECK(routing_id != MSG_ROUTING_NONE); | 499 DCHECK(routing_id != MSG_ROUTING_NONE); |
498 return new RenderView( | 500 return new RenderView( |
499 render_thread, | 501 render_thread, |
500 parent_hwnd, | 502 parent_hwnd, |
| 503 compositing_surface, |
501 opener_id, | 504 opener_id, |
502 renderer_prefs, | 505 renderer_prefs, |
503 webkit_prefs, | 506 webkit_prefs, |
504 counter, | 507 counter, |
505 routing_id, | 508 routing_id, |
506 session_storage_namespace_id, | 509 session_storage_namespace_id, |
507 frame_name); // adds reference | 510 frame_name); // adds reference |
508 } | 511 } |
509 | 512 |
510 // static | 513 // static |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 | 1270 |
1268 render_thread_->Send( | 1271 render_thread_->Send( |
1269 new ViewHostMsg_CreateWindow(params, | 1272 new ViewHostMsg_CreateWindow(params, |
1270 &routing_id, | 1273 &routing_id, |
1271 &cloned_session_storage_namespace_id)); | 1274 &cloned_session_storage_namespace_id)); |
1272 if (routing_id == MSG_ROUTING_NONE) | 1275 if (routing_id == MSG_ROUTING_NONE) |
1273 return NULL; | 1276 return NULL; |
1274 | 1277 |
1275 RenderView* view = RenderView::Create(render_thread_, | 1278 RenderView* view = RenderView::Create(render_thread_, |
1276 0, | 1279 0, |
| 1280 gfx::kNullPluginWindow, |
1277 routing_id_, | 1281 routing_id_, |
1278 renderer_preferences_, | 1282 renderer_preferences_, |
1279 webkit_preferences_, | 1283 webkit_preferences_, |
1280 shared_popup_counter_, | 1284 shared_popup_counter_, |
1281 routing_id, | 1285 routing_id, |
1282 cloned_session_storage_namespace_id, | 1286 cloned_session_storage_namespace_id, |
1283 frame_name); | 1287 frame_name); |
1284 view->opened_by_user_gesture_ = params.user_gesture; | 1288 view->opened_by_user_gesture_ = params.user_gesture; |
1285 | 1289 |
1286 // Record whether the creator frame is trying to suppress the opener field. | 1290 // Record whether the creator frame is trying to suppress the opener field. |
(...skipping 2958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4245 const webkit_glue::CustomContextMenuContext& custom_context) { | 4249 const webkit_glue::CustomContextMenuContext& custom_context) { |
4246 if (custom_context.is_pepper_menu) | 4250 if (custom_context.is_pepper_menu) |
4247 pepper_delegate_.OnContextMenuClosed(custom_context); | 4251 pepper_delegate_.OnContextMenuClosed(custom_context); |
4248 else | 4252 else |
4249 context_menu_node_.reset(); | 4253 context_menu_node_.reset(); |
4250 } | 4254 } |
4251 | 4255 |
4252 void RenderView::OnNetworkStateChanged(bool online) { | 4256 void RenderView::OnNetworkStateChanged(bool online) { |
4253 WebNetworkStateNotifier::setOnLine(online); | 4257 WebNetworkStateNotifier::setOnLine(online); |
4254 } | 4258 } |
OLD | NEW |