Merge pull request #6788 from electron/felix-progress-enum

Use enum to declare ProgressState
This commit is contained in:
Cheng Zhao 2016-08-18 14:35:00 +09:00 committed by GitHub
commit 06d2dfe119
8 changed files with 36 additions and 13 deletions

View file

@ -587,9 +587,21 @@ void Window::SetFocusable(bool focusable) {
void Window::SetProgressBar(double progress, mate::Arguments* args) {
mate::Dictionary options;
std::string mode;
NativeWindow::ProgressState state = NativeWindow::PROGRESS_NORMAL;
args->GetNext(&options) && options.Get("mode", &mode);
window_->SetProgressBar(progress, mode);
if (mode == "error") {
state = NativeWindow::PROGRESS_ERROR;
} else if (mode == "paused") {
state = NativeWindow::PROGRESS_PAUSED;
} else if (mode == "indeterminate") {
state = NativeWindow::PROGRESS_INDETERMINATE;
} else if (mode == "none") {
state = NativeWindow::PROGRESS_NONE;
}
window_->SetProgressBar(progress, state);
}
void Window::SetOverlayIcon(const gfx::Image& overlay,