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

Side by Side Diff: content/ppapi_plugin/broker_process_dispatcher.cc

Issue 1874903002: Convert //content from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix indent Created 4 years, 8 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
« no previous file with comments | « content/gpu/in_process_gpu_thread.h ('k') | content/ppapi_plugin/ppapi_blink_platform_impl.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 "content/ppapi_plugin/broker_process_dispatcher.h" 5 #include "content/ppapi_plugin/broker_process_dispatcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "build/build_config.h" 14 #include "build/build_config.h"
14 #include "content/child/child_process.h" 15 #include "content/child/child_process.h"
15 #include "ppapi/c/pp_bool.h" 16 #include "ppapi/c/pp_bool.h"
16 #include "ppapi/c/private/ppp_flash_browser_operations.h" 17 #include "ppapi/c/private/ppp_flash_browser_operations.h"
17 #include "ppapi/proxy/ppapi_messages.h" 18 #include "ppapi/proxy/ppapi_messages.h"
18 19
19 namespace content { 20 namespace content {
20 namespace { 21 namespace {
21 22
(...skipping 18 matching lines...) Expand all
40 base::WeakPtr<BrokerProcessDispatcher> dispatcher; 41 base::WeakPtr<BrokerProcessDispatcher> dispatcher;
41 uint32_t request_id; 42 uint32_t request_id;
42 }; 43 };
43 44
44 void GetPermissionSettingsCallback( 45 void GetPermissionSettingsCallback(
45 void* user_data, 46 void* user_data,
46 PP_Bool success, 47 PP_Bool success,
47 PP_Flash_BrowserOperations_Permission default_permission, 48 PP_Flash_BrowserOperations_Permission default_permission,
48 uint32_t site_count, 49 uint32_t site_count,
49 const PP_Flash_BrowserOperations_SiteSetting sites[]) { 50 const PP_Flash_BrowserOperations_SiteSetting sites[]) {
50 scoped_ptr<GetPermissionSettingsContext> context( 51 std::unique_ptr<GetPermissionSettingsContext> context(
51 reinterpret_cast<GetPermissionSettingsContext*>(user_data)); 52 reinterpret_cast<GetPermissionSettingsContext*>(user_data));
52 53
53 if (!context->dispatcher.get()) 54 if (!context->dispatcher.get())
54 return; 55 return;
55 56
56 ppapi::FlashSiteSettings site_vector; 57 ppapi::FlashSiteSettings site_vector;
57 if (success) { 58 if (success) {
58 site_vector.reserve(site_count); 59 site_vector.reserve(site_count);
59 for (uint32_t i = 0; i < site_count; ++i) { 60 for (uint32_t i = 0; i < site_count; ++i) {
60 if (!sites[i].site) { 61 if (!sites[i].site) {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 294 }
294 295
295 bool BrokerProcessDispatcher::SetSitePermission( 296 bool BrokerProcessDispatcher::SetSitePermission(
296 const base::FilePath& plugin_data_path, 297 const base::FilePath& plugin_data_path,
297 PP_Flash_BrowserOperations_SettingType setting_type, 298 PP_Flash_BrowserOperations_SettingType setting_type,
298 const ppapi::FlashSiteSettings& sites) { 299 const ppapi::FlashSiteSettings& sites) {
299 if (sites.empty()) 300 if (sites.empty())
300 return true; 301 return true;
301 302
302 std::string data_str = ConvertPluginDataPath(plugin_data_path); 303 std::string data_str = ConvertPluginDataPath(plugin_data_path);
303 scoped_ptr<PP_Flash_BrowserOperations_SiteSetting[]> site_array( 304 std::unique_ptr<PP_Flash_BrowserOperations_SiteSetting[]> site_array(
304 new PP_Flash_BrowserOperations_SiteSetting[sites.size()]); 305 new PP_Flash_BrowserOperations_SiteSetting[sites.size()]);
305 306
306 for (size_t i = 0; i < sites.size(); ++i) { 307 for (size_t i = 0; i < sites.size(); ++i) {
307 site_array[i].site = sites[i].site.c_str(); 308 site_array[i].site = sites[i].site.c_str();
308 site_array[i].permission = sites[i].permission; 309 site_array[i].permission = sites[i].permission;
309 } 310 }
310 311
311 if (flash_browser_operations_1_3_) { 312 if (flash_browser_operations_1_3_) {
312 PP_Bool result = flash_browser_operations_1_3_->SetSitePermission( 313 PP_Bool result = flash_browser_operations_1_3_->SetSitePermission(
313 data_str.c_str(), setting_type, 314 data_str.c_str(), setting_type,
314 static_cast<uint32_t>(sites.size()), site_array.get()); 315 static_cast<uint32_t>(sites.size()), site_array.get());
315 316
316 return PP_ToBool(result); 317 return PP_ToBool(result);
317 } 318 }
318 319
319 if (flash_browser_operations_1_2_) { 320 if (flash_browser_operations_1_2_) {
320 PP_Bool result = flash_browser_operations_1_2_->SetSitePermission( 321 PP_Bool result = flash_browser_operations_1_2_->SetSitePermission(
321 data_str.c_str(), setting_type, 322 data_str.c_str(), setting_type,
322 static_cast<uint32_t>(sites.size()), site_array.get()); 323 static_cast<uint32_t>(sites.size()), site_array.get());
323 324
324 return PP_ToBool(result); 325 return PP_ToBool(result);
325 } 326 }
326 327
327 return false; 328 return false;
328 } 329 }
329 330
330 } // namespace content 331 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/in_process_gpu_thread.h ('k') | content/ppapi_plugin/ppapi_blink_platform_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698