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/dev/find_dev.h" | 5 #include "ppapi/cpp/dev/find_dev.h" |
6 | 6 |
7 #include "ppapi/c/dev/ppb_find_dev.h" | 7 #include "ppapi/c/dev/ppb_find_dev.h" |
8 #include "ppapi/cpp/instance.h" | 8 #include "ppapi/cpp/instance.h" |
9 #include "ppapi/cpp/module.h" | 9 #include "ppapi/cpp/module.h" |
10 #include "ppapi/cpp/module_impl.h" | 10 #include "ppapi/cpp/module_impl.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 const PPP_Find_Dev ppp_find = { | 45 const PPP_Find_Dev ppp_find = { |
46 &StartFind, | 46 &StartFind, |
47 &SelectFindResult, | 47 &SelectFindResult, |
48 &StopFind | 48 &StopFind |
49 }; | 49 }; |
50 | 50 |
51 } // namespace | 51 } // namespace |
52 | 52 |
53 Find_Dev::Find_Dev(const InstanceHandle& instance) | 53 Find_Dev::Find_Dev(Instance* instance) : associated_instance_(instance) { |
54 : associated_instance_(instance) { | |
55 Module::Get()->AddPluginInterface(kPPPFindInterface, &ppp_find); | 54 Module::Get()->AddPluginInterface(kPPPFindInterface, &ppp_find); |
56 Instance::AddPerInstanceObject(instance, kPPPFindInterface, this); | 55 instance->AddPerInstanceObject(kPPPFindInterface, this); |
57 } | 56 } |
58 | 57 |
59 Find_Dev::~Find_Dev() { | 58 Find_Dev::~Find_Dev() { |
60 Instance::RemovePerInstanceObject(associated_instance_, | 59 Instance::RemovePerInstanceObject(associated_instance_, |
61 kPPPFindInterface, this); | 60 kPPPFindInterface, this); |
62 } | 61 } |
63 | 62 |
64 void Find_Dev::NumberOfFindResultsChanged(int32_t total, bool final_result) { | 63 void Find_Dev::NumberOfFindResultsChanged(int32_t total, bool final_result) { |
65 if (has_interface<PPB_Find_Dev>()) { | 64 if (has_interface<PPB_Find_Dev>()) { |
66 get_interface<PPB_Find_Dev>()->NumberOfFindResultsChanged( | 65 get_interface<PPB_Find_Dev>()->NumberOfFindResultsChanged( |
67 associated_instance_.pp_instance(), total, PP_FromBool(final_result)); | 66 associated_instance_.pp_instance(), total, PP_FromBool(final_result)); |
68 } | 67 } |
69 } | 68 } |
70 | 69 |
71 void Find_Dev::SelectedFindResultChanged(int32_t index) { | 70 void Find_Dev::SelectedFindResultChanged(int32_t index) { |
72 if (has_interface<PPB_Find_Dev>()) { | 71 if (has_interface<PPB_Find_Dev>()) { |
73 get_interface<PPB_Find_Dev>()->SelectedFindResultChanged( | 72 get_interface<PPB_Find_Dev>()->SelectedFindResultChanged( |
74 associated_instance_.pp_instance(), index); | 73 associated_instance_.pp_instance(), index); |
75 } | 74 } |
76 } | 75 } |
77 | 76 |
78 } // namespace pp | 77 } // namespace pp |
OLD | NEW |