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

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

Issue 7844018: Revert 100748 - This patch tries to remove most of the manual registration for Pepper interfaces,... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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_flash_clipboard_proxy.h ('k') | ppapi/proxy/ppb_flash_file_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) 2011 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_flash_clipboard_proxy.h" 5 #include "ppapi/proxy/ppb_flash_clipboard_proxy.h"
6 6
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/private/ppb_flash_clipboard.h" 8 #include "ppapi/c/private/ppb_flash_clipboard.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"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // Assume success, since it allows us to avoid a sync IPC. 81 // Assume success, since it allows us to avoid a sync IPC.
82 return PP_OK; 82 return PP_OK;
83 } 83 }
84 84
85 const PPB_Flash_Clipboard flash_clipboard_interface = { 85 const PPB_Flash_Clipboard flash_clipboard_interface = {
86 &IsFormatAvailable, 86 &IsFormatAvailable,
87 &ReadPlainText, 87 &ReadPlainText,
88 &WritePlainText 88 &WritePlainText
89 }; 89 };
90 90
91 InterfaceProxy* CreateFlashClipboardProxy(Dispatcher* dispatcher) { 91 InterfaceProxy* CreateFlashClipboardProxy(Dispatcher* dispatcher,
92 return new PPB_Flash_Clipboard_Proxy(dispatcher); 92 const void* target_interface) {
93 return new PPB_Flash_Clipboard_Proxy(dispatcher, target_interface);
93 } 94 }
94 95
95 } // namespace 96 } // namespace
96 97
97 PPB_Flash_Clipboard_Proxy::PPB_Flash_Clipboard_Proxy(Dispatcher* dispatcher) 98 PPB_Flash_Clipboard_Proxy::PPB_Flash_Clipboard_Proxy(
98 : InterfaceProxy(dispatcher), 99 Dispatcher* dispatcher, const void* target_interface)
99 ppb_flash_clipboard_impl_(NULL) { 100 : InterfaceProxy(dispatcher, target_interface) {
100 if (!dispatcher->IsPlugin()) {
101 ppb_flash_clipboard_impl_ = static_cast<const PPB_Flash_Clipboard*>(
102 dispatcher->local_get_interface()(PPB_FLASH_CLIPBOARD_INTERFACE));
103 }
104 } 101 }
105 102
106 PPB_Flash_Clipboard_Proxy::~PPB_Flash_Clipboard_Proxy() { 103 PPB_Flash_Clipboard_Proxy::~PPB_Flash_Clipboard_Proxy() {
107 } 104 }
108 105
109 // static 106 // static
110 const InterfaceProxy::Info* PPB_Flash_Clipboard_Proxy::GetInfo() { 107 const InterfaceProxy::Info* PPB_Flash_Clipboard_Proxy::GetInfo() {
111 static const Info info = { 108 static const Info info = {
112 &flash_clipboard_interface, 109 &flash_clipboard_interface,
113 PPB_FLASH_CLIPBOARD_INTERFACE, 110 PPB_FLASH_CLIPBOARD_INTERFACE,
(...skipping 16 matching lines...) Expand all
130 IPC_MESSAGE_UNHANDLED(handled = false) 127 IPC_MESSAGE_UNHANDLED(handled = false)
131 IPC_END_MESSAGE_MAP() 128 IPC_END_MESSAGE_MAP()
132 return handled; 129 return handled;
133 } 130 }
134 131
135 void PPB_Flash_Clipboard_Proxy::OnMsgIsFormatAvailable( 132 void PPB_Flash_Clipboard_Proxy::OnMsgIsFormatAvailable(
136 PP_Instance instance_id, 133 PP_Instance instance_id,
137 int clipboard_type, 134 int clipboard_type,
138 int format, 135 int format,
139 bool* result) { 136 bool* result) {
140 *result = PP_ToBool(ppb_flash_clipboard_impl_->IsFormatAvailable( 137 *result = PP_ToBool(ppb_flash_clipboard_target()->IsFormatAvailable(
141 instance_id, 138 instance_id,
142 static_cast<PP_Flash_Clipboard_Type>(clipboard_type), 139 static_cast<PP_Flash_Clipboard_Type>(clipboard_type),
143 static_cast<PP_Flash_Clipboard_Format>(format))); 140 static_cast<PP_Flash_Clipboard_Format>(format)));
144 } 141 }
145 142
146 void PPB_Flash_Clipboard_Proxy::OnMsgReadPlainText( 143 void PPB_Flash_Clipboard_Proxy::OnMsgReadPlainText(
147 PP_Instance instance_id, 144 PP_Instance instance_id,
148 int clipboard_type, 145 int clipboard_type,
149 SerializedVarReturnValue result) { 146 SerializedVarReturnValue result) {
150 result.Return(dispatcher(), 147 result.Return(dispatcher(),
151 ppb_flash_clipboard_impl_->ReadPlainText( 148 ppb_flash_clipboard_target()->ReadPlainText(
152 instance_id, 149 instance_id,
153 static_cast<PP_Flash_Clipboard_Type>(clipboard_type))); 150 static_cast<PP_Flash_Clipboard_Type>(clipboard_type)));
154 } 151 }
155 152
156 void PPB_Flash_Clipboard_Proxy::OnMsgWritePlainText( 153 void PPB_Flash_Clipboard_Proxy::OnMsgWritePlainText(
157 PP_Instance instance_id, 154 PP_Instance instance_id,
158 int clipboard_type, 155 int clipboard_type,
159 SerializedVarReceiveInput text) { 156 SerializedVarReceiveInput text) {
160 int32_t result = ppb_flash_clipboard_impl_->WritePlainText( 157 int32_t result = ppb_flash_clipboard_target()->WritePlainText(
161 instance_id, 158 instance_id,
162 static_cast<PP_Flash_Clipboard_Type>(clipboard_type), 159 static_cast<PP_Flash_Clipboard_Type>(clipboard_type),
163 text.Get(dispatcher())); 160 text.Get(dispatcher()));
164 LOG_IF(WARNING, result != PP_OK) << "Write to clipboard failed unexpectedly."; 161 LOG_IF(WARNING, result != PP_OK) << "Write to clipboard failed unexpectedly.";
165 } 162 }
166 163
167 } // namespace proxy 164 } // namespace proxy
168 } // namespace ppapi 165 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_flash_clipboard_proxy.h ('k') | ppapi/proxy/ppb_flash_file_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698