Style fixes for SetProgressBar
This commit is contained in:
parent
81244c2221
commit
dd79c71302
2 changed files with 11 additions and 15 deletions
|
@ -905,7 +905,7 @@ gfx::NativeWindow NativeWindowViews::GetNativeWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowViews::SetProgressBar(
|
void NativeWindowViews::SetProgressBar(
|
||||||
double progress, const std::string& mode) {
|
double progress, const std::string& mode) {
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
taskbar_host_.SetProgressBar(GetAcceleratedWidget(), progress, mode);
|
taskbar_host_.SetProgressBar(GetAcceleratedWidget(), progress, mode);
|
||||||
#elif defined(USE_X11)
|
#elif defined(USE_X11)
|
||||||
|
|
|
@ -118,39 +118,35 @@ bool TaskbarHost::SetThumbarButtons(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TaskbarHost::SetProgressBar(
|
bool TaskbarHost::SetProgressBar(
|
||||||
HWND window, double value, const std::string& mode) {
|
HWND window, double value, const std::string& mode) {
|
||||||
if (!InitializeTaskbar())
|
if (!InitializeTaskbar())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
HRESULT barR;
|
bool success;
|
||||||
HRESULT stateR;
|
|
||||||
|
|
||||||
if (value > 1.0 || mode == "indeterminate") {
|
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") {
|
} else if (value < 0 || mode == "none") {
|
||||||
barR = taskbar_->SetProgressState(window, TBPF_NOPROGRESS);
|
success = SUCCEEDED(taskbar_->SetProgressState(window, TBPF_NOPROGRESS));
|
||||||
} else {
|
} else {
|
||||||
// Unless SetProgressState set a blocking state (TBPF_ERROR, TBPF_PAUSED)
|
// Unless SetProgressState set a blocking state (TBPF_ERROR, TBPF_PAUSED)
|
||||||
// for the window, a call to SetProgressValue assumes the TBPF_NORMAL
|
// for the window, a call to SetProgressValue assumes the TBPF_NORMAL
|
||||||
// state even if it is not explicitly set.
|
// state even if it is not explicitly set.
|
||||||
// SetProgressValue overrides and clears the TBPF_INDETERMINATE state.
|
// SetProgressValue overrides and clears the TBPF_INDETERMINATE state.
|
||||||
if (mode == "error") {
|
if (mode == "error") {
|
||||||
stateR = taskbar_->SetProgressState(window, TBPF_ERROR);
|
success = SUCCEEDED(taskbar_->SetProgressState(window, TBPF_ERROR));
|
||||||
} else if (mode == "paused") {
|
} else if (mode == "paused") {
|
||||||
stateR = taskbar_->SetProgressState(window, TBPF_PAUSED);
|
success = SUCCEEDED(taskbar_->SetProgressState(window, TBPF_PAUSED));
|
||||||
} else {
|
} else {
|
||||||
stateR = taskbar_->SetProgressState(window, TBPF_NORMAL);
|
success = SUCCEEDED(taskbar_->SetProgressState(window, TBPF_NORMAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SUCCEEDED(stateR)) {
|
if (success) {
|
||||||
int val = static_cast<int>(value * 100);
|
int val = static_cast<int>(value * 100);
|
||||||
barR = taskbar_->SetProgressValue(window, val, 100);
|
success = SUCCEEDED(taskbar_->SetProgressValue(window, val, 100));
|
||||||
} else {
|
|
||||||
return SUCCEEDED(stateR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return SUCCEEDED(barR);
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TaskbarHost::SetOverlayIcon(
|
bool TaskbarHost::SetOverlayIcon(
|
||||||
|
|
Loading…
Reference in a new issue