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

Side by Side Diff: content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc

Issue 11359097: Refactored the PPB_Flash_File_ModuleLocal/FileRef to the new ppapi resource model (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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) 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/pepper/content_browser_pepper_host_facto ry.h" 5 #include "content/browser/renderer_host/pepper/content_browser_pepper_host_facto ry.h"
6 6
7 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" 7 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h"
8 #include "content/browser/renderer_host/pepper/pepper_flash_file_host.h"
8 #include "content/browser/renderer_host/pepper/pepper_gamepad_host.h" 9 #include "content/browser/renderer_host/pepper/pepper_gamepad_host.h"
9 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" 10 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h"
10 #include "content/browser/renderer_host/pepper/pepper_printing_host.h" 11 #include "content/browser/renderer_host/pepper/pepper_printing_host.h"
11 #include "ppapi/host/resource_host.h" 12 #include "ppapi/host/resource_host.h"
12 #include "ppapi/proxy/ppapi_messages.h" 13 #include "ppapi/proxy/ppapi_messages.h"
14 #include "ppapi/shared_impl/ppapi_permissions.h"
13 15
14 using ppapi::host::ResourceHost; 16 using ppapi::host::ResourceHost;
15 17
16 namespace content { 18 namespace content {
17 19
18 ContentBrowserPepperHostFactory::ContentBrowserPepperHostFactory( 20 ContentBrowserPepperHostFactory::ContentBrowserPepperHostFactory(
19 BrowserPpapiHostImpl* host) 21 BrowserPpapiHostImpl* host)
20 : host_(host) { 22 : host_(host) {
21 } 23 }
22 24
(...skipping 12 matching lines...) Expand all
35 return scoped_ptr<ResourceHost>(); 37 return scoped_ptr<ResourceHost>();
36 38
37 // Public interfaces. 39 // Public interfaces.
38 switch (message.type()) { 40 switch (message.type()) {
39 case PpapiHostMsg_Gamepad_Create::ID: 41 case PpapiHostMsg_Gamepad_Create::ID:
40 return scoped_ptr<ResourceHost>(new PepperGamepadHost( 42 return scoped_ptr<ResourceHost>(new PepperGamepadHost(
41 host_, instance, params.pp_resource())); 43 host_, instance, params.pp_resource()));
42 } 44 }
43 45
44 // Dev interfaces. 46 // Dev interfaces.
45 if (host_->GetPpapiHost()->permissions().HasPermission( 47 if (host_->GetPpapiHost()->permissions().HasPermission(
yzshen1 2012/11/21 00:38:59 Use GetPermissions(), please.
raymes 2012/11/21 22:44:53 Done.
46 ppapi::PERMISSION_DEV)) { 48 ppapi::PERMISSION_DEV)) {
47 switch (message.type()) { 49 switch (message.type()) {
48 case PpapiHostMsg_Printing_Create::ID: { 50 case PpapiHostMsg_Printing_Create::ID: {
49 scoped_ptr<PepperPrintSettingsManager> manager( 51 scoped_ptr<PepperPrintSettingsManager> manager(
50 new PepperPrintSettingsManagerImpl()); 52 new PepperPrintSettingsManagerImpl());
51 return scoped_ptr<ResourceHost>(new PepperPrintingHost( 53 return scoped_ptr<ResourceHost>(new PepperPrintingHost(
52 host_->GetPpapiHost(), instance, 54 host_->GetPpapiHost(), instance,
53 params.pp_resource(), manager.Pass())); 55 params.pp_resource(), manager.Pass()));
54 } 56 }
55 } 57 }
56 } 58 }
59
60 // Resources for Flash interfaces.
61 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) {
62 switch (message.type()) {
63 case PpapiHostMsg_FlashFile_Create::ID:
64 return scoped_ptr<ResourceHost>(new PepperFlashFileHost(
65 host_, instance, params.pp_resource()));
66 }
67 }
68
57 return scoped_ptr<ResourceHost>(); 69 return scoped_ptr<ResourceHost>();
58 } 70 }
59 71
72 const ppapi::PpapiPermissions&
73 ContentBrowserPepperHostFactory::GetPermissions() const {
74 return host_->GetPpapiHost()->permissions();
75 }
76
60 } // namespace content 77 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698