| OLD | NEW | 
|    1 // Copyright 2014 The Chromium Authors. All rights reserved. |    1 // Copyright 2014 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/proxy/ppp_find_proxy.h" |    5 #include "ppapi/proxy/ppp_find_proxy.h" | 
|    6  |    6  | 
|    7 #include "ppapi/proxy/host_dispatcher.h" |    7 #include "ppapi/proxy/host_dispatcher.h" | 
|    8 #include "ppapi/proxy/ppapi_messages.h" |    8 #include "ppapi/proxy/ppapi_messages.h" | 
|    9 #include "ppapi/shared_impl/api_id.h" |    9 #include "ppapi/shared_impl/api_id.h" | 
|   10 #include "ppapi/shared_impl/proxy_lock.h" |   10 #include "ppapi/shared_impl/proxy_lock.h" | 
|   11  |   11  | 
|   12 namespace ppapi { |   12 namespace ppapi { | 
|   13 namespace proxy { |   13 namespace proxy { | 
|   14  |   14  | 
|   15 namespace { |   15 namespace { | 
|   16  |   16  | 
|   17 #if !defined(OS_NACL) |   17 #if !defined(OS_NACL) | 
|   18 PP_Bool StartFind(PP_Instance instance, |   18 PP_Bool StartFind(PP_Instance instance, | 
|   19                   const char* text, |   19                   const char* text, | 
|   20                   PP_Bool case_sensitive) { |   20                   PP_Bool case_sensitive) { | 
|   21   DCHECK(case_sensitive == PP_FALSE); |   21   DCHECK(case_sensitive == PP_FALSE); | 
|   22   HostDispatcher::GetForInstance(instance)->Send( |   22   HostDispatcher::GetForInstance(instance)->Send( | 
|   23       new PpapiPluginMsg_PPPFind_StartFind(API_ID_PPP_FIND_DEV, |   23       new PpapiPluginMsg_PPPFind_StartFind(API_ID_PPP_FIND_PRIVATE, | 
|   24                                            instance, |   24                                            instance, | 
|   25                                            text)); |   25                                            text)); | 
|   26   return PP_TRUE; |   26   return PP_TRUE; | 
|   27 } |   27 } | 
|   28  |   28  | 
|   29 void SelectFindResult(PP_Instance instance, |   29 void SelectFindResult(PP_Instance instance, | 
|   30                       PP_Bool forward) { |   30                       PP_Bool forward) { | 
|   31   HostDispatcher::GetForInstance(instance)->Send( |   31   HostDispatcher::GetForInstance(instance)->Send( | 
|   32       new PpapiPluginMsg_PPPFind_SelectFindResult(API_ID_PPP_FIND_DEV, |   32       new PpapiPluginMsg_PPPFind_SelectFindResult(API_ID_PPP_FIND_PRIVATE, | 
|   33                                                   instance, forward)); |   33                                                   instance, forward)); | 
|   34 } |   34 } | 
|   35  |   35  | 
|   36 void StopFind(PP_Instance instance) { |   36 void StopFind(PP_Instance instance) { | 
|   37   HostDispatcher::GetForInstance(instance)->Send( |   37   HostDispatcher::GetForInstance(instance)->Send( | 
|   38       new PpapiPluginMsg_PPPFind_StopFind(API_ID_PPP_FIND_DEV, instance)); |   38       new PpapiPluginMsg_PPPFind_StopFind(API_ID_PPP_FIND_PRIVATE, instance)); | 
|   39 } |   39 } | 
|   40  |   40  | 
|   41 const PPP_Find_Dev ppp_find_interface = { |   41 const PPP_Find_Private ppp_find_interface = { | 
|   42   &StartFind, |   42   &StartFind, | 
|   43   &SelectFindResult, |   43   &SelectFindResult, | 
|   44   &StopFind |   44   &StopFind | 
|   45 }; |   45 }; | 
|   46 #else |   46 #else | 
|   47 // The NaCl plugin doesn't need the host side interface - stub it out. |   47 // The NaCl plugin doesn't need the host side interface - stub it out. | 
|   48 const PPP_Find_Dev ppp_find_interface = {}; |   48 const PPP_Find_Private ppp_find_interface = {}; | 
|   49 #endif |   49 #endif | 
|   50  |   50  | 
|   51 }  // namespace |   51 }  // namespace | 
|   52  |   52  | 
|   53 PPP_Find_Proxy::PPP_Find_Proxy(Dispatcher* dispatcher) |   53 PPP_Find_Proxy::PPP_Find_Proxy(Dispatcher* dispatcher) | 
|   54     : InterfaceProxy(dispatcher), |   54     : InterfaceProxy(dispatcher), | 
|   55       ppp_find_(NULL) { |   55       ppp_find_(NULL) { | 
|   56   if (dispatcher->IsPlugin()) { |   56   if (dispatcher->IsPlugin()) { | 
|   57     ppp_find_ = static_cast<const PPP_Find_Dev*>( |   57     ppp_find_ = static_cast<const PPP_Find_Private*>( | 
|   58         dispatcher->local_get_interface()(PPP_FIND_DEV_INTERFACE)); |   58         dispatcher->local_get_interface()(PPP_FIND_PRIVATE_INTERFACE)); | 
|   59   } |   59   } | 
|   60 } |   60 } | 
|   61  |   61  | 
|   62 PPP_Find_Proxy::~PPP_Find_Proxy() { |   62 PPP_Find_Proxy::~PPP_Find_Proxy() { | 
|   63 } |   63 } | 
|   64  |   64  | 
|   65 // static |   65 // static | 
|   66 const PPP_Find_Dev* PPP_Find_Proxy::GetProxyInterface() { |   66 const PPP_Find_Private* PPP_Find_Proxy::GetProxyInterface() { | 
|   67   return &ppp_find_interface; |   67   return &ppp_find_interface; | 
|   68 } |   68 } | 
|   69  |   69  | 
|   70 bool PPP_Find_Proxy::OnMessageReceived(const IPC::Message& msg) { |   70 bool PPP_Find_Proxy::OnMessageReceived(const IPC::Message& msg) { | 
|   71   if (!dispatcher()->IsPlugin()) |   71   if (!dispatcher()->IsPlugin()) | 
|   72     return false; |   72     return false; | 
|   73  |   73  | 
|   74   bool handled = true; |   74   bool handled = true; | 
|   75   IPC_BEGIN_MESSAGE_MAP(PPP_Find_Proxy, msg) |   75   IPC_BEGIN_MESSAGE_MAP(PPP_Find_Proxy, msg) | 
|   76     IPC_MESSAGE_HANDLER(PpapiPluginMsg_PPPFind_StartFind, OnPluginMsgStartFind) |   76     IPC_MESSAGE_HANDLER(PpapiPluginMsg_PPPFind_StartFind, OnPluginMsgStartFind) | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
|   94     CallWhileUnlocked(ppp_find_->SelectFindResult, instance, forward); |   94     CallWhileUnlocked(ppp_find_->SelectFindResult, instance, forward); | 
|   95 } |   95 } | 
|   96  |   96  | 
|   97 void PPP_Find_Proxy::OnPluginMsgStopFind(PP_Instance instance) { |   97 void PPP_Find_Proxy::OnPluginMsgStopFind(PP_Instance instance) { | 
|   98   if (ppp_find_) |   98   if (ppp_find_) | 
|   99     CallWhileUnlocked(ppp_find_->StopFind, instance); |   99     CallWhileUnlocked(ppp_find_->StopFind, instance); | 
|  100 } |  100 } | 
|  101  |  101  | 
|  102 }  // namespace proxy |  102 }  // namespace proxy | 
|  103 }  // namespace ppapi |  103 }  // namespace ppapi | 
| OLD | NEW |