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

Side by Side Diff: ppapi/proxy/ppb_char_set_proxy.cc

Issue 6286070: Remove all uses of the global Dispatcher Get function. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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
« no previous file with comments | « ppapi/proxy/ppb_char_set_proxy.h ('k') | ppapi/proxy/ppb_context_3d_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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/ppb_char_set_proxy.h" 5 #include "ppapi/proxy/ppb_char_set_proxy.h"
6 6
7 #include "ppapi/c/dev/ppb_char_set_dev.h" 7 #include "ppapi/c/dev/ppb_char_set_dev.h"
8 #include "ppapi/c/ppb_core.h" 8 #include "ppapi/c/ppb_core.h"
9 #include "ppapi/proxy/plugin_dispatcher.h" 9 #include "ppapi/proxy/plugin_dispatcher.h"
10 #include "ppapi/proxy/ppapi_messages.h" 10 #include "ppapi/proxy/ppapi_messages.h"
11 #include "ppapi/proxy/serialized_var.h" 11 #include "ppapi/proxy/serialized_var.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 72 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
73 if (!dispatcher) 73 if (!dispatcher)
74 return PP_MakeUndefined(); 74 return PP_MakeUndefined();
75 75
76 ReceiveSerializedVarReturnValue result; 76 ReceiveSerializedVarReturnValue result;
77 dispatcher->Send(new PpapiHostMsg_PPBCharSet_GetDefaultCharSet( 77 dispatcher->Send(new PpapiHostMsg_PPBCharSet_GetDefaultCharSet(
78 INTERFACE_ID_PPB_CHAR_SET, instance, &result)); 78 INTERFACE_ID_PPB_CHAR_SET, instance, &result));
79 return result.Return(dispatcher); 79 return result.Return(dispatcher);
80 } 80 }
81 81
82 const PPB_CharSet_Dev ppb_charset_interface = { 82 const PPB_CharSet_Dev charset_interface = {
83 &UTF16ToCharSet, 83 &UTF16ToCharSet,
84 &CharSetToUTF16, 84 &CharSetToUTF16,
85 &GetDefaultCharSet 85 &GetDefaultCharSet
86 }; 86 };
87 87
88 InterfaceProxy* CreateCharSetProxy(Dispatcher* dispatcher,
89 const void* target_interface) {
90 return new PPB_CharSet_Proxy(dispatcher, target_interface);
91 }
92
88 } // namespace 93 } // namespace
89 94
90 PPB_CharSet_Proxy::PPB_CharSet_Proxy(Dispatcher* dispatcher, 95 PPB_CharSet_Proxy::PPB_CharSet_Proxy(Dispatcher* dispatcher,
91 const void* target_interface) 96 const void* target_interface)
92 : InterfaceProxy(dispatcher, target_interface), 97 : InterfaceProxy(dispatcher, target_interface),
93 core_interface_(NULL) { 98 core_interface_(NULL) {
94 } 99 }
95 100
96 PPB_CharSet_Proxy::~PPB_CharSet_Proxy() { 101 PPB_CharSet_Proxy::~PPB_CharSet_Proxy() {
97 } 102 }
98 103
99 const void* PPB_CharSet_Proxy::GetSourceInterface() const { 104 // static
100 return &ppb_charset_interface; 105 const InterfaceProxy::Info* PPB_CharSet_Proxy::GetInfo() {
101 } 106 static const Info info = {
102 107 &charset_interface,
103 InterfaceID PPB_CharSet_Proxy::GetInterfaceId() const { 108 PPB_CHAR_SET_DEV_INTERFACE,
104 return INTERFACE_ID_PPB_CHAR_SET; 109 INTERFACE_ID_PPB_CHAR_SET,
110 false,
111 &CreateCharSetProxy,
112 };
113 return &info;
105 } 114 }
106 115
107 bool PPB_CharSet_Proxy::OnMessageReceived(const IPC::Message& msg) { 116 bool PPB_CharSet_Proxy::OnMessageReceived(const IPC::Message& msg) {
108 bool handled = true; 117 bool handled = true;
109 IPC_BEGIN_MESSAGE_MAP(PPB_CharSet_Proxy, msg) 118 IPC_BEGIN_MESSAGE_MAP(PPB_CharSet_Proxy, msg)
110 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_UTF16ToCharSet, 119 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_UTF16ToCharSet,
111 OnMsgUTF16ToCharSet) 120 OnMsgUTF16ToCharSet)
112 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_CharSetToUTF16, 121 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_CharSetToUTF16,
113 OnMsgCharSetToUTF16) 122 OnMsgCharSetToUTF16)
114 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_GetDefaultCharSet, 123 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_GetDefaultCharSet,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 const PPB_Core* PPB_CharSet_Proxy::GetCoreInterface() { 178 const PPB_Core* PPB_CharSet_Proxy::GetCoreInterface() {
170 if (!core_interface_) { 179 if (!core_interface_) {
171 core_interface_ = static_cast<const PPB_Core*>( 180 core_interface_ = static_cast<const PPB_Core*>(
172 dispatcher()->GetLocalInterface(PPB_CORE_INTERFACE)); 181 dispatcher()->GetLocalInterface(PPB_CORE_INTERFACE));
173 } 182 }
174 return core_interface_; 183 return core_interface_;
175 } 184 }
176 185
177 } // namespace proxy 186 } // namespace proxy
178 } // namespace pp 187 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_char_set_proxy.h ('k') | ppapi/proxy/ppb_context_3d_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698