| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "ppapi/cpp/instance.h" | 5 #include "ppapi/cpp/instance.h" |
| 6 | 6 |
| 7 #include "ppapi/c/dev/ppp_printing_dev.h" | 7 #include "ppapi/c/dev/ppp_printing_dev.h" |
| 8 #include "ppapi/c/ppb_instance.h" | 8 #include "ppapi/c/ppb_instance.h" |
| 9 #include "ppapi/cpp/common.h" | 9 #include "ppapi/cpp/common.h" |
| 10 #include "ppapi/cpp/dev/surface_3d_dev.h" | 10 #include "ppapi/cpp/dev/surface_3d_dev.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 | 55 |
| 56 bool Instance::HandleDocumentLoad(const URLLoader& /*url_loader*/) { | 56 bool Instance::HandleDocumentLoad(const URLLoader& /*url_loader*/) { |
| 57 return false; | 57 return false; |
| 58 } | 58 } |
| 59 | 59 |
| 60 bool Instance::HandleInputEvent(const PP_InputEvent& /*event*/) { | 60 bool Instance::HandleInputEvent(const PP_InputEvent& /*event*/) { |
| 61 return false; | 61 return false; |
| 62 } | 62 } |
| 63 | 63 |
| 64 void Instance::HandleMessage(const Var& /*message_data*/) { |
| 65 return; |
| 66 } |
| 67 |
| 64 Var Instance::GetInstanceObject() { | 68 Var Instance::GetInstanceObject() { |
| 65 return Var(); | 69 return Var(); |
| 66 } | 70 } |
| 67 | 71 |
| 68 Var Instance::GetSelectedText(bool /* html */) { | 72 Var Instance::GetSelectedText(bool /* html */) { |
| 69 return Var(); | 73 return Var(); |
| 70 } | 74 } |
| 71 | 75 |
| 72 Var Instance::GetWindowObject() { | 76 Var Instance::GetWindowObject() { |
| 73 if (!has_interface<PPB_Instance>()) | 77 if (!has_interface<PPB_Instance>()) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 Var Instance::ExecuteScript(const Var& script, Var* exception) { | 112 Var Instance::ExecuteScript(const Var& script, Var* exception) { |
| 109 if (!has_interface<PPB_Instance>()) | 113 if (!has_interface<PPB_Instance>()) |
| 110 return Var(); | 114 return Var(); |
| 111 return Var(Var::PassRef(), | 115 return Var(Var::PassRef(), |
| 112 get_interface<PPB_Instance>()->ExecuteScript( | 116 get_interface<PPB_Instance>()->ExecuteScript( |
| 113 pp_instance(), | 117 pp_instance(), |
| 114 script.pp_var(), | 118 script.pp_var(), |
| 115 Var::OutException(exception).get())); | 119 Var::OutException(exception).get())); |
| 116 } | 120 } |
| 117 | 121 |
| 122 void Instance::PostMessage(const Var& message) { |
| 123 if (!has_interface<PPB_Instance>()) |
| 124 return; |
| 125 get_interface<PPB_Instance>()->PostMessage(pp_instance(), message.pp_var()); |
| 126 } |
| 127 |
| 118 void Instance::AddPerInstanceObject(const std::string& interface_name, | 128 void Instance::AddPerInstanceObject(const std::string& interface_name, |
| 119 void* object) { | 129 void* object) { |
| 120 // Ensure we're not trying to register more than one object per interface | 130 // Ensure we're not trying to register more than one object per interface |
| 121 // type. Otherwise, we'll get confused in GetPerInstanceObject. | 131 // type. Otherwise, we'll get confused in GetPerInstanceObject. |
| 122 PP_DCHECK(interface_name_to_objects_.find(interface_name) == | 132 PP_DCHECK(interface_name_to_objects_.find(interface_name) == |
| 123 interface_name_to_objects_.end()); | 133 interface_name_to_objects_.end()); |
| 124 interface_name_to_objects_[interface_name] = object; | 134 interface_name_to_objects_[interface_name] = object; |
| 125 } | 135 } |
| 126 | 136 |
| 127 void Instance::RemovePerInstanceObject(const std::string& interface_name, | 137 void Instance::RemovePerInstanceObject(const std::string& interface_name, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 149 if (!that) | 159 if (!that) |
| 150 return NULL; | 160 return NULL; |
| 151 InterfaceNameToObjectMap::iterator found = | 161 InterfaceNameToObjectMap::iterator found = |
| 152 that->interface_name_to_objects_.find(interface_name); | 162 that->interface_name_to_objects_.find(interface_name); |
| 153 if (found == that->interface_name_to_objects_.end()) | 163 if (found == that->interface_name_to_objects_.end()) |
| 154 return NULL; | 164 return NULL; |
| 155 return found->second; | 165 return found->second; |
| 156 } | 166 } |
| 157 | 167 |
| 158 } // namespace pp | 168 } // namespace pp |
| OLD | NEW |