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

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

Issue 11578038: Convert pepper font list to new resource system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged Created 8 years 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_instance_proxy.h ('k') | ppapi/shared_impl/resource.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_instance_proxy.h" 5 #include "ppapi/proxy/ppb_instance_proxy.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/pp_time.h" 10 #include "ppapi/c/pp_time.h"
11 #include "ppapi/c/pp_var.h" 11 #include "ppapi/c/pp_var.h"
12 #include "ppapi/c/ppb_audio_config.h" 12 #include "ppapi/c/ppb_audio_config.h"
13 #include "ppapi/c/ppb_instance.h" 13 #include "ppapi/c/ppb_instance.h"
14 #include "ppapi/c/ppb_messaging.h" 14 #include "ppapi/c/ppb_messaging.h"
15 #include "ppapi/c/ppb_mouse_lock.h" 15 #include "ppapi/c/ppb_mouse_lock.h"
16 #include "ppapi/c/private/pp_content_decryptor.h" 16 #include "ppapi/c/private/pp_content_decryptor.h"
17 #include "ppapi/proxy/broker_resource.h" 17 #include "ppapi/proxy/broker_resource.h"
18 #include "ppapi/proxy/browser_font_singleton_resource.h"
18 #include "ppapi/proxy/content_decryptor_private_serializer.h" 19 #include "ppapi/proxy/content_decryptor_private_serializer.h"
19 #include "ppapi/proxy/enter_proxy.h" 20 #include "ppapi/proxy/enter_proxy.h"
20 #include "ppapi/proxy/flash_clipboard_resource.h" 21 #include "ppapi/proxy/flash_clipboard_resource.h"
21 #include "ppapi/proxy/flash_file_resource.h" 22 #include "ppapi/proxy/flash_file_resource.h"
22 #include "ppapi/proxy/flash_fullscreen_resource.h" 23 #include "ppapi/proxy/flash_fullscreen_resource.h"
23 #include "ppapi/proxy/flash_resource.h" 24 #include "ppapi/proxy/flash_resource.h"
24 #include "ppapi/proxy/gamepad_resource.h" 25 #include "ppapi/proxy/gamepad_resource.h"
25 #include "ppapi/proxy/host_dispatcher.h" 26 #include "ppapi/proxy/host_dispatcher.h"
26 #include "ppapi/proxy/plugin_dispatcher.h" 27 #include "ppapi/proxy/plugin_dispatcher.h"
27 #include "ppapi/proxy/ppapi_messages.h" 28 #include "ppapi/proxy/ppapi_messages.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 int32_t total, 317 int32_t total,
317 PP_Bool final_result) { 318 PP_Bool final_result) {
318 NOTIMPLEMENTED(); // Not proxied yet. 319 NOTIMPLEMENTED(); // Not proxied yet.
319 } 320 }
320 321
321 void PPB_Instance_Proxy::SelectedFindResultChanged(PP_Instance instance, 322 void PPB_Instance_Proxy::SelectedFindResultChanged(PP_Instance instance,
322 int32_t index) { 323 int32_t index) {
323 NOTIMPLEMENTED(); // Not proxied yet. 324 NOTIMPLEMENTED(); // Not proxied yet.
324 } 325 }
325 326
326 PP_Var PPB_Instance_Proxy::GetFontFamilies(PP_Instance instance) {
327 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
328 if (!dispatcher)
329 return PP_MakeUndefined();
330
331 // Assume the font families don't change, so we can cache the result globally.
332 CR_DEFINE_STATIC_LOCAL(std::string, families, ());
333 if (families.empty()) {
334 PluginGlobals::Get()->GetBrowserSender()->Send(
335 new PpapiHostMsg_PPBInstance_GetFontFamilies(&families));
336 }
337
338 return StringVar::StringToPPVar(families);
339 }
340
341 PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance, 327 PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance,
342 PP_Bool fullscreen) { 328 PP_Bool fullscreen) {
343 PP_Bool result = PP_FALSE; 329 PP_Bool result = PP_FALSE;
344 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetFullscreen( 330 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetFullscreen(
345 API_ID_PPB_INSTANCE, instance, fullscreen, &result)); 331 API_ID_PPB_INSTANCE, instance, fullscreen, &result));
346 return result; 332 return result;
347 } 333 }
348 334
349 PP_Bool PPB_Instance_Proxy::GetScreenSize(PP_Instance instance, 335 PP_Bool PPB_Instance_Proxy::GetScreenSize(PP_Instance instance,
350 PP_Size* size) { 336 PP_Size* size) {
(...skipping 21 matching lines...) Expand all
372 scoped_refptr<Resource> new_singleton; 358 scoped_refptr<Resource> new_singleton;
373 Connection connection(PluginGlobals::Get()->GetBrowserSender(), dispatcher()); 359 Connection connection(PluginGlobals::Get()->GetBrowserSender(), dispatcher());
374 360
375 switch (id) { 361 switch (id) {
376 case BROKER_SINGLETON_ID: 362 case BROKER_SINGLETON_ID:
377 new_singleton = new BrokerResource(connection, instance); 363 new_singleton = new BrokerResource(connection, instance);
378 break; 364 break;
379 case GAMEPAD_SINGLETON_ID: 365 case GAMEPAD_SINGLETON_ID:
380 new_singleton = new GamepadResource(connection, instance); 366 new_singleton = new GamepadResource(connection, instance);
381 break; 367 break;
382 // Flash resources aren't needed for NaCl. 368 // Flash/trusted resources aren't needed for NaCl.
383 #if !defined(OS_NACL) && !defined(NACL_WIN64) 369 #if !defined(OS_NACL) && !defined(NACL_WIN64)
370 case BROWSER_FONT_SINGLETON_ID:
371 new_singleton = new BrowserFontSingletonResource(connection, instance);
372 break;
384 case FLASH_CLIPBOARD_SINGLETON_ID: 373 case FLASH_CLIPBOARD_SINGLETON_ID:
385 new_singleton = new FlashClipboardResource(connection, instance); 374 new_singleton = new FlashClipboardResource(connection, instance);
386 break; 375 break;
387 case FLASH_FILE_SINGLETON_ID: 376 case FLASH_FILE_SINGLETON_ID:
388 new_singleton = new FlashFileResource(connection, instance); 377 new_singleton = new FlashFileResource(connection, instance);
389 break; 378 break;
390 case FLASH_FULLSCREEN_SINGLETON_ID: 379 case FLASH_FULLSCREEN_SINGLETON_ID:
391 new_singleton = new FlashFullscreenResource(connection, instance); 380 new_singleton = new FlashFullscreenResource(connection, instance);
392 break; 381 break;
393 case FLASH_SINGLETON_ID: 382 case FLASH_SINGLETON_ID:
394 new_singleton = new FlashResource(connection, instance, 383 new_singleton = new FlashResource(connection, instance,
395 static_cast<PluginDispatcher*>(dispatcher())); 384 static_cast<PluginDispatcher*>(dispatcher()));
396 break; 385 break;
397 #else 386 #else
387 case BROWSER_FONT_SINGLETON_ID:
398 case FLASH_CLIPBOARD_SINGLETON_ID: 388 case FLASH_CLIPBOARD_SINGLETON_ID:
399 case FLASH_FILE_SINGLETON_ID: 389 case FLASH_FILE_SINGLETON_ID:
400 case FLASH_FULLSCREEN_SINGLETON_ID: 390 case FLASH_FULLSCREEN_SINGLETON_ID:
401 case FLASH_SINGLETON_ID: 391 case FLASH_SINGLETON_ID:
402 NOTREACHED(); 392 NOTREACHED();
403 break; 393 break;
404 #endif // !defined(OS_NACL) && !defined(NACL_WIN64) 394 #endif // !defined(OS_NACL) && !defined(NACL_WIN64)
405 } 395 }
406 396
407 if (!new_singleton) { 397 if (!new_singleton) {
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 PP_Instance instance) { 1245 PP_Instance instance) {
1256 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 1246 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
1257 GetInstanceData(instance); 1247 GetInstanceData(instance);
1258 if (!data) 1248 if (!data)
1259 return; // Instance was probably deleted. 1249 return; // Instance was probably deleted.
1260 data->should_do_request_surrounding_text = false; 1250 data->should_do_request_surrounding_text = false;
1261 } 1251 }
1262 1252
1263 } // namespace proxy 1253 } // namespace proxy
1264 } // namespace ppapi 1254 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.h ('k') | ppapi/shared_impl/resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698