refactor: replace remaining NULL
with nullptr
(#40053)
refactor: use nullptr everywhere
This commit is contained in:
parent
9d0e6d09f0
commit
04b2ba84cd
34 changed files with 98 additions and 93 deletions
|
@ -60,7 +60,7 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
#if defined(HELPER_EXECUTABLE) && !IS_MAS_BUILD()
|
#if defined(HELPER_EXECUTABLE) && !IS_MAS_BUILD()
|
||||||
uint32_t exec_path_size = 0;
|
uint32_t exec_path_size = 0;
|
||||||
int rv = _NSGetExecutablePath(NULL, &exec_path_size);
|
int rv = _NSGetExecutablePath(nullptr, &exec_path_size);
|
||||||
if (rv != -1) {
|
if (rv != -1) {
|
||||||
FatalError("_NSGetExecutablePath: get length failed.");
|
FatalError("_NSGetExecutablePath: get length failed.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ void App::SetActivationPolicy(gin_helper::ErrorThrower thrower,
|
||||||
bool App::IsRunningUnderARM64Translation() const {
|
bool App::IsRunningUnderARM64Translation() const {
|
||||||
int proc_translated = 0;
|
int proc_translated = 0;
|
||||||
size_t size = sizeof(proc_translated);
|
size_t size = sizeof(proc_translated);
|
||||||
if (sysctlbyname("sysctl.proc_translated", &proc_translated, &size, NULL,
|
if (sysctlbyname("sysctl.proc_translated", &proc_translated, &size, nullptr,
|
||||||
0) == -1) {
|
0) == -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ struct Converter<electron::ElectronMenuModel*> {
|
||||||
static bool FromV8(v8::Isolate* isolate,
|
static bool FromV8(v8::Isolate* isolate,
|
||||||
v8::Local<v8::Value> val,
|
v8::Local<v8::Value> val,
|
||||||
electron::ElectronMenuModel** out) {
|
electron::ElectronMenuModel** out) {
|
||||||
// null would be transferred to NULL.
|
// null would be transferred to nullptr.
|
||||||
if (val->IsNull()) {
|
if (val->IsNull()) {
|
||||||
*out = nullptr;
|
*out = nullptr;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -27,8 +27,8 @@ void PowerMonitor::InitPlatformSpecificMonitors() {
|
||||||
WNDCLASSEX window_class;
|
WNDCLASSEX window_class;
|
||||||
base::win::InitializeWindowClass(
|
base::win::InitializeWindowClass(
|
||||||
kPowerMonitorWindowClass,
|
kPowerMonitorWindowClass,
|
||||||
&base::win::WrappedWindowProc<PowerMonitor::WndProcStatic>, 0, 0, 0, NULL,
|
&base::win::WrappedWindowProc<PowerMonitor::WndProcStatic>, 0, 0, 0,
|
||||||
NULL, NULL, NULL, NULL, &window_class);
|
nullptr, nullptr, nullptr, nullptr, nullptr, &window_class);
|
||||||
instance_ = window_class.hInstance;
|
instance_ = window_class.hInstance;
|
||||||
atom_ = RegisterClassEx(&window_class);
|
atom_ = RegisterClassEx(&window_class);
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ void SystemPreferences::InitializeWindow() {
|
||||||
base::win::InitializeWindowClass(
|
base::win::InitializeWindowClass(
|
||||||
kSystemPreferencesWindowClass,
|
kSystemPreferencesWindowClass,
|
||||||
&base::win::WrappedWindowProc<SystemPreferences::WndProcStatic>, 0, 0, 0,
|
&base::win::WrappedWindowProc<SystemPreferences::WndProcStatic>, 0, 0, 0,
|
||||||
NULL, NULL, NULL, NULL, NULL, &window_class);
|
nullptr, nullptr, nullptr, nullptr, nullptr, &window_class);
|
||||||
instance_ = window_class.hInstance;
|
instance_ = window_class.hInstance;
|
||||||
atom_ = RegisterClassEx(&window_class);
|
atom_ = RegisterClassEx(&window_class);
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
// This interface is for managing the global services of the application. Each
|
// This interface is for managing the global services of the application. Each
|
||||||
// service is lazily created when requested the first time. The service getters
|
// service is lazily created when requested the first time. The service getters
|
||||||
// will return NULL if the service is not available, so callers must check for
|
// will return nullptr if the service is not available, so callers must check
|
||||||
// this condition.
|
// for this condition.
|
||||||
|
|
||||||
#ifndef ELECTRON_SHELL_BROWSER_BROWSER_PROCESS_IMPL_H_
|
#ifndef ELECTRON_SHELL_BROWSER_BROWSER_PROCESS_IMPL_H_
|
||||||
#define ELECTRON_SHELL_BROWSER_BROWSER_PROCESS_IMPL_H_
|
#define ELECTRON_SHELL_BROWSER_BROWSER_PROCESS_IMPL_H_
|
||||||
|
@ -35,7 +35,7 @@ class PrintJobManager;
|
||||||
class BackgroundModeManager {};
|
class BackgroundModeManager {};
|
||||||
|
|
||||||
// NOT THREAD SAFE, call only from the main thread.
|
// NOT THREAD SAFE, call only from the main thread.
|
||||||
// These functions shouldn't return NULL unless otherwise noted.
|
// These functions shouldn't return nullptr unless otherwise noted.
|
||||||
class BrowserProcessImpl : public BrowserProcess {
|
class BrowserProcessImpl : public BrowserProcess {
|
||||||
public:
|
public:
|
||||||
BrowserProcessImpl();
|
BrowserProcessImpl();
|
||||||
|
|
|
@ -100,8 +100,8 @@ std::wstring GetAppInfoHelperForProtocol(ASSOCSTR assoc_str, const GURL& url) {
|
||||||
wchar_t out_buffer[1024];
|
wchar_t out_buffer[1024];
|
||||||
DWORD buffer_size = std::size(out_buffer);
|
DWORD buffer_size = std::size(out_buffer);
|
||||||
HRESULT hr =
|
HRESULT hr =
|
||||||
AssocQueryString(ASSOCF_IS_PROTOCOL, assoc_str, url_scheme.c_str(), NULL,
|
AssocQueryString(ASSOCF_IS_PROTOCOL, assoc_str, url_scheme.c_str(),
|
||||||
out_buffer, &buffer_size);
|
nullptr, out_buffer, &buffer_size);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
DLOG(WARNING) << "AssocQueryString failed!";
|
DLOG(WARNING) << "AssocQueryString failed!";
|
||||||
return std::wstring();
|
return std::wstring();
|
||||||
|
@ -315,7 +315,7 @@ void GetApplicationInfoForProtocolUsingAssocQuery(
|
||||||
|
|
||||||
void Browser::AddRecentDocument(const base::FilePath& path) {
|
void Browser::AddRecentDocument(const base::FilePath& path) {
|
||||||
CComPtr<IShellItem> item;
|
CComPtr<IShellItem> item;
|
||||||
HRESULT hr = SHCreateItemFromParsingName(path.value().c_str(), NULL,
|
HRESULT hr = SHCreateItemFromParsingName(path.value().c_str(), nullptr,
|
||||||
IID_PPV_ARGS(&item));
|
IID_PPV_ARGS(&item));
|
||||||
if (SUCCEEDED(hr)) {
|
if (SUCCEEDED(hr)) {
|
||||||
SHARDAPPIDINFO info;
|
SHARDAPPIDINFO info;
|
||||||
|
|
|
@ -62,7 +62,7 @@ class ElectronExtensionMessageFilter : public content::BrowserMessageFilter {
|
||||||
|
|
||||||
// The BrowserContext associated with our renderer process. This should only
|
// The BrowserContext associated with our renderer process. This should only
|
||||||
// be accessed on the UI thread! Furthermore since this class is refcounted it
|
// be accessed on the UI thread! Furthermore since this class is refcounted it
|
||||||
// may outlive |browser_context_|, so make sure to NULL check if in doubt;
|
// may outlive |browser_context_|, so make sure to nullptr check if in doubt;
|
||||||
// async calls and the like.
|
// async calls and the like.
|
||||||
raw_ptr<content::BrowserContext> browser_context_;
|
raw_ptr<content::BrowserContext> browser_context_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -95,7 +95,8 @@ void ElectronExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
|
||||||
std::unique_ptr<base::Value::Dict> ParseManifest(
|
std::unique_ptr<base::Value::Dict> ParseManifest(
|
||||||
base::StringPiece manifest_contents) {
|
base::StringPiece manifest_contents) {
|
||||||
JSONStringValueDeserializer deserializer(manifest_contents);
|
JSONStringValueDeserializer deserializer(manifest_contents);
|
||||||
std::unique_ptr<base::Value> manifest = deserializer.Deserialize(NULL, NULL);
|
std::unique_ptr<base::Value> manifest =
|
||||||
|
deserializer.Deserialize(nullptr, nullptr);
|
||||||
|
|
||||||
if (!manifest.get() || !manifest->is_dict()) {
|
if (!manifest.get() || !manifest->is_dict()) {
|
||||||
LOG(ERROR) << "Failed to parse extension manifest.";
|
LOG(ERROR) << "Failed to parse extension manifest.";
|
||||||
|
|
|
@ -460,7 +460,7 @@ void FileSelectHelper::RunFileChooserOnUIThread(
|
||||||
? 1
|
? 1
|
||||||
: 0, // 1-based index of default extension to show.
|
: 0, // 1-based index of default extension to show.
|
||||||
base::FilePath::StringType(),
|
base::FilePath::StringType(),
|
||||||
web_contents->owner_window()->GetNativeWindow(), NULL);
|
web_contents->owner_window()->GetNativeWindow(), nullptr);
|
||||||
|
|
||||||
select_file_types_.reset();
|
select_file_types_.reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,8 +133,8 @@ void FileSelectHelper::ProcessSelectedFilesMacOnUIThread(
|
||||||
temporary_files.end());
|
temporary_files.end());
|
||||||
|
|
||||||
// Typically, |temporary_files| are deleted after |web_contents_| is
|
// Typically, |temporary_files| are deleted after |web_contents_| is
|
||||||
// destroyed. If |web_contents_| is already NULL, then the temporary files
|
// destroyed. If |web_contents_| is already nullptr, then the temporary
|
||||||
// need to be deleted now.
|
// files need to be deleted now.
|
||||||
if (!web_contents_) {
|
if (!web_contents_) {
|
||||||
DeleteTemporaryFiles();
|
DeleteTemporaryFiles();
|
||||||
RunFileChooserEnd();
|
RunFileChooserEnd();
|
||||||
|
|
|
@ -1163,7 +1163,7 @@ void NativeWindowViews::SetBackgroundColor(SkColor background_color) {
|
||||||
reinterpret_cast<LONG_PTR>(brush));
|
reinterpret_cast<LONG_PTR>(brush));
|
||||||
if (previous_brush)
|
if (previous_brush)
|
||||||
DeleteObject((HBRUSH)previous_brush);
|
DeleteObject((HBRUSH)previous_brush);
|
||||||
InvalidateRect(GetAcceleratedWidget(), NULL, 1);
|
InvalidateRect(GetAcceleratedWidget(), nullptr, 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1394,7 +1394,7 @@ void NativeWindowViews::SetParentWindow(NativeWindow* parent) {
|
||||||
// For do this we must NOT use the ::SetParent function, instead we must use
|
// For do this we must NOT use the ::SetParent function, instead we must use
|
||||||
// the ::GetWindowLongPtr or ::SetWindowLongPtr functions with "nIndex" set
|
// the ::GetWindowLongPtr or ::SetWindowLongPtr functions with "nIndex" set
|
||||||
// to "GWLP_HWNDPARENT" which actually means the window owner.
|
// to "GWLP_HWNDPARENT" which actually means the window owner.
|
||||||
HWND hwndParent = parent ? parent->GetAcceleratedWidget() : NULL;
|
HWND hwndParent = parent ? parent->GetAcceleratedWidget() : nullptr;
|
||||||
if (hwndParent ==
|
if (hwndParent ==
|
||||||
(HWND)::GetWindowLongPtr(GetAcceleratedWidget(), GWLP_HWNDPARENT))
|
(HWND)::GetWindowLongPtr(GetAcceleratedWidget(), GWLP_HWNDPARENT))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -297,7 +297,7 @@ class NativeWindowViews : public NativeWindow,
|
||||||
static std::set<NativeWindowViews*> forwarding_windows_;
|
static std::set<NativeWindowViews*> forwarding_windows_;
|
||||||
static HHOOK mouse_hook_;
|
static HHOOK mouse_hook_;
|
||||||
bool forwarding_mouse_messages_ = false;
|
bool forwarding_mouse_messages_ = false;
|
||||||
HWND legacy_window_ = NULL;
|
HWND legacy_window_ = nullptr;
|
||||||
bool layered_ = false;
|
bool layered_ = false;
|
||||||
|
|
||||||
// Set to true if the window is always on top and behind the task bar.
|
// Set to true if the window is always on top and behind the task bar.
|
||||||
|
|
|
@ -206,7 +206,7 @@ bool IsScreenReaderActive() {
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
std::set<NativeWindowViews*> NativeWindowViews::forwarding_windows_;
|
std::set<NativeWindowViews*> NativeWindowViews::forwarding_windows_;
|
||||||
HHOOK NativeWindowViews::mouse_hook_ = NULL;
|
HHOOK NativeWindowViews::mouse_hook_ = nullptr;
|
||||||
|
|
||||||
void NativeWindowViews::Maximize() {
|
void NativeWindowViews::Maximize() {
|
||||||
// Only use Maximize() when window is NOT transparent style
|
// Only use Maximize() when window is NOT transparent style
|
||||||
|
@ -509,7 +509,7 @@ void NativeWindowViews::SetForwardMouseMessages(bool forward) {
|
||||||
reinterpret_cast<DWORD_PTR>(this));
|
reinterpret_cast<DWORD_PTR>(this));
|
||||||
|
|
||||||
if (!mouse_hook_) {
|
if (!mouse_hook_) {
|
||||||
mouse_hook_ = SetWindowsHookEx(WH_MOUSE_LL, MouseHookProc, NULL, 0);
|
mouse_hook_ = SetWindowsHookEx(WH_MOUSE_LL, MouseHookProc, nullptr, 0);
|
||||||
}
|
}
|
||||||
} else if (!forward && forwarding_mouse_messages_) {
|
} else if (!forward && forwarding_mouse_messages_) {
|
||||||
forwarding_mouse_messages_ = false;
|
forwarding_mouse_messages_ = false;
|
||||||
|
@ -519,7 +519,7 @@ void NativeWindowViews::SetForwardMouseMessages(bool forward) {
|
||||||
|
|
||||||
if (forwarding_windows_.empty()) {
|
if (forwarding_windows_.empty()) {
|
||||||
UnhookWindowsHookEx(mouse_hook_);
|
UnhookWindowsHookEx(mouse_hook_);
|
||||||
mouse_hook_ = NULL;
|
mouse_hook_ = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -557,7 +557,7 @@ LRESULT CALLBACK NativeWindowViews::MouseHookProc(int n_code,
|
||||||
WPARAM w_param,
|
WPARAM w_param,
|
||||||
LPARAM l_param) {
|
LPARAM l_param) {
|
||||||
if (n_code < 0) {
|
if (n_code < 0) {
|
||||||
return CallNextHookEx(NULL, n_code, w_param, l_param);
|
return CallNextHookEx(nullptr, n_code, w_param, l_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post a WM_MOUSEMOVE message for those windows whose client area contains
|
// Post a WM_MOUSEMOVE message for those windows whose client area contains
|
||||||
|
@ -581,7 +581,7 @@ LRESULT CALLBACK NativeWindowViews::MouseHookProc(int n_code,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CallNextHookEx(NULL, n_code, w_param, l_param);
|
return CallNextHookEx(nullptr, n_code, w_param, l_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace electron
|
} // namespace electron
|
||||||
|
|
|
@ -122,7 +122,7 @@ void LibnotifyNotification::Show(const NotificationOptions& options) {
|
||||||
|
|
||||||
if (!options.tag.empty()) {
|
if (!options.tag.empty()) {
|
||||||
GQuark id = g_quark_from_string(options.tag.c_str());
|
GQuark id = g_quark_from_string(options.tag.c_str());
|
||||||
g_object_set(G_OBJECT(notification_), "id", id, NULL);
|
g_object_set(G_OBJECT(notification_), "id", id, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always try to append notifications.
|
// Always try to append notifications.
|
||||||
|
|
|
@ -117,8 +117,8 @@ bool RelaunchAppWithHelper(const base::FilePath& helper,
|
||||||
#if BUILDFLAG(IS_WIN)
|
#if BUILDFLAG(IS_WIN)
|
||||||
// Synchronize with the relauncher process.
|
// Synchronize with the relauncher process.
|
||||||
StringType name = internal::GetWaitEventName(process.Pid());
|
StringType name = internal::GetWaitEventName(process.Pid());
|
||||||
HANDLE wait_event = ::CreateEventW(NULL, TRUE, FALSE, name.c_str());
|
HANDLE wait_event = ::CreateEventW(nullptr, TRUE, FALSE, name.c_str());
|
||||||
if (wait_event != NULL) {
|
if (wait_event != nullptr) {
|
||||||
WaitForSingleObject(wait_event, 1000);
|
WaitForSingleObject(wait_event, 1000);
|
||||||
CloseHandle(wait_event);
|
CloseHandle(wait_event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ void RelauncherSynchronizeWithParent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct kevent change = {0};
|
struct kevent change = {0};
|
||||||
EV_SET(&change, parent_pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
|
EV_SET(&change, parent_pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, nullptr);
|
||||||
if (kevent(kq.get(), &change, 1, nullptr, 0, nullptr) == -1) {
|
if (kevent(kq.get(), &change, 1, nullptr, 0, nullptr) == -1) {
|
||||||
PLOG(ERROR) << "kevent (add)";
|
PLOG(ERROR) << "kevent (add)";
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -47,16 +47,16 @@ HANDLE GetParentProcessHandle(base::ProcessHandle handle) {
|
||||||
ResolveNTFunctionPtr("NtQueryInformationProcess", &NtQueryInformationProcess);
|
ResolveNTFunctionPtr("NtQueryInformationProcess", &NtQueryInformationProcess);
|
||||||
if (!NtQueryInformationProcess) {
|
if (!NtQueryInformationProcess) {
|
||||||
LOG(ERROR) << "Unable to get NtQueryInformationProcess";
|
LOG(ERROR) << "Unable to get NtQueryInformationProcess";
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROCESS_BASIC_INFORMATION pbi;
|
PROCESS_BASIC_INFORMATION pbi;
|
||||||
LONG status =
|
LONG status =
|
||||||
NtQueryInformationProcess(handle, ProcessBasicInformation, &pbi,
|
NtQueryInformationProcess(handle, ProcessBasicInformation, &pbi,
|
||||||
sizeof(PROCESS_BASIC_INFORMATION), NULL);
|
sizeof(PROCESS_BASIC_INFORMATION), nullptr);
|
||||||
if (!NT_SUCCESS(status)) {
|
if (!NT_SUCCESS(status)) {
|
||||||
LOG(ERROR) << "NtQueryInformationProcess failed";
|
LOG(ERROR) << "NtQueryInformationProcess failed";
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ::OpenProcess(PROCESS_ALL_ACCESS, TRUE,
|
return ::OpenProcess(PROCESS_ALL_ACCESS, TRUE,
|
||||||
|
@ -131,7 +131,7 @@ void RelauncherSynchronizeWithParent() {
|
||||||
// Notify the parent process that it can quit now.
|
// Notify the parent process that it can quit now.
|
||||||
StringType name = internal::GetWaitEventName(process.Pid());
|
StringType name = internal::GetWaitEventName(process.Pid());
|
||||||
base::win::ScopedHandle wait_event(
|
base::win::ScopedHandle wait_event(
|
||||||
CreateEvent(NULL, TRUE, FALSE, name.c_str()));
|
CreateEvent(nullptr, TRUE, FALSE, name.c_str()));
|
||||||
::SetEvent(wait_event.Get());
|
::SetEvent(wait_event.Get());
|
||||||
|
|
||||||
// Wait for parent process to quit.
|
// Wait for parent process to quit.
|
||||||
|
|
|
@ -21,14 +21,14 @@ namespace certificate_trust {
|
||||||
BOOL AddToTrustedRootStore(const PCCERT_CONTEXT cert_context,
|
BOOL AddToTrustedRootStore(const PCCERT_CONTEXT cert_context,
|
||||||
const scoped_refptr<net::X509Certificate>& cert) {
|
const scoped_refptr<net::X509Certificate>& cert) {
|
||||||
auto* root_cert_store = CertOpenStore(
|
auto* root_cert_store = CertOpenStore(
|
||||||
CERT_STORE_PROV_SYSTEM, 0, NULL, CERT_SYSTEM_STORE_CURRENT_USER, L"Root");
|
CERT_STORE_PROV_SYSTEM, 0, 0, CERT_SYSTEM_STORE_CURRENT_USER, L"Root");
|
||||||
|
|
||||||
if (root_cert_store == NULL) {
|
if (root_cert_store == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto result = CertAddCertificateContextToStore(
|
auto result = CertAddCertificateContextToStore(
|
||||||
root_cert_store, cert_context, CERT_STORE_ADD_REPLACE_EXISTING, NULL);
|
root_cert_store, cert_context, CERT_STORE_ADD_REPLACE_EXISTING, nullptr);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
// force Chromium to reload it's database for this certificate
|
// force Chromium to reload it's database for this certificate
|
||||||
|
@ -44,7 +44,7 @@ BOOL AddToTrustedRootStore(const PCCERT_CONTEXT cert_context,
|
||||||
CERT_CHAIN_PARA GetCertificateChainParameters() {
|
CERT_CHAIN_PARA GetCertificateChainParameters() {
|
||||||
CERT_ENHKEY_USAGE enhkey_usage;
|
CERT_ENHKEY_USAGE enhkey_usage;
|
||||||
enhkey_usage.cUsageIdentifier = 0;
|
enhkey_usage.cUsageIdentifier = 0;
|
||||||
enhkey_usage.rgpszUsageIdentifier = NULL;
|
enhkey_usage.rgpszUsageIdentifier = nullptr;
|
||||||
|
|
||||||
CERT_USAGE_MATCH cert_usage;
|
CERT_USAGE_MATCH cert_usage;
|
||||||
// ensure the rules are applied to the entire chain
|
// ensure the rules are applied to the entire chain
|
||||||
|
@ -69,8 +69,8 @@ v8::Local<v8::Promise> ShowCertificateTrust(
|
||||||
auto cert_context = net::x509_util::CreateCertContextWithChain(cert.get());
|
auto cert_context = net::x509_util::CreateCertContextWithChain(cert.get());
|
||||||
auto params = GetCertificateChainParameters();
|
auto params = GetCertificateChainParameters();
|
||||||
|
|
||||||
if (CertGetCertificateChain(NULL, cert_context.get(), NULL, NULL, ¶ms,
|
if (CertGetCertificateChain(nullptr, cert_context.get(), nullptr, nullptr,
|
||||||
NULL, NULL, &chain_context)) {
|
¶ms, 0, nullptr, &chain_context)) {
|
||||||
auto error_status = chain_context->TrustStatus.dwErrorStatus;
|
auto error_status = chain_context->TrustStatus.dwErrorStatus;
|
||||||
if (error_status == CERT_TRUST_IS_SELF_SIGNED ||
|
if (error_status == CERT_TRUST_IS_SELF_SIGNED ||
|
||||||
error_status == CERT_TRUST_IS_UNTRUSTED_ROOT) {
|
error_status == CERT_TRUST_IS_UNTRUSTED_ROOT) {
|
||||||
|
|
|
@ -63,8 +63,8 @@ NSString* ContainingDiskImageDevice(NSString* bundlePath) {
|
||||||
NSDictionary* info =
|
NSDictionary* info =
|
||||||
[NSPropertyListSerialization propertyListWithData:data
|
[NSPropertyListSerialization propertyListWithData:data
|
||||||
options:NSPropertyListImmutable
|
options:NSPropertyListImmutable
|
||||||
format:NULL
|
format:nil
|
||||||
error:NULL];
|
error:nil];
|
||||||
|
|
||||||
if (![info isKindOfClass:[NSDictionary class]])
|
if (![info isKindOfClass:[NSDictionary class]])
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -100,7 +100,7 @@ NSString* ContainingDiskImageDevice(NSString* bundlePath) {
|
||||||
NSString* ResolvePath(NSString* path) {
|
NSString* ResolvePath(NSString* path) {
|
||||||
NSString* standardizedPath = [path stringByStandardizingPath];
|
NSString* standardizedPath = [path stringByStandardizingPath];
|
||||||
char resolved[PATH_MAX];
|
char resolved[PATH_MAX];
|
||||||
if (realpath([standardizedPath UTF8String], resolved) == NULL)
|
if (realpath([standardizedPath UTF8String], resolved) == nullptr)
|
||||||
return path;
|
return path;
|
||||||
return @(resolved);
|
return @(resolved);
|
||||||
}
|
}
|
||||||
|
@ -147,20 +147,20 @@ bool AuthorizedInstall(NSString* srcPath, NSString* dstPath, bool* canceled) {
|
||||||
|
|
||||||
// Get the authorization
|
// Get the authorization
|
||||||
OSStatus err =
|
OSStatus err =
|
||||||
AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment,
|
AuthorizationCreate(nullptr, kAuthorizationEmptyEnvironment,
|
||||||
kAuthorizationFlagDefaults, &myAuthorizationRef);
|
kAuthorizationFlagDefaults, &myAuthorizationRef);
|
||||||
if (err != errAuthorizationSuccess)
|
if (err != errAuthorizationSuccess)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
AuthorizationItem myItems = {kAuthorizationRightExecute, 0, NULL, 0};
|
AuthorizationItem myItems = {kAuthorizationRightExecute, 0, nullptr, 0};
|
||||||
AuthorizationRights myRights = {1, &myItems};
|
AuthorizationRights myRights = {1, &myItems};
|
||||||
AuthorizationFlags myFlags =
|
AuthorizationFlags myFlags =
|
||||||
(AuthorizationFlags)(kAuthorizationFlagInteractionAllowed |
|
(AuthorizationFlags)(kAuthorizationFlagInteractionAllowed |
|
||||||
kAuthorizationFlagExtendRights |
|
kAuthorizationFlagExtendRights |
|
||||||
kAuthorizationFlagPreAuthorize);
|
kAuthorizationFlagPreAuthorize);
|
||||||
|
|
||||||
err = AuthorizationCopyRights(myAuthorizationRef, &myRights, NULL, myFlags,
|
err = AuthorizationCopyRights(myAuthorizationRef, &myRights, nullptr, myFlags,
|
||||||
NULL);
|
nullptr);
|
||||||
if (err != errAuthorizationSuccess) {
|
if (err != errAuthorizationSuccess) {
|
||||||
if (err == errAuthorizationCanceled && canceled)
|
if (err == errAuthorizationCanceled && canceled)
|
||||||
*canceled = true;
|
*canceled = true;
|
||||||
|
@ -170,7 +170,7 @@ bool AuthorizedInstall(NSString* srcPath, NSString* dstPath, bool* canceled) {
|
||||||
static OSStatus (*security_AuthorizationExecuteWithPrivileges)(
|
static OSStatus (*security_AuthorizationExecuteWithPrivileges)(
|
||||||
AuthorizationRef authorization, const char* pathToTool,
|
AuthorizationRef authorization, const char* pathToTool,
|
||||||
AuthorizationFlags options, char* const* arguments,
|
AuthorizationFlags options, char* const* arguments,
|
||||||
FILE** communicationsPipe) = NULL;
|
FILE** communicationsPipe) = nullptr;
|
||||||
if (!security_AuthorizationExecuteWithPrivileges) {
|
if (!security_AuthorizationExecuteWithPrivileges) {
|
||||||
// On 10.7, AuthorizationExecuteWithPrivileges is deprecated. We want to
|
// On 10.7, AuthorizationExecuteWithPrivileges is deprecated. We want to
|
||||||
// still use it since there's no good alternative (without requiring code
|
// still use it since there's no good alternative (without requiring code
|
||||||
|
@ -188,9 +188,10 @@ bool AuthorizedInstall(NSString* srcPath, NSString* dstPath, bool* canceled) {
|
||||||
// Delete the destination
|
// Delete the destination
|
||||||
{
|
{
|
||||||
char rf[] = "-rf";
|
char rf[] = "-rf";
|
||||||
char* args[] = {rf, (char*)[dstPath fileSystemRepresentation], NULL};
|
char* args[] = {rf, (char*)[dstPath fileSystemRepresentation], nullptr};
|
||||||
err = security_AuthorizationExecuteWithPrivileges(
|
err = security_AuthorizationExecuteWithPrivileges(
|
||||||
myAuthorizationRef, "/bin/rm", kAuthorizationFlagDefaults, args, NULL);
|
myAuthorizationRef, "/bin/rm", kAuthorizationFlagDefaults, args,
|
||||||
|
nullptr);
|
||||||
if (err != errAuthorizationSuccess)
|
if (err != errAuthorizationSuccess)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@ -205,9 +206,10 @@ bool AuthorizedInstall(NSString* srcPath, NSString* dstPath, bool* canceled) {
|
||||||
{
|
{
|
||||||
char pR[] = "-pR";
|
char pR[] = "-pR";
|
||||||
char* args[] = {pR, (char*)[srcPath fileSystemRepresentation],
|
char* args[] = {pR, (char*)[srcPath fileSystemRepresentation],
|
||||||
(char*)[dstPath fileSystemRepresentation], NULL};
|
(char*)[dstPath fileSystemRepresentation], nullptr};
|
||||||
err = security_AuthorizationExecuteWithPrivileges(
|
err = security_AuthorizationExecuteWithPrivileges(
|
||||||
myAuthorizationRef, "/bin/cp", kAuthorizationFlagDefaults, args, NULL);
|
myAuthorizationRef, "/bin/cp", kAuthorizationFlagDefaults, args,
|
||||||
|
nullptr);
|
||||||
if (err != errAuthorizationSuccess)
|
if (err != errAuthorizationSuccess)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@ -272,8 +274,8 @@ bool Trash(NSString* path) {
|
||||||
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_8) {
|
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_8) {
|
||||||
result = [[NSFileManager defaultManager]
|
result = [[NSFileManager defaultManager]
|
||||||
trashItemAtURL:[NSURL fileURLWithPath:path]
|
trashItemAtURL:[NSURL fileURLWithPath:path]
|
||||||
resultingItemURL:NULL
|
resultingItemURL:nil
|
||||||
error:NULL];
|
error:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
// As a last resort try trashing with AppleScript.
|
// As a last resort try trashing with AppleScript.
|
||||||
|
|
|
@ -90,7 +90,7 @@ NSMenu* MakeEmptySubmenu() {
|
||||||
NSString* empty_menu_title =
|
NSString* empty_menu_title =
|
||||||
l10n_util::GetNSString(IDS_APP_MENU_EMPTY_SUBMENU);
|
l10n_util::GetNSString(IDS_APP_MENU_EMPTY_SUBMENU);
|
||||||
|
|
||||||
[submenu addItemWithTitle:empty_menu_title action:NULL keyEquivalent:@""];
|
[submenu addItemWithTitle:empty_menu_title action:nullptr keyEquivalent:@""];
|
||||||
[[submenu itemAtIndex:0] setEnabled:NO];
|
[[submenu itemAtIndex:0] setEnabled:NO];
|
||||||
return submenu;
|
return submenu;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ class FileChooserDialog {
|
||||||
|
|
||||||
if (electron::IsElectron_gtkInitialized()) {
|
if (electron::IsElectron_gtkInitialized()) {
|
||||||
dialog_ = GTK_FILE_CHOOSER(gtk_file_chooser_native_new(
|
dialog_ = GTK_FILE_CHOOSER(gtk_file_chooser_native_new(
|
||||||
settings.title.c_str(), NULL, action,
|
settings.title.c_str(), nullptr, action,
|
||||||
label.empty() ? nullptr : label.c_str(), nullptr));
|
label.empty() ? nullptr : label.c_str(), nullptr));
|
||||||
} else {
|
} else {
|
||||||
const char* confirm_text = gtk_util::GetOkLabel();
|
const char* confirm_text = gtk_util::GetOkLabel();
|
||||||
|
@ -75,8 +75,8 @@ class FileChooserDialog {
|
||||||
confirm_text = gtk_util::GetOpenLabel();
|
confirm_text = gtk_util::GetOpenLabel();
|
||||||
|
|
||||||
dialog_ = GTK_FILE_CHOOSER(gtk_file_chooser_dialog_new(
|
dialog_ = GTK_FILE_CHOOSER(gtk_file_chooser_dialog_new(
|
||||||
settings.title.c_str(), NULL, action, gtk_util::GetCancelLabel(),
|
settings.title.c_str(), nullptr, action, gtk_util::GetCancelLabel(),
|
||||||
GTK_RESPONSE_CANCEL, confirm_text, GTK_RESPONSE_ACCEPT, NULL));
|
GTK_RESPONSE_CANCEL, confirm_text, GTK_RESPONSE_ACCEPT, nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent_) {
|
if (parent_) {
|
||||||
|
|
|
@ -68,9 +68,9 @@ static HRESULT GetFileNameFromShellItem(IShellItem* pShellItem,
|
||||||
SIGDN type,
|
SIGDN type,
|
||||||
LPWSTR lpstr,
|
LPWSTR lpstr,
|
||||||
size_t cchLength) {
|
size_t cchLength) {
|
||||||
assert(pShellItem != NULL);
|
assert(pShellItem != nullptr);
|
||||||
|
|
||||||
LPWSTR lpstrName = NULL;
|
LPWSTR lpstrName = nullptr;
|
||||||
HRESULT hRet = pShellItem->GetDisplayName(type, &lpstrName);
|
HRESULT hRet = pShellItem->GetDisplayName(type, &lpstrName);
|
||||||
|
|
||||||
if (SUCCEEDED(hRet)) {
|
if (SUCCEEDED(hRet)) {
|
||||||
|
@ -93,7 +93,7 @@ static void SetDefaultFolder(IFileDialog* dialog,
|
||||||
IsDirectory(file_path) ? file_path.value() : file_path.DirName().value();
|
IsDirectory(file_path) ? file_path.value() : file_path.DirName().value();
|
||||||
|
|
||||||
ATL::CComPtr<IShellItem> folder_item;
|
ATL::CComPtr<IShellItem> folder_item;
|
||||||
HRESULT hr = SHCreateItemFromParsingName(directory.c_str(), NULL,
|
HRESULT hr = SHCreateItemFromParsingName(directory.c_str(), nullptr,
|
||||||
IID_PPV_ARGS(&folder_item));
|
IID_PPV_ARGS(&folder_item));
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
dialog->SetFolder(folder_item);
|
dialog->SetFolder(folder_item);
|
||||||
|
@ -105,7 +105,7 @@ static HRESULT ShowFileDialog(IFileDialog* dialog,
|
||||||
settings.parent_window
|
settings.parent_window
|
||||||
? static_cast<electron::NativeWindowViews*>(settings.parent_window)
|
? static_cast<electron::NativeWindowViews*>(settings.parent_window)
|
||||||
->GetAcceleratedWidget()
|
->GetAcceleratedWidget()
|
||||||
: NULL;
|
: nullptr;
|
||||||
|
|
||||||
return dialog->Show(parent_window);
|
return dialog->Show(parent_window);
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ DialogResult ShowTaskDialogWstr(gfx::AcceleratedWidget parent,
|
||||||
|
|
||||||
TASKDIALOGCONFIG config = {0};
|
TASKDIALOGCONFIG config = {0};
|
||||||
config.cbSize = sizeof(config);
|
config.cbSize = sizeof(config);
|
||||||
config.hInstance = GetModuleHandle(NULL);
|
config.hInstance = GetModuleHandle(nullptr);
|
||||||
config.dwFlags = flags;
|
config.dwFlags = flags;
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
|
|
|
@ -15,14 +15,14 @@
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool MonitorHasAutohideTaskbarForEdge(UINT edge, HMONITOR monitor) {
|
bool MonitorHasAutohideTaskbarForEdge(UINT edge, HMONITOR monitor) {
|
||||||
APPBARDATA taskbar_data = {sizeof(APPBARDATA), NULL, 0, edge};
|
APPBARDATA taskbar_data = {sizeof(APPBARDATA), nullptr, 0, edge};
|
||||||
taskbar_data.hWnd = ::GetForegroundWindow();
|
taskbar_data.hWnd = ::GetForegroundWindow();
|
||||||
|
|
||||||
// MSDN documents an ABM_GETAUTOHIDEBAREX, which supposedly takes a monitor
|
// MSDN documents an ABM_GETAUTOHIDEBAREX, which supposedly takes a monitor
|
||||||
// rect and returns autohide bars on that monitor. This sounds like a good
|
// rect and returns autohide bars on that monitor. This sounds like a good
|
||||||
// idea for multi-monitor systems. Unfortunately, it appears to not work at
|
// idea for multi-monitor systems. Unfortunately, it appears to not work at
|
||||||
// least some of the time (erroneously returning NULL) and there's almost no
|
// least some of the time (erroneously returning nullptr) and there's almost
|
||||||
// online documentation or other sample code using it that suggests ways to
|
// no online documentation or other sample code using it that suggests ways to
|
||||||
// address this problem. We do the following:-
|
// address this problem. We do the following:-
|
||||||
// 1. Use the ABM_GETAUTOHIDEBAR message. If it works, i.e. returns a valid
|
// 1. Use the ABM_GETAUTOHIDEBAR message. If it works, i.e. returns a valid
|
||||||
// window we are done.
|
// window we are done.
|
||||||
|
@ -40,7 +40,7 @@ bool MonitorHasAutohideTaskbarForEdge(UINT edge, HMONITOR monitor) {
|
||||||
if (!(taskbar_state & ABS_AUTOHIDE))
|
if (!(taskbar_state & ABS_AUTOHIDE))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
new_taskbar_data.hWnd = ::FindWindow(L"Shell_TrayWnd", NULL);
|
new_taskbar_data.hWnd = ::FindWindow(L"Shell_TrayWnd", nullptr);
|
||||||
if (!::IsWindow(new_taskbar_data.hWnd))
|
if (!::IsWindow(new_taskbar_data.hWnd))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ namespace electron {
|
||||||
|
|
||||||
HICON ViewsDelegate::GetDefaultWindowIcon() const {
|
HICON ViewsDelegate::GetDefaultWindowIcon() const {
|
||||||
// Use current exe's icon as default window icon.
|
// Use current exe's icon as default window icon.
|
||||||
return LoadIcon(GetModuleHandle(NULL),
|
return LoadIcon(GetModuleHandle(nullptr),
|
||||||
MAKEINTRESOURCE(1 /* IDR_MAINFRAME */));
|
MAKEINTRESOURCE(1 /* IDR_MAINFRAME */));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ bool AppendFile(const JumpListItem& item, IObjectCollection* collection) {
|
||||||
DCHECK(collection);
|
DCHECK(collection);
|
||||||
|
|
||||||
CComPtr<IShellItem> file;
|
CComPtr<IShellItem> file;
|
||||||
if (SUCCEEDED(SHCreateItemFromParsingName(item.path.value().c_str(), NULL,
|
if (SUCCEEDED(SHCreateItemFromParsingName(item.path.value().c_str(), nullptr,
|
||||||
IID_PPV_ARGS(&file))))
|
IID_PPV_ARGS(&file))))
|
||||||
return SUCCEEDED(collection->AddObject(file));
|
return SUCCEEDED(collection->AddObject(file));
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ NotifyIconHost::NotifyIconHost() {
|
||||||
base::win::InitializeWindowClass(
|
base::win::InitializeWindowClass(
|
||||||
kNotifyIconHostWindowClass,
|
kNotifyIconHostWindowClass,
|
||||||
&base::win::WrappedWindowProc<NotifyIconHost::WndProcStatic>, 0, 0, 0,
|
&base::win::WrappedWindowProc<NotifyIconHost::WndProcStatic>, 0, 0, 0,
|
||||||
NULL, NULL, NULL, NULL, NULL, &window_class);
|
nullptr, nullptr, nullptr, nullptr, nullptr, &window_class);
|
||||||
instance_ = window_class.hInstance;
|
instance_ = window_class.hInstance;
|
||||||
atom_ = RegisterClassEx(&window_class);
|
atom_ = RegisterClassEx(&window_class);
|
||||||
CHECK(atom_);
|
CHECK(atom_);
|
||||||
|
@ -144,7 +144,7 @@ LRESULT CALLBACK NotifyIconHost::WndProc(HWND hwnd,
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (message == kNotifyIconMessage) {
|
} else if (message == kNotifyIconMessage) {
|
||||||
NotifyIcon* win_icon = NULL;
|
NotifyIcon* win_icon = nullptr;
|
||||||
|
|
||||||
// Find the selected status icon.
|
// Find the selected status icon.
|
||||||
for (NotifyIcons::const_iterator i(notify_icons_.begin());
|
for (NotifyIcons::const_iterator i(notify_icons_.begin());
|
||||||
|
|
|
@ -182,7 +182,7 @@ bool TaskbarHost::SetThumbnailClip(HWND window, const gfx::Rect& region) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (region.IsEmpty()) {
|
if (region.IsEmpty()) {
|
||||||
return SUCCEEDED(taskbar_->SetThumbnailClip(window, NULL));
|
return SUCCEEDED(taskbar_->SetThumbnailClip(window, nullptr));
|
||||||
} else {
|
} else {
|
||||||
RECT rect =
|
RECT rect =
|
||||||
display::win::ScreenWin::DIPToScreenRect(window, region).ToRECT();
|
display::win::ScreenWin::DIPToScreenRect(window, region).ToRECT();
|
||||||
|
|
|
@ -114,8 +114,8 @@ base::win::ScopedHICON ReadICOFromPath(int size, const base::FilePath& path) {
|
||||||
|
|
||||||
// Load the icon from file.
|
// Load the icon from file.
|
||||||
return base::win::ScopedHICON(
|
return base::win::ScopedHICON(
|
||||||
static_cast<HICON>(LoadImage(NULL, image_path.value().c_str(), IMAGE_ICON,
|
static_cast<HICON>(LoadImage(nullptr, image_path.value().c_str(),
|
||||||
size, size, LR_LOADFROMFILE)));
|
IMAGE_ICON, size, size, LR_LOADFROMFILE)));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ HICON NativeImage::GetHICON(int size) {
|
||||||
|
|
||||||
// Then convert the image to ICO.
|
// Then convert the image to ICO.
|
||||||
if (image_.IsEmpty())
|
if (image_.IsEmpty())
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
auto& hicon = hicons_[size];
|
auto& hicon = hicons_[size];
|
||||||
hicon = IconUtil::CreateHICONFromSkBitmap(image_.AsBitmap());
|
hicon = IconUtil::CreateHICONFromSkBitmap(image_.AsBitmap());
|
||||||
|
|
|
@ -62,7 +62,7 @@ v8::Local<v8::Promise> NativeImage::CreateThumbnailFromPath(
|
||||||
hr = pThumbnailCache->GetThumbnail(
|
hr = pThumbnailCache->GetThumbnail(
|
||||||
pItem.Get(), size.width(),
|
pItem.Get(), size.width(),
|
||||||
WTS_FLAGS::WTS_SCALETOREQUESTEDSIZE | WTS_FLAGS::WTS_SCALEUP, &pThumbnail,
|
WTS_FLAGS::WTS_SCALETOREQUESTEDSIZE | WTS_FLAGS::WTS_SCALEUP, &pThumbnail,
|
||||||
NULL, NULL);
|
nullptr, nullptr);
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
promise.RejectWithErrorMessage(
|
promise.RejectWithErrorMessage(
|
||||||
|
@ -71,7 +71,7 @@ v8::Local<v8::Promise> NativeImage::CreateThumbnailFromPath(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init HBITMAP
|
// Init HBITMAP
|
||||||
HBITMAP hBitmap = NULL;
|
HBITMAP hBitmap = nullptr;
|
||||||
hr = pThumbnail->GetSharedBitmap(&hBitmap);
|
hr = pThumbnail->GetSharedBitmap(&hBitmap);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
promise.RejectWithErrorMessage("Failed to extract bitmap from thumbnail");
|
promise.RejectWithErrorMessage("Failed to extract bitmap from thumbnail");
|
||||||
|
|
|
@ -15,9 +15,9 @@ struct Converter<electron::NativeWindow*> {
|
||||||
static bool FromV8(v8::Isolate* isolate,
|
static bool FromV8(v8::Isolate* isolate,
|
||||||
v8::Local<v8::Value> val,
|
v8::Local<v8::Value> val,
|
||||||
electron::NativeWindow** out) {
|
electron::NativeWindow** out) {
|
||||||
// null would be transferred to NULL.
|
// null would be transferred to nullptr.
|
||||||
if (val->IsNull()) {
|
if (val->IsNull()) {
|
||||||
*out = NULL;
|
*out = nullptr;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@ NodeBindingsWin::NodeBindingsWin(BrowserEnvironment browser_env)
|
||||||
|
|
||||||
if (event_loop->iocp && event_loop->iocp != INVALID_HANDLE_VALUE)
|
if (event_loop->iocp && event_loop->iocp != INVALID_HANDLE_VALUE)
|
||||||
CloseHandle(event_loop->iocp);
|
CloseHandle(event_loop->iocp);
|
||||||
event_loop->iocp = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 2);
|
event_loop->iocp =
|
||||||
|
CreateIoCompletionPort(INVALID_HANDLE_VALUE, nullptr, 0, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ void NodeBindingsWin::PollEvents() {
|
||||||
timeout);
|
timeout);
|
||||||
|
|
||||||
// Give the event back so libuv can deal with it.
|
// Give the event back so libuv can deal with it.
|
||||||
if (overlapped != NULL)
|
if (overlapped != nullptr)
|
||||||
PostQueuedCompletionStatus(event_loop->iocp, bytes, key, overlapped);
|
PostQueuedCompletionStatus(event_loop->iocp, bytes, key, overlapped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,9 @@ std::string OpenURL(NSURL* ns_url, bool activate) {
|
||||||
CFURLRef ref =
|
CFURLRef ref =
|
||||||
LSCopyDefaultApplicationURLForURL(cf_url, kLSRolesAll, nullptr);
|
LSCopyDefaultApplicationURLForURL(cf_url, kLSRolesAll, nullptr);
|
||||||
|
|
||||||
// If no application could be found, NULL is returned and outError
|
// If no application could be found, nullptr is returned and outError
|
||||||
// (if not NULL) is populated with kLSApplicationNotFoundErr.
|
// (if not nullptr) is populated with kLSApplicationNotFoundErr.
|
||||||
if (ref == NULL)
|
if (ref == nullptr)
|
||||||
return "No application in the Launch Services database matches the input "
|
return "No application in the Launch Services database matches the input "
|
||||||
"criteria.";
|
"criteria.";
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ std::string OpenPathOnThread(const base::FilePath& full_path) {
|
||||||
withAppBundleIdentifier:nil
|
withAppBundleIdentifier:nil
|
||||||
options:launch_options
|
options:launch_options
|
||||||
additionalEventParamDescriptor:nil
|
additionalEventParamDescriptor:nil
|
||||||
launchIdentifiers:NULL];
|
launchIdentifiers:nil];
|
||||||
|
|
||||||
return success ? "" : "Failed to open path";
|
return success ? "" : "Failed to open path";
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ HRESULT DeleteFileProgressSink::PreDeleteItem(DWORD dwFlags, IShellItem*) {
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT DeleteFileProgressSink::QueryInterface(REFIID riid, LPVOID* ppvObj) {
|
HRESULT DeleteFileProgressSink::QueryInterface(REFIID riid, LPVOID* ppvObj) {
|
||||||
// Always set out parameter to NULL, validating it first.
|
// Always set out parameter to nullptr, validating it first.
|
||||||
if (!ppvObj)
|
if (!ppvObj)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
*ppvObj = nullptr;
|
*ppvObj = nullptr;
|
||||||
|
@ -285,16 +285,16 @@ void ShowItemInFolderOnWorkerThread(const base::FilePath& full_path) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
base::win::ScopedCoMem<ITEMIDLIST> dir_item;
|
base::win::ScopedCoMem<ITEMIDLIST> dir_item;
|
||||||
hr = desktop->ParseDisplayName(NULL, NULL,
|
hr = desktop->ParseDisplayName(nullptr, nullptr,
|
||||||
const_cast<wchar_t*>(dir.value().c_str()),
|
const_cast<wchar_t*>(dir.value().c_str()),
|
||||||
NULL, &dir_item, NULL);
|
nullptr, &dir_item, nullptr);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
base::win::ScopedCoMem<ITEMIDLIST> file_item;
|
base::win::ScopedCoMem<ITEMIDLIST> file_item;
|
||||||
hr = desktop->ParseDisplayName(
|
hr = desktop->ParseDisplayName(
|
||||||
NULL, NULL, const_cast<wchar_t*>(full_path.value().c_str()), NULL,
|
nullptr, nullptr, const_cast<wchar_t*>(full_path.value().c_str()),
|
||||||
&file_item, NULL);
|
nullptr, &file_item, nullptr);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -305,7 +305,8 @@ void ShowItemInFolderOnWorkerThread(const base::FilePath& full_path) {
|
||||||
// found" even though the file is there. In these cases, ShellExecute()
|
// found" even though the file is there. In these cases, ShellExecute()
|
||||||
// seems to work as a fallback (although it won't select the file).
|
// seems to work as a fallback (although it won't select the file).
|
||||||
if (hr == ERROR_FILE_NOT_FOUND) {
|
if (hr == ERROR_FILE_NOT_FOUND) {
|
||||||
ShellExecute(NULL, L"open", dir.value().c_str(), NULL, NULL, SW_SHOW);
|
ShellExecute(nullptr, L"open", dir.value().c_str(), nullptr, nullptr,
|
||||||
|
SW_SHOW);
|
||||||
} else {
|
} else {
|
||||||
LOG(WARNING) << " " << __func__ << "(): Can't open full_path = \""
|
LOG(WARNING) << " " << __func__ << "(): Can't open full_path = \""
|
||||||
<< full_path.value() << "\""
|
<< full_path.value() << "\""
|
||||||
|
@ -380,7 +381,7 @@ bool MoveItemToTrashWithError(const base::FilePath& path,
|
||||||
|
|
||||||
// Create an IShellItem from the supplied source path.
|
// Create an IShellItem from the supplied source path.
|
||||||
Microsoft::WRL::ComPtr<IShellItem> delete_item;
|
Microsoft::WRL::ComPtr<IShellItem> delete_item;
|
||||||
if (FAILED(SHCreateItemFromParsingName(path.value().c_str(), NULL,
|
if (FAILED(SHCreateItemFromParsingName(path.value().c_str(), nullptr,
|
||||||
IID_PPV_ARGS(&delete_item)))) {
|
IID_PPV_ARGS(&delete_item)))) {
|
||||||
*error = "Failed to parse path";
|
*error = "Failed to parse path";
|
||||||
return false;
|
return false;
|
||||||
|
@ -433,8 +434,8 @@ bool GetFolderPath(int key, base::FilePath* result) {
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case electron::DIR_RECENT:
|
case electron::DIR_RECENT:
|
||||||
if (FAILED(SHGetFolderPath(NULL, CSIDL_RECENT, NULL, SHGFP_TYPE_CURRENT,
|
if (FAILED(SHGetFolderPath(nullptr, CSIDL_RECENT, nullptr,
|
||||||
system_buffer))) {
|
SHGFP_TYPE_CURRENT, system_buffer))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*result = base::FilePath(system_buffer);
|
*result = base::FilePath(system_buffer);
|
||||||
|
|
Loading…
Reference in a new issue