window_->PreviewFile(path, display_name);
}
+void Window::CloseFilePreview() {
+ window_->CloseFilePreview();
+}
+
void Window::SetParentWindow(v8::Local<v8::Value> value,
mate::Arguments* args) {
if (IsModal()) {
.SetMethod("isFullScreen", &Window::IsFullscreen)
.SetMethod("setAspectRatio", &Window::SetAspectRatio)
.SetMethod("previewFile", &Window::PreviewFile)
+ .SetMethod("closeFilePreview", &Window::CloseFilePreview)
#if !defined(OS_WIN)
.SetMethod("setParentWindow", &Window::SetParentWindow)
#endif
bool IsMenuBarVisible();
void SetAspectRatio(double aspect_ratio, mate::Arguments* args);
void PreviewFile(const std::string& path, mate::Arguments* args);
+ void CloseFilePreview();
void SetParentWindow(v8::Local<v8::Value> value, mate::Arguments* args);
v8::Local<v8::Value> GetParentWindow() const;
std::vector<v8::Local<v8::Object>> GetChildWindows() const;
const std::string& display_name) {
}
+void NativeWindow::CloseFilePreview() {
+}
+
void NativeWindow::RequestToClosePage() {
bool prevent_default = false;
FOR_EACH_OBSERVER(NativeWindowObserver,
double GetAspectRatio();
gfx::Size GetAspectRatioExtraSize();
virtual void SetAspectRatio(double aspect_ratio, const gfx::Size& extra_size);
+
+ // File preview APIs.
virtual void PreviewFile(const std::string& path,
const std::string& display_name);
+ virtual void CloseFilePreview();
base::WeakPtr<NativeWindow> GetWeakPtr() {
return weak_factory_.GetWeakPtr();
override;
void PreviewFile(const std::string& path, const std::string& display_name)
override;
+ void CloseFilePreview() override;
bool IsMovable() override;
void SetMinimizable(bool minimizable) override;
bool IsMinimizable() override;
[window_ previewFileAtPath:path_ns withName:name_ns];
}
+void NativeWindowMac::CloseFilePreview() {
+ if ([QLPreviewPanel sharedPreviewPanelExists]) {
+ [[QLPreviewPanel sharedPreviewPanel] close];
+ }
+}
+
void NativeWindowMac::SetMovable(bool movable) {
[window_ setMovable:movable];
}
Uses [Quick Look][quick-look] to preview a file at a given path.
+#### `win.closeFilePreview()` _macOS_
+
+Closes the currently open [Quick Look][quick-look] panel.
+
#### `win.setBounds(bounds[, animate])`
* `bounds` [Rectangle](structures/rectangle.md)