diff --git a/cef_paths2.gypi b/cef_paths2.gypi index 5d6e2e3ac..79bd24f30 100644 --- a/cef_paths2.gypi +++ b/cef_paths2.gypi @@ -136,7 +136,6 @@ 'libcef_dll/cpptoc/cpptoc_scoped.h', 'libcef_dll/ctocpp/ctocpp_ref_counted.h', 'libcef_dll/ctocpp/ctocpp_scoped.h', - 'libcef_dll/ptr_util.h', 'libcef_dll/shutdown_checker.cc', 'libcef_dll/shutdown_checker.h', 'libcef_dll/transfer_util.cc', diff --git a/include/wrapper/cef_resource_manager.h b/include/wrapper/cef_resource_manager.h index 38e098a95..da68cfc91 100644 --- a/include/wrapper/cef_resource_manager.h +++ b/include/wrapper/cef_resource_manager.h @@ -38,11 +38,11 @@ #pragma once #include +#include #include "include/base/cef_callback.h" #include "include/base/cef_macros.h" #include "include/base/cef_ref_counted.h" -#include "include/base/cef_scoped_ptr.h" #include "include/base/cef_weak_ptr.h" #include "include/cef_request_handler.h" #include "include/wrapper/cef_closure_task.h" @@ -160,18 +160,18 @@ class CefResourceManager // The below methods are called on the browser process IO thread. - explicit Request(scoped_ptr state); + explicit Request(std::unique_ptr state); - scoped_ptr SendRequest(); + std::unique_ptr SendRequest(); bool HasState(); - static void ContinueOnIOThread(scoped_ptr state, + static void ContinueOnIOThread(std::unique_ptr state, CefRefPtr handler); - static void StopOnIOThread(scoped_ptr state); + static void StopOnIOThread(std::unique_ptr state); // Will be non-NULL while the request is pending. Only accessed on the // browser process IO thread. - scoped_ptr state_; + std::unique_ptr state_; // Params that stay with this request object. Safe to access on any thread. RequestParams params_; @@ -342,10 +342,10 @@ class CefResourceManager // Methods that manage request state between requests. Called on the browser // process IO thread. - bool SendRequest(scoped_ptr state); - void ContinueRequest(scoped_ptr state, + bool SendRequest(std::unique_ptr state); + void ContinueRequest(std::unique_ptr state, CefRefPtr handler); - void StopRequest(scoped_ptr state); + void StopRequest(std::unique_ptr state); bool IncrementProvider(RequestState* state); void DetachRequestFromProvider(RequestState* state); void GetNextValidProvider(ProviderEntryList::iterator& iterator); @@ -364,7 +364,7 @@ class CefResourceManager MimeTypeResolver mime_type_resolver_; // Must be the last member. Created and accessed on the IO thread. - scoped_ptr> weak_ptr_factory_; + std::unique_ptr> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(CefResourceManager); }; diff --git a/libcef/browser/browser_platform_delegate.h b/libcef/browser/browser_platform_delegate.h index 501a778f6..7336ff836 100644 --- a/libcef/browser/browser_platform_delegate.h +++ b/libcef/browser/browser_platform_delegate.h @@ -356,7 +356,7 @@ class CefBrowserPlatformDelegate { virtual void StopFinding(bool clearSelection); protected: - // Allow deletion via scoped_ptr only. + // Allow deletion via std::unique_ptr only. friend std::default_delete; CefBrowserPlatformDelegate(); diff --git a/libcef/browser/file_dialog_runner.h b/libcef/browser/file_dialog_runner.h index be051fe90..548a4222f 100644 --- a/libcef/browser/file_dialog_runner.h +++ b/libcef/browser/file_dialog_runner.h @@ -39,7 +39,7 @@ class CefFileDialogRunner { RunFileChooserCallback callback) = 0; protected: - // Allow deletion via scoped_ptr only. + // Allow deletion via std::unique_ptr only. friend std::default_delete; CefFileDialogRunner() {} diff --git a/libcef/browser/javascript_dialog_runner.h b/libcef/browser/javascript_dialog_runner.h index ff601a962..befadcc5d 100644 --- a/libcef/browser/javascript_dialog_runner.h +++ b/libcef/browser/javascript_dialog_runner.h @@ -30,7 +30,7 @@ class CefJavaScriptDialogRunner { virtual void Cancel() = 0; protected: - // Allow deletion via scoped_ptr only. + // Allow deletion via std::unique_ptr only. friend std::default_delete; CefJavaScriptDialogRunner() {} diff --git a/libcef/browser/menu_runner.h b/libcef/browser/menu_runner.h index b8bf22f0b..2e17ae07d 100644 --- a/libcef/browser/menu_runner.h +++ b/libcef/browser/menu_runner.h @@ -27,7 +27,7 @@ class CefMenuRunner { virtual bool FormatLabel(std::u16string& label) { return false; } protected: - // Allow deletion via scoped_ptr only. + // Allow deletion via std::unique_ptr only. friend std::default_delete; CefMenuRunner() {} diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc index e367eea03..f7b6ec82c 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.cc +++ b/libcef/browser/osr/render_widget_host_view_osr.cc @@ -1615,7 +1615,7 @@ void CefRenderWidgetHostViewOSR::CancelWidget() { if (render_widget_host_ && !is_destroyed_) { is_destroyed_ = true; - // Don't delete the RWHI manually while owned by a scoped_ptr in RVHI. + // Don't delete the RWHI manually while owned by a std::unique_ptr in RVHI. // This matches a CHECK() in RenderWidgetHostImpl::Destroy(). const bool also_delete = !render_widget_host_->owner_delegate(); diff --git a/libcef_dll/cpptoc/cpptoc_scoped.h b/libcef_dll/cpptoc/cpptoc_scoped.h index b552404f4..7b0dc24be 100644 --- a/libcef_dll/cpptoc/cpptoc_scoped.h +++ b/libcef_dll/cpptoc/cpptoc_scoped.h @@ -10,7 +10,6 @@ #include "include/base/cef_macros.h" #include "include/capi/cef_base_capi.h" #include "include/cef_base.h" -#include "libcef_dll/ptr_util.h" #include "libcef_dll/wrapper_types.h" // Wrap a C++ class with a C structure. This is used when the class diff --git a/libcef_dll/cpptoc/test/translator_test_cpptoc.cc b/libcef_dll/cpptoc/test/translator_test_cpptoc.cc index d516caaf6..515fd23cf 100644 --- a/libcef_dll/cpptoc/test/translator_test_cpptoc.cc +++ b/libcef_dll/cpptoc/test/translator_test_cpptoc.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=a102f383e3ecac5237310b2e5aa5b2fd37474188$ +// $hash=982f16fd8ec5c6a195f24f6aaeac41b2e1373f68$ // #include "libcef_dll/cpptoc/test/translator_test_cpptoc.h" @@ -1152,7 +1152,7 @@ translator_test_get_own_ptr_library(struct _cef_translator_test_t* self, CefTranslatorTestCppToC::Get(self)->GetOwnPtrLibrary(val); // Return type: ownptr_same - return CefTranslatorTestScopedLibraryCppToC::WrapOwn(OWN_PASS(_retval)); + return CefTranslatorTestScopedLibraryCppToC::WrapOwn(std::move(_retval)); } int CEF_CALLBACK translator_test_set_own_ptr_library( @@ -1200,7 +1200,7 @@ translator_test_set_own_ptr_library_and_return( CefTranslatorTestScopedLibraryCppToC::UnwrapOwn(val)); // Return type: ownptr_same - return CefTranslatorTestScopedLibraryCppToC::WrapOwn(OWN_PASS(_retval)); + return CefTranslatorTestScopedLibraryCppToC::WrapOwn(std::move(_retval)); } int CEF_CALLBACK translator_test_set_child_own_ptr_library( @@ -1248,7 +1248,7 @@ translator_test_set_child_own_ptr_library_and_return_parent( CefTranslatorTestScopedLibraryChildCppToC::UnwrapOwn(val)); // Return type: ownptr_same - return CefTranslatorTestScopedLibraryCppToC::WrapOwn(OWN_PASS(_retval)); + return CefTranslatorTestScopedLibraryCppToC::WrapOwn(std::move(_retval)); } int CEF_CALLBACK translator_test_set_own_ptr_client( @@ -1272,7 +1272,7 @@ int CEF_CALLBACK translator_test_set_own_ptr_client( // Execute int _retval = - CefTranslatorTestCppToC::Get(self)->SetOwnPtrClient(OWN_PASS(valPtr)); + CefTranslatorTestCppToC::Get(self)->SetOwnPtrClient(std::move(valPtr)); // Return type: simple return _retval; @@ -1301,10 +1301,10 @@ translator_test_set_own_ptr_client_and_return( // Execute CefOwnPtr _retval = CefTranslatorTestCppToC::Get(self)->SetOwnPtrClientAndReturn( - OWN_PASS(valPtr)); + std::move(valPtr)); // Return type: ownptr_diff - return CefTranslatorTestScopedClientCToCpp::UnwrapOwn(OWN_PASS(_retval)); + return CefTranslatorTestScopedClientCToCpp::UnwrapOwn(std::move(_retval)); } int CEF_CALLBACK translator_test_set_child_own_ptr_client( @@ -1328,7 +1328,7 @@ int CEF_CALLBACK translator_test_set_child_own_ptr_client( // Execute int _retval = CefTranslatorTestCppToC::Get(self)->SetChildOwnPtrClient( - OWN_PASS(valPtr)); + std::move(valPtr)); // Return type: simple return _retval; @@ -1357,10 +1357,10 @@ translator_test_set_child_own_ptr_client_and_return_parent( // Execute CefOwnPtr _retval = CefTranslatorTestCppToC::Get(self)->SetChildOwnPtrClientAndReturnParent( - OWN_PASS(valPtr)); + std::move(valPtr)); // Return type: ownptr_diff - return CefTranslatorTestScopedClientCToCpp::UnwrapOwn(OWN_PASS(_retval)); + return CefTranslatorTestScopedClientCToCpp::UnwrapOwn(std::move(_retval)); } int CEF_CALLBACK translator_test_set_raw_ptr_library( diff --git a/libcef_dll/cpptoc/test/translator_test_scoped_client_cpptoc.cc b/libcef_dll/cpptoc/test/translator_test_scoped_client_cpptoc.cc index b1f60a648..947c2edaa 100644 --- a/libcef_dll/cpptoc/test/translator_test_scoped_client_cpptoc.cc +++ b/libcef_dll/cpptoc/test/translator_test_scoped_client_cpptoc.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=7fbfdb7d8fd3b7e41ba55f2138e9752f301a2438$ +// $hash=fe3ba17a673de7d4051eb0ed4c83eb7d40f6d4b6$ // #include "libcef_dll/cpptoc/test/translator_test_scoped_client_cpptoc.h" @@ -54,10 +54,8 @@ CefCppToCScoped(s)), - CefTranslatorTestScopedClient); + return CefTranslatorTestScopedClientChildCppToC::UnwrapOwn( + reinterpret_cast(s)); } NOTREACHED() << "Unexpected class type: " << type; return CefOwnPtr(); diff --git a/libcef_dll/cpptoc/test/translator_test_scoped_library_child_child_cpptoc.cc b/libcef_dll/cpptoc/test/translator_test_scoped_library_child_child_cpptoc.cc index 22cd0629b..c64ce1f21 100644 --- a/libcef_dll/cpptoc/test/translator_test_scoped_library_child_child_cpptoc.cc +++ b/libcef_dll/cpptoc/test/translator_test_scoped_library_child_child_cpptoc.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=2f64a37b4735c7d91035aec2fffa263d7d27942b$ +// $hash=1fa64c4f005a9ce3af83148fa5eeccaf45706200$ // #include "libcef_dll/cpptoc/test/translator_test_scoped_library_child_child_cpptoc.h" @@ -29,7 +29,7 @@ cef_translator_test_scoped_library_child_child_create(int value, // Return type: ownptr_same return CefTranslatorTestScopedLibraryChildChildCppToC::WrapOwn( - OWN_PASS(_retval)); + std::move(_retval)); } namespace { diff --git a/libcef_dll/cpptoc/test/translator_test_scoped_library_child_cpptoc.cc b/libcef_dll/cpptoc/test/translator_test_scoped_library_child_cpptoc.cc index 63ecd5eba..43c8038ee 100644 --- a/libcef_dll/cpptoc/test/translator_test_scoped_library_child_cpptoc.cc +++ b/libcef_dll/cpptoc/test/translator_test_scoped_library_child_cpptoc.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=cd7a42714195bed68aef8a200c7e1a38681558f2$ +// $hash=a5c43bc178aa01efbf560be47b1429fd4540d27f$ // #include "libcef_dll/cpptoc/test/translator_test_scoped_library_child_cpptoc.h" @@ -26,7 +26,7 @@ cef_translator_test_scoped_library_child_create(int value, int other_value) { CefTranslatorTestScopedLibraryChild::Create(value, other_value); // Return type: ownptr_same - return CefTranslatorTestScopedLibraryChildCppToC::WrapOwn(OWN_PASS(_retval)); + return CefTranslatorTestScopedLibraryChildCppToC::WrapOwn(std::move(_retval)); } namespace { @@ -122,11 +122,8 @@ CefCppToCScoped( - s)), - CefTranslatorTestScopedLibraryChild); + return CefTranslatorTestScopedLibraryChildChildCppToC::UnwrapOwn( + reinterpret_cast(s)); } NOTREACHED() << "Unexpected class type: " << type; return CefOwnPtr(); diff --git a/libcef_dll/cpptoc/test/translator_test_scoped_library_cpptoc.cc b/libcef_dll/cpptoc/test/translator_test_scoped_library_cpptoc.cc index d07e59474..bff5119c5 100644 --- a/libcef_dll/cpptoc/test/translator_test_scoped_library_cpptoc.cc +++ b/libcef_dll/cpptoc/test/translator_test_scoped_library_cpptoc.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=9e0c499cc30e7e762de3d5969ab6795ec50ffc08$ +// $hash=4f28d789be1549022af70417a8d2f711d688f3b7$ // #include "libcef_dll/cpptoc/test/translator_test_scoped_library_cpptoc.h" @@ -27,7 +27,7 @@ cef_translator_test_scoped_library_create(int value) { CefTranslatorTestScopedLibrary::Create(value); // Return type: ownptr_same - return CefTranslatorTestScopedLibraryCppToC::WrapOwn(OWN_PASS(_retval)); + return CefTranslatorTestScopedLibraryCppToC::WrapOwn(std::move(_retval)); } namespace { @@ -83,17 +83,12 @@ CefCppToCScoped(s)), - CefTranslatorTestScopedLibrary); + return CefTranslatorTestScopedLibraryChildCppToC::UnwrapOwn( + reinterpret_cast(s)); } if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) { - return OWN_RETURN_AS( - CefTranslatorTestScopedLibraryChildChildCppToC::UnwrapOwn( - reinterpret_cast( - s)), - CefTranslatorTestScopedLibrary); + return CefTranslatorTestScopedLibraryChildChildCppToC::UnwrapOwn( + reinterpret_cast(s)); } NOTREACHED() << "Unexpected class type: " << type; return CefOwnPtr(); diff --git a/libcef_dll/ctocpp/ctocpp_scoped.h b/libcef_dll/ctocpp/ctocpp_scoped.h index 5ceddcb56..ed3e17a49 100644 --- a/libcef_dll/ctocpp/ctocpp_scoped.h +++ b/libcef_dll/ctocpp/ctocpp_scoped.h @@ -10,7 +10,6 @@ #include "include/base/cef_macros.h" #include "include/capi/cef_base_capi.h" #include "include/cef_base.h" -#include "libcef_dll/ptr_util.h" #include "libcef_dll/wrapper_types.h" // Wrap a C structure with a C++ class. This is used when the implementation @@ -49,7 +48,7 @@ class CefCToCppScoped : public BaseName { // // void MyMethod(CefOwnPtr obj) { // // Ownership of the underlying MyType object is passed to my_method(). - // my_method(MyTypeCToCpp::UnwrapOwn(obj.Pass())); + // my_method(MyTypeCToCpp::UnwrapOwn(std::move(obj))); // // |obj| is now NULL. // } static StructName* UnwrapOwn(CefOwnPtr c); @@ -129,7 +128,7 @@ StructName* CefCToCppScoped::UnwrapOwn( // If the type does not match this object then we need to unwrap as the // derived type. if (wrapperStruct->type_ != kWrapperType) - return UnwrapDerivedOwn(wrapperStruct->type_, OWN_PASS(c)); + return UnwrapDerivedOwn(wrapperStruct->type_, std::move(c)); StructName* orig_struct = wrapperStruct->struct_; diff --git a/libcef_dll/ctocpp/test/translator_test_ctocpp.cc b/libcef_dll/ctocpp/test/translator_test_ctocpp.cc index af3527075..0773742d7 100644 --- a/libcef_dll/ctocpp/test/translator_test_ctocpp.cc +++ b/libcef_dll/ctocpp/test/translator_test_ctocpp.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=ff27c226ced0b2651b858eadea688d164dfa777e$ +// $hash=210590ae794f6690729538f2e6ca59d264cb1dc9$ // #include "libcef_dll/ctocpp/test/translator_test_ctocpp.h" @@ -1161,7 +1161,7 @@ int CefTranslatorTestCToCpp::SetOwnPtrLibrary( // Execute int _retval = _struct->set_own_ptr_library( - _struct, CefTranslatorTestScopedLibraryCToCpp::UnwrapOwn(OWN_PASS(val))); + _struct, CefTranslatorTestScopedLibraryCToCpp::UnwrapOwn(std::move(val))); // Return type: simple return _retval; @@ -1187,7 +1187,7 @@ CefOwnPtr CefTranslatorTestCToCpp:: cef_translator_test_scoped_library_t* _retval = _struct->set_own_ptr_library_and_return( _struct, - CefTranslatorTestScopedLibraryCToCpp::UnwrapOwn(OWN_PASS(val))); + CefTranslatorTestScopedLibraryCToCpp::UnwrapOwn(std::move(val))); // Return type: ownptr_same return CefTranslatorTestScopedLibraryCToCpp::Wrap(_retval); @@ -1212,7 +1212,7 @@ int CefTranslatorTestCToCpp::SetChildOwnPtrLibrary( // Execute int _retval = _struct->set_child_own_ptr_library( _struct, - CefTranslatorTestScopedLibraryChildCToCpp::UnwrapOwn(OWN_PASS(val))); + CefTranslatorTestScopedLibraryChildCToCpp::UnwrapOwn(std::move(val))); // Return type: simple return _retval; @@ -1239,7 +1239,7 @@ CefOwnPtr CefTranslatorTestCToCpp:: cef_translator_test_scoped_library_t* _retval = _struct->set_child_own_ptr_library_and_return_parent( _struct, - CefTranslatorTestScopedLibraryChildCToCpp::UnwrapOwn(OWN_PASS(val))); + CefTranslatorTestScopedLibraryChildCToCpp::UnwrapOwn(std::move(val))); // Return type: ownptr_same return CefTranslatorTestScopedLibraryCToCpp::Wrap(_retval); @@ -1263,7 +1263,7 @@ int CefTranslatorTestCToCpp::SetOwnPtrClient( // Execute int _retval = _struct->set_own_ptr_client( - _struct, CefTranslatorTestScopedClientCppToC::WrapOwn(OWN_PASS(val))); + _struct, CefTranslatorTestScopedClientCppToC::WrapOwn(std::move(val))); // Return type: simple return _retval; @@ -1288,7 +1288,8 @@ CefOwnPtr CefTranslatorTestCToCpp:: // Execute cef_translator_test_scoped_client_t* _retval = _struct->set_own_ptr_client_and_return( - _struct, CefTranslatorTestScopedClientCppToC::WrapOwn(OWN_PASS(val))); + _struct, + CefTranslatorTestScopedClientCppToC::WrapOwn(std::move(val))); // Return type: ownptr_diff return CefTranslatorTestScopedClientCppToC::UnwrapOwn(_retval); @@ -1313,7 +1314,7 @@ int CefTranslatorTestCToCpp::SetChildOwnPtrClient( // Execute int _retval = _struct->set_child_own_ptr_client( _struct, - CefTranslatorTestScopedClientChildCppToC::WrapOwn(OWN_PASS(val))); + CefTranslatorTestScopedClientChildCppToC::WrapOwn(std::move(val))); // Return type: simple return _retval; @@ -1340,7 +1341,7 @@ CefOwnPtr CefTranslatorTestCToCpp:: cef_translator_test_scoped_client_t* _retval = _struct->set_child_own_ptr_client_and_return_parent( _struct, - CefTranslatorTestScopedClientChildCppToC::WrapOwn(OWN_PASS(val))); + CefTranslatorTestScopedClientChildCppToC::WrapOwn(std::move(val))); // Return type: ownptr_diff return CefTranslatorTestScopedClientCppToC::UnwrapOwn(_retval); diff --git a/libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.cc b/libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.cc index c32a2f90a..08f1e247b 100644 --- a/libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.cc +++ b/libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=bfa7d52202c1d09dfa86e05df4f60f3b9264e19c$ +// $hash=3768f0baca452bd0aa50e298dcc2166efd11f3db$ // #include "libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.h" @@ -68,8 +68,7 @@ CefCToCppScoped( CefTranslatorTestScopedClientChildCToCpp::UnwrapRaw( CefRawPtr( - reinterpret_cast( - CEF_RAW_PTR_GET(c))))); + reinterpret_cast(c)))); } NOTREACHED() << "Unexpected class type: " << type; return nullptr; diff --git a/libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.cc b/libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.cc index aed7fc454..c8371811a 100644 --- a/libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.cc +++ b/libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=3218861c702d3419a97a3a49b87898e1afc3d55e$ +// $hash=e259f697e1edef88f12eae86d7161a4807438ef7$ // #include "libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.h" @@ -18,9 +18,8 @@ // STATIC METHODS - Body may be edited by hand. NO_SANITIZE("cfi-icall") -CefOwnPtr< - CefTranslatorTestScopedLibraryChild> CefTranslatorTestScopedLibraryChild:: - Create(int value, int other_value) { +CefOwnPtr +CefTranslatorTestScopedLibraryChild::Create(int value, int other_value) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // Execute @@ -129,7 +128,7 @@ CefCToCppScoped( reinterpret_cast( - CEF_RAW_PTR_GET(c))))); + c)))); } NOTREACHED() << "Unexpected class type: " << type; return nullptr; diff --git a/libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.cc b/libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.cc index 324b1d51c..f97bda0d2 100644 --- a/libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.cc +++ b/libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=93bec9c1c78c75b71ca887b790977d027f197a79$ +// $hash=589f29aab564ddcd4eaf69e116e2854a46b8048d$ // #include "libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.h" @@ -19,8 +19,8 @@ // STATIC METHODS - Body may be edited by hand. NO_SANITIZE("cfi-icall") -CefOwnPtr CefTranslatorTestScopedLibrary:: - Create(int value) { +CefOwnPtr +CefTranslatorTestScopedLibrary::Create(int value) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // Execute @@ -103,15 +103,14 @@ CefCToCppScoped( CefTranslatorTestScopedLibraryChildCToCpp::UnwrapRaw( CefRawPtr( - reinterpret_cast( - CEF_RAW_PTR_GET(c))))); + reinterpret_cast(c)))); } if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) { return reinterpret_cast( CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapRaw( CefRawPtr( reinterpret_cast( - CEF_RAW_PTR_GET(c))))); + c)))); } NOTREACHED() << "Unexpected class type: " << type; return nullptr; diff --git a/libcef_dll/ptr_util.h b/libcef_dll/ptr_util.h deleted file mode 100644 index 969232216..000000000 --- a/libcef_dll/ptr_util.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -#ifndef CEF_LIBCEF_DLL_PTR_UTIL_H_ -#define CEF_LIBCEF_DLL_PTR_UTIL_H_ -#pragma once - -// Helpers for CefOwnPtr<>. -#if defined(USING_CHROMIUM_INCLUDES) -#define OWN_PASS(p) std::move(p) -#define OWN_RETURN_AS(p, t) (p) -#else -#define OWN_PASS(p) (p).Pass() -#define OWN_RETURN_AS(p, t) (p).PassAs() -#endif - -#endif // CEF_LIBCEF_DLL_PTR_UTIL_H_ diff --git a/libcef_dll/shutdown_checker.cc b/libcef_dll/shutdown_checker.cc index f369d0345..e5646a7e7 100644 --- a/libcef_dll/shutdown_checker.cc +++ b/libcef_dll/shutdown_checker.cc @@ -4,13 +4,7 @@ #include "libcef_dll/shutdown_checker.h" -// For compatibility with older client compiler versions only use std::atomic -// on the library side. -#if defined(BUILDING_CEF_SHARED) #include -#else -#include "include/base/cef_atomic_ref_count.h" -#endif #include "include/base/cef_logging.h" @@ -20,8 +14,6 @@ namespace shutdown_checker { namespace { -#if defined(BUILDING_CEF_SHARED) - std::atomic_bool g_cef_shutdown{false}; bool IsCefShutdown() { @@ -32,20 +24,6 @@ void SetCefShutdown() { g_cef_shutdown.store(true); } -#else // !defined(BUILDING_CEF_SHARED) - -base::AtomicRefCount g_cef_shutdown ATOMIC_DECLARATION; - -bool IsCefShutdown() { - return !base::AtomicRefCountIsZero(&g_cef_shutdown); -} - -void SetCefShutdown() { - base::AtomicRefCountInc(&g_cef_shutdown); -} - -#endif // !defined(BUILDING_CEF_SHARED) - } // namespace void AssertNotShutdown() { diff --git a/libcef_dll/wrapper/cef_resource_manager.cc b/libcef_dll/wrapper/cef_resource_manager.cc index e9521eefd..c55c2e96d 100644 --- a/libcef_dll/wrapper/cef_resource_manager.cc +++ b/libcef_dll/wrapper/cef_resource_manager.cc @@ -175,7 +175,7 @@ class ArchiveProvider : public CefResourceManager::Provider { password_(password), archive_load_started_(false), archive_load_ended_(false), - ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { + weak_ptr_factory_(this) { DCHECK(!url_path_.empty()); DCHECK(!archive_path_.empty()); @@ -306,7 +306,7 @@ struct CefResourceManager::ProviderEntry { identifier_(identifier), deletion_pending_(false) {} - scoped_ptr provider_; + std::unique_ptr provider_; int order_; std::string identifier_; @@ -362,8 +362,8 @@ void CefResourceManager::Request::Stop() { base::Passed(&state_))); } -CefResourceManager::Request::Request(scoped_ptr state) - : state_(state.Pass()), params_(state_->params_) { +CefResourceManager::Request::Request(std::unique_ptr state) + : state_(std::move(state)), params_(state_->params_) { CEF_REQUIRE_IO_THREAD(); ProviderEntry* entry = *(state_->current_entry_pos_); @@ -379,13 +379,13 @@ CefResourceManager::Request::Request(scoped_ptr state) // handle the request. Note that |state_| may already be NULL if OnRequest // executes a callback before returning, in which case execution will continue // asynchronously in any case. -scoped_ptr +std::unique_ptr CefResourceManager::Request::SendRequest() { CEF_REQUIRE_IO_THREAD(); Provider* provider = (*state_->current_entry_pos_)->provider_.get(); if (!provider->OnRequest(this)) - return state_.Pass(); - return scoped_ptr(); + return std::move(state_); + return std::unique_ptr(); } bool CefResourceManager::Request::HasState() { @@ -395,23 +395,23 @@ bool CefResourceManager::Request::HasState() { // static void CefResourceManager::Request::ContinueOnIOThread( - scoped_ptr state, + std::unique_ptr state, CefRefPtr handler) { CEF_REQUIRE_IO_THREAD(); // The manager may already have been deleted. base::WeakPtr manager = state->manager_; if (manager) - manager->ContinueRequest(state.Pass(), handler); + manager->ContinueRequest(std::move(state), handler); } // static void CefResourceManager::Request::StopOnIOThread( - scoped_ptr state) { + std::unique_ptr state) { CEF_REQUIRE_IO_THREAD(); // The manager may already have been deleted. base::WeakPtr manager = state->manager_; if (manager) - manager->StopRequest(state.Pass()); + manager->StopRequest(std::move(state)); } // CefResourceManager implementation. @@ -472,7 +472,7 @@ void CefResourceManager::AddProvider(Provider* provider, return; } - scoped_ptr new_entry( + std::unique_ptr new_entry( new ProviderEntry(provider, order, identifier)); if (providers_.empty()) { @@ -566,7 +566,7 @@ cef_return_value_t CefResourceManager::OnBeforeResourceLoad( return RV_CONTINUE; } - scoped_ptr state(new RequestState); + std::unique_ptr state(new RequestState); if (!weak_ptr_factory_.get()) { // WeakPtrFactory instances need to be created and destroyed on the same @@ -590,7 +590,7 @@ cef_return_value_t CefResourceManager::OnBeforeResourceLoad( state->current_entry_pos_ = current_entry_pos; // If the request is potentially handled we need to continue asynchronously. - return SendRequest(state.Pass()) ? RV_CONTINUE_ASYNC : RV_CONTINUE; + return SendRequest(std::move(state)) ? RV_CONTINUE_ASYNC : RV_CONTINUE; } CefRefPtr CefResourceManager::GetResourceHandler( @@ -616,13 +616,13 @@ CefRefPtr CefResourceManager::GetResourceHandler( // Send the request to providers in order until one potentially handles it or we // run out of providers. Returns true if the request is potentially handled. -bool CefResourceManager::SendRequest(scoped_ptr state) { +bool CefResourceManager::SendRequest(std::unique_ptr state) { bool potentially_handled = false; do { // Should not be on the last provider entry. DCHECK(state->current_entry_pos_ != providers_.end()); - scoped_refptr request = new Request(state.Pass()); + scoped_refptr request = new Request(std::move(state)); // Give the provider an opportunity to handle the request. state = request->SendRequest(); @@ -630,7 +630,7 @@ bool CefResourceManager::SendRequest(scoped_ptr state) { // The provider will not handle the request. Move to the next provider if // any. if (!IncrementProvider(state.get())) - StopRequest(state.Pass()); + StopRequest(std::move(state)); } else { potentially_handled = true; } @@ -640,7 +640,7 @@ bool CefResourceManager::SendRequest(scoped_ptr state) { } void CefResourceManager::ContinueRequest( - scoped_ptr state, + std::unique_ptr state, CefRefPtr handler) { CEF_REQUIRE_IO_THREAD(); @@ -648,17 +648,17 @@ void CefResourceManager::ContinueRequest( // The request has been handled. Associate the request ID with the handler. pending_handlers_.insert( std::make_pair(state->params_.request_->GetIdentifier(), handler)); - StopRequest(state.Pass()); + StopRequest(std::move(state)); } else { // Move to the next provider if any. if (IncrementProvider(state.get())) - SendRequest(state.Pass()); + SendRequest(std::move(state)); else - StopRequest(state.Pass()); + StopRequest(std::move(state)); } } -void CefResourceManager::StopRequest(scoped_ptr state) { +void CefResourceManager::StopRequest(std::unique_ptr state) { CEF_REQUIRE_IO_THREAD(); // Detach from the current provider. diff --git a/libcef_dll/wrapper/cef_zip_archive.cc b/libcef_dll/wrapper/cef_zip_archive.cc index 63a58e148..8dfdcfb1c 100644 --- a/libcef_dll/wrapper/cef_zip_archive.cc +++ b/libcef_dll/wrapper/cef_zip_archive.cc @@ -5,10 +5,10 @@ #include "include/wrapper/cef_zip_archive.h" #include +#include #include "include/base/cef_logging.h" #include "include/base/cef_macros.h" -#include "include/base/cef_scoped_ptr.h" #include "include/cef_stream.h" #include "include/cef_zip_reader.h" #include "include/wrapper/cef_byte_read_handler.h" @@ -56,7 +56,7 @@ class CefZipFile : public CefZipArchive::File { private: size_t data_size_; - scoped_ptr data_; + std::unique_ptr data_; IMPLEMENT_REFCOUNTING(CefZipFile); DISALLOW_COPY_AND_ASSIGN(CefZipFile); diff --git a/libcef_dll/wrapper/libcef_dll_dylib.cc b/libcef_dll/wrapper/libcef_dll_dylib.cc index 67655ef1d..5fb99d882 100644 --- a/libcef_dll/wrapper/libcef_dll_dylib.cc +++ b/libcef_dll/wrapper/libcef_dll_dylib.cc @@ -9,12 +9,13 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=9fbe1de9cf7f32c551c535e190d4c82b4947765d$ +// $hash=85426bf2da9016443939636319265fff616f1cb4$ // #include #include +#include "include/base/cef_compiler_specific.h" #include "include/capi/cef_app_capi.h" #include "include/capi/cef_browser_capi.h" #include "include/capi/cef_command_line_capi.h" diff --git a/tests/cefclient/browser/browser_window.cc b/tests/cefclient/browser/browser_window.cc index ffe67edbb..355620c3a 100644 --- a/tests/cefclient/browser/browser_window.cc +++ b/tests/cefclient/browser/browser_window.cc @@ -4,7 +4,7 @@ #include "tests/cefclient/browser/browser_window.h" -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "tests/shared/browser/main_message_loop.h" namespace client { diff --git a/tests/cefclient/browser/browser_window.h b/tests/cefclient/browser/browser_window.h index 81c925c6a..314ba1f36 100644 --- a/tests/cefclient/browser/browser_window.h +++ b/tests/cefclient/browser/browser_window.h @@ -6,7 +6,8 @@ #define CEF_TESTS_CEFCLIENT_BROWSER_BROWSER_WINDOW_H_ #pragma once -#include "include/base/cef_scoped_ptr.h" +#include + #include "include/cef_browser.h" #include "tests/cefclient/browser/client_handler.h" #include "tests/cefclient/browser/client_types.h" @@ -110,8 +111,8 @@ class BrowserWindow : public ClientHandler::Delegate { bool IsClosing() const; protected: - // Allow deletion via scoped_ptr only. - friend struct base::DefaultDeleter; + // Allow deletion via std::unique_ptr only. + friend std::default_delete; // Constructor may be called on any thread. // |delegate| must outlive this object. diff --git a/tests/cefclient/browser/browser_window_osr_gtk.cc b/tests/cefclient/browser/browser_window_osr_gtk.cc index 3b73f0c77..4b955f99a 100644 --- a/tests/cefclient/browser/browser_window_osr_gtk.cc +++ b/tests/cefclient/browser/browser_window_osr_gtk.cc @@ -16,6 +16,7 @@ #include #include +#include "include/base/cef_cxx17_backports.h" #include "include/base/cef_logging.h" #include "include/base/cef_macros.h" #include "include/wrapper/cef_closure_task.h" @@ -788,7 +789,7 @@ KeyboardCode GdkEventToWindowsKeyCode(const GdkEventKey* event) { if (windows_key_code) return windows_key_code; - if (event->hardware_keycode < arraysize(kHardwareCodeToGDKKeyval)) { + if (event->hardware_keycode < base::size(kHardwareCodeToGDKKeyval)) { int keyval = kHardwareCodeToGDKKeyval[event->hardware_keycode]; if (keyval) return KeyboardCodeFromXKeysym(keyval); @@ -907,7 +908,7 @@ class ScopedGLContext { ScopedGLContext(GtkWidget* widget, bool swap_buffers) : swap_buffers_(swap_buffers), widget_(widget) { gtk_gl_area_make_current(GTK_GL_AREA(widget)); - is_valid_ = gtk_gl_area_get_error(GTK_GL_AREA(widget)) == NULL; + is_valid_ = gtk_gl_area_get_error(GTK_GL_AREA(widget)) == nullptr; if (swap_buffers_ && is_valid_) { gtk_gl_area_queue_render(GTK_GL_AREA(widget_)); gtk_gl_area_attach_buffers(GTK_GL_AREA(widget)); @@ -939,12 +940,12 @@ BrowserWindowOsrGtk::BrowserWindowOsrGtk(BrowserWindow::Delegate* delegate, gl_enabled_(false), painting_popup_(false), hidden_(false), - glarea_(NULL), + glarea_(nullptr), drag_trigger_event_(nullptr), drag_data_(nullptr), drag_operation_(DRAG_OPERATION_NONE), drag_context_(nullptr), - drag_targets_(gtk_target_list_new(NULL, 0)), + drag_targets_(gtk_target_list_new(nullptr, 0)), drag_leave_(false), drag_drop_(false), device_scale_factor_(1.0f) { @@ -1115,8 +1116,8 @@ void BrowserWindowOsrGtk::OnBeforeClose(CefRefPtr browser) { UnregisterDragDrop(); // Disconnect all signal handlers that reference |this|. - g_signal_handlers_disconnect_matched(glarea_, G_SIGNAL_MATCH_DATA, 0, 0, NULL, - NULL, this); + g_signal_handlers_disconnect_matched(glarea_, G_SIGNAL_MATCH_DATA, 0, 0, + nullptr, nullptr, this); DisableGL(); } @@ -1775,7 +1776,8 @@ void BrowserWindowOsrGtk::RegisterDragDrop() { // Default values for drag threshold are set to 8 pixels in both GTK and // Chromium, but doesn't work as expected. // --OFF-- - // gtk_drag_source_set(glarea_, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_COPY); + // gtk_drag_source_set(glarea_, GDK_BUTTON1_MASK, nullptr, 0, + // GDK_ACTION_COPY); // Source widget events. g_signal_connect(G_OBJECT(glarea_), "drag_begin", @@ -1786,7 +1788,7 @@ void BrowserWindowOsrGtk::RegisterDragDrop() { G_CALLBACK(&BrowserWindowOsrGtk::DragEnd), this); // Destination widget and its events. - gtk_drag_dest_set(glarea_, (GtkDestDefaults)0, (GtkTargetEntry*)NULL, 0, + gtk_drag_dest_set(glarea_, (GtkDestDefaults)0, (GtkTargetEntry*)nullptr, 0, (GdkDragAction)GDK_ACTION_COPY); g_signal_connect(G_OBJECT(glarea_), "drag_motion", G_CALLBACK(&BrowserWindowOsrGtk::DragMotion), this); @@ -1859,9 +1861,10 @@ void BrowserWindowOsrGtk::DragBegin(GtkWidget* widget, gboolean success = FALSE; loader = gdk_pixbuf_loader_new_with_type("png", &error); if (error == nullptr && loader) { - success = gdk_pixbuf_loader_write(loader, image_buffer, image_size, NULL); + success = + gdk_pixbuf_loader_write(loader, image_buffer, image_size, nullptr); if (success) { - success = gdk_pixbuf_loader_close(loader, NULL); + success = gdk_pixbuf_loader_close(loader, nullptr); if (success) { pixbuf = gdk_pixbuf_loader_get_pixbuf(loader); if (pixbuf) { diff --git a/tests/cefclient/browser/browser_window_osr_mac.h b/tests/cefclient/browser/browser_window_osr_mac.h index 94be309df..2755d5e6f 100644 --- a/tests/cefclient/browser/browser_window_osr_mac.h +++ b/tests/cefclient/browser/browser_window_osr_mac.h @@ -91,7 +91,7 @@ class BrowserWindowOsrMac : public BrowserWindow, void UpdateAccessibilityLocation(CefRefPtr value) override; private: - scoped_ptr impl_; + std::unique_ptr impl_; DISALLOW_COPY_AND_ASSIGN(BrowserWindowOsrMac); diff --git a/tests/cefclient/browser/browser_window_osr_mac.mm b/tests/cefclient/browser/browser_window_osr_mac.mm index 5418d84eb..26163bc87 100644 --- a/tests/cefclient/browser/browser_window_osr_mac.mm +++ b/tests/cefclient/browser/browser_window_osr_mac.mm @@ -142,8 +142,8 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) { } - (void)detach { - renderer_ = NULL; - browser_window_ = NULL; + renderer_ = nullptr; + browser_window_ = nullptr; if (text_input_client_) [text_input_client_ detach]; } @@ -151,7 +151,7 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) { - (CefRefPtr)getBrowser { if (browser_window_) return browser_window_->GetBrowser(); - return NULL; + return nullptr; } - (void)setFrame:(NSRect)frameRect { @@ -475,12 +475,12 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) { - (BOOL)canBecomeKeyView { CefRefPtr browser = [self getBrowser]; - return (browser.get() != NULL); + return (browser.get() != nullptr); } - (BOOL)acceptsFirstResponder { CefRefPtr browser = [self getBrowser]; - return (browser.get() != NULL); + return (browser.get() != nullptr); } - (BOOL)becomeFirstResponder { @@ -836,7 +836,7 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) { if (!current_drag_data_) return nil; - size_t expected_size = current_drag_data_->GetFileContents(NULL); + size_t expected_size = current_drag_data_->GetFileContents(nullptr); if (expected_size == 0) return nil; @@ -969,7 +969,7 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) { // File contents. } else if ([type isEqualToString:fileUTI_]) { - size_t size = current_drag_data_->GetFileContents(NULL); + size_t size = current_drag_data_->GetFileContents(nullptr); DCHECK_GT(size, 0U); CefRefPtr handler = new client::BytesWriteHandler(size); @@ -1025,7 +1025,7 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) { // Add Root as first Kid NSMutableArray* kids = [NSMutableArray arrayWithCapacity:1]; NSObject* child = CAST_CEF_NATIVE_ACCESSIBLE_TO_NSOBJECT( - node->GetNativeAccessibleObject(NULL)); + node->GetNativeAccessibleObject(nullptr)); [kids addObject:child]; return NSAccessibilityUnignoredChildren(kids); } else { @@ -1037,7 +1037,7 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) { if (accessibility_helper_) { client::OsrAXNode* node = accessibility_helper_->GetFocusedNode(); return node ? CAST_CEF_NATIVE_ACCESSIBLE_TO_NSOBJECT( - node->GetNativeAccessibleObject(NULL)) + node->GetNativeAccessibleObject(nullptr)) : nil; } return nil; @@ -1047,7 +1047,7 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) { - (void)resetDragDrop { current_drag_op_ = NSDragOperationNone; current_allowed_ops_ = NSDragOperationNone; - current_drag_data_ = NULL; + current_drag_data_ = nullptr; if (fileUTI_) { #if !__has_feature(objc_arc) [fileUTI_ release]; @@ -1079,7 +1079,7 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) { // MIME type. CefString mimeType; - size_t contents_size = current_drag_data_->GetFileContents(NULL); + size_t contents_size = current_drag_data_->GetFileContents(nullptr); CefString download_metadata = current_drag_data_->GetLinkMetadata(); CefString file_name = current_drag_data_->GetFileName(); @@ -1097,7 +1097,7 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) { mimeType.ToString().c_str(), kCFStringEncodingUTF8); fileUTI_ = (__bridge NSString*)UTTypeCreatePreferredIdentifierForTag( - kUTTagClassMIMEType, mimeTypeCF, NULL); + kUTTagClassMIMEType, mimeTypeCF, nullptr); CFRelease(mimeTypeCF); // File (HFS) promise. NSArray* fileUTIList = @[ fileUTI_ ]; diff --git a/tests/cefclient/browser/browser_window_osr_win.cc b/tests/cefclient/browser/browser_window_osr_win.cc index 053c655b7..ac3081d46 100644 --- a/tests/cefclient/browser/browser_window_osr_win.cc +++ b/tests/cefclient/browser/browser_window_osr_win.cc @@ -11,7 +11,7 @@ namespace client { BrowserWindowOsrWin::BrowserWindowOsrWin(BrowserWindow::Delegate* delegate, const std::string& startup_url, const OsrRendererSettings& settings) - : BrowserWindow(delegate), osr_hwnd_(NULL), device_scale_factor_(0) { + : BrowserWindow(delegate), osr_hwnd_(nullptr), device_scale_factor_(0) { osr_window_ = new OsrWindowWin(this, settings); client_handler_ = new ClientHandlerOsr(this, osr_window_.get(), startup_url); } diff --git a/tests/cefclient/browser/browser_window_std_gtk.cc b/tests/cefclient/browser/browser_window_std_gtk.cc index 4810f527f..f832a373d 100644 --- a/tests/cefclient/browser/browser_window_std_gtk.cc +++ b/tests/cefclient/browser/browser_window_std_gtk.cc @@ -43,7 +43,7 @@ void SetXWindowVisible(XDisplay* xdisplay, ::Window xwindow, bool visible) { if (!visible) { // Set the hidden property state value. - scoped_ptr data(new Atom[1]); + std::unique_ptr data(new Atom[1]); data[0] = atoms[2]; XChangeProperty(xdisplay, xwindow, @@ -59,7 +59,7 @@ void SetXWindowVisible(XDisplay* xdisplay, ::Window xwindow, bool visible) { atoms[0], // name atoms[1], // type 32, // size in bits of items in 'value' - PropModeReplace, NULL, + PropModeReplace, nullptr, 0); // num items } } @@ -182,7 +182,7 @@ ClientWindowHandle BrowserWindowStdGtk::GetWindowHandle() const { // There is no GtkWidget* representation of this object. NOTREACHED(); - return NULL; + return nullptr; } } // namespace client diff --git a/tests/cefclient/browser/browser_window_std_mac.mm b/tests/cefclient/browser/browser_window_std_mac.mm index c02bb3258..8b000a878 100644 --- a/tests/cefclient/browser/browser_window_std_mac.mm +++ b/tests/cefclient/browser/browser_window_std_mac.mm @@ -88,7 +88,7 @@ ClientWindowHandle BrowserWindowStdMac::GetWindowHandle() const { if (browser_) return browser_->GetHost()->GetWindowHandle(); - return NULL; + return nullptr; } } // namespace client diff --git a/tests/cefclient/browser/browser_window_std_win.cc b/tests/cefclient/browser/browser_window_std_win.cc index f1e53d696..8b17f11ee 100644 --- a/tests/cefclient/browser/browser_window_std_win.cc +++ b/tests/cefclient/browser/browser_window_std_win.cc @@ -62,7 +62,7 @@ void BrowserWindowStdWin::ShowPopup(ClientWindowHandle parent_handle, HWND hwnd = GetWindowHandle(); if (hwnd) { SetParent(hwnd, parent_handle); - SetWindowPos(hwnd, NULL, x, y, static_cast(width), + SetWindowPos(hwnd, nullptr, x, y, static_cast(width), static_cast(height), SWP_NOZORDER | SWP_NOACTIVATE); const bool no_activate = @@ -86,7 +86,7 @@ void BrowserWindowStdWin::Hide() { if (hwnd) { // When the frame window is minimized set the browser window size to 0x0 to // reduce resource usage. - SetWindowPos(hwnd, NULL, 0, 0, 0, 0, + SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); } } @@ -97,7 +97,7 @@ void BrowserWindowStdWin::SetBounds(int x, int y, size_t width, size_t height) { HWND hwnd = GetWindowHandle(); if (hwnd) { // Set the browser window bounds. - SetWindowPos(hwnd, NULL, x, y, static_cast(width), + SetWindowPos(hwnd, nullptr, x, y, static_cast(width), static_cast(height), SWP_NOZORDER); } } @@ -114,7 +114,7 @@ ClientWindowHandle BrowserWindowStdWin::GetWindowHandle() const { if (browser_) return browser_->GetHost()->GetWindowHandle(); - return NULL; + return nullptr; } } // namespace client diff --git a/tests/cefclient/browser/client_handler.cc b/tests/cefclient/browser/client_handler.cc index 0a8d2b5ee..1af059bc1 100644 --- a/tests/cefclient/browser/client_handler.cc +++ b/tests/cefclient/browser/client_handler.cc @@ -10,7 +10,7 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_browser.h" #include "include/cef_frame.h" #include "include/cef_parser.h" diff --git a/tests/cefclient/browser/client_handler_osr.cc b/tests/cefclient/browser/client_handler_osr.cc index 90271b7f3..bc1e98b66 100644 --- a/tests/cefclient/browser/client_handler_osr.cc +++ b/tests/cefclient/browser/client_handler_osr.cc @@ -4,7 +4,7 @@ #include "tests/cefclient/browser/client_handler_osr.h" -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_helpers.h" diff --git a/tests/cefclient/browser/dialog_handler_gtk.cc b/tests/cefclient/browser/dialog_handler_gtk.cc index 2522ffb66..81758be71 100644 --- a/tests/cefclient/browser/dialog_handler_gtk.cc +++ b/tests/cefclient/browser/dialog_handler_gtk.cc @@ -275,7 +275,7 @@ void ClientDialogHandlerGtk::OnFileDialogContinue(OnFileDialogParams params, GtkWidget* dialog = gtk_file_chooser_dialog_new( title_str.c_str(), GTK_WINDOW(window), action, "_Cancel", - GTK_RESPONSE_CANCEL, accept_button, GTK_RESPONSE_ACCEPT, NULL); + GTK_RESPONSE_CANCEL, accept_button, GTK_RESPONSE_ACCEPT, nullptr); if (mode_type == FILE_DIALOG_OPEN_MULTIPLE) gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE); @@ -402,7 +402,7 @@ void ClientDialogHandlerGtk::OnJSDialogContinue(OnJSDialogParams params, gtk_message_type, buttons, "%s", params.message_text.ToString().c_str()); g_signal_connect(gtk_dialog_, "delete-event", - G_CALLBACK(gtk_widget_hide_on_delete), NULL); + G_CALLBACK(gtk_widget_hide_on_delete), nullptr); gtk_window_set_title(GTK_WINDOW(gtk_dialog_), title.c_str()); diff --git a/tests/cefclient/browser/image_cache.h b/tests/cefclient/browser/image_cache.h index fa43c8de6..7d92589ab 100644 --- a/tests/cefclient/browser/image_cache.h +++ b/tests/cefclient/browser/image_cache.h @@ -9,7 +9,7 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/base/cef_ref_counted.h" #include "include/cef_image.h" #include "include/wrapper/cef_closure_task.h" diff --git a/tests/cefclient/browser/main_context_impl.h b/tests/cefclient/browser/main_context_impl.h index cdbba75a9..7b7cef689 100644 --- a/tests/cefclient/browser/main_context_impl.h +++ b/tests/cefclient/browser/main_context_impl.h @@ -6,7 +6,8 @@ #define CEF_TESTS_CEFCLIENT_BROWSER_MAIN_CONTEXT_IMPL_H_ #pragma once -#include "include/base/cef_scoped_ptr.h" +#include + #include "include/base/cef_thread_checker.h" #include "include/cef_app.h" #include "include/cef_command_line.h" @@ -48,8 +49,8 @@ class MainContextImpl : public MainContext { void Shutdown(); private: - // Allow deletion via scoped_ptr only. - friend struct base::DefaultDeleter; + // Allow deletion via std::unique_ptr only. + friend std::default_delete; ~MainContextImpl(); @@ -75,7 +76,7 @@ class MainContextImpl : public MainContext { bool use_views_; bool touch_events_enabled_; - scoped_ptr root_window_manager_; + std::unique_ptr root_window_manager_; #if defined(OS_WIN) bool shared_texture_enabled_; diff --git a/tests/cefclient/browser/main_context_impl_win.cc b/tests/cefclient/browser/main_context_impl_win.cc index 0bbfbf22f..d85c6e9a4 100644 --- a/tests/cefclient/browser/main_context_impl_win.cc +++ b/tests/cefclient/browser/main_context_impl_win.cc @@ -14,8 +14,8 @@ std::string MainContextImpl::GetDownloadPath(const std::string& file_name) { std::string path; // Save the file in the user's "My Documents" folder. - if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, - 0, szFolderPath))) { + if (SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, + nullptr, 0, szFolderPath))) { path = CefString(szFolderPath); path += "\\" + file_name; } diff --git a/tests/cefclient/browser/main_message_loop_multithreaded_gtk.cc b/tests/cefclient/browser/main_message_loop_multithreaded_gtk.cc index 36e4b5ab3..876948e4c 100644 --- a/tests/cefclient/browser/main_message_loop_multithreaded_gtk.cc +++ b/tests/cefclient/browser/main_message_loop_multithreaded_gtk.cc @@ -7,7 +7,7 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/base/cef_logging.h" #include "include/wrapper/cef_closure_task.h" diff --git a/tests/cefclient/browser/main_message_loop_multithreaded_win.cc b/tests/cefclient/browser/main_message_loop_multithreaded_win.cc index 39912ceaf..2f6b23427 100644 --- a/tests/cefclient/browser/main_message_loop_multithreaded_win.cc +++ b/tests/cefclient/browser/main_message_loop_multithreaded_win.cc @@ -4,7 +4,7 @@ #include "tests/cefclient/browser/main_message_loop_multithreaded_win.h" -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/base/cef_logging.h" #include "include/cef_app.h" #include "tests/cefclient/browser/resource.h" @@ -22,8 +22,8 @@ const wchar_t kTaskMessageName[] = L"Client_CustomTask"; MainMessageLoopMultithreadedWin::MainMessageLoopMultithreadedWin() : thread_id_(base::PlatformThread::CurrentId()), task_message_id_(RegisterWindowMessage(kTaskMessageName)), - dialog_hwnd_(NULL), - message_hwnd_(NULL) {} + dialog_hwnd_(nullptr), + message_hwnd_(nullptr) {} MainMessageLoopMultithreadedWin::~MainMessageLoopMultithreadedWin() { DCHECK(RunsTasksOnCurrentThread()); @@ -34,7 +34,7 @@ MainMessageLoopMultithreadedWin::~MainMessageLoopMultithreadedWin() { int MainMessageLoopMultithreadedWin::Run() { DCHECK(RunsTasksOnCurrentThread()); - HINSTANCE hInstance = ::GetModuleHandle(NULL); + HINSTANCE hInstance = ::GetModuleHandle(nullptr); { base::AutoLock lock_scope(lock_); @@ -59,7 +59,7 @@ int MainMessageLoopMultithreadedWin::Run() { MSG msg; // Run the application message loop. - while (GetMessage(&msg, NULL, 0, 0)) { + while (GetMessage(&msg, nullptr, 0, 0)) { // Allow processing of dialog messages. if (dialog_hwnd_ && IsDialogMessage(dialog_hwnd_, &msg)) continue; @@ -75,7 +75,7 @@ int MainMessageLoopMultithreadedWin::Run() { // Destroy the message window. DestroyWindow(message_hwnd_); - message_hwnd_ = NULL; + message_hwnd_ = nullptr; } return static_cast(msg.wParam); @@ -142,7 +142,7 @@ MainMessageLoopMultithreadedWin::MessageWndProc(HWND hWnd, switch (message) { case WM_NCDESTROY: // Clear the reference to |self|. - SetUserDataPtr(hWnd, NULL); + SetUserDataPtr(hWnd, nullptr); break; } } diff --git a/tests/cefclient/browser/media_router_test.cc b/tests/cefclient/browser/media_router_test.cc index 71b9f6de4..9c7144b97 100644 --- a/tests/cefclient/browser/media_router_test.cc +++ b/tests/cefclient/browser/media_router_test.cc @@ -74,7 +74,7 @@ class MediaRouteCreateCallback : public CefMediaRouteCreateCallback { } else { SendFailure(create_callback_, kRequestFailedError + result, error); } - create_callback_ = NULL; + create_callback_ = nullptr; } private: @@ -257,7 +257,7 @@ class MediaObserver : public CefMediaObserver { CefRefPtr GetSource(const std::string& source_urn) { CefRefPtr source = media_router_->GetSource(source_urn); if (!source) - return NULL; + return nullptr; return source; } @@ -265,7 +265,7 @@ class MediaObserver : public CefMediaObserver { SinkInfoMap::const_iterator it = sink_info_map_.find(sink_id); if (it != sink_info_map_.end()) return it->second->sink; - return NULL; + return nullptr; } void ClearSinkInfoMap() { @@ -299,7 +299,7 @@ class MediaObserver : public CefMediaObserver { RouteMap::const_iterator it = route_map_.find(route_id); if (it != route_map_.end()) return it->second; - return NULL; + return nullptr; } void SendResponse(const std::string& name, @@ -574,7 +574,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler { if (it != subscription_state_map_.end()) { return it->second->observer; } - return NULL; + return nullptr; } // Map of browser ID to SubscriptionState object. diff --git a/tests/cefclient/browser/osr_accessibility_node.cc b/tests/cefclient/browser/osr_accessibility_node.cc index befa25ff0..fdee83f2a 100644 --- a/tests/cefclient/browser/osr_accessibility_node.cc +++ b/tests/cefclient/browser/osr_accessibility_node.cc @@ -97,7 +97,7 @@ void OsrAXNode::UpdateValue(CefRefPtr value) { CefWindowHandle OsrAXNode::GetWindowHandle() const { if (accessibility_helper_) return accessibility_helper_->GetWindowHandle(); - return NULL; + return nullptr; } CefRefPtr OsrAXNode::GetBrowser() const { diff --git a/tests/cefclient/browser/osr_dragdrop_win.cc b/tests/cefclient/browser/osr_dragdrop_win.cc index cdd95b824..c880ac02c 100644 --- a/tests/cefclient/browser/osr_dragdrop_win.cc +++ b/tests/cefclient/browser/osr_dragdrop_win.cc @@ -62,7 +62,7 @@ void GetStorageForBytes(STGMEDIUM* storage, const void* data, size_t bytes) { storage->hGlobal = handle; storage->tymed = TYMED_HGLOBAL; - storage->pUnkForRelease = NULL; + storage->pUnkForRelease = nullptr; } template @@ -86,7 +86,7 @@ void GetStorageForFileDescriptor(STGMEDIUM* storage, storage->tymed = TYMED_HGLOBAL; storage->hGlobal = hdata; - storage->pUnkForRelease = NULL; + storage->pUnkForRelease = nullptr; } // Helper method for converting from text/html to MS CF_HTML. @@ -202,7 +202,7 @@ void CFHtmlToHtml(const std::string& cf_html, size_t frag_start = std::string::npos; size_t frag_end = std::string::npos; - CFHtmlExtractMetadata(cf_html, base_url, NULL, &frag_start, &frag_end); + CFHtmlExtractMetadata(cf_html, base_url, nullptr, &frag_start, &frag_end); if (html && frag_start != std::string::npos && frag_end != std::string::npos) { @@ -221,7 +221,7 @@ bool DragDataToDataObject(CefRefPtr drag_data, const int kMaxDataObjects = 10; FORMATETC fmtetcs[kMaxDataObjects]; STGMEDIUM stgmeds[kMaxDataObjects]; - FORMATETC fmtetc = {0, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; + FORMATETC fmtetc = {0, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; int curr_index = 0; CefString text = drag_data->GetFragmentText(); if (!text.empty()) { @@ -249,7 +249,7 @@ bool DragDataToDataObject(CefRefPtr drag_data, curr_index++; } - size_t bufferSize = drag_data->GetFileContents(NULL); + size_t bufferSize = drag_data->GetFileContents(nullptr); if (bufferSize) { CefRefPtr handler = new BytesWriteHandler(bufferSize); CefRefPtr writer = @@ -559,7 +559,7 @@ HRESULT DataObjectWin::QueryGetData(FORMATETC* pFormatEtc) { HRESULT DataObjectWin::GetCanonicalFormatEtc(FORMATETC* pFormatEct, FORMATETC* pFormatEtcOut) { - pFormatEtcOut->ptd = NULL; + pFormatEtcOut->ptd = nullptr; return E_NOTIMPL; } diff --git a/tests/cefclient/browser/osr_ime_handler_win.cc b/tests/cefclient/browser/osr_ime_handler_win.cc index aac4d3d2a..b497deb17 100644 --- a/tests/cefclient/browser/osr_ime_handler_win.cc +++ b/tests/cefclient/browser/osr_ime_handler_win.cc @@ -14,10 +14,12 @@ #include "tests/shared/browser/main_message_loop.h" #include "tests/shared/browser/util_win.h" -#define ColorUNDERLINE 0xFF000000 // Black SkColor value for underline, - // same as Blink. -#define ColorBKCOLOR 0x00000000 // White SkColor value for background, - // same as Blink. +#define ColorUNDERLINE \ + 0xFF000000 // Black SkColor value for underline, + // same as Blink. +#define ColorBKCOLOR \ + 0x00000000 // White SkColor value for background, + // same as Blink. namespace client { @@ -35,7 +37,7 @@ bool IsSelectionAttribute(char attribute) { void GetCompositionSelectionRange(HIMC imc, int* target_start, int* target_end) { - int attribute_size = ::ImmGetCompositionString(imc, GCS_COMPATTR, NULL, 0); + int attribute_size = ::ImmGetCompositionString(imc, GCS_COMPATTR, nullptr, 0); if (attribute_size > 0) { int start = 0; int end = 0; @@ -64,7 +66,7 @@ void GetCompositionUnderlines( int target_start, int target_end, std::vector& underlines) { - int clause_size = ::ImmGetCompositionString(imc, GCS_COMPCLAUSE, NULL, 0); + int clause_size = ::ImmGetCompositionString(imc, GCS_COMPCLAUSE, nullptr, 0); int clause_length = clause_size / sizeof(uint32); if (clause_length) { std::vector clause_data(clause_length); @@ -131,7 +133,7 @@ void OsrImeHandlerWin::CreateImeWindow() { if (PRIMARYLANGID(input_language_id_) == LANG_CHINESE || PRIMARYLANGID(input_language_id_) == LANG_JAPANESE) { if (!system_caret_) { - if (::CreateCaret(hwnd_, NULL, 1, 1)) + if (::CreateCaret(hwnd_, nullptr, 1, 1)) system_caret_ = true; } } @@ -262,7 +264,7 @@ void OsrImeHandlerWin::GetCompositionInfo( if (!(lparam & CS_NOMOVECARET) && (lparam & GCS_CURSORPOS)) { // IMM32 does not support non-zero-width selection in a composition. So // always use the caret position as selection range. - int cursor = ::ImmGetCompositionString(imc, GCS_CURSORPOS, NULL, 0); + int cursor = ::ImmGetCompositionString(imc, GCS_CURSORPOS, nullptr, 0); composition_start = cursor; } else { composition_start = 0; @@ -304,11 +306,11 @@ bool OsrImeHandlerWin::GetString(HIMC imc, CefString& result) { if (!(lparam & type)) return false; - LONG string_size = ::ImmGetCompositionString(imc, type, NULL, 0); + LONG string_size = ::ImmGetCompositionString(imc, type, nullptr, 0); if (string_size <= 0) return false; - // For trailing NULL - ImmGetCompositionString excludes that. + // For trailing nullptr - ImmGetCompositionString excludes that. string_size += sizeof(WCHAR); std::vector buffer(string_size); @@ -354,7 +356,7 @@ bool OsrImeHandlerWin::GetComposition( void OsrImeHandlerWin::DisableIME() { CleanupComposition(); - ::ImmAssociateContextEx(hwnd_, NULL, 0); + ::ImmAssociateContextEx(hwnd_, nullptr, 0); } void OsrImeHandlerWin::CancelIME() { @@ -370,7 +372,7 @@ void OsrImeHandlerWin::CancelIME() { void OsrImeHandlerWin::EnableIME() { // Load the default IME context. - ::ImmAssociateContextEx(hwnd_, NULL, IACE_DEFAULT); + ::ImmAssociateContextEx(hwnd_, nullptr, IACE_DEFAULT); } void OsrImeHandlerWin::UpdateCaretPosition(int index) { diff --git a/tests/cefclient/browser/osr_render_handler_win.cc b/tests/cefclient/browser/osr_render_handler_win.cc index 8fa9b1692..6c9cb3fca 100644 --- a/tests/cefclient/browser/osr_render_handler_win.cc +++ b/tests/cefclient/browser/osr_render_handler_win.cc @@ -4,7 +4,7 @@ #include "tests/cefclient/browser/osr_render_handler_win.h" -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_helpers.h" #include "tests/shared/browser/util_win.h" diff --git a/tests/cefclient/browser/osr_render_handler_win_d3d11.cc b/tests/cefclient/browser/osr_render_handler_win_d3d11.cc index 67f4d9051..db46691b0 100644 --- a/tests/cefclient/browser/osr_render_handler_win_d3d11.cc +++ b/tests/cefclient/browser/osr_render_handler_win_d3d11.cc @@ -4,7 +4,7 @@ #include "tests/cefclient/browser/osr_render_handler_win_d3d11.h" -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_helpers.h" #include "tests/shared/browser/util_win.h" diff --git a/tests/cefclient/browser/osr_render_handler_win_gl.cc b/tests/cefclient/browser/osr_render_handler_win_gl.cc index 6bfe1ea33..648de1703 100644 --- a/tests/cefclient/browser/osr_render_handler_win_gl.cc +++ b/tests/cefclient/browser/osr_render_handler_win_gl.cc @@ -4,7 +4,7 @@ #include "tests/cefclient/browser/osr_render_handler_win_gl.h" -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_helpers.h" #include "tests/shared/browser/util_win.h" @@ -23,7 +23,7 @@ class ScopedGLContext { DCHECK(result); } ~ScopedGLContext() { - BOOL result = wglMakeCurrent(NULL, NULL); + BOOL result = wglMakeCurrent(nullptr, nullptr); DCHECK(result); if (swap_buffers_) { result = SwapBuffers(hdc_); @@ -43,8 +43,8 @@ OsrRenderHandlerWinGL::OsrRenderHandlerWinGL( HWND hwnd) : OsrRenderHandlerWin(settings, hwnd), renderer_(settings), - hdc_(NULL), - hrc_(NULL), + hdc_(nullptr), + hrc_(nullptr), painting_popup_(false) {} void OsrRenderHandlerWinGL::Initialize(CefRefPtr browser) { @@ -194,8 +194,8 @@ void OsrRenderHandlerWinGL::DisableGL() { ReleaseDC(hwnd(), hdc_); } - hdc_ = NULL; - hrc_ = NULL; + hdc_ = nullptr; + hrc_ = nullptr; } } // namespace client diff --git a/tests/cefclient/browser/osr_window_win.cc b/tests/cefclient/browser/osr_window_win.cc index c74afc463..e87d60b74 100644 --- a/tests/cefclient/browser/osr_window_win.cc +++ b/tests/cefclient/browser/osr_window_win.cc @@ -85,7 +85,7 @@ OsrWindowWin::OsrWindowWin(Delegate* delegate, const OsrRendererSettings& settings) : delegate_(delegate), settings_(settings), - hwnd_(NULL), + hwnd_(nullptr), device_scale_factor_(0), hidden_(false), last_mouse_pos_(), @@ -235,7 +235,7 @@ void OsrWindowWin::SetBounds(int x, int y, size_t width, size_t height) { if (hwnd_) { // Set the browser window bounds. - ::SetWindowPos(hwnd_, NULL, x, y, static_cast(width), + ::SetWindowPos(hwnd_, nullptr, x, y, static_cast(width), static_cast(height), SWP_NOZORDER); } } @@ -277,7 +277,7 @@ void OsrWindowWin::Create(HWND parent_hwnd, const RECT& rect) { DCHECK(parent_hwnd); DCHECK(!::IsRectEmpty(&rect)); - HINSTANCE hInst = ::GetModuleHandle(NULL); + HINSTANCE hInst = ::GetModuleHandle(nullptr); const cef_color_t background_color = MainContext::Get()->GetBackgroundColor(); const HBRUSH background_brush = CreateSolidBrush( @@ -327,7 +327,7 @@ void OsrWindowWin::Create(HWND parent_hwnd, const RECT& rect) { void OsrWindowWin::Destroy() { CEF_REQUIRE_UI_THREAD(); - DCHECK(hwnd_ != NULL); + DCHECK(hwnd_ != nullptr); #if defined(CEF_USE_ATL) // Revoke/delete the drag&drop handler. @@ -340,7 +340,7 @@ void OsrWindowWin::Destroy() { // Destroy the native window. ::DestroyWindow(hwnd_); ime_handler_.reset(); - hwnd_ = NULL; + hwnd_ = nullptr; } void OsrWindowWin::NotifyNativeWindowCreated(HWND hwnd) { @@ -371,10 +371,10 @@ void OsrWindowWin::RegisterOsrClass(HINSTANCE hInstance, wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; - wcex.hIcon = NULL; - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hIcon = nullptr; + wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); wcex.hbrBackground = background_brush; - wcex.lpszMenuName = NULL; + wcex.lpszMenuName = nullptr; wcex.lpszClassName = kWndClass; wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); @@ -552,8 +552,8 @@ LRESULT CALLBACK OsrWindowWin::OsrWndProc(HWND hWnd, case WM_NCDESTROY: // Clear the reference to |self|. - SetUserDataPtr(hWnd, NULL); - self->hwnd_ = NULL; + SetUserDataPtr(hWnd, nullptr); + self->hwnd_ = nullptr; break; } diff --git a/tests/cefclient/browser/osr_window_win.h b/tests/cefclient/browser/osr_window_win.h index fdaaf9c7c..fea8ec42e 100644 --- a/tests/cefclient/browser/osr_window_win.h +++ b/tests/cefclient/browser/osr_window_win.h @@ -6,7 +6,7 @@ #define CEF_TESTS_CEFCLIENT_BROWSER_OSR_WINDOW_WIN_H_ #pragma once -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/base/cef_ref_counted.h" #include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_helpers.h" @@ -173,10 +173,10 @@ class OsrWindowWin const OsrRendererSettings settings_; HWND hwnd_; - scoped_ptr render_handler_; + std::unique_ptr render_handler_; // Class that encapsulates IMM32 APIs and controls IMEs attached to a window. - scoped_ptr ime_handler_; + std::unique_ptr ime_handler_; RECT client_rect_; float device_scale_factor_; @@ -189,7 +189,7 @@ class OsrWindowWin // Class that abstracts the accessibility information received from the // renderer. - scoped_ptr accessibility_handler_; + std::unique_ptr accessibility_handler_; IAccessible* accessibility_root_; #endif diff --git a/tests/cefclient/browser/print_handler_gtk.cc b/tests/cefclient/browser/print_handler_gtk.cc index 3eb098783..0b823f8b5 100644 --- a/tests/cefclient/browser/print_handler_gtk.cc +++ b/tests/cefclient/browser/print_handler_gtk.cc @@ -10,7 +10,7 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/base/cef_logging.h" #include "include/base/cef_macros.h" #include "include/wrapper/cef_helpers.h" @@ -95,7 +95,7 @@ StickyPrintSettingGtk* GetLastUsedSettings() { class GtkPrinterList { public: GtkPrinterList() : default_printer_(nullptr) { - gtk_enumerate_printers(SetPrinter, this, NULL, TRUE); + gtk_enumerate_printers(SetPrinter, this, nullptr, TRUE); } ~GtkPrinterList() { @@ -105,11 +105,11 @@ class GtkPrinterList { } } - // Can return NULL if there's no default printer. E.g. Printer on a laptop + // Can return nullptr if there's no default printer. E.g. Printer on a laptop // is "home_printer", but the laptop is at work. GtkPrinter* default_printer() { return default_printer_; } - // Can return NULL if the printer cannot be found due to: + // Can return nullptr if the printer cannot be found due to: // - Printer list out of sync with printer dialog UI. // - Querying for non-existant printers like 'Print to PDF'. GtkPrinter* GetPrinterWithName(const std::string& name) { @@ -272,8 +272,8 @@ void InitPrintSettings(GtkPrintSettings* settings, printable_area_device_units, true); } -// Returns the GtkWindow* for the browser. Will return NULL when using the Views -// framework. +// Returns the GtkWindow* for the browser. Will return nullptr when using the +// Views framework. GtkWindow* GetWindow(CefRefPtr browser) { scoped_refptr root_window = RootWindow::GetForBrowser(browser->GetIdentifier()); @@ -410,9 +410,9 @@ struct ClientPrintHandlerGtk::PrintHandler { ScopedGdkThreadsEnter scoped_gdk_threads; // TODO(estade): We need a window title here. - dialog_ = gtk_print_unix_dialog_new(NULL, parent); + dialog_ = gtk_print_unix_dialog_new(nullptr, parent); g_signal_connect(dialog_, "delete-event", - G_CALLBACK(gtk_widget_hide_on_delete), NULL); + G_CALLBACK(gtk_widget_hide_on_delete), nullptr); // Set modal so user cannot focus the same tab and press print again. gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE); @@ -441,8 +441,8 @@ struct ClientPrintHandlerGtk::PrintHandler { bool OnPrintJob(const CefString& document_name, const CefString& pdf_file_path, CefRefPtr callback) { - // If |printer_| is NULL then somehow the GTK printer list changed out under - // us. In which case, just bail out. + // If |printer_| is nullptr then somehow the GTK printer list changed out + // under us. In which case, just bail out. if (!printer_) return false; @@ -456,8 +456,8 @@ struct ClientPrintHandlerGtk::PrintHandler { GtkPrintJob* print_job = gtk_print_job_new( document_name.ToString().c_str(), printer_, gtk_settings_, page_setup_); gtk_print_job_set_source_file(print_job, pdf_file_path.ToString().c_str(), - NULL); - gtk_print_job_send(print_job, OnJobCompletedThunk, this, NULL); + nullptr); + gtk_print_job_send(print_job, OnJobCompletedThunk, this, nullptr); return true; } diff --git a/tests/cefclient/browser/root_window.h b/tests/cefclient/browser/root_window.h index b089ba7e7..7ee847dc0 100644 --- a/tests/cefclient/browser/root_window.h +++ b/tests/cefclient/browser/root_window.h @@ -76,7 +76,7 @@ class RootWindow class Delegate { public: // Called to retrieve the CefRequestContext for browser. Only called for - // non-popup browsers. May return NULL. + // non-popup browsers. May return nullptr. virtual CefRefPtr GetRequestContext( RootWindow* root_window) = 0; @@ -129,7 +129,7 @@ class RootWindow // Initialize as a normal window. This will create and show a native window // hosting a single browser instance. This method may be called on any thread. - // |delegate| must be non-NULL and outlive this object. + // |delegate| must be non-nullptr and outlive this object. // Use RootWindowManager::CreateRootWindow() instead of calling this method // directly. virtual void Init(RootWindow::Delegate* delegate, @@ -139,9 +139,9 @@ class RootWindow // Initialize as a popup window. This is used to attach a new native window to // a single browser instance that will be created later. The native window // will be created and shown once the browser is available. This method may be - // called on any thread. |delegate| must be non-NULL and outlive this object. - // Use RootWindowManager::CreateRootWindowAsPopup() instead of calling this - // method directly. Called on the UI thread. + // called on any thread. |delegate| must be non-nullptr and outlive this + // object. Use RootWindowManager::CreateRootWindowAsPopup() instead of calling + // this method directly. Called on the UI thread. virtual void InitAsPopup(RootWindow::Delegate* delegate, bool with_controls, bool with_osr, diff --git a/tests/cefclient/browser/root_window_gtk.cc b/tests/cefclient/browser/root_window_gtk.cc index 51d85d9ba..1e775da2a 100644 --- a/tests/cefclient/browser/root_window_gtk.cc +++ b/tests/cefclient/browser/root_window_gtk.cc @@ -11,7 +11,7 @@ #undef Success // Definition conflicts with cef_message_router.h #undef RootWindow // Definition conflicts with root_window.h -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_app.h" #include "tests/cefclient/browser/browser_window_osr_gtk.h" #include "tests/cefclient/browser/browser_window_std_gtk.h" @@ -40,13 +40,13 @@ void UseDefaultX11VisualForGtk(GtkWidget* widget) { GList* visuals = gdk_screen_list_visuals(screen); GdkX11Screen* x11_screen = GDK_X11_SCREEN(screen); - if (x11_screen == NULL) + if (x11_screen == nullptr) return; Visual* default_xvisual = DefaultVisual(GDK_SCREEN_XDISPLAY(x11_screen), GDK_SCREEN_XNUMBER(x11_screen)); GList* cursor = visuals; - while (cursor != NULL) { + while (cursor != nullptr) { GdkVisual* visual = GDK_X11_VISUAL(cursor->data); if (default_xvisual->visualid == gdk_x11_visual_get_xvisual(visual)->visualid) { @@ -357,25 +357,28 @@ void RootWindowGtk::CreateRootWindow(const CefBrowserSettings& settings, G_CALLBACK(&RootWindowGtk::ToolbarSizeAllocated), this); back_button_ = gtk_tool_button_new( - gtk_image_new_from_icon_name("go-previous", GTK_ICON_SIZE_MENU), NULL); + gtk_image_new_from_icon_name("go-previous", GTK_ICON_SIZE_MENU), + nullptr); g_signal_connect(back_button_, "clicked", G_CALLBACK(&RootWindowGtk::BackButtonClicked), this); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), back_button_, -1 /* append */); forward_button_ = gtk_tool_button_new( - gtk_image_new_from_icon_name("go-next", GTK_ICON_SIZE_MENU), NULL); + gtk_image_new_from_icon_name("go-next", GTK_ICON_SIZE_MENU), nullptr); g_signal_connect(forward_button_, "clicked", G_CALLBACK(&RootWindowGtk::ForwardButtonClicked), this); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), forward_button_, -1 /* append */); reload_button_ = gtk_tool_button_new( - gtk_image_new_from_icon_name("view-refresh", GTK_ICON_SIZE_MENU), NULL); + gtk_image_new_from_icon_name("view-refresh", GTK_ICON_SIZE_MENU), + nullptr); g_signal_connect(reload_button_, "clicked", G_CALLBACK(&RootWindowGtk::ReloadButtonClicked), this); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), reload_button_, -1 /* append */); stop_button_ = gtk_tool_button_new( - gtk_image_new_from_icon_name("process-stop", GTK_ICON_SIZE_MENU), NULL); + gtk_image_new_from_icon_name("process-stop", GTK_ICON_SIZE_MENU), + nullptr); g_signal_connect(stop_button_, "clicked", G_CALLBACK(&RootWindowGtk::StopButtonClicked), this); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), stop_button_, -1 /* append */); @@ -496,7 +499,7 @@ void RootWindowGtk::OnSetFullscreen(bool fullscreen) { CefRefPtr browser = GetBrowser(); if (browser) { - scoped_ptr test_runner( + std::unique_ptr test_runner( new window_test::WindowTestRunnerGtk()); if (fullscreen) test_runner->Maximize(browser); diff --git a/tests/cefclient/browser/root_window_gtk.h b/tests/cefclient/browser/root_window_gtk.h index 0c6f18877..c52e7b67a 100644 --- a/tests/cefclient/browser/root_window_gtk.h +++ b/tests/cefclient/browser/root_window_gtk.h @@ -7,9 +7,9 @@ #pragma once #include +#include #include -#include "include/base/cef_scoped_ptr.h" #include "tests/cefclient/browser/browser_window.h" #include "tests/cefclient/browser/root_window.h" @@ -130,7 +130,7 @@ class RootWindowGtk : public RootWindow, public BrowserWindow::Delegate { bool with_extension_; bool is_popup_; CefRect start_rect_; - scoped_ptr browser_window_; + std::unique_ptr browser_window_; bool initialized_; // Main window. diff --git a/tests/cefclient/browser/root_window_mac.h b/tests/cefclient/browser/root_window_mac.h index 0c0e689cf..575113346 100644 --- a/tests/cefclient/browser/root_window_mac.h +++ b/tests/cefclient/browser/root_window_mac.h @@ -6,9 +6,9 @@ #define CEF_TESTS_CEFCLIENT_BROWSER_ROOT_WINDOW_MAC_H_ #pragma once +#include #include -#include "include/base/cef_scoped_ptr.h" #include "tests/cefclient/browser/browser_window.h" #include "tests/cefclient/browser/root_window.h" diff --git a/tests/cefclient/browser/root_window_mac.mm b/tests/cefclient/browser/root_window_mac.mm index 3e5d4e835..1ad2fb28e 100644 --- a/tests/cefclient/browser/root_window_mac.mm +++ b/tests/cefclient/browser/root_window_mac.mm @@ -6,7 +6,7 @@ #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_app.h" #include "include/cef_application_mac.h" #include "tests/cefclient/browser/browser_window_osr_mac.h" @@ -126,7 +126,7 @@ class RootWindowMacImpl bool with_extension_; bool is_popup_; CefRect start_rect_; - scoped_ptr browser_window_; + std::unique_ptr browser_window_; bool initialized_; // Main window. @@ -328,7 +328,7 @@ CefRefPtr RootWindowMacImpl::GetBrowser() const { if (browser_window_) return browser_window_->GetBrowser(); - return NULL; + return nullptr; } ClientWindowHandle RootWindowMacImpl::GetWindowHandle() const { @@ -487,7 +487,7 @@ void RootWindowMacImpl::CreateRootWindow(const CefBrowserSettings& settings, // Create the browser window. browser_window_->CreateBrowser( CAST_NSVIEW_TO_CEF_WINDOW_HANDLE(contentView), - CefRect(0, 0, width, height), settings, NULL, + CefRect(0, 0, width, height), settings, nullptr, root_window_.delegate_->GetRequestContext(&root_window_)); } else { // With popups we already have a browser window. Parent the browser window @@ -564,7 +564,7 @@ void RootWindowMacImpl::OnSetFullscreen(bool fullscreen) { CefRefPtr browser = GetBrowser(); if (browser) { - scoped_ptr test_runner( + std::unique_ptr test_runner( new window_test::WindowTestRunnerMac()); if (fullscreen) test_runner->Maximize(browser); diff --git a/tests/cefclient/browser/root_window_manager.cc b/tests/cefclient/browser/root_window_manager.cc index 5946b97e8..91cc49971 100644 --- a/tests/cefclient/browser/root_window_manager.cc +++ b/tests/cefclient/browser/root_window_manager.cc @@ -6,7 +6,7 @@ #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/base/cef_logging.h" #include "include/wrapper/cef_helpers.h" #include "tests/cefclient/browser/main_context.h" @@ -196,9 +196,7 @@ bool RootWindowManager::HasRootWindowAsExtension( CefRefPtr extension) { REQUIRE_MAIN_THREAD(); - RootWindowSet::const_iterator it = root_windows_.begin(); - for (; it != root_windows_.end(); ++it) { - const RootWindow* root_window = (*it); + for (auto root_window : root_windows_) { if (!root_window->WithExtension()) continue; @@ -220,11 +218,10 @@ scoped_refptr RootWindowManager::GetWindowForBrowser( int browser_id) const { REQUIRE_MAIN_THREAD(); - RootWindowSet::const_iterator it = root_windows_.begin(); - for (; it != root_windows_.end(); ++it) { - CefRefPtr browser = (*it)->GetBrowser(); + for (auto root_window : root_windows_) { + CefRefPtr browser = root_window->GetBrowser(); if (browser.get() && browser->GetIdentifier() == browser_id) - return *it; + return root_window; } return nullptr; } @@ -254,9 +251,9 @@ void RootWindowManager::CloseAllWindows(bool force) { // in OnRootWindowDestroyed while iterating. RootWindowSet root_windows = root_windows_; - RootWindowSet::const_iterator it = root_windows.begin(); - for (; it != root_windows.end(); ++it) - (*it)->Close(force); + for (auto root_window : root_windows_) { + root_window->Close(force); + } } void RootWindowManager::AddExtension(CefRefPtr extension) { @@ -298,7 +295,7 @@ void RootWindowManager::OnRootWindowCreated( if (root_windows_.size() == 1U) { // The first non-extension root window should be considered the active // window. - OnRootWindowActivated(root_window); + OnRootWindowActivated(root_window.get()); } } } @@ -306,9 +303,7 @@ void RootWindowManager::OnRootWindowCreated( void RootWindowManager::NotifyExtensionsChanged() { REQUIRE_MAIN_THREAD(); - RootWindowSet::const_iterator it = root_windows_.begin(); - for (; it != root_windows_.end(); ++it) { - RootWindow* root_window = *it; + for (auto root_window : root_windows_) { if (!root_window->WithExtension()) root_window->OnExtensionsChanged(extensions_); } @@ -335,7 +330,7 @@ CefRefPtr RootWindowManager::GetRequestContext( // isolated context objects. std::stringstream ss; ss << command_line->GetSwitchValue(switches::kCachePath).ToString() - << file_util::kPathSep << time(NULL); + << file_util::kPathSep << time(nullptr); CefString(&settings.cache_path) = ss.str(); } } @@ -410,7 +405,7 @@ void RootWindowManager::OnRootWindowActivated(RootWindow* root_window) { { base::AutoLock lock_scope(active_browser_lock_); - // May be NULL at this point, in which case we'll make the association in + // May be nullptr at this point, in which case we'll make the association in // OnBrowserCreated. active_browser_ = active_root_window_->GetBrowser(); } diff --git a/tests/cefclient/browser/root_window_manager.h b/tests/cefclient/browser/root_window_manager.h index aed17abe2..84db6e8e0 100644 --- a/tests/cefclient/browser/root_window_manager.h +++ b/tests/cefclient/browser/root_window_manager.h @@ -6,9 +6,9 @@ #define CEF_TESTS_CEFCLIENT_BROWSER_ROOT_WINDOW_MANAGER_H_ #pragma once +#include #include -#include "include/base/cef_scoped_ptr.h" #include "include/cef_command_line.h" #include "include/cef_request_context_handler.h" #include "tests/cefclient/browser/image_cache.h" @@ -62,12 +62,12 @@ class RootWindowManager : public RootWindow::Delegate { // called on the main thread. scoped_refptr GetWindowForBrowser(int browser_id) const; - // Returns the currently active/foreground RootWindow. May return NULL. Must - // be called on the main thread. + // Returns the currently active/foreground RootWindow. May return nullptr. + // Must be called on the main thread. scoped_refptr GetActiveRootWindow() const; - // Returns the currently active/foreground browser. May return NULL. Safe to - // call from any thread. + // Returns the currently active/foreground browser. May return nullptr. Safe + // to call from any thread. CefRefPtr GetActiveBrowser() const; // Close all existing windows. If |force| is true onunload handlers will not @@ -83,8 +83,8 @@ class RootWindowManager : public RootWindow::Delegate { } private: - // Allow deletion via scoped_ptr only. - friend struct base::DefaultDeleter; + // Allow deletion via std::unique_ptr only. + friend std::default_delete; ~RootWindowManager(); @@ -127,7 +127,7 @@ class RootWindowManager : public RootWindow::Delegate { CefRefPtr active_browser_; // Singleton window used as the temporary parent for popup browsers. - scoped_ptr temp_window_; + std::unique_ptr temp_window_; CefRefPtr shared_request_context_; diff --git a/tests/cefclient/browser/root_window_views.cc b/tests/cefclient/browser/root_window_views.cc index 0165a9c26..b08537da1 100644 --- a/tests/cefclient/browser/root_window_views.cc +++ b/tests/cefclient/browser/root_window_views.cc @@ -4,8 +4,9 @@ #include "tests/cefclient/browser/root_window_views.h" -#include "include/base/cef_bind.h" #include "include/base/cef_build.h" +#include "include/base/cef_callback.h" +#include "include/base/cef_cxx17_backports.h" #include "include/cef_app.h" #include "include/wrapper/cef_helpers.h" #include "tests/cefclient/browser/client_handler_std.h" @@ -178,7 +179,7 @@ ClientWindowHandle RootWindowViews::GetWindowHandle() const { REQUIRE_MAIN_THREAD(); #if defined(OS_LINUX) // ClientWindowHandle is a GtkWidget* on Linux and we don't have one of those. - return NULL; + return nullptr; #else if (browser_) return browser_->GetHost()->GetWindowHandle(); @@ -490,7 +491,7 @@ void RootWindowViews::InitOnUIThread( // Populate the default image cache. ImageCache::ImageInfoSet image_set; - for (size_t i = 0U; i < arraysize(kDefaultImageCache); ++i) + for (size_t i = 0U; i < base::size(kDefaultImageCache); ++i) image_set.push_back(ImageCache::ImageInfo::Create2x(kDefaultImageCache[i])); image_cache_->LoadImages( @@ -508,8 +509,8 @@ void RootWindowViews::CreateViewsWindow( #ifndef NDEBUG // Make sure the default images loaded successfully. - DCHECK_EQ(images.size(), arraysize(kDefaultImageCache)); - for (size_t i = 0U; i < arraysize(kDefaultImageCache); ++i) { + DCHECK_EQ(images.size(), base::size(kDefaultImageCache)); + for (size_t i = 0U; i < base::size(kDefaultImageCache); ++i) { DCHECK(images[i]) << "Default image " << i << " failed to load"; } #endif diff --git a/tests/cefclient/browser/root_window_views.h b/tests/cefclient/browser/root_window_views.h index d21d2957f..5b4d23030 100644 --- a/tests/cefclient/browser/root_window_views.h +++ b/tests/cefclient/browser/root_window_views.h @@ -6,9 +6,9 @@ #define CEF_TESTS_CEFCLIENT_BROWSER_ROOT_WINDOW_VIEWS_H_ #pragma once +#include #include -#include "include/base/cef_scoped_ptr.h" #include "tests/cefclient/browser/client_handler.h" #include "tests/cefclient/browser/root_window.h" #include "tests/cefclient/browser/views_window.h" diff --git a/tests/cefclient/browser/root_window_win.cc b/tests/cefclient/browser/root_window_win.cc index dd208db0c..8080ec9b3 100644 --- a/tests/cefclient/browser/root_window_win.cc +++ b/tests/cefclient/browser/root_window_win.cc @@ -6,8 +6,8 @@ #include -#include "include/base/cef_bind.h" #include "include/base/cef_build.h" +#include "include/base/cef_callback.h" #include "include/cef_app.h" #include "tests/cefclient/browser/browser_window_osr_win.h" #include "tests/cefclient/browser/browser_window_std_win.h" @@ -109,19 +109,19 @@ RootWindowWin::RootWindowWin() is_popup_(false), start_rect_(), initialized_(false), - hwnd_(NULL), - draggable_region_(NULL), - font_(NULL), + hwnd_(nullptr), + draggable_region_(nullptr), + font_(nullptr), font_height_(0), - back_hwnd_(NULL), - forward_hwnd_(NULL), - reload_hwnd_(NULL), - stop_hwnd_(NULL), - edit_hwnd_(NULL), - edit_wndproc_old_(NULL), - find_hwnd_(NULL), + back_hwnd_(nullptr), + forward_hwnd_(nullptr), + reload_hwnd_(nullptr), + stop_hwnd_(nullptr), + edit_hwnd_(nullptr), + edit_wndproc_old_(nullptr), + find_hwnd_(nullptr), find_message_id_(0), - find_wndproc_old_(NULL), + find_wndproc_old_(nullptr), find_state_(), find_next_(false), find_match_case_last_(false), @@ -248,7 +248,7 @@ void RootWindowWin::SetBounds(int x, int y, size_t width, size_t height) { REQUIRE_MAIN_THREAD(); if (hwnd_) { - SetWindowPos(hwnd_, NULL, x, y, static_cast(width), + SetWindowPos(hwnd_, nullptr, x, y, static_cast(width), static_cast(height), SWP_NOZORDER); } } @@ -319,7 +319,7 @@ void RootWindowWin::CreateRootWindow(const CefBrowserSettings& settings, REQUIRE_MAIN_THREAD(); DCHECK(!hwnd_); - HINSTANCE hInstance = GetModuleHandle(NULL); + HINSTANCE hInstance = GetModuleHandle(nullptr); // Load strings from the resource file. const std::wstring& window_title = GetResourceString(IDS_APP_TITLE); @@ -367,7 +367,7 @@ void RootWindowWin::CreateRootWindow(const CefBrowserSettings& settings, // Create the main window initially hidden. CreateWindowEx(dwExStyle, window_class.c_str(), window_title.c_str(), dwStyle, - x, y, width, height, NULL, NULL, hInstance, this); + x, y, width, height, nullptr, nullptr, hInstance, this); CHECK(hwnd_); if (!called_enable_non_client_dpi_scaling_ && IsProcessPerMonitorDpiAware()) { @@ -408,7 +408,7 @@ void RootWindowWin::RegisterRootClass(HINSTANCE hInstance, wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_CEFCLIENT)); - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); wcex.hbrBackground = background_brush; wcex.lpszMenuName = MAKEINTRESOURCE(IDC_CEFCLIENT); wcex.lpszClassName = window_class.c_str(); @@ -447,8 +447,8 @@ LRESULT CALLBACK RootWindowWin::EditWndProc(HWND hWnd, break; case WM_NCDESTROY: // Clear the reference to |self|. - SetUserDataPtr(hWnd, NULL); - self->edit_hwnd_ = NULL; + SetUserDataPtr(hWnd, nullptr); + self->edit_hwnd_ = nullptr; break; } @@ -469,13 +469,13 @@ LRESULT CALLBACK RootWindowWin::FindWndProc(HWND hWnd, switch (message) { case WM_ACTIVATE: // Set this dialog as current when activated. - MainMessageLoop::Get()->SetCurrentModelessDialog(wParam == 0 ? NULL + MainMessageLoop::Get()->SetCurrentModelessDialog(wParam == 0 ? nullptr : hWnd); return FALSE; case WM_NCDESTROY: // Clear the reference to |self|. - SetUserDataPtr(hWnd, NULL); - self->find_hwnd_ = NULL; + SetUserDataPtr(hWnd, nullptr); + self->find_hwnd_ = nullptr; break; } @@ -607,8 +607,8 @@ LRESULT CALLBACK RootWindowWin::RootWndProc(HWND hWnd, case WM_NCDESTROY: // Clear the reference to |self|. - SetUserDataPtr(hWnd, NULL); - self->hwnd_ = NULL; + SetUserDataPtr(hWnd, nullptr); + self->hwnd_ = nullptr; self->OnDestroyed(); break; } @@ -683,30 +683,30 @@ void RootWindowWin::OnSize(bool minimized) { int x_offset = rect.left; - // |browser_hwnd| may be NULL if the browser has not yet been created. - HWND browser_hwnd = NULL; + // |browser_hwnd| may be nullptr if the browser has not yet been created. + HWND browser_hwnd = nullptr; if (browser_window_) browser_hwnd = browser_window_->GetWindowHandle(); // Resize all controls. HDWP hdwp = BeginDeferWindowPos(browser_hwnd ? 6 : 5); - hdwp = DeferWindowPos(hdwp, back_hwnd_, NULL, x_offset, 0, button_width, + hdwp = DeferWindowPos(hdwp, back_hwnd_, nullptr, x_offset, 0, button_width, urlbar_height, SWP_NOZORDER); x_offset += button_width; - hdwp = DeferWindowPos(hdwp, forward_hwnd_, NULL, x_offset, 0, button_width, + hdwp = DeferWindowPos(hdwp, forward_hwnd_, nullptr, x_offset, 0, + button_width, urlbar_height, SWP_NOZORDER); + x_offset += button_width; + hdwp = DeferWindowPos(hdwp, reload_hwnd_, nullptr, x_offset, 0, + button_width, urlbar_height, SWP_NOZORDER); + x_offset += button_width; + hdwp = DeferWindowPos(hdwp, stop_hwnd_, nullptr, x_offset, 0, button_width, urlbar_height, SWP_NOZORDER); x_offset += button_width; - hdwp = DeferWindowPos(hdwp, reload_hwnd_, NULL, x_offset, 0, button_width, - urlbar_height, SWP_NOZORDER); - x_offset += button_width; - hdwp = DeferWindowPos(hdwp, stop_hwnd_, NULL, x_offset, 0, button_width, - urlbar_height, SWP_NOZORDER); - x_offset += button_width; - hdwp = DeferWindowPos(hdwp, edit_hwnd_, NULL, x_offset, 0, + hdwp = DeferWindowPos(hdwp, edit_hwnd_, nullptr, x_offset, 0, rect.right - x_offset, urlbar_height, SWP_NOZORDER); if (browser_hwnd) { - hdwp = DeferWindowPos(hdwp, browser_hwnd, NULL, rect.left, rect.top, + hdwp = DeferWindowPos(hdwp, browser_hwnd, nullptr, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER); } @@ -849,7 +849,7 @@ void RootWindowWin::OnFindEvent() { void RootWindowWin::OnAbout() { // Show the about box. - DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_ABOUTBOX), hwnd_, + DialogBox(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDD_ABOUTBOX), hwnd_, AboutWndProc); } @@ -936,7 +936,7 @@ void RootWindowWin::OnCreate(LPCREATESTRUCT lpCreateStruct) { } } else { // No controls so also remove the default menu. - ::SetMenu(hwnd_, NULL); + ::SetMenu(hwnd_, nullptr); } const float device_scale_factor = GetWindowScaleFactor(hwnd_); @@ -1032,7 +1032,7 @@ void RootWindowWin::OnSetFullscreen(bool fullscreen) { CefRefPtr browser = GetBrowser(); if (browser) { - scoped_ptr test_runner( + std::unique_ptr test_runner( new window_test::WindowTestRunnerWin()); if (fullscreen) test_runner->Maximize(browser); @@ -1058,7 +1058,7 @@ void RootWindowWin::OnAutoResize(const CefSize& new_size) { LogicalToDevice(new_size.height, device_scale_factor)}; DWORD style = GetWindowLong(hwnd_, GWL_STYLE); DWORD ex_style = GetWindowLong(hwnd_, GWL_EXSTYLE); - bool has_menu = !(style & WS_CHILD) && (GetMenu(hwnd_) != NULL); + bool has_menu = !(style & WS_CHILD) && (GetMenu(hwnd_) != nullptr); // The size value is for the client area. Calculate the whole window size // based on the current style. @@ -1066,7 +1066,7 @@ void RootWindowWin::OnAutoResize(const CefSize& new_size) { // Size the window. The left/top values may be negative. // Also show the window if it's not currently visible. - SetWindowPos(hwnd_, NULL, 0, 0, rect.right - rect.left, + SetWindowPos(hwnd_, nullptr, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW); } diff --git a/tests/cefclient/browser/root_window_win.h b/tests/cefclient/browser/root_window_win.h index 514562a57..ebf2bd8fc 100644 --- a/tests/cefclient/browser/root_window_win.h +++ b/tests/cefclient/browser/root_window_win.h @@ -10,9 +10,9 @@ #include +#include #include -#include "include/base/cef_scoped_ptr.h" #include "tests/cefclient/browser/browser_window.h" #include "tests/cefclient/browser/root_window.h" @@ -117,7 +117,7 @@ class RootWindowWin : public RootWindow, public BrowserWindow::Delegate { bool with_extension_; bool is_popup_; RECT start_rect_; - scoped_ptr browser_window_; + std::unique_ptr browser_window_; CefBrowserSettings browser_settings_; bool initialized_; diff --git a/tests/cefclient/browser/server_test.cc b/tests/cefclient/browser/server_test.cc index 574443922..93516af21 100644 --- a/tests/cefclient/browser/server_test.cc +++ b/tests/cefclient/browser/server_test.cc @@ -7,7 +7,7 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/base/cef_weak_ptr.h" #include "include/cef_parser.h" #include "include/cef_server.h" diff --git a/tests/cefclient/browser/temp_window_mac.h b/tests/cefclient/browser/temp_window_mac.h index c64062f2c..feded5ccf 100644 --- a/tests/cefclient/browser/temp_window_mac.h +++ b/tests/cefclient/browser/temp_window_mac.h @@ -22,13 +22,13 @@ class TempWindowMac { private: // A single instance will be created/owned by RootWindowManager. friend class RootWindowManager; - // Allow deletion via scoped_ptr only. - friend struct base::DefaultDeleter; + // Allow deletion via std::unique_ptr only. + friend std::default_delete; TempWindowMac(); ~TempWindowMac(); - scoped_ptr impl_; + std::unique_ptr impl_; DISALLOW_COPY_AND_ASSIGN(TempWindowMac); }; diff --git a/tests/cefclient/browser/temp_window_mac.mm b/tests/cefclient/browser/temp_window_mac.mm index 6aff01cd7..e28ad40cc 100644 --- a/tests/cefclient/browser/temp_window_mac.mm +++ b/tests/cefclient/browser/temp_window_mac.mm @@ -13,7 +13,7 @@ namespace client { namespace { -TempWindowMac* g_temp_window = NULL; +TempWindowMac* g_temp_window = nullptr; } // namespace @@ -46,7 +46,7 @@ TempWindowMac::TempWindowMac() { TempWindowMac::~TempWindowMac() { impl_.reset(); - g_temp_window = NULL; + g_temp_window = nullptr; } // static diff --git a/tests/cefclient/browser/temp_window_win.cc b/tests/cefclient/browser/temp_window_win.cc index af5cdf9e6..2bd74614c 100644 --- a/tests/cefclient/browser/temp_window_win.cc +++ b/tests/cefclient/browser/temp_window_win.cc @@ -16,7 +16,7 @@ const wchar_t kWndClass[] = L"Client_TempWindow"; // Create the temp window. HWND CreateTempWindow() { - HINSTANCE hInstance = ::GetModuleHandle(NULL); + HINSTANCE hInstance = ::GetModuleHandle(nullptr); WNDCLASSEX wc = {0}; wc.cbSize = sizeof(wc); @@ -27,14 +27,14 @@ HWND CreateTempWindow() { // Create a 1x1 pixel hidden window. return CreateWindow(kWndClass, 0, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, 0, 0, - 1, 1, NULL, NULL, hInstance, NULL); + 1, 1, nullptr, nullptr, hInstance, nullptr); } TempWindowWin* g_temp_window = nullptr; } // namespace -TempWindowWin::TempWindowWin() : hwnd_(NULL) { +TempWindowWin::TempWindowWin() : hwnd_(nullptr) { DCHECK(!g_temp_window); g_temp_window = this; diff --git a/tests/cefclient/browser/temp_window_win.h b/tests/cefclient/browser/temp_window_win.h index b5f312ebf..2716a3800 100644 --- a/tests/cefclient/browser/temp_window_win.h +++ b/tests/cefclient/browser/temp_window_win.h @@ -20,8 +20,8 @@ class TempWindowWin { private: // A single instance will be created/owned by RootWindowManager. friend class RootWindowManager; - // Allow deletion via scoped_ptr only. - friend struct base::DefaultDeleter; + // Allow deletion via std::unique_ptr only. + friend std::default_delete; TempWindowWin(); ~TempWindowWin(); diff --git a/tests/cefclient/browser/temp_window_x11.h b/tests/cefclient/browser/temp_window_x11.h index 08e452e67..849d02f02 100644 --- a/tests/cefclient/browser/temp_window_x11.h +++ b/tests/cefclient/browser/temp_window_x11.h @@ -20,8 +20,8 @@ class TempWindowX11 { private: // A single instance will be created/owned by RootWindowManager. friend class RootWindowManager; - // Allow deletion via scoped_ptr only. - friend struct base::DefaultDeleter; + // Allow deletion via std::unique_ptr only. + friend std::default_delete; TempWindowX11(); ~TempWindowX11(); diff --git a/tests/cefclient/browser/test_runner.cc b/tests/cefclient/browser/test_runner.cc index aaa459bb8..69611ac26 100644 --- a/tests/cefclient/browser/test_runner.cc +++ b/tests/cefclient/browser/test_runner.cc @@ -8,7 +8,7 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_parser.h" #include "include/cef_task.h" #include "include/cef_trace.h" diff --git a/tests/cefclient/browser/text_input_client_osr_mac.mm b/tests/cefclient/browser/text_input_client_osr_mac.mm index 8532708ed..3ced03292 100644 --- a/tests/cefclient/browser/text_input_client_osr_mac.mm +++ b/tests/cefclient/browser/text_input_client_osr_mac.mm @@ -71,7 +71,7 @@ extern NSString* NSTextInputReplacementRangeAttributeName; } - (void)detach { - browser_ = NULL; + browser_ = nullptr; } - (NSArray*)validAttributesForMarkedText { @@ -226,8 +226,8 @@ extern NSString* NSTextInputReplacementRangeAttributeName; - (NSRect)firstRectForCharacterRange:(NSRange)theRange actualRange:(NSRangePointer)actualRange { - NSRect rect = - [self firstViewRectForCharacterRange:theRange actualRange:actualRange]; + NSRect rect = [self firstViewRectForCharacterRange:theRange + actualRange:actualRange]; // Convert into screen coordinates for return. rect = [self screenRectFromViewRect:rect]; diff --git a/tests/cefclient/browser/urlrequest_test.cc b/tests/cefclient/browser/urlrequest_test.cc index e30744322..d008751dc 100644 --- a/tests/cefclient/browser/urlrequest_test.cc +++ b/tests/cefclient/browser/urlrequest_test.cc @@ -6,7 +6,6 @@ #include -#include "include/base/cef_bind.h" #include "include/base/cef_callback.h" #include "include/base/cef_logging.h" #include "include/cef_urlrequest.h" diff --git a/tests/cefclient/browser/views_menu_bar.h b/tests/cefclient/browser/views_menu_bar.h index 1e7f4e4aa..656fd3b18 100644 --- a/tests/cefclient/browser/views_menu_bar.h +++ b/tests/cefclient/browser/views_menu_bar.h @@ -47,11 +47,11 @@ class ViewsMenuBar : public CefMenuButtonDelegate, public CefMenuModelDelegate { // Returns the CefPanel that represents the menu bar. CefRefPtr GetMenuPanel(); - // Create a new menu with the specified |label|. If |menu_id| is non-NULL it - // will be populated with the new menu ID. + // Create a new menu with the specified |label|. If |menu_id| is non-nullptr + // it will be populated with the new menu ID. CefRefPtr CreateMenuModel(const CefString& label, int* menu_id); - // Returns the menu with the specified |menu_id|, or NULL if no such menu + // Returns the menu with the specified |menu_id|, or nullptr if no such menu // exists. CefRefPtr GetMenuModel(int menu_id) const; diff --git a/tests/cefclient/browser/views_window.cc b/tests/cefclient/browser/views_window.cc index dce5a653c..73f0a7328 100644 --- a/tests/cefclient/browser/views_window.cc +++ b/tests/cefclient/browser/views_window.cc @@ -6,8 +6,8 @@ #include -#include "include/base/cef_bind.h" #include "include/base/cef_build.h" +#include "include/base/cef_callback.h" #include "include/cef_app.h" #include "include/views/cef_box_layout.h" #include "include/wrapper/cef_helpers.h" @@ -313,7 +313,7 @@ void ViewsWindow::OnExtensionsChanged(const ExtensionSet& extensions) { image_set.push_back( ImageCache::ImageInfo::Create1x(icon_path, icon_path, internal)); } else { - // Get a NULL image and use the default icon. + // Get a nullptr image and use the default icon. image_set.push_back(ImageCache::ImageInfo::Empty()); } } diff --git a/tests/cefclient/browser/views_window.h b/tests/cefclient/browser/views_window.h index a261a9af0..d729de283 100644 --- a/tests/cefclient/browser/views_window.h +++ b/tests/cefclient/browser/views_window.h @@ -174,7 +174,8 @@ class ViewsWindow : public CefBrowserViewDelegate, private: // |delegate| is guaranteed to outlive this object. - // |browser_view| may be NULL, in which case SetBrowserView() will be called. + // |browser_view| may be nullptr, in which case SetBrowserView() will be + // called. ViewsWindow(Delegate* delegate, CefRefPtr browser_view); void SetBrowserView(CefRefPtr browser_view); diff --git a/tests/cefclient/browser/window_test.cc b/tests/cefclient/browser/window_test.cc index 6fa85aa34..8211e1eba 100644 --- a/tests/cefclient/browser/window_test.cc +++ b/tests/cefclient/browser/window_test.cc @@ -9,7 +9,7 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/wrapper/cef_stream_resource_handler.h" #include "tests/cefclient/browser/main_context.h" #include "tests/cefclient/browser/test_runner.h" @@ -39,18 +39,18 @@ const char kMessageMaximizeName[] = "WindowTest.Maximize"; const char kMessageRestoreName[] = "WindowTest.Restore"; // Create the appropriate platform test runner object. -scoped_ptr CreateWindowTestRunner() { +std::unique_ptr CreateWindowTestRunner() { #if defined(OS_WIN) || defined(OS_LINUX) if (MainContext::Get()->UseViews()) - return scoped_ptr(new WindowTestRunnerViews()); + return std::make_unique(); #endif #if defined(OS_WIN) - return scoped_ptr(new WindowTestRunnerWin()); + return std::make_unique(); #elif defined(OS_LINUX) - return scoped_ptr(new WindowTestRunnerGtk()); + return std::make_unique(); #elif defined(OS_MAC) - return scoped_ptr(new WindowTestRunnerMac()); + return std::make_unique(); #else #error "No implementation available for your platform." #endif @@ -109,7 +109,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler { } private: - scoped_ptr runner_; + std::unique_ptr runner_; }; } // namespace diff --git a/tests/cefclient/browser/window_test_runner_win.cc b/tests/cefclient/browser/window_test_runner_win.cc index de03c96ee..1faf6a158 100644 --- a/tests/cefclient/browser/window_test_runner_win.cc +++ b/tests/cefclient/browser/window_test_runner_win.cc @@ -65,7 +65,7 @@ void SetPosImpl(CefRefPtr browser, ::ShowWindow(root_hwnd, SW_RESTORE); } else { // Set the window position. - ::SetWindowPos(root_hwnd, NULL, window_rect.x, window_rect.y, + ::SetWindowPos(root_hwnd, nullptr, window_rect.x, window_rect.y, window_rect.width, window_rect.height, SWP_NOZORDER); } } diff --git a/tests/cefclient/cefclient_gtk.cc b/tests/cefclient/cefclient_gtk.cc index 0ef64e6cd..d551b79cc 100644 --- a/tests/cefclient/cefclient_gtk.cc +++ b/tests/cefclient/cefclient_gtk.cc @@ -10,10 +10,10 @@ #include #include +#include #include #include "include/base/cef_logging.h" -#include "include/base/cef_scoped_ptr.h" #include "include/cef_app.h" #include "include/cef_command_line.h" #include "include/wrapper/cef_helpers.h" @@ -83,7 +83,7 @@ int RunMain(int argc, char* argv[]) { return exit_code; // Create the main context object. - scoped_ptr context(new MainContextImpl(command_line, true)); + auto context = std::make_unique(command_line, true); CefSettings settings; @@ -105,7 +105,7 @@ int RunMain(int argc, char* argv[]) { } // Create the main message loop object. - scoped_ptr message_loop; + std::unique_ptr message_loop; if (settings.multi_threaded_message_loop) message_loop.reset(new MainMessageLoopMultithreadedGtk); else if (settings.external_message_pump) diff --git a/tests/cefclient/cefclient_mac.mm b/tests/cefclient/cefclient_mac.mm index 0e452aeae..dbd9d88f7 100644 --- a/tests/cefclient/cefclient_mac.mm +++ b/tests/cefclient/cefclient_mac.mm @@ -381,7 +381,7 @@ int RunMain(int argc, char* argv[]) { app = new ClientAppBrowser(); // Create the main context object. - scoped_ptr context( + std::unique_ptr context( new MainContextImpl(command_line, true)); CefSettings settings; @@ -397,14 +397,14 @@ int RunMain(int argc, char* argv[]) { context->PopulateSettings(&settings); // Create the main message loop object. - scoped_ptr message_loop; + std::unique_ptr message_loop; if (settings.external_message_pump) message_loop = MainMessageLoopExternalPump::Create(); else message_loop.reset(new MainMessageLoopStd); // Initialize CEF. - context->Initialize(main_args, settings, app, NULL); + context->Initialize(main_args, settings, app, nullptr); // Register scheme handlers. test_runner::RegisterSchemeHandlers(); diff --git a/tests/cefclient/cefclient_win.cc b/tests/cefclient/cefclient_win.cc index 74166bb16..e446376d9 100644 --- a/tests/cefclient/cefclient_win.cc +++ b/tests/cefclient/cefclient_win.cc @@ -4,7 +4,8 @@ #include -#include "include/base/cef_scoped_ptr.h" +#include + #include "include/cef_command_line.h" #include "include/cef_sandbox_win.h" #include "tests/cefclient/browser/main_context_impl.h" @@ -68,7 +69,7 @@ int RunMain(HINSTANCE hInstance, int nCmdShow) { return exit_code; // Create the main context object. - scoped_ptr context(new MainContextImpl(command_line, true)); + auto context = std::make_unique(command_line, true); CefSettings settings; @@ -84,7 +85,7 @@ int RunMain(HINSTANCE hInstance, int nCmdShow) { context->PopulateSettings(&settings); // Create the main message loop object. - scoped_ptr message_loop; + std::unique_ptr message_loop; if (settings.multi_threaded_message_loop) message_loop.reset(new MainMessageLoopMultithreadedWin); else if (settings.external_message_pump) diff --git a/tests/cefsimple/cefsimple_mac.mm b/tests/cefsimple/cefsimple_mac.mm index 240794a55..35c00d1a6 100644 --- a/tests/cefsimple/cefsimple_mac.mm +++ b/tests/cefsimple/cefsimple_mac.mm @@ -158,7 +158,7 @@ int main(int argc, char* argv[]) { CefRefPtr app(new SimpleApp); // Initialize CEF for the browser process. - CefInitialize(main_args, settings, app.get(), NULL); + CefInitialize(main_args, settings, app.get(), nullptr); // Create the application delegate. NSObject* delegate = [[SimpleAppDelegate alloc] init]; diff --git a/tests/cefsimple/simple_app.cc b/tests/cefsimple/simple_app.cc index 189a1d584..8562fafe9 100644 --- a/tests/cefsimple/simple_app.cc +++ b/tests/cefsimple/simple_app.cc @@ -119,7 +119,7 @@ void SimpleApp::OnContextInitialized() { #if defined(OS_WIN) // On Windows we need to specify certain flags that will be passed to // CreateWindowEx(). - window_info.SetAsPopup(NULL, "cefsimple"); + window_info.SetAsPopup(nullptr, "cefsimple"); #endif // Create the first browser window. diff --git a/tests/cefsimple/simple_handler.cc b/tests/cefsimple/simple_handler.cc index 334893377..5c4ae7938 100644 --- a/tests/cefsimple/simple_handler.cc +++ b/tests/cefsimple/simple_handler.cc @@ -7,7 +7,7 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_app.h" #include "include/cef_parser.h" #include "include/views/cef_browser_view.h" diff --git a/tests/ceftests/audio_output_unittest.cc b/tests/ceftests/audio_output_unittest.cc index 981cdb46b..1c659c4b2 100644 --- a/tests/ceftests/audio_output_unittest.cc +++ b/tests/ceftests/audio_output_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/wrapper/cef_closure_task.h" #include "tests/ceftests/test_handler.h" #include "tests/gtest/include/gtest/gtest.h" diff --git a/tests/ceftests/cookie_unittest.cc b/tests/ceftests/cookie_unittest.cc index 62312aaf8..67861d79f 100644 --- a/tests/ceftests/cookie_unittest.cc +++ b/tests/ceftests/cookie_unittest.cc @@ -4,7 +4,7 @@ #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/base/cef_logging.h" #include "include/base/cef_ref_counted.h" #include "include/cef_cookie.h" diff --git a/tests/ceftests/cors_unittest.cc b/tests/ceftests/cors_unittest.cc index 4790df711..70220771e 100644 --- a/tests/ceftests/cors_unittest.cc +++ b/tests/ceftests/cors_unittest.cc @@ -6,7 +6,7 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_callback.h" #include "include/cef_origin_whitelist.h" #include "include/cef_scheme.h" diff --git a/tests/ceftests/devtools_message_unittest.cc b/tests/ceftests/devtools_message_unittest.cc index 13f070eb7..f0e3fcbcc 100644 --- a/tests/ceftests/devtools_message_unittest.cc +++ b/tests/ceftests/devtools_message_unittest.cc @@ -5,7 +5,8 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" +#include "include/base/cef_callback_helpers.h" #include "include/cef_callback.h" #include "include/cef_devtools_message_observer.h" #include "include/cef_parser.h" @@ -281,7 +282,7 @@ class DevToolsMessageTestHandler : public TestHandler { // STEP 3: Page domain notifications are enabled. Now start a new // navigation (but do nothing on method result) and wait for the // "Page.frameNavigated" event. - ExecuteMethod("Page.navigate", params.str(), base::Bind(base::DoNothing), + ExecuteMethod("Page.navigate", params.str(), base::DoNothing(), /*expected_result=*/"{\"frameId\":"); } diff --git a/tests/ceftests/dialog_unittest.cc b/tests/ceftests/dialog_unittest.cc index 800dc1c40..ee98d4dcd 100644 --- a/tests/ceftests/dialog_unittest.cc +++ b/tests/ceftests/dialog_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/wrapper/cef_closure_task.h" #include "tests/ceftests/test_handler.h" #include "tests/ceftests/test_util.h" diff --git a/tests/ceftests/display_unittest.cc b/tests/ceftests/display_unittest.cc index 06ba2113e..62844599f 100644 --- a/tests/ceftests/display_unittest.cc +++ b/tests/ceftests/display_unittest.cc @@ -4,7 +4,7 @@ #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/wrapper/cef_closure_task.h" #include "tests/ceftests/routing_test_handler.h" #include "tests/ceftests/test_handler.h" diff --git a/tests/ceftests/frame_handler_unittest.cc b/tests/ceftests/frame_handler_unittest.cc index 8d30ce17d..a7a1d83c5 100644 --- a/tests/ceftests/frame_handler_unittest.cc +++ b/tests/ceftests/frame_handler_unittest.cc @@ -8,7 +8,7 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/wrapper/cef_closure_task.h" #include "tests/ceftests/routing_test_handler.h" #include "tests/ceftests/test_handler.h" @@ -1483,18 +1483,19 @@ class ParentOrderMainTestHandler : public OrderMainTestHandler { CefRefPtr popup_handler) : OrderMainTestHandler(completion_state), popup_handler_(popup_handler) {} - bool OnBeforePopup(CefRefPtr browser, - CefRefPtr frame, - const CefString& target_url, - const CefString& target_frame_name, - CefLifeSpanHandler::WindowOpenDisposition target_disposition, - bool user_gesture, - const CefPopupFeatures& popupFeatures, - CefWindowInfo& windowInfo, - CefRefPtr& client, - CefBrowserSettings& settings, - CefRefPtr& extra_info, - bool* no_javascript_access) override { + bool OnBeforePopup( + CefRefPtr browser, + CefRefPtr frame, + const CefString& target_url, + const CefString& target_frame_name, + CefLifeSpanHandler::WindowOpenDisposition target_disposition, + bool user_gesture, + const CefPopupFeatures& popupFeatures, + CefWindowInfo& windowInfo, + CefRefPtr& client, + CefBrowserSettings& settings, + CefRefPtr& extra_info, + bool* no_javascript_access) override { // Intentionally not calling the parent class method. EXPECT_FALSE(got_on_before_popup_); got_on_before_popup_.yes(); @@ -1541,8 +1542,8 @@ void RunOrderMainPopupTest(bool cross_origin) { CefRefPtr parent_handler = new ParentOrderMainTestHandler(&completion_state, popup_handler); - collection.AddTestHandler(popup_handler); - collection.AddTestHandler(parent_handler); + collection.AddTestHandler(popup_handler.get()); + collection.AddTestHandler(parent_handler.get()); collection.ExecuteTests(); ReleaseAndWaitForDestructor(parent_handler); diff --git a/tests/ceftests/frame_unittest.cc b/tests/ceftests/frame_unittest.cc index 9a154566a..b300f7cef 100644 --- a/tests/ceftests/frame_unittest.cc +++ b/tests/ceftests/frame_unittest.cc @@ -2,8 +2,9 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" -#include "include/base/cef_scoped_ptr.h" +#include + +#include "include/base/cef_callback.h" #include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_stream_resource_handler.h" #include "tests/ceftests/test_handler.h" @@ -222,7 +223,7 @@ class FrameNavExpectationsFactoryBrowser : public FrameNavExpectationsFactory { FrameNavExpectationsFactoryBrowser() {} // Create a new factory instance of the specified type. - static scoped_ptr FromID( + static std::unique_ptr FromID( FrameNavFactoryId id); // Returns true if there will be more navigations in the browser process @@ -232,18 +233,17 @@ class FrameNavExpectationsFactoryBrowser : public FrameNavExpectationsFactory { // Verify final expectations results. virtual bool Finalize() = 0; - scoped_ptr Create( + std::unique_ptr Create( int nav, const FrameNavExpectations::CompletionCallback& completion_callback) { - scoped_ptr expectations; - expectations = Create(nav); + auto expectations = Create(nav); expectations->set_completion_callback(completion_callback); - return expectations.Pass(); + return expectations; } protected: // Implement in the test-specific factory instance. - virtual scoped_ptr Create(int nav) = 0; + virtual std::unique_ptr Create(int nav) = 0; }; // Renderer process expectations factory abstact base class. @@ -252,21 +252,20 @@ class FrameNavExpectationsFactoryRenderer : public FrameNavExpectationsFactory { FrameNavExpectationsFactoryRenderer() {} // Create a new factory instance of the specified type. - static scoped_ptr FromID( + static std::unique_ptr FromID( FrameNavFactoryId id); - scoped_ptr Create( + std::unique_ptr Create( int nav, const FrameNavExpectations::CompletionCallback& completion_callback) { - scoped_ptr expectations; - expectations = Create(nav); + auto expectations = Create(nav); expectations->set_completion_callback(completion_callback); - return expectations.Pass(); + return expectations; } protected: // Implement in the test-specific factory instance. - virtual scoped_ptr Create(int nav) = 0; + virtual std::unique_ptr Create(int nav) = 0; }; // Renderer side handler. @@ -361,8 +360,8 @@ class FrameNavRendererTest : public ClientAppRenderer::Delegate, bool run_test_; int nav_; - scoped_ptr factory_; - scoped_ptr expectations_; + std::unique_ptr factory_; + std::unique_ptr expectations_; IMPLEMENT_REFCOUNTING(FrameNavRendererTest); }; @@ -514,8 +513,8 @@ class FrameNavTestHandler : public TestHandler { int nav_; TrackCallback got_destroyed_; - scoped_ptr factory_; - scoped_ptr expectations_; + std::unique_ptr factory_; + std::unique_ptr expectations_; IMPLEMENT_REFCOUNTING(FrameNavTestHandler); }; @@ -795,11 +794,11 @@ class FrameNavExpectationsFactoryBrowserTestSingleNavHarness } protected: - scoped_ptr Create(int nav) override { + std::unique_ptr Create(int nav) override { EXPECT_FALSE(got_create_); got_create_.yes(); - return scoped_ptr( - new FrameNavExpectationsBrowserTestSingleNavHarness(nav)); + return std::make_unique( + nav); } private: @@ -816,9 +815,9 @@ class FrameNavExpectationsFactoryRendererTestSingleNavHarness FrameNavFactoryId GetID() const override { return FNF_ID_SINGLE_NAV_HARNESS; } protected: - scoped_ptr Create(int nav) override { - return scoped_ptr( - new FrameNavExpectationsRendererTestSingleNavHarness(nav)); + std::unique_ptr Create(int nav) override { + return std::make_unique( + nav); } }; @@ -1014,9 +1013,8 @@ class FrameNavExpectationsFactoryBrowserTestSingleNav bool Finalize() override { return true; } protected: - scoped_ptr Create(int nav) override { - return scoped_ptr( - new FrameNavExpectationsBrowserTestSingleNav(nav)); + std::unique_ptr Create(int nav) override { + return std::make_unique(nav); } }; @@ -1028,9 +1026,8 @@ class FrameNavExpectationsFactoryRendererTestSingleNav FrameNavFactoryId GetID() const override { return FNF_ID_SINGLE_NAV; } protected: - scoped_ptr Create(int nav) override { - return scoped_ptr( - new FrameNavExpectationsRendererTestSingleNav(nav)); + std::unique_ptr Create(int nav) override { + return std::make_unique(nav); } }; @@ -1340,10 +1337,10 @@ class FrameNavExpectationsFactoryBrowserTestMultiNavHarness } protected: - scoped_ptr Create(int nav) override { + std::unique_ptr Create(int nav) override { create_count_++; - return scoped_ptr( - new FrameNavExpectationsBrowserTestMultiNavHarness(nav)); + return std::make_unique( + nav); } private: @@ -1360,9 +1357,9 @@ class FrameNavExpectationsFactoryRendererTestMultiNavHarness FrameNavFactoryId GetID() const override { return FNF_ID_MULTI_NAV_HARNESS; } protected: - scoped_ptr Create(int nav) override { - return scoped_ptr( - new FrameNavExpectationsRendererTestMultiNavHarness(nav)); + std::unique_ptr Create(int nav) override { + return std::make_unique( + nav); } }; @@ -1570,10 +1567,9 @@ class FrameNavExpectationsFactoryBrowserTestMultiNav } protected: - scoped_ptr Create(int nav) override { + std::unique_ptr Create(int nav) override { nav_count_++; - return scoped_ptr( - new FrameNavExpectationsBrowserTestMultiNav(nav)); + return std::make_unique(nav); } private: @@ -1588,9 +1584,8 @@ class FrameNavExpectationsFactoryRendererTestMultiNav FrameNavFactoryId GetID() const override { return FNF_ID_MULTI_NAV; } protected: - scoped_ptr Create(int nav) override { - return scoped_ptr( - new FrameNavExpectationsRendererTestMultiNav(nav)); + std::unique_ptr Create(int nav) override { + return std::make_unique(nav); } }; @@ -2146,10 +2141,10 @@ class FrameNavExpectationsFactoryBrowserTestNestedIframesSameOrigin } protected: - scoped_ptr Create(int nav) override { + std::unique_ptr Create(int nav) override { create_count_++; - return scoped_ptr( - new FrameNavExpectationsBrowserTestNestedIframes(nav, true)); + return std::make_unique(nav, + true); } private: @@ -2166,9 +2161,9 @@ class FrameNavExpectationsFactoryRendererTestNestedIframesSameOrigin } protected: - scoped_ptr Create(int nav) override { - return scoped_ptr( - new FrameNavExpectationsRendererTestNestedIframes(nav, true)); + std::unique_ptr Create(int nav) override { + return std::make_unique( + nav, true); } }; @@ -2200,10 +2195,10 @@ class FrameNavExpectationsFactoryBrowserTestNestedIframesDiffOrigin } protected: - scoped_ptr Create(int nav) override { + std::unique_ptr Create(int nav) override { create_count_++; - return scoped_ptr( - new FrameNavExpectationsBrowserTestNestedIframes(nav, false)); + return std::make_unique( + nav, false); } private: @@ -2220,9 +2215,9 @@ class FrameNavExpectationsFactoryRendererTestNestedIframesDiffOrigin } protected: - scoped_ptr Create(int nav) override { - return scoped_ptr( - new FrameNavExpectationsRendererTestNestedIframes(nav, false)); + std::unique_ptr Create(int nav) override { + return std::make_unique( + nav, false); } }; @@ -2237,9 +2232,9 @@ namespace { // must be listed here. // static -scoped_ptr +std::unique_ptr FrameNavExpectationsFactoryBrowser::FromID(FrameNavFactoryId id) { - scoped_ptr factory; + std::unique_ptr factory; switch (id) { case FNF_ID_SINGLE_NAV_HARNESS: factory.reset(new FrameNavExpectationsFactoryBrowserTestSingleNavHarness); @@ -2266,13 +2261,13 @@ FrameNavExpectationsFactoryBrowser::FromID(FrameNavFactoryId id) { } EXPECT_TRUE(factory); EXPECT_EQ(id, factory->GetID()); - return factory.Pass(); + return factory; } // static -scoped_ptr +std::unique_ptr FrameNavExpectationsFactoryRenderer::FromID(FrameNavFactoryId id) { - scoped_ptr factory; + std::unique_ptr factory; switch (id) { case FNF_ID_SINGLE_NAV_HARNESS: factory.reset( @@ -2300,7 +2295,7 @@ FrameNavExpectationsFactoryRenderer::FromID(FrameNavFactoryId id) { } EXPECT_TRUE(factory); EXPECT_EQ(id, factory->GetID()); - return factory.Pass(); + return factory; } } // namespace diff --git a/tests/ceftests/jsdialog_unittest.cc b/tests/ceftests/jsdialog_unittest.cc index ae645a13c..3cb59f4ce 100644 --- a/tests/ceftests/jsdialog_unittest.cc +++ b/tests/ceftests/jsdialog_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/test/cef_test_helpers.h" #include "include/wrapper/cef_closure_task.h" #include "tests/ceftests/test_handler.h" diff --git a/tests/ceftests/life_span_unittest.cc b/tests/ceftests/life_span_unittest.cc index 7e71d0467..10107ede8 100644 --- a/tests/ceftests/life_span_unittest.cc +++ b/tests/ceftests/life_span_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/test/cef_test_helpers.h" #include "include/wrapper/cef_closure_task.h" #include "tests/ceftests/routing_test_handler.h" diff --git a/tests/ceftests/message_router_unittest.cc b/tests/ceftests/message_router_unittest.cc index ca848dc6c..72a56bf2f 100644 --- a/tests/ceftests/message_router_unittest.cc +++ b/tests/ceftests/message_router_unittest.cc @@ -7,7 +7,7 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/base/cef_weak_ptr.h" #include "include/cef_v8.h" #include "include/wrapper/cef_closure_task.h" diff --git a/tests/ceftests/navigation_unittest.cc b/tests/ceftests/navigation_unittest.cc index f200b416e..2c529d6e1 100644 --- a/tests/ceftests/navigation_unittest.cc +++ b/tests/ceftests/navigation_unittest.cc @@ -5,7 +5,7 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_callback.h" #include "include/cef_scheme.h" #include "include/wrapper/cef_closure_task.h" diff --git a/tests/ceftests/os_rendering_unittest.cc b/tests/ceftests/os_rendering_unittest.cc index 92e5889bd..c969de2a8 100644 --- a/tests/ceftests/os_rendering_unittest.cc +++ b/tests/ceftests/os_rendering_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/base/cef_logging.h" #include "include/cef_parser.h" #include "include/cef_v8.h" diff --git a/tests/ceftests/osr_accessibility_unittest.cc b/tests/ceftests/osr_accessibility_unittest.cc index 5d6521990..ea8662950 100644 --- a/tests/ceftests/osr_accessibility_unittest.cc +++ b/tests/ceftests/osr_accessibility_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_accessibility_handler.h" #include "include/cef_parser.h" #include "include/cef_waitable_event.h" diff --git a/tests/ceftests/osr_display_unittest.cc b/tests/ceftests/osr_display_unittest.cc index 085572658..67ecf86cd 100644 --- a/tests/ceftests/osr_display_unittest.cc +++ b/tests/ceftests/osr_display_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/wrapper/cef_closure_task.h" #include "tests/ceftests/routing_test_handler.h" @@ -312,7 +312,7 @@ class OsrPopupJSOtherCefClient : public CefClient, public CefLifeSpanHandler, public CefRenderHandler { public: - OsrPopupJSOtherCefClient() { handler_ = NULL; } + OsrPopupJSOtherCefClient() { handler_ = nullptr; } void SetHandler(CefRefPtr handler) { handler_ = handler; diff --git a/tests/ceftests/plugin_unittest.cc b/tests/ceftests/plugin_unittest.cc index 9bdc894d5..38697994c 100644 --- a/tests/ceftests/plugin_unittest.cc +++ b/tests/ceftests/plugin_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_pack_resources.h" #include "include/cef_request_context_handler.h" #include "include/wrapper/cef_closure_task.h" diff --git a/tests/ceftests/preference_unittest.cc b/tests/ceftests/preference_unittest.cc index 737e45f94..c6ba8eaf0 100644 --- a/tests/ceftests/preference_unittest.cc +++ b/tests/ceftests/preference_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_request_context_handler.h" #include "include/cef_waitable_event.h" #include "include/wrapper/cef_closure_task.h" diff --git a/tests/ceftests/process_message_unittest.cc b/tests/ceftests/process_message_unittest.cc index cbb7a8308..92bac0cc7 100644 --- a/tests/ceftests/process_message_unittest.cc +++ b/tests/ceftests/process_message_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_process_message.h" #include "include/cef_task.h" #include "include/wrapper/cef_closure_task.h" diff --git a/tests/ceftests/request_context_unittest.cc b/tests/ceftests/request_context_unittest.cc index c62841d85..e0676ab6f 100644 --- a/tests/ceftests/request_context_unittest.cc +++ b/tests/ceftests/request_context_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_request_context.h" #include "include/cef_request_context_handler.h" #include "include/wrapper/cef_closure_task.h" diff --git a/tests/ceftests/request_handler_unittest.cc b/tests/ceftests/request_handler_unittest.cc index 88b2ebe14..ab7732cbf 100644 --- a/tests/ceftests/request_handler_unittest.cc +++ b/tests/ceftests/request_handler_unittest.cc @@ -4,12 +4,12 @@ #include #include +#include #include #include #include -#include "include/base/cef_bind.h" -#include "include/base/cef_scoped_ptr.h" +#include "include/base/cef_callback.h" #include "include/cef_cookie.h" #include "include/cef_request_context_handler.h" #include "include/wrapper/cef_closure_task.h" @@ -467,7 +467,7 @@ void RunNetNotifyTest(NetNotifyTestType test_type, for (size_t i = 0U; i < count; ++i) { CefRefPtr handler = new NetNotifyTestHandler(&completion_state, test_type, same_origin); - collection.AddTestHandler(handler); + collection.AddTestHandler(handler.get()); handlers.push_back(handler); } diff --git a/tests/ceftests/request_unittest.cc b/tests/ceftests/request_unittest.cc index cf7869754..8b5bf65a1 100644 --- a/tests/ceftests/request_unittest.cc +++ b/tests/ceftests/request_unittest.cc @@ -4,7 +4,7 @@ #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_request.h" #include "include/wrapper/cef_closure_task.h" #include "tests/ceftests/test_handler.h" diff --git a/tests/ceftests/resource_manager_unittest.cc b/tests/ceftests/resource_manager_unittest.cc index ee919cbcb..ceca51644 100644 --- a/tests/ceftests/resource_manager_unittest.cc +++ b/tests/ceftests/resource_manager_unittest.cc @@ -4,7 +4,7 @@ #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_file_util.h" #include "include/cef_waitable_event.h" #include "include/wrapper/cef_closure_task.h" @@ -997,10 +997,11 @@ class EchoProvider : public CefResourceManager::Provider { static_cast(const_cast(content.data())), content.length()); + CefRefPtr handler( + new CefStreamResourceHandler("text/html", stream)); CefPostDelayedTask( TID_IO, - base::Bind(&CefResourceManager::Request::Continue, request, - new CefStreamResourceHandler("text/html", stream)), + base::Bind(&CefResourceManager::Request::Continue, request, handler), delay); return true; diff --git a/tests/ceftests/resource_request_handler_unittest.cc b/tests/ceftests/resource_request_handler_unittest.cc index f5d565652..50e47f2d1 100644 --- a/tests/ceftests/resource_request_handler_unittest.cc +++ b/tests/ceftests/resource_request_handler_unittest.cc @@ -4,11 +4,11 @@ #include #include +#include #include #include -#include "include/base/cef_bind.h" -#include "include/base/cef_scoped_ptr.h" +#include "include/base/cef_callback.h" #include "include/cef_request_context_handler.h" #include "include/cef_scheme.h" #include "include/wrapper/cef_closure_task.h" @@ -3184,7 +3184,7 @@ class RedirectResponseTest : public TestHandler { const bool via_request_context_handler_; int browser_id_ = 0; - scoped_ptr resource_test_; + std::unique_ptr resource_test_; CefRefPtr resource_request_handler_; IMPLEMENT_REFCOUNTING(RedirectResponseTest); @@ -3432,8 +3432,8 @@ const char kInputHeader[] = ""; const char kInputFooter[] = ""; // Repeat |content| the minimum number of times necessary to satisfy -// |desired_min_size|. If |calculated_repeat_ct| is non-NULL it will be set to -// the number of times that |content| was repeated. +// |desired_min_size|. If |calculated_repeat_ct| is non-nullptr it will be set +// to the number of times that |content| was repeated. std::string CreateInput(const std::string& content, size_t desired_min_size, size_t* calculated_repeat_ct = nullptr) { diff --git a/tests/ceftests/run_all_unittests.cc b/tests/ceftests/run_all_unittests.cc index ede6890dc..d6f65b03b 100644 --- a/tests/ceftests/run_all_unittests.cc +++ b/tests/ceftests/run_all_unittests.cc @@ -16,7 +16,7 @@ #include #endif -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_app.h" #include "include/cef_task.h" #include "include/cef_thread.h" @@ -187,7 +187,7 @@ int main(int argc, char* argv[]) { #endif // Create the MessageLoop. - scoped_ptr message_loop; + std::unique_ptr message_loop; if (!settings.multi_threaded_message_loop) { if (settings.external_message_pump) message_loop = client::MainMessageLoopExternalPump::Create(); diff --git a/tests/ceftests/scheme_handler_unittest.cc b/tests/ceftests/scheme_handler_unittest.cc index bcab2b2c3..175bef4b1 100644 --- a/tests/ceftests/scheme_handler_unittest.cc +++ b/tests/ceftests/scheme_handler_unittest.cc @@ -5,7 +5,7 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_callback.h" #include "include/cef_origin_whitelist.h" #include "include/cef_scheme.h" diff --git a/tests/ceftests/server_unittest.cc b/tests/ceftests/server_unittest.cc index f9cc673b6..53f471812 100644 --- a/tests/ceftests/server_unittest.cc +++ b/tests/ceftests/server_unittest.cc @@ -4,11 +4,11 @@ #include #include +#include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/base/cef_ref_counted.h" -#include "include/base/cef_scoped_ptr.h" #include "include/cef_command_line.h" #include "include/cef_server.h" #include "include/cef_task.h" @@ -117,7 +117,8 @@ class TestServerHandler : public CefServerHandler { } // Must be called before CreateServer(). - void AddHttpRequestHandler(scoped_ptr request_handler) { + void AddHttpRequestHandler( + std::unique_ptr request_handler) { EXPECT_FALSE(initialized_); EXPECT_TRUE(request_handler); http_request_handler_list_.push_back(request_handler.release()); @@ -130,7 +131,7 @@ class TestServerHandler : public CefServerHandler { } // Must be called before CreateServer(). - void AddWsRequestHandler(scoped_ptr request_handler) { + void AddWsRequestHandler(std::unique_ptr request_handler) { EXPECT_FALSE(initialized_); EXPECT_TRUE(request_handler); ws_request_handler_list_.push_back(request_handler.release()); @@ -479,7 +480,7 @@ class HttpTestRunner : public base::RefCountedThreadSafe { virtual ~RequestRunner() {} // Create the server-side handler for the request. - virtual scoped_ptr + virtual std::unique_ptr CreateHttpRequestHandler() = 0; // Run the request and execute |complete_callback| on completion. @@ -505,7 +506,7 @@ class HttpTestRunner : public base::RefCountedThreadSafe { destroy_event_->Signal(); } - void AddRequestRunner(scoped_ptr request_runner) { + void AddRequestRunner(std::unique_ptr request_runner) { EXPECT_FALSE(initialized_); request_runner_map_.insert( std::make_pair(++next_request_id_, request_runner.release())); @@ -675,7 +676,7 @@ class HttpTestRunner : public base::RefCountedThreadSafe { TrackCallback got_all_requests_; TrackCallback got_server_destroyed_; - scoped_ptr ui_thread_helper_; + std::unique_ptr ui_thread_helper_; DISALLOW_COPY_AND_ASSIGN(HttpTestRunner); }; @@ -930,7 +931,7 @@ class StaticHttpRequestRunner : public HttpTestRunner::RequestRunner { const HttpServerResponse& response) : request_(request), response_(response) {} - static scoped_ptr Create200( + static std::unique_ptr Create200( const std::string& path, bool with_content = true) { CefRefPtr request = CreateTestServerRequest(path, "GET"); @@ -938,30 +939,27 @@ class StaticHttpRequestRunner : public HttpTestRunner::RequestRunner { response.content_type = "text/html"; if (with_content) response.content = "200 response content"; - return make_scoped_ptr( - new StaticHttpRequestRunner(request, response)); + return std::make_unique(request, response); } - static scoped_ptr Create404( + static std::unique_ptr Create404( const std::string& path) { CefRefPtr request = CreateTestServerRequest(path, "GET"); HttpServerResponse response(HttpServerResponse::TYPE_404); - return make_scoped_ptr( - new StaticHttpRequestRunner(request, response)); + return std::make_unique(request, response); } - static scoped_ptr Create500( + static std::unique_ptr Create500( const std::string& path) { CefRefPtr request = CreateTestServerRequest(path, "GET"); // Don't retry the request. request->SetFlags(UR_FLAG_NO_RETRY_ON_5XX); HttpServerResponse response(HttpServerResponse::TYPE_500); response.error_message = "Something went wrong!"; - return make_scoped_ptr( - new StaticHttpRequestRunner(request, response)); + return std::make_unique(request, response); } - static scoped_ptr CreateCustom( + static std::unique_ptr CreateCustom( const std::string& path, bool with_content = true, bool with_content_length = true) { @@ -985,16 +983,15 @@ class StaticHttpRequestRunner : public HttpTestRunner::RequestRunner { response.extra_headers.insert( std::make_pair("x-response-custom2", "My Value 2")); - return make_scoped_ptr( - new StaticHttpRequestRunner(request, response)); + return std::make_unique(request, response); } - scoped_ptr CreateHttpRequestHandler() - override { + std::unique_ptr + CreateHttpRequestHandler() override { EXPECT_FALSE(got_create_handler_); got_create_handler_.yes(); - return make_scoped_ptr( - new StaticHttpServerRequestHandler(request_, 1, response_)); + return std::make_unique(request_, 1, + response_); } void RunRequest(const base::Closure& complete_callback) override { @@ -1428,11 +1425,10 @@ class EchoWebSocketTestHandler : public WebSocketTestHandler { handler->SetExpectedWsConnectedCount(connection_ct_); handler->SetExpectedWsMessageCount(connection_ct_ * message_ct_); - EchoWebSocketRequestHandler* echo_handler = - new EchoWebSocketRequestHandler(connection_ct_ * message_ct_); + auto echo_handler = std::make_unique( + connection_ct_ * message_ct_); ws_url_ = echo_handler->GetWebSocketUrl(); - handler->AddWsRequestHandler( - make_scoped_ptr(echo_handler)); + handler->AddWsRequestHandler(std::move(echo_handler)); } void OnDoneMessage(const std::string& result) override { diff --git a/tests/ceftests/stream_resource_handler_unittest.cc b/tests/ceftests/stream_resource_handler_unittest.cc index 462f41878..98f3f30c5 100644 --- a/tests/ceftests/stream_resource_handler_unittest.cc +++ b/tests/ceftests/stream_resource_handler_unittest.cc @@ -6,7 +6,7 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_stream.h" #include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_stream_resource_handler.h" diff --git a/tests/ceftests/task_unittest.cc b/tests/ceftests/task_unittest.cc index 20525902f..3ede66ecc 100644 --- a/tests/ceftests/task_unittest.cc +++ b/tests/ceftests/task_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_command_line.h" #include "include/cef_task.h" #include "include/wrapper/cef_closure_task.h" diff --git a/tests/ceftests/test_handler.cc b/tests/ceftests/test_handler.cc index 4dc1769fd..727f7c53f 100644 --- a/tests/ceftests/test_handler.cc +++ b/tests/ceftests/test_handler.cc @@ -4,7 +4,7 @@ #include "tests/ceftests/test_handler.h" -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/base/cef_logging.h" #include "include/cef_command_line.h" #include "include/cef_stream.h" diff --git a/tests/ceftests/test_handler.h b/tests/ceftests/test_handler.h index 65f4a2e89..7161d818b 100644 --- a/tests/ceftests/test_handler.h +++ b/tests/ceftests/test_handler.h @@ -8,11 +8,11 @@ #include #include +#include #include #include -#include "include/base/cef_bind.h" -#include "include/base/cef_scoped_ptr.h" +#include "include/base/cef_callback.h" #include "include/cef_browser.h" #include "include/cef_client.h" #include "include/cef_frame.h" @@ -293,7 +293,7 @@ class TestHandler : public CefClient, bool destroy_test_expected_; bool destroy_test_called_; - scoped_ptr ui_thread_helper_; + std::unique_ptr ui_thread_helper_; // Used to track the number of currently existing browser windows. static int browser_count_; diff --git a/tests/ceftests/test_request.h b/tests/ceftests/test_request.h index e7b42ec76..9e2f9251f 100644 --- a/tests/ceftests/test_request.h +++ b/tests/ceftests/test_request.h @@ -8,7 +8,7 @@ #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_cookie.h" #include "include/cef_frame.h" #include "include/cef_request.h" diff --git a/tests/ceftests/test_server.h b/tests/ceftests/test_server.h index 00d39e3f2..319bb692b 100644 --- a/tests/ceftests/test_server.h +++ b/tests/ceftests/test_server.h @@ -8,7 +8,7 @@ #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_registration.h" #include "include/cef_request.h" #include "include/cef_response.h" diff --git a/tests/ceftests/test_server_unittest.cc b/tests/ceftests/test_server_unittest.cc index 54f686ce5..7872bb06b 100644 --- a/tests/ceftests/test_server_unittest.cc +++ b/tests/ceftests/test_server_unittest.cc @@ -4,6 +4,7 @@ #include +#include "include/base/cef_cxx17_backports.h" #include "include/cef_task.h" #include "include/cef_waitable_event.h" #include "include/wrapper/cef_closure_task.h" @@ -237,7 +238,7 @@ TEST(TestServerTest, ObserverHelperMultiple) { TestState states[3]; size_t count = 0; - const size_t size = arraysize(states); + const size_t size = base::size(states); const base::Closure& done_callback = base::Bind(SignalIfDone, event, base::Unretained(&count), size); diff --git a/tests/ceftests/thread_helper.h b/tests/ceftests/thread_helper.h index db6320883..0561663ed 100644 --- a/tests/ceftests/thread_helper.h +++ b/tests/ceftests/thread_helper.h @@ -6,7 +6,7 @@ #define CEF_TESTS_CEFTESTS_THREAD_HELPER_H_ #pragma once -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_task.h" #include "include/cef_waitable_event.h" diff --git a/tests/ceftests/thread_unittest.cc b/tests/ceftests/thread_unittest.cc index e68ca5312..166001bf8 100644 --- a/tests/ceftests/thread_unittest.cc +++ b/tests/ceftests/thread_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_task.h" #include "include/cef_thread.h" #include "include/wrapper/cef_closure_task.h" diff --git a/tests/ceftests/tracing_unittest.cc b/tests/ceftests/tracing_unittest.cc index 38c1b1b40..b8be786cf 100644 --- a/tests/ceftests/tracing_unittest.cc +++ b/tests/ceftests/tracing_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_file_util.h" #include "include/cef_task.h" #include "include/cef_trace.h" diff --git a/tests/ceftests/translator_unittest.cc b/tests/ceftests/translator_unittest.cc index b039cbc9b..12e05ece6 100644 --- a/tests/ceftests/translator_unittest.cc +++ b/tests/ceftests/translator_unittest.cc @@ -394,7 +394,7 @@ TEST(TranslatorTest, OwnPtrLibrary) { CefTranslatorTestScopedLibrary::Create(kTestVal); EXPECT_TRUE(test_obj.get()); EXPECT_EQ(kTestVal, test_obj->GetValue()); - int retval = obj->SetOwnPtrLibrary(test_obj.Pass()); + int retval = obj->SetOwnPtrLibrary(std::move(test_obj)); EXPECT_EQ(kTestVal, retval); EXPECT_FALSE(test_obj.get()); @@ -403,7 +403,7 @@ TEST(TranslatorTest, OwnPtrLibrary) { obj->GetOwnPtrLibrary(kTestVal2); EXPECT_TRUE(test_obj2.get()); EXPECT_EQ(kTestVal2, test_obj2->GetValue()); - int retval2 = obj->SetOwnPtrLibrary(test_obj2.Pass()); + int retval2 = obj->SetOwnPtrLibrary(std::move(test_obj2)); EXPECT_EQ(kTestVal2, retval2); EXPECT_FALSE(test_obj2.get()); @@ -422,20 +422,19 @@ TEST(TranslatorTest, OwnPtrLibraryInherit) { EXPECT_TRUE(test_obj.get()); EXPECT_EQ(kTestVal, test_obj->GetValue()); EXPECT_EQ(kTestVal2, test_obj->GetOtherValue()); - int retval = - obj->SetOwnPtrLibrary(test_obj.PassAs()); + int retval = obj->SetOwnPtrLibrary(std::move(test_obj)); EXPECT_EQ(kTestVal, retval); EXPECT_FALSE(test_obj.get()); test_obj = CefTranslatorTestScopedLibraryChild::Create(kTestVal, kTestVal2); EXPECT_TRUE(test_obj.get()); - EXPECT_EQ(kTestVal, obj->SetChildOwnPtrLibrary(test_obj.Pass())); + EXPECT_EQ(kTestVal, obj->SetChildOwnPtrLibrary(std::move(test_obj))); EXPECT_FALSE(test_obj.get()); test_obj = CefTranslatorTestScopedLibraryChild::Create(kTestVal, kTestVal2); EXPECT_TRUE(test_obj.get()); CefOwnPtr test_obj_parent = - obj->SetChildOwnPtrLibraryAndReturnParent(test_obj.Pass()); + obj->SetChildOwnPtrLibraryAndReturnParent(std::move(test_obj)); EXPECT_FALSE(test_obj.get()); EXPECT_TRUE(test_obj_parent.get()); EXPECT_EQ(kTestVal, test_obj_parent->GetValue()); @@ -448,22 +447,19 @@ TEST(TranslatorTest, OwnPtrLibraryInherit) { EXPECT_EQ(kTestVal, test_obj2->GetValue()); EXPECT_EQ(kTestVal2, test_obj2->GetOtherValue()); EXPECT_EQ(kTestVal3, test_obj2->GetOtherOtherValue()); - int retval2 = - obj->SetOwnPtrLibrary(test_obj2.PassAs()); + int retval2 = obj->SetOwnPtrLibrary(std::move(test_obj2)); EXPECT_EQ(kTestVal, retval2); EXPECT_FALSE(test_obj2.get()); test_obj2 = CefTranslatorTestScopedLibraryChildChild::Create( kTestVal, kTestVal2, kTestVal3); - EXPECT_EQ(kTestVal, - obj->SetChildOwnPtrLibrary( - test_obj2.PassAs())); + EXPECT_EQ(kTestVal, obj->SetChildOwnPtrLibrary(std::move(test_obj2))); EXPECT_FALSE(test_obj2.get()); test_obj2 = CefTranslatorTestScopedLibraryChildChild::Create( kTestVal, kTestVal2, kTestVal3); - test_obj_parent = obj->SetChildOwnPtrLibraryAndReturnParent( - test_obj2.PassAs()); + test_obj_parent = + obj->SetChildOwnPtrLibraryAndReturnParent(std::move(test_obj2)); EXPECT_FALSE(test_obj2.get()); EXPECT_TRUE(test_obj_parent.get()); EXPECT_EQ(kTestVal, test_obj_parent->GetValue()); @@ -523,14 +519,14 @@ TEST(TranslatorTest, OwnPtrClient) { CefOwnPtr test_obj( new TranslatorTestScopedClient(kTestVal, &got_delete)); EXPECT_EQ(kTestVal, test_obj->GetValue()); - EXPECT_EQ(kTestVal, obj->SetOwnPtrClient(test_obj.Pass())); + EXPECT_EQ(kTestVal, obj->SetOwnPtrClient(std::move(test_obj))); EXPECT_FALSE(test_obj.get()); EXPECT_TRUE(got_delete); got_delete.reset(); test_obj.reset(new TranslatorTestScopedClient(kTestVal, &got_delete)); CefOwnPtr handler = - obj->SetOwnPtrClientAndReturn(test_obj.Pass()); + obj->SetOwnPtrClientAndReturn(std::move(test_obj)); EXPECT_FALSE(test_obj.get()); EXPECT_TRUE(handler.get()); EXPECT_FALSE(got_delete); @@ -554,15 +550,14 @@ TEST(TranslatorTest, OwnPtrClientInherit) { new TranslatorTestScopedClientChild(kTestVal, kTestVal2, &got_delete)); EXPECT_EQ(kTestVal, test_obj->GetValue()); EXPECT_EQ(kTestVal2, test_obj->GetOtherValue()); - EXPECT_EQ(kTestVal, obj->SetOwnPtrClient( - test_obj.PassAs())); + EXPECT_EQ(kTestVal, obj->SetOwnPtrClient(std::move(test_obj))); EXPECT_FALSE(test_obj.get()); EXPECT_TRUE(got_delete); got_delete.reset(); test_obj.reset( new TranslatorTestScopedClientChild(kTestVal, kTestVal2, &got_delete)); - EXPECT_EQ(kTestVal, obj->SetChildOwnPtrClient(test_obj.Pass())); + EXPECT_EQ(kTestVal, obj->SetChildOwnPtrClient(std::move(test_obj))); EXPECT_FALSE(test_obj.get()); EXPECT_TRUE(got_delete); @@ -570,7 +565,7 @@ TEST(TranslatorTest, OwnPtrClientInherit) { test_obj.reset( new TranslatorTestScopedClientChild(kTestVal, kTestVal2, &got_delete)); CefOwnPtr handler( - obj->SetChildOwnPtrClientAndReturnParent(test_obj.Pass())); + obj->SetChildOwnPtrClientAndReturnParent(std::move(test_obj))); EXPECT_EQ(kTestVal, handler->GetValue()); EXPECT_FALSE(test_obj.get()); EXPECT_FALSE(got_delete); diff --git a/tests/ceftests/urlrequest_unittest.cc b/tests/ceftests/urlrequest_unittest.cc index acdab2abe..8bb635db9 100644 --- a/tests/ceftests/urlrequest_unittest.cc +++ b/tests/ceftests/urlrequest_unittest.cc @@ -6,7 +6,7 @@ #include #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_parser.h" #include "include/cef_request_context_handler.h" #include "include/cef_scheme.h" diff --git a/tests/ceftests/v8_unittest.cc b/tests/ceftests/v8_unittest.cc index 2273c39a9..9c4fc308c 100644 --- a/tests/ceftests/v8_unittest.cc +++ b/tests/ceftests/v8_unittest.cc @@ -4,7 +4,7 @@ #include -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_task.h" #include "include/cef_v8.h" #include "include/wrapper/cef_closure_task.h" diff --git a/tests/ceftests/views/button_unittest.cc b/tests/ceftests/views/button_unittest.cc index 1bd636322..059b29088 100644 --- a/tests/ceftests/views/button_unittest.cc +++ b/tests/ceftests/views/button_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/views/cef_button.h" #include "include/views/cef_button_delegate.h" #include "include/views/cef_label_button.h" diff --git a/tests/ceftests/views/scroll_view_unittest.cc b/tests/ceftests/views/scroll_view_unittest.cc index cb446f3f0..a212be003 100644 --- a/tests/ceftests/views/scroll_view_unittest.cc +++ b/tests/ceftests/views/scroll_view_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_pack_strings.h" #include "include/views/cef_panel.h" #include "include/views/cef_panel_delegate.h" diff --git a/tests/ceftests/views/textfield_unittest.cc b/tests/ceftests/views/textfield_unittest.cc index 7186948c9..eec745954 100644 --- a/tests/ceftests/views/textfield_unittest.cc +++ b/tests/ceftests/views/textfield_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_pack_strings.h" #include "include/views/cef_textfield.h" #include "include/views/cef_textfield_delegate.h" diff --git a/tests/ceftests/views/window_unittest.cc b/tests/ceftests/views/window_unittest.cc index 420d9d56f..ad1b5c981 100644 --- a/tests/ceftests/views/window_unittest.cc +++ b/tests/ceftests/views/window_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/views/cef_box_layout.h" #include "include/views/cef_layout.h" #include "include/views/cef_panel.h" diff --git a/tests/ceftests/waitable_event_unittest.cc b/tests/ceftests/waitable_event_unittest.cc index 4e55655c7..000f816b4 100644 --- a/tests/ceftests/waitable_event_unittest.cc +++ b/tests/ceftests/waitable_event_unittest.cc @@ -2,7 +2,7 @@ // 2012 The Chromium Authors. All rights reserved. Use of this source code is // governed by a BSD-style license that can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_thread.h" #include "include/cef_waitable_event.h" #include "include/wrapper/cef_closure_task.h" diff --git a/tests/ceftests/webui_unittest.cc b/tests/ceftests/webui_unittest.cc index 7c69d867b..d099cfddd 100644 --- a/tests/ceftests/webui_unittest.cc +++ b/tests/ceftests/webui_unittest.cc @@ -2,7 +2,7 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" #include "include/cef_callback.h" #include "include/cef_parser.h" #include "include/wrapper/cef_closure_task.h" diff --git a/tests/shared/browser/extension_util.cc b/tests/shared/browser/extension_util.cc index 8bef3d384..690dd27ad 100644 --- a/tests/shared/browser/extension_util.cc +++ b/tests/shared/browser/extension_util.cc @@ -4,7 +4,8 @@ #include "tests/shared/browser/extension_util.h" -#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" +#include "include/base/cef_cxx17_backports.h" #include "include/cef_parser.h" #include "include/cef_path_util.h" #include "include/wrapper/cef_closure_task.h" @@ -120,7 +121,7 @@ bool IsInternalExtension(const std::string& extension_path) { static const char* extensions[] = {"set_page_color"}; const std::string& internal_path = GetInternalPath(extension_path); - for (size_t i = 0; i < arraysize(extensions); ++i) { + for (size_t i = 0; i < base::size(extensions); ++i) { // Exact match or first directory component. const std::string& extension = extensions[i]; if (internal_path == extension || diff --git a/tests/shared/browser/extension_util.h b/tests/shared/browser/extension_util.h index f3e643acb..10b3511bf 100644 --- a/tests/shared/browser/extension_util.h +++ b/tests/shared/browser/extension_util.h @@ -33,8 +33,8 @@ std::string GetInternalExtensionResourcePath(const std::string& extension_path); // will be the full file path on disk. For internal extensions this will be the // relative path expected by LoadBinaryResource (uses '/' as path separator on // all platforms). Internal extensions must be on the hard-coded list enforced -// by IsInternalExtension. If |internal| is non-NULL it will be set to true if -// the extension is handled internally. +// by IsInternalExtension. If |internal| is non-nullptr it will be set to true +// if the extension is handled internally. std::string GetExtensionResourcePath(const std::string& extension_path, bool* internal); @@ -69,7 +69,7 @@ std::string GetExtensionOrigin(const std::string& extension_id); std::string GetExtensionURL(CefRefPtr extension); // Look for a browser_action.default_icon manifest value and return the resource -// path. If |internal| is non-NULL it will be set to true if the extension is +// path. If |internal| is non-nullptr it will be set to true if the extension is // handled internally. std::string GetExtensionIconPath(CefRefPtr extension, bool* internal); diff --git a/tests/shared/browser/file_util.cc b/tests/shared/browser/file_util.cc index 73c415929..5c3da37d1 100644 --- a/tests/shared/browser/file_util.cc +++ b/tests/shared/browser/file_util.cc @@ -4,14 +4,13 @@ #include "tests/shared/browser/file_util.h" -#include "include/base/cef_build.h" -#include "include/base/cef_scoped_ptr.h" -#include "include/cef_task.h" - #include #include #include +#include "include/base/cef_build.h" +#include "include/cef_task.h" + namespace client { namespace file_util { @@ -46,7 +45,7 @@ bool ReadFileToString(const std::string& path, return false; const size_t kBufferSize = 1 << 16; - scoped_ptr buf(new char[kBufferSize]); + std::unique_ptr buf(new char[kBufferSize]); size_t len; size_t size = 0; bool read_status = true; diff --git a/tests/shared/browser/file_util.h b/tests/shared/browser/file_util.h index cc484b7b3..b08d7dc04 100644 --- a/tests/shared/browser/file_util.h +++ b/tests/shared/browser/file_util.h @@ -19,10 +19,10 @@ extern const char kPathSep; // false on error. In case of I/O error, |contents| holds the data that could // be read from the file before the error occurred. When the file size exceeds // max_size|, the function returns false with |contents| holding the file -// truncated to |max_size|. |contents| may be NULL, in which case this function -// is useful for its side effect of priming the disk cache (could be used for -// unit tests). Calling this function on the browser process UI or IO threads is -// not allowed. +// truncated to |max_size|. |contents| may be nullptr, in which case this +// function is useful for its side effect of priming the disk cache (could be +// used for unit tests). Calling this function on the browser process UI or IO +// threads is not allowed. bool ReadFileToString(const std::string& path, std::string* contents, size_t max_size = std::numeric_limits::max()); diff --git a/tests/shared/browser/main_message_loop.h b/tests/shared/browser/main_message_loop.h index 90edd8d13..a24900e87 100644 --- a/tests/shared/browser/main_message_loop.h +++ b/tests/shared/browser/main_message_loop.h @@ -6,8 +6,9 @@ #define CEF_TESTS_SHARED_BROWSER_MAIN_MESSAGE_LOOP_H_ #pragma once -#include "include/base/cef_bind.h" -#include "include/base/cef_scoped_ptr.h" +#include + +#include "include/base/cef_callback.h" #include "include/cef_task.h" #if defined(OS_WIN) @@ -50,8 +51,8 @@ class MainMessageLoop { void PostClosure(const base::Closure& closure); protected: - // Only allow deletion via scoped_ptr. - friend struct base::DefaultDeleter; + // Only allow deletion via std::unique_ptr. + friend std::default_delete; MainMessageLoop(); virtual ~MainMessageLoop(); @@ -97,7 +98,7 @@ struct DeleteOnMainThread { delete x; } else { client::MainMessageLoop::Get()->PostClosure( - base::Bind(&DeleteOnMainThread::Destruct, x)); + base::Bind(&DeleteOnMainThread::Destruct, base::Unretained(x))); } } }; diff --git a/tests/shared/browser/main_message_loop_external_pump.h b/tests/shared/browser/main_message_loop_external_pump.h index a25af462d..fa3236ea2 100644 --- a/tests/shared/browser/main_message_loop_external_pump.h +++ b/tests/shared/browser/main_message_loop_external_pump.h @@ -23,7 +23,7 @@ class MainMessageLoopExternalPump : public MainMessageLoopStd { public: // Creates the singleton instance of this object. Must be called on the main // application thread. - static scoped_ptr Create(); + static std::unique_ptr Create(); // Returns the singleton instance of this object. Safe to call from any // thread. @@ -35,8 +35,8 @@ class MainMessageLoopExternalPump : public MainMessageLoopStd { virtual void OnScheduleMessagePumpWork(int64 delay_ms) = 0; protected: - // Only allow deletion via scoped_ptr. - friend struct base::DefaultDeleter; + // Only allow deletion via std::unique_ptr. + friend std::default_delete; // Construct and destruct this object on the main application thread. MainMessageLoopExternalPump(); diff --git a/tests/shared/browser/main_message_loop_external_pump_linux.cc b/tests/shared/browser/main_message_loop_external_pump_linux.cc index 44df563c8..4e8ba0d86 100644 --- a/tests/shared/browser/main_message_loop_external_pump_linux.cc +++ b/tests/shared/browser/main_message_loop_external_pump_linux.cc @@ -6,9 +6,10 @@ #include #include +#include #include -#include +#include #include "include/base/cef_logging.h" #include "include/cef_app.h" @@ -100,8 +101,9 @@ class MainMessageLoopExternalPumpLinux : public MainMessageLoopExternalPump { int wakeup_pipe_read_; int wakeup_pipe_write_; - // Use a scoped_ptr to avoid needing the definition of GPollFD in the header. - scoped_ptr wakeup_gpollfd_; + // Use a std::unique_ptr to avoid needing the definition of GPollFD in the + // header. + std::unique_ptr wakeup_gpollfd_; }; // Return a timeout suitable for the glib loop, -1 to block forever, @@ -150,7 +152,7 @@ gboolean WorkSourceDispatch(GSource* source, // I wish these could be const, but g_source_new wants non-const. GSourceFuncs WorkSourceFuncs = {WorkSourcePrepare, WorkSourceCheck, - WorkSourceDispatch, NULL}; + WorkSourceDispatch, nullptr}; MainMessageLoopExternalPumpLinux::MainMessageLoopExternalPumpLinux() : should_quit_(false), @@ -292,9 +294,9 @@ bool MainMessageLoopExternalPumpLinux::IsTimerPending() { } // namespace // static -scoped_ptr MainMessageLoopExternalPump::Create() { - return scoped_ptr( - new MainMessageLoopExternalPumpLinux()); +std::unique_ptr +MainMessageLoopExternalPump::Create() { + return std::make_unique(); } } // namespace client diff --git a/tests/shared/browser/main_message_loop_external_pump_mac.mm b/tests/shared/browser/main_message_loop_external_pump_mac.mm index f27f63ee0..323997fe8 100644 --- a/tests/shared/browser/main_message_loop_external_pump_mac.mm +++ b/tests/shared/browser/main_message_loop_external_pump_mac.mm @@ -7,6 +7,8 @@ #import #import +#include + #include "include/cef_app.h" @class EventHandler; @@ -173,9 +175,9 @@ void MainMessageLoopExternalPumpMac::KillTimer() { } // static -scoped_ptr MainMessageLoopExternalPump::Create() { - return scoped_ptr( - new MainMessageLoopExternalPumpMac()); +std::unique_ptr +MainMessageLoopExternalPump::Create() { + return std::make_unique(); } } // namespace client diff --git a/tests/shared/browser/main_message_loop_external_pump_win.cc b/tests/shared/browser/main_message_loop_external_pump_win.cc index a9262120c..ae9535863 100644 --- a/tests/shared/browser/main_message_loop_external_pump_win.cc +++ b/tests/shared/browser/main_message_loop_external_pump_win.cc @@ -6,6 +6,8 @@ #include +#include + #include "include/cef_app.h" #include "tests/shared/browser/util_win.h" @@ -49,8 +51,8 @@ class MainMessageLoopExternalPumpWin : public MainMessageLoopExternalPump { }; MainMessageLoopExternalPumpWin::MainMessageLoopExternalPumpWin() - : timer_pending_(false), main_thread_target_(NULL) { - HINSTANCE hInstance = GetModuleHandle(NULL); + : timer_pending_(false), main_thread_target_(nullptr) { + HINSTANCE hInstance = GetModuleHandle(nullptr); const wchar_t* const kClassName = L"CEFMainTargetHWND"; WNDCLASSEX wcex = {}; @@ -62,8 +64,8 @@ MainMessageLoopExternalPumpWin::MainMessageLoopExternalPumpWin() // Create the message handling window. main_thread_target_ = - CreateWindowW(kClassName, NULL, WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, - HWND_MESSAGE, NULL, hInstance, NULL); + CreateWindowW(kClassName, nullptr, WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, + HWND_MESSAGE, nullptr, hInstance, nullptr); DCHECK(main_thread_target_); SetUserDataPtr(main_thread_target_, this); } @@ -75,13 +77,13 @@ MainMessageLoopExternalPumpWin::~MainMessageLoopExternalPumpWin() { } void MainMessageLoopExternalPumpWin::Quit() { - PostMessage(NULL, WM_QUIT, 0, 0); + PostMessage(nullptr, WM_QUIT, 0, 0); } int MainMessageLoopExternalPumpWin::Run() { // Run the message loop. MSG msg; - while (GetMessage(&msg, NULL, 0, 0)) { + while (GetMessage(&msg, nullptr, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } @@ -111,7 +113,7 @@ void MainMessageLoopExternalPumpWin::SetTimer(int64 delay_ms) { DCHECK(!timer_pending_); DCHECK_GT(delay_ms, 0); timer_pending_ = true; - ::SetTimer(main_thread_target_, 1, static_cast(delay_ms), NULL); + ::SetTimer(main_thread_target_, 1, static_cast(delay_ms), nullptr); } void MainMessageLoopExternalPumpWin::KillTimer() { @@ -144,9 +146,9 @@ LRESULT CALLBACK MainMessageLoopExternalPumpWin::WndProc(HWND hwnd, } // namespace // static -scoped_ptr MainMessageLoopExternalPump::Create() { - return scoped_ptr( - new MainMessageLoopExternalPumpWin()); +std::unique_ptr +MainMessageLoopExternalPump::Create() { + return std::make_unique(); } } // namespace client diff --git a/tests/shared/browser/resource_util_mac.mm b/tests/shared/browser/resource_util_mac.mm index 219f12bc4..d2998cb3a 100644 --- a/tests/shared/browser/resource_util_mac.mm +++ b/tests/shared/browser/resource_util_mac.mm @@ -31,7 +31,7 @@ bool AmIBundled() { bool GetResourceDir(std::string& dir) { // Retrieve the executable directory. uint32_t pathSize = 0; - _NSGetExecutablePath(NULL, &pathSize); + _NSGetExecutablePath(nullptr, &pathSize); if (pathSize > 0) { dir.resize(pathSize); _NSGetExecutablePath(const_cast(dir.c_str()), &pathSize); diff --git a/tests/shared/browser/resource_util_win.cc b/tests/shared/browser/resource_util_win.cc index 003f3e72c..9b8f6c13d 100644 --- a/tests/shared/browser/resource_util_win.cc +++ b/tests/shared/browser/resource_util_win.cc @@ -14,7 +14,7 @@ namespace client { namespace { bool LoadBinaryResource(int binaryId, DWORD& dwSize, LPBYTE& pBytes) { - HINSTANCE hInst = GetModuleHandle(NULL); + HINSTANCE hInst = GetModuleHandle(nullptr); HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(binaryId), MAKEINTRESOURCE(256)); if (hRes) { diff --git a/tests/shared/browser/util_win.cc b/tests/shared/browser/util_win.cc index 0be060fce..b7f4294f3 100644 --- a/tests/shared/browser/util_win.cc +++ b/tests/shared/browser/util_win.cc @@ -34,7 +34,7 @@ void SetUserDataPtr(HWND hWnd, void* ptr) { WNDPROC SetWndProcPtr(HWND hWnd, WNDPROC wndProc) { WNDPROC old = reinterpret_cast(::GetWindowLongPtr(hWnd, GWLP_WNDPROC)); - CHECK(old != NULL); + CHECK(old != nullptr); LONG_PTR result = ::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast(wndProc)); CHECK(result != 0 || GetLastError() == ERROR_SUCCESS); @@ -44,7 +44,7 @@ WNDPROC SetWndProcPtr(HWND hWnd, WNDPROC wndProc) { std::wstring GetResourceString(UINT id) { #define MAX_LOADSTRING 100 TCHAR buff[MAX_LOADSTRING] = {0}; - LoadString(::GetModuleHandle(NULL), id, buff, MAX_LOADSTRING); + LoadString(::GetModuleHandle(nullptr), id, buff, MAX_LOADSTRING); return buff; } @@ -163,10 +163,10 @@ float GetDeviceScaleFactor() { // This value is safe to cache for the life time of the app since the user // must logout to change the DPI setting. This value also applies to all // screens. - HDC screen_dc = ::GetDC(NULL); + HDC screen_dc = ::GetDC(nullptr); int dpi_x = GetDeviceCaps(screen_dc, LOGPIXELSX); scale_factor = static_cast(dpi_x) / 96.0f; - ::ReleaseDC(NULL, screen_dc); + ::ReleaseDC(nullptr, screen_dc); initialized = true; } diff --git a/tools/make_cpptoc_impl.py b/tools/make_cpptoc_impl.py index 305244be3..4b7737eaf 100644 --- a/tools/make_cpptoc_impl.py +++ b/tools/make_cpptoc_impl.py @@ -220,7 +220,7 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names, base_scoped): result += comment+\ '\n CefOwnPtr<'+ptr_class+'> '+arg_name+'Ptr('+ptr_class+'CToCpp::Wrap('+arg_name+'));' if arg_type == 'ownptr_diff': - params.append('OWN_PASS(' + arg_name + 'Ptr)') + params.append('std::move(' + arg_name + 'Ptr)') else: params.append(arg_name + 'Ptr.get()') elif arg_type == 'refptr_same_byref' or arg_type == 'refptr_diff_byref': @@ -441,10 +441,10 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names, base_scoped): result += '\n return ' + ptr_class + 'CToCpp::Unwrap(_retval);' elif retval_type == 'ownptr_same': ptr_class = retval.get_type().get_ptr_type() - result += '\n return ' + ptr_class + 'CppToC::WrapOwn(OWN_PASS(_retval));' + result += '\n return ' + ptr_class + 'CppToC::WrapOwn(std::move(_retval));' elif retval_type == 'ownptr_diff': ptr_class = retval.get_type().get_ptr_type() - result += '\n return ' + ptr_class + 'CToCpp::UnwrapOwn(OWN_PASS(_retval));' + result += '\n return ' + ptr_class + 'CToCpp::UnwrapOwn(std::move(_retval));' else: raise Exception('Unsupported return type %s in %s' % (retval_type, name)) @@ -545,8 +545,8 @@ def make_cpptoc_unwrap_derived(header, cls, base_scoped): impl = ['', ''] for clsname in derived_classes: impl[0] += ' if (type == '+get_wrapper_type_enum(clsname)+') {\n'+\ - ' return OWN_RETURN_AS('+clsname+'CppToC::UnwrapOwn(reinterpret_cast<'+\ - get_capi_name(clsname, True)+'*>(s)), '+cur_clsname+');\n'+\ + ' return '+clsname+'CppToC::UnwrapOwn(reinterpret_cast<'+\ + get_capi_name(clsname, True)+'*>(s));\n'+\ ' }\n' impl[1] += ' if (type == '+get_wrapper_type_enum(clsname)+') {\n'+\ ' return '+clsname+'CppToC::UnwrapRaw(reinterpret_cast<'+\ diff --git a/tools/make_ctocpp_impl.py b/tools/make_ctocpp_impl.py index 52dd9c52c..67cc701a9 100644 --- a/tools/make_ctocpp_impl.py +++ b/tools/make_ctocpp_impl.py @@ -207,7 +207,8 @@ def make_ctocpp_function_impl_new(clsname, name, func, base_scoped): params.append(ptr_class + 'CToCpp::Unwrap(' + arg_name + ')') elif arg_type == 'ownptr_same': ptr_class = arg.get_type().get_ptr_type() - params.append(ptr_class + 'CToCpp::UnwrapOwn(OWN_PASS(' + arg_name + '))') + params.append(ptr_class + 'CToCpp::UnwrapOwn(std::move(' + arg_name + + '))') elif arg_type == 'rawptr_same': ptr_class = arg.get_type().get_ptr_type() params.append(ptr_class + 'CToCpp::UnwrapRaw(' + arg_name + ')') @@ -216,7 +217,7 @@ def make_ctocpp_function_impl_new(clsname, name, func, base_scoped): params.append(ptr_class + 'CppToC::Wrap(' + arg_name + ')') elif arg_type == 'ownptr_diff': ptr_class = arg.get_type().get_ptr_type() - params.append(ptr_class + 'CppToC::WrapOwn(OWN_PASS(' + arg_name + '))') + params.append(ptr_class + 'CppToC::WrapOwn(std::move(' + arg_name + '))') elif arg_type == 'rawptr_diff': ptr_class = arg.get_type().get_ptr_type() result += comment+\ @@ -557,7 +558,7 @@ def make_ctocpp_unwrap_derived(header, cls, base_scoped): ' }\n' impl[1] += ' if (type == '+get_wrapper_type_enum(clsname)+') {\n'+\ ' return reinterpret_cast<'+get_capi_name(cls.get_name(), True)+'*>('+\ - clsname+'CToCpp::UnwrapRaw(CefRawPtr<'+clsname+'>(reinterpret_cast<'+clsname+'*>(CEF_RAW_PTR_GET(c)))));\n'+\ + clsname+'CToCpp::UnwrapRaw(CefRawPtr<'+clsname+'>(reinterpret_cast<'+clsname+'*>(c))));\n'+\ ' }\n' else: impl = '' diff --git a/tools/make_libcef_dll_dylib_impl.py b/tools/make_libcef_dll_dylib_impl.py index 14e36967f..485d2610c 100644 --- a/tools/make_libcef_dll_dylib_impl.py +++ b/tools/make_libcef_dll_dylib_impl.py @@ -60,7 +60,10 @@ def make_libcef_dll_dylib_impl_func(func): def make_libcef_dll_dylib_impl(header): filenames = [] - includes = [] + includes = [ + '#include "include/base/cef_compiler_specific.h"', + '#include "include/wrapper/cef_library_loader.h"', + ] ptr_typedef = '' ptr_declare = '' ptr_init = '' @@ -119,7 +122,6 @@ def make_libcef_dll_dylib_impl(header): #include """ + "\n".join(sorted(includes)) + """ -#include "include/wrapper/cef_library_loader.h" // GLOBAL WRAPPER FUNCTIONS - Do not edit by hand.