diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 39e402aba53e..af793719cddc 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -905,7 +905,7 @@ gfx::NativeWindow NativeWindowViews::GetNativeWindow() { } void NativeWindowViews::SetProgressBar( - double progress, const std::string& mode) { + double progress, const std::string& mode) { #if defined(OS_WIN) taskbar_host_.SetProgressBar(GetAcceleratedWidget(), progress, mode); #elif defined(USE_X11) diff --git a/atom/browser/ui/win/taskbar_host.cc b/atom/browser/ui/win/taskbar_host.cc index a9ff16dccaed..698c2f6c23c0 100644 --- a/atom/browser/ui/win/taskbar_host.cc +++ b/atom/browser/ui/win/taskbar_host.cc @@ -118,39 +118,35 @@ bool TaskbarHost::SetThumbarButtons( } bool TaskbarHost::SetProgressBar( - HWND window, double value, const std::string& mode) { + HWND window, double value, const std::string& mode) { if (!InitializeTaskbar()) return false; - HRESULT barR; - HRESULT stateR; - + bool success; if (value > 1.0 || mode == "indeterminate") { - barR = taskbar_->SetProgressState(window, TBPF_INDETERMINATE); + success = SUCCEEDED(taskbar_->SetProgressState(window, TBPF_INDETERMINATE)); } else if (value < 0 || mode == "none") { - barR = taskbar_->SetProgressState(window, TBPF_NOPROGRESS); + success = SUCCEEDED(taskbar_->SetProgressState(window, TBPF_NOPROGRESS)); } else { // Unless SetProgressState set a blocking state (TBPF_ERROR, TBPF_PAUSED) // for the window, a call to SetProgressValue assumes the TBPF_NORMAL // state even if it is not explicitly set. // SetProgressValue overrides and clears the TBPF_INDETERMINATE state. if (mode == "error") { - stateR = taskbar_->SetProgressState(window, TBPF_ERROR); + success = SUCCEEDED(taskbar_->SetProgressState(window, TBPF_ERROR)); } else if (mode == "paused") { - stateR = taskbar_->SetProgressState(window, TBPF_PAUSED); + success = SUCCEEDED(taskbar_->SetProgressState(window, TBPF_PAUSED)); } else { - stateR = taskbar_->SetProgressState(window, TBPF_NORMAL); + success = SUCCEEDED(taskbar_->SetProgressState(window, TBPF_NORMAL)); } - if (SUCCEEDED(stateR)) { + if (success) { int val = static_cast(value * 100); - barR = taskbar_->SetProgressValue(window, val, 100); - } else { - return SUCCEEDED(stateR); + success = SUCCEEDED(taskbar_->SetProgressValue(window, val, 100)); } } - return SUCCEEDED(barR); + return success; } bool TaskbarHost::SetOverlayIcon(