OLD | NEW |
(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/dev/resize_client_dev.h" |
| 6 |
| 7 #include "ppapi/c/dev/ppp_resize_dev.h" |
| 8 #include "ppapi/cpp/instance.h" |
| 9 #include "ppapi/cpp/module.h" |
| 10 #include "ppapi/cpp/module_impl.h" |
| 11 |
| 12 namespace pp { |
| 13 |
| 14 namespace { |
| 15 |
| 16 // PPP_Resize_Dev -------------------------------------------------------------- |
| 17 |
| 18 const char kPPPResizeInterface[] = PPP_RESIZE_DEV_INTERFACE; |
| 19 |
| 20 void WillStartLiveResize(PP_Instance instance) { |
| 21 void* object = |
| 22 pp::Instance::GetPerInstanceObject(instance, kPPPResizeInterface); |
| 23 if (!object) |
| 24 return; |
| 25 return static_cast<ResizeClient_Dev*>(object)->WillStartLiveResize(); |
| 26 } |
| 27 |
| 28 void WillEndLiveResize(PP_Instance instance) { |
| 29 void* object = |
| 30 pp::Instance::GetPerInstanceObject(instance, kPPPResizeInterface); |
| 31 if (!object) |
| 32 return; |
| 33 return static_cast<ResizeClient_Dev*>(object)->WillEndLiveResize(); |
| 34 } |
| 35 |
| 36 static PPP_Resize_Dev resize_interface = { |
| 37 &WillStartLiveResize, |
| 38 &WillEndLiveResize |
| 39 }; |
| 40 |
| 41 } // namespace |
| 42 |
| 43 ResizeClient_Dev::ResizeClient_Dev(Instance* instance) |
| 44 : associated_instance_(instance) { |
| 45 pp::Module::Get()->AddPluginInterface(kPPPResizeInterface, &resize_interface); |
| 46 associated_instance_->AddPerInstanceObject(kPPPResizeInterface, this); |
| 47 } |
| 48 |
| 49 ResizeClient_Dev::~ResizeClient_Dev() { |
| 50 associated_instance_->RemovePerInstanceObject(kPPPResizeInterface, this); |
| 51 } |
| 52 |
| 53 } // namespace pp |
OLD | NEW |