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

Side by Side Diff: content/renderer/pepper/pepper_instance_state_accessor_impl.cc

Issue 10815073: Refactoring of new IPC-only pepper implementation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/renderer/pepper/pepper_instance_state_accessor_impl.h"
6
7 #include "ppapi/shared_impl/ppapi_permissions.h"
8 #include "webkit/plugins/ppapi/host_globals.h"
9 #include "webkit/plugins/ppapi/plugin_module.h"
10 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
11
12 using webkit::ppapi::HostGlobals;
13 using webkit::ppapi::PluginInstance;
14
15 namespace content {
16
17 PepperInstanceStateAccessorImpl::PepperInstanceStateAccessorImpl(
18 webkit::ppapi::PluginModule* module)
19 : module_(module) {
20 }
21
22 PepperInstanceStateAccessorImpl::~PepperInstanceStateAccessorImpl() {
23 }
24
25 bool PepperInstanceStateAccessorImpl::IsValidInstance(PP_Instance instance) {
26 return !!GetAndValidateInstance(instance);
27 }
28
29 bool PepperInstanceStateAccessorImpl::HasUserGesture(PP_Instance pp_instance) {
30 PluginInstance* instance = GetAndValidateInstance(pp_instance);
31 if (!instance)
32 return false;
33
34 if (instance->module()->permissions().HasPermission(
35 ppapi::PERMISSION_BYPASS_USER_GESTURE))
36 return true;
37 return instance->IsProcessingUserGesture();
38 }
39
40 PluginInstance* PepperInstanceStateAccessorImpl::GetAndValidateInstance(
41 PP_Instance pp_instance) {
42 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance);
43 if (!instance)
44 return NULL;
45 if (instance->module() != module_)
46 return NULL;
47 return instance;
48 }
49
50 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_instance_state_accessor_impl.h ('k') | content/renderer/pepper/pepper_plugin_delegate_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698