| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/renderer/render_view.h" | 5 #include "chrome/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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 RenderThreadBase* render_thread, | 587 RenderThreadBase* render_thread, |
| 588 gfx::NativeViewId parent_hwnd, | 588 gfx::NativeViewId parent_hwnd, |
| 589 int32 opener_id, | 589 int32 opener_id, |
| 590 const RendererPreferences& renderer_prefs, | 590 const RendererPreferences& renderer_prefs, |
| 591 const WebPreferences& webkit_prefs, | 591 const WebPreferences& webkit_prefs, |
| 592 SharedRenderViewCounter* counter, | 592 SharedRenderViewCounter* counter, |
| 593 int32 routing_id, | 593 int32 routing_id, |
| 594 int64 session_storage_namespace_id, | 594 int64 session_storage_namespace_id, |
| 595 const string16& frame_name) { | 595 const string16& frame_name) { |
| 596 DCHECK(routing_id != MSG_ROUTING_NONE); | 596 DCHECK(routing_id != MSG_ROUTING_NONE); |
| 597 scoped_refptr<RenderView> view = new RenderView(render_thread, webkit_prefs, | 597 scoped_refptr<RenderView> view(new RenderView(render_thread, webkit_prefs, |
| 598 session_storage_namespace_id); | 598 session_storage_namespace_id)); |
| 599 view->Init(parent_hwnd, | 599 view->Init(parent_hwnd, |
| 600 opener_id, | 600 opener_id, |
| 601 renderer_prefs, | 601 renderer_prefs, |
| 602 counter, | 602 counter, |
| 603 routing_id, | 603 routing_id, |
| 604 frame_name); // adds reference | 604 frame_name); // adds reference |
| 605 return view; | 605 return view; |
| 606 } | 606 } |
| 607 | 607 |
| 608 /*static*/ | 608 /*static*/ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 630 const WebPluginParams& params) { | 630 const WebPluginParams& params) { |
| 631 WebPluginInfo info; | 631 WebPluginInfo info; |
| 632 bool found; | 632 bool found; |
| 633 ContentSetting setting; | 633 ContentSetting setting; |
| 634 std::string mime_type; | 634 std::string mime_type; |
| 635 Send(new ViewHostMsg_GetPluginInfo( | 635 Send(new ViewHostMsg_GetPluginInfo( |
| 636 params.url, frame->top()->url(), params.mimeType.utf8(), &found, | 636 params.url, frame->top()->url(), params.mimeType.utf8(), &found, |
| 637 &info, &setting, &mime_type)); | 637 &info, &setting, &mime_type)); |
| 638 if (!found || !info.enabled) | 638 if (!found || !info.enabled) |
| 639 return NULL; | 639 return NULL; |
| 640 scoped_refptr<pepper::PluginModule> pepper_module = | 640 scoped_refptr<pepper::PluginModule> pepper_module( |
| 641 PepperPluginRegistry::GetInstance()->GetModule(info.path); | 641 PepperPluginRegistry::GetInstance()->GetModule(info.path)); |
| 642 if (pepper_module) | 642 if (pepper_module) |
| 643 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); | 643 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); |
| 644 else | 644 else |
| 645 return CreateNPAPIPlugin(frame, params, info.path, mime_type); | 645 return CreateNPAPIPlugin(frame, params, info.path, mime_type); |
| 646 } | 646 } |
| 647 | 647 |
| 648 void RenderView::RegisterPluginDelegate(WebPluginDelegateProxy* delegate) { | 648 void RenderView::RegisterPluginDelegate(WebPluginDelegateProxy* delegate) { |
| 649 plugin_delegates_.insert(delegate); | 649 plugin_delegates_.insert(delegate); |
| 650 // If the renderer is visible, set initial visibility and focus state. | 650 // If the renderer is visible, set initial visibility and focus state. |
| 651 if (!is_hidden()) { | 651 if (!is_hidden()) { |
| (...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2531 Send(new ViewHostMsg_DisabledOutdatedPlugin(routing_id_, | 2531 Send(new ViewHostMsg_DisabledOutdatedPlugin(routing_id_, |
| 2532 group->GetGroupName(), | 2532 group->GetGroupName(), |
| 2533 GURL(group->GetUpdateURL()))); | 2533 GURL(group->GetUpdateURL()))); |
| 2534 return CreateOutdatedPluginPlaceholder(frame, params, group.get()); | 2534 return CreateOutdatedPluginPlaceholder(frame, params, group.get()); |
| 2535 } | 2535 } |
| 2536 return NULL; | 2536 return NULL; |
| 2537 } | 2537 } |
| 2538 | 2538 |
| 2539 if (info.path.value() == kDefaultPluginLibraryName || | 2539 if (info.path.value() == kDefaultPluginLibraryName || |
| 2540 setting == CONTENT_SETTING_ALLOW) { | 2540 setting == CONTENT_SETTING_ALLOW) { |
| 2541 scoped_refptr<pepper::PluginModule> pepper_module = | 2541 scoped_refptr<pepper::PluginModule> pepper_module( |
| 2542 PepperPluginRegistry::GetInstance()->GetModule(info.path); | 2542 PepperPluginRegistry::GetInstance()->GetModule(info.path)); |
| 2543 if (pepper_module) { | 2543 if (pepper_module) { |
| 2544 return CreatePepperPlugin(frame, | 2544 return CreatePepperPlugin(frame, |
| 2545 params, | 2545 params, |
| 2546 info.path, | 2546 info.path, |
| 2547 pepper_module.get()); | 2547 pepper_module.get()); |
| 2548 } | 2548 } |
| 2549 return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type); | 2549 return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type); |
| 2550 } | 2550 } |
| 2551 std::string resource; | 2551 std::string resource; |
| 2552 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) | 2552 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2651 new webkit_glue::MediaResourceLoaderBridgeFactory( | 2651 new webkit_glue::MediaResourceLoaderBridgeFactory( |
| 2652 GURL(frame->url()), // referrer | 2652 GURL(frame->url()), // referrer |
| 2653 "null", // frame origin | 2653 "null", // frame origin |
| 2654 "null", // main_frame_origin | 2654 "null", // main_frame_origin |
| 2655 base::GetCurrentProcId(), | 2655 base::GetCurrentProcId(), |
| 2656 appcache_host ? appcache_host->host_id() : appcache::kNoHostId, | 2656 appcache_host ? appcache_host->host_id() : appcache::kNoHostId, |
| 2657 routing_id()); | 2657 routing_id()); |
| 2658 | 2658 |
| 2659 scoped_refptr<webkit_glue::WebVideoRenderer> video_renderer; | 2659 scoped_refptr<webkit_glue::WebVideoRenderer> video_renderer; |
| 2660 if (cmd_line->HasSwitch(switches::kEnableVideoLayering)) { | 2660 if (cmd_line->HasSwitch(switches::kEnableVideoLayering)) { |
| 2661 scoped_refptr<IPCVideoRenderer> renderer = | 2661 scoped_refptr<IPCVideoRenderer> renderer( |
| 2662 new IPCVideoRenderer(routing_id_); | 2662 new IPCVideoRenderer(routing_id_)); |
| 2663 collection.push_back(renderer); | 2663 collection.push_back(renderer); |
| 2664 video_renderer = renderer; | 2664 video_renderer = renderer; |
| 2665 } else { | 2665 } else { |
| 2666 bool pts_logging = cmd_line->HasSwitch(switches::kEnableVideoLogging); | 2666 bool pts_logging = cmd_line->HasSwitch(switches::kEnableVideoLogging); |
| 2667 scoped_refptr<webkit_glue::VideoRendererImpl> renderer = | 2667 scoped_refptr<webkit_glue::VideoRendererImpl> renderer( |
| 2668 new webkit_glue::VideoRendererImpl(pts_logging); | 2668 new webkit_glue::VideoRendererImpl(pts_logging)); |
| 2669 collection.push_back(renderer); | 2669 collection.push_back(renderer); |
| 2670 video_renderer = renderer; | 2670 video_renderer = renderer; |
| 2671 } | 2671 } |
| 2672 | 2672 |
| 2673 return new webkit_glue::WebMediaPlayerImpl( | 2673 return new webkit_glue::WebMediaPlayerImpl( |
| 2674 client, collection, bridge_factory_simple, bridge_factory_buffered, | 2674 client, collection, bridge_factory_simple, bridge_factory_buffered, |
| 2675 cmd_line->HasSwitch(switches::kSimpleDataSource),video_renderer); | 2675 cmd_line->HasSwitch(switches::kSimpleDataSource),video_renderer); |
| 2676 } | 2676 } |
| 2677 | 2677 |
| 2678 WebApplicationCacheHost* RenderView::createApplicationCacheHost( | 2678 WebApplicationCacheHost* RenderView::createApplicationCacheHost( |
| (...skipping 3446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6125 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), | 6125 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), |
| 6126 message_id); | 6126 message_id); |
| 6127 } | 6127 } |
| 6128 | 6128 |
| 6129 #if defined(OS_MACOSX) | 6129 #if defined(OS_MACOSX) |
| 6130 void RenderView::OnSelectPopupMenuItem(int selected_index) { | 6130 void RenderView::OnSelectPopupMenuItem(int selected_index) { |
| 6131 external_popup_menu_->DidSelectItem(selected_index); | 6131 external_popup_menu_->DidSelectItem(selected_index); |
| 6132 external_popup_menu_.reset(); | 6132 external_popup_menu_.reset(); |
| 6133 } | 6133 } |
| 6134 #endif | 6134 #endif |
| OLD | NEW |