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

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: include reordering, minor tweaks 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
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(
brettw 2011/04/18 21:13:26 I'd indent these lines to 4 spaces from the left o
51 pp_instance()));
52 }
53
54 VarPrivate InstancePrivate::GetOwnerElementObject() {
55 if (!has_interface<PPB_Instance_Private>())
56 return VarPrivate();
57 return VarPrivate(Var::PassRef(),
58 get_interface<PPB_Instance_Private>()->GetOwnerElementObject(
59 pp_instance()));
60 }
61
62 VarPrivate InstancePrivate::ExecuteScript(const VarPrivate& script,
63 VarPrivate* exception) {
64 if (!has_interface<PPB_Instance_Private>())
65 return VarPrivate();
66 return VarPrivate(Var::PassRef(),
67 get_interface<PPB_Instance_Private>()->ExecuteScript(
68 pp_instance(),
69 script.pp_var(),
70 VarPrivate::OutException(exception).get()));
71 }
72
73 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698