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

Side by Side Diff: ppapi/cpp/private/instance_private.cc

Issue 6871040: Rename Instance_Trusted to Instance_Private, wire it up in Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix up based on review comments. Created 9 years, 8 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
« no previous file with comments | « ppapi/cpp/private/instance_private.h ('k') | ppapi/cpp/private/var_private.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ppapi/cpp/private/instance_private.h"
6
7 #include "ppapi/c/private/ppb_instance_private.h"
8 #include "ppapi/c/private/ppp_instance_private.h"
9 #include "ppapi/cpp/module_impl.h"
10 #include "ppapi/cpp/private/var_private.h"
11
12 namespace pp {
13
14 namespace {
15
16 template <> const char* interface_name<PPB_Instance_Private>() {
17 return PPB_INSTANCE_PRIVATE_INTERFACE;
18 }
19
20 PP_Var GetInstanceObject(PP_Instance pp_instance) {
21 Module* module_singleton = Module::Get();
22 if (!module_singleton)
23 return Var().Detach();
24 InstancePrivate* instance_private = static_cast<InstancePrivate*>(
25 module_singleton->InstanceForPPInstance(pp_instance));
26 if (!instance_private)
27 return Var().Detach();
28 return instance_private->GetInstanceObject().Detach();
29 }
30
31 const PPP_Instance_Private ppp_instance_private = {
32 &GetInstanceObject
33 };
34
35 } // namespace
36
37 InstancePrivate::InstancePrivate(PP_Instance instance) : Instance(instance) {
38 // If at least 1 InstancePrivate is created, register the PPP_INSTANCE_PRIVATE
39 // interface.
40 Module::Get()->AddPluginInterface(PPP_INSTANCE_PRIVATE_INTERFACE,
41 &ppp_instance_private);
42 }
43
44 InstancePrivate::~InstancePrivate() {}
45
46 VarPrivate InstancePrivate::GetWindowObject() {
47 if (!has_interface<PPB_Instance_Private>())
48 return VarPrivate();
49 return VarPrivate(Var::PassRef(),
50 get_interface<PPB_Instance_Private>()->GetWindowObject(pp_instance()));
51 }
52
53 VarPrivate InstancePrivate::GetOwnerElementObject() {
54 if (!has_interface<PPB_Instance_Private>())
55 return VarPrivate();
56 return VarPrivate(Var::PassRef(),
57 get_interface<PPB_Instance_Private>()->GetOwnerElementObject(
58 pp_instance()));
59 }
60
61 VarPrivate InstancePrivate::ExecuteScript(const VarPrivate& script,
62 VarPrivate* exception) {
63 if (!has_interface<PPB_Instance_Private>())
64 return VarPrivate();
65 return VarPrivate(Var::PassRef(),
66 get_interface<PPB_Instance_Private>()->ExecuteScript(
67 pp_instance(),
68 script.pp_var(),
69 VarPrivate::OutException(exception).get()));
70 }
71
72 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/private/instance_private.h ('k') | ppapi/cpp/private/var_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698