Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: content/renderer/pepper_plugin_delegate_impl.cc

Issue 7053022: Use the WebKit default fonts when specifying generic font families. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/pepper_plugin_delegate_impl.h" 5 #include "content/renderer/pepper_plugin_delegate_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 27 matching lines...) Expand all
38 #include "content/renderer/render_widget_fullscreen_pepper.h" 38 #include "content/renderer/render_widget_fullscreen_pepper.h"
39 #include "content/renderer/webgraphicscontext3d_command_buffer_impl.h" 39 #include "content/renderer/webgraphicscontext3d_command_buffer_impl.h"
40 #include "content/renderer/webplugin_delegate_proxy.h" 40 #include "content/renderer/webplugin_delegate_proxy.h"
41 #include "ipc/ipc_channel_handle.h" 41 #include "ipc/ipc_channel_handle.h"
42 #include "ppapi/c/dev/pp_video_dev.h" 42 #include "ppapi/c/dev/pp_video_dev.h"
43 #include "ppapi/c/pp_errors.h" 43 #include "ppapi/c/pp_errors.h"
44 #include "ppapi/c/private/ppb_flash.h" 44 #include "ppapi/c/private/ppb_flash.h"
45 #include "ppapi/c/private/ppb_flash_net_connector.h" 45 #include "ppapi/c/private/ppb_flash_net_connector.h"
46 #include "ppapi/proxy/host_dispatcher.h" 46 #include "ppapi/proxy/host_dispatcher.h"
47 #include "ppapi/proxy/ppapi_messages.h" 47 #include "ppapi/proxy/ppapi_messages.h"
48 #include "ppapi/shared_impl/ppapi_preferences.h"
48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet ion.h" 49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet ion.h"
49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams. h" 50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams. h"
50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" 51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" 52 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
52 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
53 #include "ui/gfx/size.h" 54 #include "ui/gfx/size.h"
54 #include "ui/gfx/surface/transport_dib.h" 55 #include "ui/gfx/surface/transport_dib.h"
55 #include "webkit/fileapi/file_system_callback_dispatcher.h" 56 #include "webkit/fileapi/file_system_callback_dispatcher.h"
56 #include "webkit/glue/context_menu.h" 57 #include "webkit/glue/context_menu.h"
57 #include "webkit/plugins/npapi/webplugin.h" 58 #include "webkit/plugins/npapi/webplugin.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 handle, socket_handle, length)); 322 handle, socket_handle, length));
322 } 323 }
323 } 324 }
324 325
325 class DispatcherWrapper 326 class DispatcherWrapper
326 : public webkit::ppapi::PluginDelegate::OutOfProcessProxy { 327 : public webkit::ppapi::PluginDelegate::OutOfProcessProxy {
327 public: 328 public:
328 DispatcherWrapper() {} 329 DispatcherWrapper() {}
329 virtual ~DispatcherWrapper() {} 330 virtual ~DispatcherWrapper() {}
330 331
331 bool Init(base::ProcessHandle plugin_process_handle, 332 bool Init(RenderView* render_view,
333 base::ProcessHandle plugin_process_handle,
332 const IPC::ChannelHandle& channel_handle, 334 const IPC::ChannelHandle& channel_handle,
333 PP_Module pp_module, 335 PP_Module pp_module,
334 pp::proxy::Dispatcher::GetInterfaceFunc local_get_interface); 336 pp::proxy::Dispatcher::GetInterfaceFunc local_get_interface);
335 337
336 // OutOfProcessProxy implementation. 338 // OutOfProcessProxy implementation.
337 virtual const void* GetProxiedInterface(const char* name) { 339 virtual const void* GetProxiedInterface(const char* name) {
338 return dispatcher_->GetProxiedInterface(name); 340 return dispatcher_->GetProxiedInterface(name);
339 } 341 }
340 virtual void AddInstance(PP_Instance instance) { 342 virtual void AddInstance(PP_Instance instance) {
341 pp::proxy::HostDispatcher::SetForInstance(instance, dispatcher_.get()); 343 pp::proxy::HostDispatcher::SetForInstance(instance, dispatcher_.get());
342 } 344 }
343 virtual void RemoveInstance(PP_Instance instance) { 345 virtual void RemoveInstance(PP_Instance instance) {
344 pp::proxy::HostDispatcher::RemoveForInstance(instance); 346 pp::proxy::HostDispatcher::RemoveForInstance(instance);
345 } 347 }
346 348
347 private: 349 private:
348 scoped_ptr<pp::proxy::HostDispatcher> dispatcher_; 350 scoped_ptr<pp::proxy::HostDispatcher> dispatcher_;
349 }; 351 };
350 352
351 } // namespace 353 } // namespace
352 354
353 bool DispatcherWrapper::Init( 355 bool DispatcherWrapper::Init(
356 RenderView* render_view,
354 base::ProcessHandle plugin_process_handle, 357 base::ProcessHandle plugin_process_handle,
355 const IPC::ChannelHandle& channel_handle, 358 const IPC::ChannelHandle& channel_handle,
356 PP_Module pp_module, 359 PP_Module pp_module,
357 pp::proxy::Dispatcher::GetInterfaceFunc local_get_interface) { 360 pp::proxy::Dispatcher::GetInterfaceFunc local_get_interface) {
358 dispatcher_.reset(new pp::proxy::HostDispatcher( 361 dispatcher_.reset(new pp::proxy::HostDispatcher(
359 plugin_process_handle, pp_module, local_get_interface)); 362 plugin_process_handle, pp_module, local_get_interface));
360 363
361 if (!dispatcher_->InitHostWithChannel(PepperPluginRegistry::GetInstance(), 364 if (!dispatcher_->InitHostWithChannel(
362 channel_handle, true)) { 365 PepperPluginRegistry::GetInstance(),
366 channel_handle, true,
367 ppapi::Preferences(render_view->webkit_preferences()))) {
363 dispatcher_.reset(); 368 dispatcher_.reset();
364 return false; 369 return false;
365 } 370 }
366 dispatcher_->channel()->SetRestrictDispatchToSameChannel(true); 371 dispatcher_->channel()->SetRestrictDispatchToSameChannel(true);
367 return true; 372 return true;
368 } 373 }
369 374
370 BrokerDispatcherWrapper::BrokerDispatcherWrapper() { 375 BrokerDispatcherWrapper::BrokerDispatcherWrapper() {
371 } 376 }
372 377
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 } 606 }
602 607
603 // Create a new HostDispatcher for the proxying, and hook it to a new 608 // Create a new HostDispatcher for the proxying, and hook it to a new
604 // PluginModule. Note that AddLiveModule must be called before any early 609 // PluginModule. Note that AddLiveModule must be called before any early
605 // returns since the module's destructor will remove itself. 610 // returns since the module's destructor will remove itself.
606 module = new webkit::ppapi::PluginModule(info->name, path, 611 module = new webkit::ppapi::PluginModule(info->name, path,
607 PepperPluginRegistry::GetInstance()); 612 PepperPluginRegistry::GetInstance());
608 PepperPluginRegistry::GetInstance()->AddLiveModule(path, module); 613 PepperPluginRegistry::GetInstance()->AddLiveModule(path, module);
609 scoped_ptr<DispatcherWrapper> dispatcher(new DispatcherWrapper); 614 scoped_ptr<DispatcherWrapper> dispatcher(new DispatcherWrapper);
610 if (!dispatcher->Init( 615 if (!dispatcher->Init(
616 render_view_,
611 plugin_process_handle, channel_handle, 617 plugin_process_handle, channel_handle,
612 module->pp_module(), 618 module->pp_module(),
613 webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc())) 619 webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc()))
614 return scoped_refptr<webkit::ppapi::PluginModule>(); 620 return scoped_refptr<webkit::ppapi::PluginModule>();
615 module->InitAsProxied(dispatcher.release()); 621 module->InitAsProxied(dispatcher.release());
616 return module; 622 return module;
617 } 623 }
618 624
619 scoped_refptr<PpapiBrokerImpl> PepperPluginDelegateImpl::CreatePpapiBroker( 625 scoped_refptr<PpapiBrokerImpl> PepperPluginDelegateImpl::CreatePpapiBroker(
620 webkit::ppapi::PluginModule* plugin_module) { 626 webkit::ppapi::PluginModule* plugin_module) {
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 DLOG(WARNING) << "Browser allocation request message failed"; 1318 DLOG(WARNING) << "Browser allocation request message failed";
1313 return NULL; 1319 return NULL;
1314 } 1320 }
1315 if (!base::SharedMemory::IsHandleValid(handle)) { 1321 if (!base::SharedMemory::IsHandleValid(handle)) {
1316 DLOG(WARNING) << "Browser failed to allocate shared memory"; 1322 DLOG(WARNING) << "Browser failed to allocate shared memory";
1317 return NULL; 1323 return NULL;
1318 } 1324 }
1319 shm.reset(new base::SharedMemory(handle, false)); 1325 shm.reset(new base::SharedMemory(handle, false));
1320 return shm.release(); 1326 return shm.release();
1321 } 1327 }
1328
1329 ::ppapi::Preferences PepperPluginDelegateImpl::GetPreferences() {
1330 return ::ppapi::Preferences(render_view_->webkit_preferences());
yzshen1 2011/05/25 23:40:11 I think here the '::' prefix is not mandatory, rig
1331 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698