window_->Print(settings.silent, settings.print_backgournd);
}
+void Window::SetProgressBar(double progress) {
+ window_->SetProgressBar(progress);
+}
+
mate::Handle<WebContents> Window::GetWebContents(v8::Isolate* isolate) const {
return WebContents::Create(isolate, window_->GetWebContents());
}
.SetMethod("isWebViewFocused", &Window::IsWebViewFocused)
.SetMethod("capturePage", &Window::CapturePage)
.SetMethod("print", &Window::Print)
+ .SetMethod("setProgressBar", &Window::SetProgressBar)
.SetMethod("_getWebContents", &Window::GetWebContents)
.SetMethod("_getDevToolsWebContents", &Window::GetDevToolsWebContents);
}
bool IsDocumentEdited();
void CapturePage(mate::Arguments* args);
void Print(mate::Arguments* args);
+ void SetProgressBar(double progress);
// APIs for WebContents.
mate::Handle<WebContents> GetWebContents(v8::Isolate* isolate) const;
virtual void SetMenu(ui::MenuModel* menu);
virtual bool HasModalDialog();
virtual gfx::NativeWindow GetNativeWindow() = 0;
+ virtual void SetProgressBar(double progress) = 0;
virtual bool IsClosed() const { return is_closed_; }
virtual void OpenDevTools();
#elif defined(OS_WIN)
#include "atom/browser/ui/views/win_frame_view.h"
#include "base/win/scoped_comptr.h"
+#include "base/win/windows_version.h"
#include "ui/base/win/shell.h"
+#include "ui/views/win/hwnd_util.h"
#endif
namespace atom {
return window_->GetNativeWindow();
}
+void NativeWindowViews::SetProgressBar(double progress) {
+#if defined(OS_WIN)
+ if (base::win::GetVersion() < base::win::VERSION_WIN7)
+ return;
+ base::win::ScopedComPtr<ITaskbarList3> taskbar;
+ if (FAILED(taskbar.CreateInstance(CLSID_TaskbarList, NULL,
+ CLSCTX_INPROC_SERVER) ||
+ FAILED(taskbar->HrInit()))) {
+ return;
+ }
+ HWND frame = views::HWNDForNativeWindow(GetNativeWindow());
+ if (progress > 1.0) {
+ taskbar->SetProgressState(frame, TBPF_INDETERMINATE);
+ } else if (progress < 0) {
+ taskbar->SetProgressState(frame, TBPF_NOPROGRESS);
+ } else if (progress >= 0) {
+ taskbar->SetProgressValue(frame, static_cast<int>(progress*100), progress);
+ }
+#endif
+}
+
gfx::AcceleratedWidget NativeWindowViews::GetAcceleratedWidget() {
return GetNativeWindow()->GetHost()->GetAcceleratedWidget();
}
virtual bool IsKiosk() OVERRIDE;
virtual void SetMenu(ui::MenuModel* menu_model) OVERRIDE;
virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
+ virtual void SetProgressBar(double value) OVERRIDE;
gfx::AcceleratedWidget GetAcceleratedWidget();