diff --git a/atom/app/atom_main_delegate.cc b/atom/app/atom_main_delegate.cc index 08e0776daf67..7e04c3f119da 100644 --- a/atom/app/atom_main_delegate.cc +++ b/atom/app/atom_main_delegate.cc @@ -83,7 +83,7 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) { #endif // !defined(OS_WIN) // Only enable logging when --enable-logging is specified. - std::unique_ptr env(base::Environment::Create()); + auto env = base::Environment::Create(); if (!command_line->HasSwitch(::switches::kEnableLogging) && !env->HasVar("ELECTRON_ENABLE_LOGGING")) { settings.logging_dest = logging::LOG_NONE; @@ -203,7 +203,7 @@ bool AtomMainDelegate::DelaySandboxInitialization( std::unique_ptr AtomMainDelegate::CreateContentClient() { - return std::unique_ptr(new AtomContentClient); + return std::make_unique(); } } // namespace atom diff --git a/atom/app/node_main.cc b/atom/app/node_main.cc index 61a661e4ad9e..58b58c231ce3 100644 --- a/atom/app/node_main.cc +++ b/atom/app/node_main.cc @@ -38,7 +38,7 @@ int NodeMain(int argc, char* argv[]) { base::ThreadTaskRunnerHandle handle(uv_task_runner); // Initialize feature list. - std::unique_ptr feature_list(new base::FeatureList); + auto feature_list = std::make_unique(); feature_list->InitializeFromCommandLine("", ""); base::FeatureList::SetInstance(std::move(feature_list)); diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index 69d8aaf4825b..f17cd2957671 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -547,9 +547,9 @@ App::App(v8::Isolate* isolate) { Browser::Get()->AddObserver(this); content::GpuDataManager::GetInstance()->AddObserver(this); base::ProcessId pid = base::GetCurrentProcId(); - std::unique_ptr process_metric(new atom::ProcessMetric( + auto process_metric = std::make_unique( content::PROCESS_TYPE_BROWSER, pid, - base::ProcessMetrics::CreateCurrentProcessMetrics())); + base::ProcessMetrics::CreateCurrentProcessMetrics()); app_metrics_[pid] = std::move(process_metric); Init(isolate); } @@ -811,9 +811,8 @@ void App::ChildProcessLaunched(int process_type, base::ProcessHandle handle) { std::unique_ptr metrics( base::ProcessMetrics::CreateProcessMetrics(handle)); #endif - std::unique_ptr process_metric( - new atom::ProcessMetric(process_type, pid, std::move(metrics))); - app_metrics_[pid] = std::move(process_metric); + app_metrics_[pid] = std::make_unique(process_type, pid, + std::move(metrics)); } void App::ChildProcessDisconnected(base::ProcessId pid) { diff --git a/atom/browser/api/atom_api_browser_window.cc b/atom/browser/api/atom_api_browser_window.cc index a987828be55b..98ea05bfec6e 100644 --- a/atom/browser/api/atom_api_browser_window.cc +++ b/atom/browser/api/atom_api_browser_window.cc @@ -336,7 +336,7 @@ v8::Local BrowserWindow::GetWebContents(v8::Isolate* isolate) { // Convert draggable regions in raw format to SkRegion format. std::unique_ptr BrowserWindow::DraggableRegionsToSkRegion( const std::vector& regions) { - std::unique_ptr sk_region(new SkRegion); + auto sk_region = std::make_unique(); for (const DraggableRegion& region : regions) { sk_region->op( region.bounds.x(), region.bounds.y(), region.bounds.right(), diff --git a/atom/browser/api/atom_api_browser_window_mac.mm b/atom/browser/api/atom_api_browser_window_mac.mm index 06ee98cc57e4..ac64fb800f39 100644 --- a/atom/browser/api/atom_api_browser_window_mac.mm +++ b/atom/browser/api/atom_api_browser_window_mac.mm @@ -42,10 +42,10 @@ std::vector CalculateNonDraggableRegions( int width, int height) { std::vector result; - std::unique_ptr non_draggable(new SkRegion); - non_draggable->op(0, 0, width, height, SkRegion::kUnion_Op); - non_draggable->op(*draggable, SkRegion::kDifference_Op); - for (SkRegion::Iterator it(*non_draggable); !it.done(); it.next()) { + SkRegion non_draggable; + non_draggable.op(0, 0, width, height, SkRegion::kUnion_Op); + non_draggable.op(*draggable, SkRegion::kDifference_Op); + for (SkRegion::Iterator it(non_draggable); !it.done(); it.next()) { result.push_back(gfx::SkIRectToRect(it.rect())); } return result; diff --git a/atom/browser/api/atom_api_menu_views.cc b/atom/browser/api/atom_api_menu_views.cc index 677279fa676f..3da7dc2842fa 100644 --- a/atom/browser/api/atom_api_menu_views.cc +++ b/atom/browser/api/atom_api_menu_views.cc @@ -46,8 +46,8 @@ void MenuViews::PopupAt(TopLevelWindow* window, int32_t window_id = window->weak_map_id(); auto close_callback = base::Bind( &MenuViews::OnClosed, weak_factory_.GetWeakPtr(), window_id, callback); - menu_runners_[window_id] = std::unique_ptr( - new MenuRunner(model(), flags, close_callback)); + menu_runners_[window_id] = + std::make_unique(model(), flags, close_callback); menu_runners_[window_id]->RunMenuAt( native_window->widget(), NULL, gfx::Rect(location, gfx::Size()), views::MENU_ANCHOR_TOPLEFT, ui::MENU_SOURCE_MOUSE); diff --git a/atom/browser/api/atom_api_power_save_blocker.cc b/atom/browser/api/atom_api_power_save_blocker.cc index 51df0a63a5e8..dc94215fd72b 100644 --- a/atom/browser/api/atom_api_power_save_blocker.cc +++ b/atom/browser/api/atom_api_power_save_blocker.cc @@ -72,12 +72,11 @@ void PowerSaveBlocker::UpdatePowerSaveBlocker() { } if (!power_save_blocker_ || new_blocker_type != current_blocker_type_) { - std::unique_ptr new_blocker( - new device::PowerSaveBlocker( - new_blocker_type, device::PowerSaveBlocker::kReasonOther, - ATOM_PRODUCT_NAME, - BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), - BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE))); + auto new_blocker = std::make_unique( + new_blocker_type, device::PowerSaveBlocker::kReasonOther, + ATOM_PRODUCT_NAME, + BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), + BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)); power_save_blocker_.swap(new_blocker); current_blocker_type_ = new_blocker_type; } diff --git a/atom/browser/api/atom_api_protocol.h b/atom/browser/api/atom_api_protocol.h index 72a76caf5a6b..ab5e34872c6e 100644 --- a/atom/browser/api/atom_api_protocol.h +++ b/atom/browser/api/atom_api_protocol.h @@ -117,9 +117,8 @@ class Protocol : public mate::TrackableObject { request_context_getter->job_factory()); if (job_factory->IsHandledProtocol(scheme)) return PROTOCOL_REGISTERED; - std::unique_ptr> protocol_handler( - new CustomProtocolHandler( - isolate, request_context_getter.get(), handler)); + auto protocol_handler = std::make_unique>( + isolate, request_context_getter.get(), handler); if (job_factory->SetProtocolHandler(scheme, std::move(protocol_handler))) return PROTOCOL_OK; else @@ -166,9 +165,8 @@ class Protocol : public mate::TrackableObject { // It is possible a protocol is handled but can not be intercepted. if (!job_factory->HasProtocolHandler(scheme)) return PROTOCOL_FAIL; - std::unique_ptr> protocol_handler( - new CustomProtocolHandler( - isolate, request_context_getter.get(), handler)); + auto protocol_handler = std::make_unique>( + isolate, request_context_getter.get(), handler); if (!job_factory->InterceptProtocol(scheme, std::move(protocol_handler))) return PROTOCOL_INTERCEPTED; return PROTOCOL_OK; diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 4a01680dcb3b..0aa55312f458 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -772,9 +772,7 @@ void WebContents::RequestToLockMouse(content::WebContents* web_contents, std::unique_ptr WebContents::RunBluetoothChooser( content::RenderFrameHost* frame, const content::BluetoothChooser::EventHandler& event_handler) { - std::unique_ptr bluetooth_chooser( - new BluetoothChooser(this, event_handler)); - return std::move(bluetooth_chooser); + return std::make_unique(this, event_handler); } content::JavaScriptDialogManager* WebContents::GetJavaScriptDialogManager( diff --git a/atom/browser/atom_browser_main_parts.cc b/atom/browser/atom_browser_main_parts.cc index 6b19e7e0d150..2bd534defcbe 100644 --- a/atom/browser/atom_browser_main_parts.cc +++ b/atom/browser/atom_browser_main_parts.cc @@ -223,8 +223,7 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() { #if !defined(OS_MACOSX) // The corresponding call in macOS is in AtomApplicationDelegate. Browser::Get()->WillFinishLaunching(); - std::unique_ptr empty_info(new base::DictionaryValue); - Browser::Get()->DidFinishLaunching(*empty_info); + Browser::Get()->DidFinishLaunching(base::DictionaryValue()); #endif // Notify observers that main thread message loop was initialized. diff --git a/atom/browser/atom_resource_dispatcher_host_delegate.cc b/atom/browser/atom_resource_dispatcher_host_delegate.cc index 68b4fc5cf596..76dbc6e7aad2 100644 --- a/atom/browser/atom_resource_dispatcher_host_delegate.cc +++ b/atom/browser/atom_resource_dispatcher_host_delegate.cc @@ -134,12 +134,12 @@ std::unique_ptr AtomResourceDispatcherHostDelegate::CreateClientCertStore( content::ResourceContext* resource_context) { #if defined(USE_NSS_CERTS) - return std::unique_ptr(new net::ClientCertStoreNSS( - net::ClientCertStoreNSS::PasswordDelegateFactory())); + return std::make_unique( + net::ClientCertStoreNSS::PasswordDelegateFactory()); #elif defined(OS_WIN) - return std::unique_ptr(new net::ClientCertStoreWin()); + return std::make_unique(); #elif defined(OS_MACOSX) - return std::unique_ptr(new net::ClientCertStoreMac()); + return std::make_unique(); #elif defined(USE_OPENSSL) return std::unique_ptr(); #endif diff --git a/atom/browser/mac/atom_application_delegate.mm b/atom/browser/mac/atom_application_delegate.mm index 8f8ea28cd20f..dfd5740f8dcd 100644 --- a/atom/browser/mac/atom_application_delegate.mm +++ b/atom/browser/mac/atom_application_delegate.mm @@ -62,9 +62,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session; atom::NSDictionaryToDictionaryValue(user_notification.userInfo); atom::Browser::Get()->DidFinishLaunching(*launch_info); } else { - std::unique_ptr empty_info( - new base::DictionaryValue); - atom::Browser::Get()->DidFinishLaunching(*empty_info); + atom::Browser::Get()->DidFinishLaunching(base::DictionaryValue()); } #if BUILDFLAG(USE_ALLOCATOR_SHIM) diff --git a/atom/browser/mac/dict_util.mm b/atom/browser/mac/dict_util.mm index b18f81b4326a..4f44e00ce51d 100644 --- a/atom/browser/mac/dict_util.mm +++ b/atom/browser/mac/dict_util.mm @@ -26,7 +26,7 @@ std::unique_ptr NSArrayToListValue(NSArray* arr) { if (!arr) return nullptr; - std::unique_ptr result(new base::ListValue); + auto result = std::make_unique(); for (id value in arr) { if ([value isKindOfClass:[NSString class]]) { result->AppendString(base::SysNSStringToUTF8(value)); @@ -79,7 +79,7 @@ std::unique_ptr NSDictionaryToDictionaryValue( if (!dict) return nullptr; - std::unique_ptr result(new base::DictionaryValue); + auto result = std::make_unique(); for (id key in dict) { std::string str_key = base::SysNSStringToUTF8( [key isKindOfClass:[NSString class]] ? key : [key description]); diff --git a/atom/browser/net/atom_cert_verifier.cc b/atom/browser/net/atom_cert_verifier.cc index 25dd6a2792ef..75437f605c83 100644 --- a/atom/browser/net/atom_cert_verifier.cc +++ b/atom/browser/net/atom_cert_verifier.cc @@ -88,7 +88,7 @@ class CertVerifierRequest : public AtomCertVerifier::Request { void OnDefaultVerificationDone(int error) { error_ = error; - std::unique_ptr request(new VerifyRequestParams()); + auto request = std::make_unique(); request->hostname = params_.hostname(); request->default_result = net::ErrorToString(error); request->error_code = error; @@ -174,8 +174,7 @@ int AtomCertVerifier::Verify(const RequestParams& params, CertVerifierRequest* request = FindRequest(params); if (!request) { out_req->reset(); - std::unique_ptr new_request = - std::make_unique(params, this); + auto new_request = std::make_unique(params, this); new_request->Start(crl_set, net_log); request = new_request.get(); *out_req = std::move(new_request); diff --git a/atom/browser/net/atom_network_delegate.cc b/atom/browser/net/atom_network_delegate.cc index 3471622db0b9..e743e044ad62 100644 --- a/atom/browser/net/atom_network_delegate.cc +++ b/atom/browser/net/atom_network_delegate.cc @@ -105,7 +105,7 @@ void ToDictionary(base::DictionaryValue* details, net::URLRequest* request) { void ToDictionary(base::DictionaryValue* details, const net::HttpRequestHeaders& headers) { - std::unique_ptr dict(new base::DictionaryValue); + auto dict = std::make_unique(); net::HttpRequestHeaders::Iterator it(headers); while (it.GetNext()) dict->SetKey(it.name(), base::Value(it.value())); @@ -117,7 +117,7 @@ void ToDictionary(base::DictionaryValue* details, if (!headers) return; - std::unique_ptr dict(new base::DictionaryValue); + auto dict = std::make_unique(); size_t iter = 0; std::string key; std::string value; @@ -127,7 +127,7 @@ void ToDictionary(base::DictionaryValue* details, if (dict->GetList(key, &values)) values->AppendString(value); } else { - std::unique_ptr values(new base::ListValue); + auto values = std::make_unique(); values->AppendString(value); dict->Set(key, std::move(values)); } @@ -388,7 +388,7 @@ int AtomNetworkDelegate::HandleResponseEvent( if (!MatchesFilterCondition(request, info.url_patterns)) return net::OK; - std::unique_ptr details(new base::DictionaryValue); + auto details = std::make_unique(); FillDetailsObject(details.get(), request, args...); int render_process_id, render_frame_id; @@ -416,7 +416,7 @@ void AtomNetworkDelegate::HandleSimpleEvent(SimpleEvent type, if (!MatchesFilterCondition(request, info.url_patterns)) return; - std::unique_ptr details(new base::DictionaryValue); + auto details = std::make_unique(); FillDetailsObject(details.get(), request, args...); int render_process_id, render_frame_id; diff --git a/atom/browser/net/js_asker.h b/atom/browser/net/js_asker.h index bc5834f62464..45e2da9b8220 100644 --- a/atom/browser/net/js_asker.h +++ b/atom/browser/net/js_asker.h @@ -68,8 +68,7 @@ class JsAsker : public RequestJob { private: // RequestJob: void Start() override { - std::unique_ptr request_details( - new base::DictionaryValue); + auto request_details = std::make_unique(); request_start_time_ = base::TimeTicks::Now(); FillRequestDetails(request_details.get(), RequestJob::request()); content::BrowserThread::PostTask( diff --git a/atom/browser/ui/file_dialog_gtk.cc b/atom/browser/ui/file_dialog_gtk.cc index b712f6a78c47..dad4fabde9f7 100644 --- a/atom/browser/ui/file_dialog_gtk.cc +++ b/atom/browser/ui/file_dialog_gtk.cc @@ -187,8 +187,8 @@ void FileChooserDialog::AddFilters(const Filters& filters) { GtkFileFilter* gtk_filter = gtk_file_filter_new(); for (size_t j = 0; j < filter.second.size(); ++j) { - std::unique_ptr file_extension( - new std::string("." + filter.second[j])); + auto file_extension = + std::make_unique("." + filter.second[j]); gtk_file_filter_add_custom( gtk_filter, GTK_FILE_FILTER_FILENAME, reinterpret_cast(FileFilterCaseInsensitive), diff --git a/atom/browser/ui/file_dialog_mac.mm b/atom/browser/ui/file_dialog_mac.mm index bfe9c7d97e3a..18b18a8b240c 100644 --- a/atom/browser/ui/file_dialog_mac.mm +++ b/atom/browser/ui/file_dialog_mac.mm @@ -85,13 +85,9 @@ void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) { // Create array to keep file types and their name. for (const Filter& filter : filters) { NSMutableSet* file_type_set = [NSMutableSet set]; - base::ScopedCFTypeRef name_cf( - base::SysUTF8ToCFStringRef(filter.first)); - [filter_names addObject:base::mac::CFToNSCast(name_cf.get())]; + [filter_names addObject:@(filter.first.c_str())]; for (const std::string& ext : filter.second) { - base::ScopedCFTypeRef ext_cf( - base::SysUTF8ToCFStringRef(ext)); - [file_type_set addObject:base::mac::CFToNSCast(ext_cf.get())]; + [file_type_set addObject:@(ext.c_str())]; } [file_types_list addObject:[file_type_set allObjects]]; } diff --git a/atom/browser/ui/file_dialog_win.cc b/atom/browser/ui/file_dialog_win.cc index cd08d038fbd4..2d708086bfdf 100644 --- a/atom/browser/ui/file_dialog_win.cc +++ b/atom/browser/ui/file_dialog_win.cc @@ -151,8 +151,8 @@ struct RunState { }; bool CreateDialogThread(RunState* run_state) { - std::unique_ptr thread( - new base::Thread(ATOM_PRODUCT_NAME "FileDialogThread")); + auto thread = + std::make_unique(ATOM_PRODUCT_NAME "FileDialogThread"); thread->init_com_with_mta(false); if (!thread->Start()) return false; diff --git a/atom/browser/ui/message_box_win.cc b/atom/browser/ui/message_box_win.cc index db8447e9794e..e5a0e61379d0 100644 --- a/atom/browser/ui/message_box_win.cc +++ b/atom/browser/ui/message_box_win.cc @@ -257,8 +257,8 @@ void ShowMessageBox(NativeWindow* parent, bool checkbox_checked, const gfx::ImageSkia& icon, const MessageBoxCallback& callback) { - std::unique_ptr thread( - new base::Thread(ATOM_PRODUCT_NAME "MessageBoxThread")); + auto thread = + std::make_unique(ATOM_PRODUCT_NAME "MessageBoxThread"); thread->init_com_with_mta(false); if (!thread->Start()) { callback.Run(cancel_id, checkbox_checked); diff --git a/atom/common/api/atom_api_asar.cc b/atom/common/api/atom_api_asar.cc index a6be35e9502a..240b5504c248 100644 --- a/atom/common/api/atom_api_asar.cc +++ b/atom/common/api/atom_api_asar.cc @@ -23,7 +23,7 @@ class Archive : public mate::Wrappable { public: static v8::Local Create(v8::Isolate* isolate, const base::FilePath& path) { - std::unique_ptr archive(new asar::Archive(path)); + auto archive = std::make_unique(path); if (!archive->Init()) return v8::False(isolate); return (new Archive(isolate, std::move(archive)))->GetWrapper(); diff --git a/atom/common/api/atom_api_native_image.cc b/atom/common/api/atom_api_native_image.cc index 980f2641e502..7b274b38cae7 100644 --- a/atom/common/api/atom_api_native_image.cc +++ b/atom/common/api/atom_api_native_image.cc @@ -85,7 +85,7 @@ bool AddImageSkiaRep(gfx::ImageSkia* image, int width, int height, double scale_factor) { - std::unique_ptr decoded(new SkBitmap()); + auto decoded = std::make_unique(); // Try PNG first. if (!gfx::PNGCodec::Decode(data, size, decoded.get())) { diff --git a/atom/common/api/atom_bindings.cc b/atom/common/api/atom_bindings.cc index 66211723a8fe..a31696c09a01 100644 --- a/atom/common/api/atom_bindings.cc +++ b/atom/common/api/atom_bindings.cc @@ -157,8 +157,7 @@ v8::Local AtomBindings::GetHeapStatistics(v8::Isolate* isolate) { // static v8::Local AtomBindings::GetProcessMemoryInfo(v8::Isolate* isolate) { - std::unique_ptr metrics( - base::ProcessMetrics::CreateCurrentProcessMetrics()); + auto metrics = base::ProcessMetrics::CreateCurrentProcessMetrics(); mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate); dict.Set("workingSetSize", @@ -224,8 +223,7 @@ v8::Local AtomBindings::GetCPUUsage(v8::Isolate* isolate) { // static v8::Local AtomBindings::GetIOCounters(v8::Isolate* isolate) { - std::unique_ptr metrics( - base::ProcessMetrics::CreateCurrentProcessMetrics()); + auto metrics = base::ProcessMetrics::CreateCurrentProcessMetrics(); base::IoCounters io_counters; mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate); diff --git a/atom/common/asar/archive.cc b/atom/common/asar/archive.cc index ef8f0e33adb7..d46537c05695 100644 --- a/atom/common/asar/archive.cc +++ b/atom/common/asar/archive.cc @@ -291,7 +291,7 @@ bool Archive::CopyFileOut(const base::FilePath& path, base::FilePath* out) { return true; } - std::unique_ptr temp_file(new ScopedTemporaryFile); + auto temp_file = std::make_unique(); base::FilePath::StringType ext = path.Extension(); if (!temp_file->InitFromFile(&file_, ext, info.offset, info.size)) return false; diff --git a/atom/common/native_mate_converters/content_converter.cc b/atom/common/native_mate_converters/content_converter.cc index a74ae403213b..1495137ade2b 100644 --- a/atom/common/native_mate_converters/content_converter.cc +++ b/atom/common/native_mate_converters/content_converter.cc @@ -209,10 +209,9 @@ v8::Local Converter>::ToV8( const scoped_refptr& val) { if (!val) return v8::Null(isolate); - std::unique_ptr list(new base::ListValue); + auto list = std::make_unique(); for (const auto& element : *(val->elements())) { - std::unique_ptr post_data_dict( - new base::DictionaryValue); + auto post_data_dict = std::make_unique(); auto type = element.type(); if (type == ResourceRequestBody::Element::TYPE_BYTES) { std::unique_ptr bytes(base::Value::CreateWithCopiedBuffer( @@ -249,7 +248,7 @@ bool Converter>::FromV8( v8::Isolate* isolate, v8::Local val, scoped_refptr* out) { - std::unique_ptr list(new base::ListValue); + auto list = std::make_unique(); if (!ConvertFromV8(isolate, val, list.get())) return false; *out = new content::ResourceRequestBody(); diff --git a/atom/common/native_mate_converters/net_converter.cc b/atom/common/native_mate_converters/net_converter.cc index 8e490ca733b4..30d98f70a8fc 100644 --- a/atom/common/native_mate_converters/net_converter.cc +++ b/atom/common/native_mate_converters/net_converter.cc @@ -158,7 +158,7 @@ v8::Local Converter::ToV8( if (response_headers.GetList(key, &values)) values->AppendString(value); } else { - std::unique_ptr values(new base::ListValue()); + auto values = std::make_unique(); values->AppendString(value); response_headers.Set(key, std::move(values)); } @@ -208,12 +208,11 @@ void FillRequestDetails(base::DictionaryValue* details, url = request->url().spec(); details->SetKey("url", base::Value(url)); details->SetString("referrer", request->referrer()); - std::unique_ptr list(new base::ListValue); + auto list = std::make_unique(); GetUploadData(list.get(), request); if (!list->empty()) details->Set("uploadData", std::move(list)); - std::unique_ptr headers_value( - new base::DictionaryValue); + auto headers_value = std::make_unique(); for (net::HttpRequestHeaders::Iterator it(request->extra_request_headers()); it.GetNext();) { headers_value->SetString(it.name(), it.value()); @@ -229,8 +228,7 @@ void GetUploadData(base::ListValue* upload_data_list, const std::vector>* readers = upload_data->GetElementReaders(); for (const auto& reader : *readers) { - std::unique_ptr upload_data_dict( - new base::DictionaryValue); + auto upload_data_dict = std::make_unique(); if (reader->AsBytesReader()) { const net::UploadBytesElementReader* bytes_reader = reader->AsBytesReader(); diff --git a/atom/common/native_mate_converters/v8_value_converter.cc b/atom/common/native_mate_converters/v8_value_converter.cc index b97b5fdfd8ee..9253896fec51 100644 --- a/atom/common/native_mate_converters/v8_value_converter.cc +++ b/atom/common/native_mate_converters/v8_value_converter.cc @@ -429,7 +429,7 @@ base::Value* V8ValueConverter::FromV8Object(v8::Local val, val->CreationContext() != isolate->GetCurrentContext()) scope.reset(new v8::Context::Scope(val->CreationContext())); - std::unique_ptr result(new base::DictionaryValue()); + auto result = std::make_unique(); v8::Local property_names(val->GetOwnPropertyNames()); for (uint32_t i = 0; i < property_names->Length(); ++i) { diff --git a/atom/renderer/api/atom_api_web_frame.cc b/atom/renderer/api/atom_api_web_frame.cc index 179edd448c2a..68bb084a2fc7 100644 --- a/atom/renderer/api/atom_api_web_frame.cc +++ b/atom/renderer/api/atom_api_web_frame.cc @@ -195,8 +195,8 @@ void WebFrame::SetSpellCheckProvider(mate::Arguments* args, return; } - std::unique_ptr client(new SpellCheckClient( - language, auto_spell_correct_turned_on, args->isolate(), provider)); + auto client = std::make_unique( + language, auto_spell_correct_turned_on, args->isolate(), provider); // Set spellchecker for all live frames in the same process or // in the sandbox mode for all live sub frames to this WebFrame. FrameSpellChecker spell_checker( diff --git a/atom/renderer/renderer_client_base.cc b/atom/renderer/renderer_client_base.cc index 09bb006ecdaa..aca4f9360316 100644 --- a/atom/renderer/renderer_client_base.cc +++ b/atom/renderer/renderer_client_base.cc @@ -136,9 +136,7 @@ void RendererClientBase::RenderThreadStarted() { #if defined(OS_MACOSX) base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); bool scroll_bounce = command_line->HasSwitch(switches::kScrollBounce); - base::ScopedCFTypeRef rubber_banding_key( - base::SysUTF8ToCFStringRef("NSScrollViewRubberbanding")); - CFPreferencesSetAppValue(rubber_banding_key, + CFPreferencesSetAppValue(CFSTR("NSScrollViewRubberbanding"), scroll_bounce ? kCFBooleanTrue : kCFBooleanFalse, kCFPreferencesCurrentApplication); CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);