2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// Copyright (c) 2018 GitHub, Inc.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// Use of this source code is governed by the MIT license that can be
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// found in the LICENSE file.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/browser/api/electron_api_base_window.h"
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <string>
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-31 16:56:00 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <utility>
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <vector>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-02 01:30:53 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "electron/buildflags/buildflags.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-06 14:52:54 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "gin/dictionary.h"
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-04 12:19:40 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/browser/api/electron_api_browser_view.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "shell/browser/api/electron_api_menu.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "shell/browser/api/electron_api_view.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "shell/browser/api/electron_api_web_contents.h"
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-28 15:09:56 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/browser/javascript_environment.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-19 13:46:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/color_util.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-06 14:52:54 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/gin_converters/callback_converter.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/gin_converters/file_path_converter.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/gin_converters/gfx_converter.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-06 14:52:54 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/gin_converters/image_converter.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/gin_converters/native_window_converter.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-31 16:56:00 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/gin_converters/value_converter.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/gin_helper/dictionary.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/gin_helper/object_template_builder.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-31 16:56:00 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/gin_helper/persistent_dictionary.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-19 13:46:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/node_includes.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/options_switches.h"
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#if defined(TOOLKIT_VIEWS)
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-19 13:46:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/browser/native_window_views.h"
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#if defined(OS_WIN)
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-19 13:46:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/browser/ui/win/taskbar_host.h"
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "ui/base/win/shell.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#if defined(OS_WIN)
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								namespace gin {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								template <>
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-19 14:23:04 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								struct Converter<electron::TaskbarHost::ThumbarButton> {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  static bool FromV8(v8::Isolate* isolate,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                     v8::Handle<v8::Value> val,
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-19 14:23:04 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                     electron::TaskbarHost::ThumbarButton* out) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-09 00:10:18 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    gin::Dictionary dict(isolate);
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-06 14:52:54 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if (!gin::ConvertFromV8(isolate, val, &dict))
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    dict.Get("click", &(out->clicked_callback));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    dict.Get("tooltip", &(out->tooltip));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    dict.Get("flags", &out->flags);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return dict.Get("icon", &(out->icon));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}  // namespace gin
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-19 14:23:04 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								namespace electron {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								namespace api {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								namespace {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// Converts binary data to Buffer.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								v8::Local<v8::Value> ToBuffer(v8::Isolate* isolate, void* val, int size) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  auto buffer = node::Buffer::Copy(isolate, static_cast<char*>(val), size);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (buffer.IsEmpty())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return v8::Null(isolate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return buffer.ToLocalChecked();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}  // namespace
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								BaseWindow::BaseWindow(v8::Isolate* isolate,
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-26 19:16:21 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                       const gin_helper::Dictionary& options) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // The parent window.
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin::Handle<BaseWindow> parent;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (options.Get("parent", &parent) && !parent.IsEmpty())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    parent_window_.Reset(isolate, parent.ToV8());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-02 01:30:53 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#if BUILDFLAG(ENABLE_OSR)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Offscreen windows are always created frameless.
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin_helper::Dictionary web_preferences;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bool offscreen;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (options.Get(options::kWebPreferences, &web_preferences) &&
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-29 10:09:51 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      web_preferences.Get(options::kOffscreen, &offscreen) && offscreen) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    const_cast<gin_helper::Dictionary&>(options).Set(options::kFrame, false);
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Creates NativeWindow.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_.reset(NativeWindow::Create(
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      options, parent.IsEmpty() ? nullptr : parent->window_.get()));
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->AddObserver(this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#if defined(TOOLKIT_VIEWS)
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-04 12:58:31 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  v8::Local<v8::Value> icon;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (options.Get(options::kIcon, &icon)) {
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-24 19:24:10 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    SetIconImpl(isolate, icon, NativeImage::OnConvertError::kWarn);
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-07 14:18:43 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								BaseWindow::BaseWindow(gin_helper::Arguments* args,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                       const gin_helper::Dictionary& options)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    : BaseWindow(args->isolate(), options) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-15 10:15:23 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  InitWithArgs(args);
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 16:29:16 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // Init window after everything has been setup.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window()->InitFromOptions(options);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								BaseWindow::~BaseWindow() {
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-15 18:43:25 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  CloseImmediately();
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Destroy the native window in next tick because the native code might be
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // iterating all windows.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, window_.release());
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-11 09:37:46 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Remove global reference so the JS object can be garbage collected.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  self_ref_.Reset();
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::InitWith(v8::Isolate* isolate, v8::Local<v8::Object> wrapper) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 16:18:55 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  AttachAsUserData(window_.get());
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin_helper::TrackableObject<BaseWindow>::InitWith(isolate, wrapper);
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 16:18:55 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // We can only append this window to parent window's child windows after this
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // window's JS wrapper gets initialized.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!parent_window_.IsEmpty()) {
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    gin::Handle<BaseWindow> parent;
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    gin::ConvertFromV8(isolate, GetParentWindow(), &parent);
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 16:18:55 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    DCHECK(!parent.IsEmpty());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    parent->child_windows_.Set(isolate, weak_map_id(), wrapper);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-11 09:37:46 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Reference this object in case it got garbage collected.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  self_ref_.Reset(isolate, wrapper);
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 16:18:55 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::WillCloseWindow(bool* prevent_default) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-19 12:39:17 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (Emit("close")) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    *prevent_default = true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowClosed() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 00:28:04 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // Invalidate weak ptrs before the Javascript object is destroyed,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // there might be some delayed emit events which shouldn't be
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // triggered after this.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  weak_factory_.InvalidateWeakPtrs();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  RemoveFromWeakMap();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->RemoveObserver(this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // We can not call Destroy here because we need to call Emit first, but we
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // also do not want any method to be used, so just mark as destroyed here.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  MarkDestroyed();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("closed");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  RemoveFromParentChildWindows();
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  BaseWindow::ResetBrowserViews();
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Destroy the native class when window is closed.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, GetDestroyClosure());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowEndSession() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("session-end");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowBlur() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-07 11:21:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  EmitEventSoon("blur");
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowFocus() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-07 11:21:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  EmitEventSoon("focus");
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowShow() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("show");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowHide() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("hide");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowMaximize() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("maximize");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowUnmaximize() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("unmaximize");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowMinimize() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("minimize");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowRestore() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("restore");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowWillResize(const gfx::Rect& new_bounds,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                    bool* prevent_default) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-27 11:53:01 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (Emit("will-resize", new_bounds)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    *prevent_default = true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowResize() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("resize");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-11 19:27:24 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowResized() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("resized");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowWillMove(const gfx::Rect& new_bounds,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                  bool* prevent_default) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-28 09:44:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (Emit("will-move", new_bounds)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    *prevent_default = true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowMove() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("move");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowMoved() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("moved");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowEnterFullScreen() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("enter-full-screen");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowLeaveFullScreen() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("leave-full-screen");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowScrollTouchBegin() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("scroll-touch-begin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowScrollTouchEnd() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("scroll-touch-end");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowSwipe(const std::string& direction) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("swipe", direction);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowRotateGesture(float rotation) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-23 12:42:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  Emit("rotate-gesture", rotation);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowSheetBegin() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("sheet-begin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowSheetEnd() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("sheet-end");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowEnterHtmlFullScreen() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("enter-html-full-screen");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowLeaveHtmlFullScreen() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("leave-html-full-screen");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowAlwaysOnTopChanged() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-04 11:02:16 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  Emit("always-on-top-changed", IsAlwaysOnTop());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnExecuteAppCommand(const std::string& command_name) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("app-command", command_name);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnTouchBarItemResult(const std::string& item_id,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                      const base::DictionaryValue& details) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("-touch-bar-interaction", item_id, details);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnNewWindowForTab() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Emit("new-window-for-tab");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-10-08 15:45:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnSystemContextMenu(int x, int y, bool* prevent_default) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (Emit("system-context-menu", gfx::Point(x, y))) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    *prevent_default = true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#if defined(OS_WIN)
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (IsWindowMessageHooked(message)) {
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-28 15:09:56 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    v8::Locker locker(isolate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    v8::HandleScope scope(isolate);
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    messages_callback_map_[message].Run(
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-28 15:09:56 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ToBuffer(isolate, static_cast<void*>(&w_param), sizeof(WPARAM)),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ToBuffer(isolate, static_cast<void*>(&l_param), sizeof(LPARAM)));
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetContentView(gin::Handle<View> view) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ResetBrowserViews();
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-08 14:47:26 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  content_view_.Reset(isolate(), view.ToV8());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetContentView(view->view());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-15 18:43:25 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::CloseImmediately() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!window_->IsClosed())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    window_->CloseImmediately();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::Close() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->Close();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::Focus() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->Focus(true);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::Blur() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->Focus(false);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsFocused() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsFocused();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::Show() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->Show();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::ShowInactive() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // This method doesn't make sense for modal window.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (IsModal())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->ShowInactive();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::Hide() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->Hide();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsVisible() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsVisible();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsEnabled() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsEnabled();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetEnabled(bool enable) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetEnabled(enable);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::Maximize() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->Maximize();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::Unmaximize() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->Unmaximize();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsMaximized() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsMaximized();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::Minimize() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->Minimize();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::Restore() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->Restore();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsMinimized() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsMinimized();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetFullScreen(bool fullscreen) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetFullScreen(fullscreen);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsFullscreen() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsFullscreen();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetBounds(const gfx::Rect& bounds,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                           gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bool animate = false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  args->GetNext(&animate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetBounds(bounds, animate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								gfx::Rect BaseWindow::GetBounds() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->GetBounds();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsNormal() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-24 23:33:27 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return window_->IsNormal();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								gfx::Rect BaseWindow::GetNormalBounds() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-24 23:33:27 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return window_->GetNormalBounds();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetContentBounds(const gfx::Rect& bounds,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                  gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bool animate = false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  args->GetNext(&animate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetContentBounds(bounds, animate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								gfx::Rect BaseWindow::GetContentBounds() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->GetContentBounds();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetSize(int width, int height, gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bool animate = false;
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-09 10:08:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gfx::Size size = window_->GetMinimumSize();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  size.SetToMax(gfx::Size(width, height));
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  args->GetNext(&animate);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-09 10:08:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  window_->SetSize(size, animate);
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::vector<int> BaseWindow::GetSize() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  std::vector<int> result(2);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gfx::Size size = window_->GetSize();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  result[0] = size.width();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  result[1] = size.height();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return result;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetContentSize(int width,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                int height,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bool animate = false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  args->GetNext(&animate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetContentSize(gfx::Size(width, height), animate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::vector<int> BaseWindow::GetContentSize() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  std::vector<int> result(2);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gfx::Size size = window_->GetContentSize();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  result[0] = size.width();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  result[1] = size.height();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return result;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetMinimumSize(int width, int height) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetMinimumSize(gfx::Size(width, height));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::vector<int> BaseWindow::GetMinimumSize() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  std::vector<int> result(2);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gfx::Size size = window_->GetMinimumSize();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  result[0] = size.width();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  result[1] = size.height();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return result;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetMaximumSize(int width, int height) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetMaximumSize(gfx::Size(width, height));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::vector<int> BaseWindow::GetMaximumSize() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  std::vector<int> result(2);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gfx::Size size = window_->GetMaximumSize();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  result[0] = size.width();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  result[1] = size.height();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return result;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetSheetOffset(double offsetY, gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  double offsetX = 0.0;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  args->GetNext(&offsetX);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetSheetOffset(offsetX, offsetY);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetResizable(bool resizable) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetResizable(resizable);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsResizable() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsResizable();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetMovable(bool movable) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetMovable(movable);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsMovable() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsMovable();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetMinimizable(bool minimizable) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetMinimizable(minimizable);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsMinimizable() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsMinimizable();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetMaximizable(bool maximizable) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetMaximizable(maximizable);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsMaximizable() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsMaximizable();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetFullScreenable(bool fullscreenable) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetFullScreenable(fullscreenable);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsFullScreenable() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsFullScreenable();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetClosable(bool closable) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetClosable(closable);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsClosable() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsClosable();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetAlwaysOnTop(bool top, gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  std::string level = "floating";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  int relative_level = 0;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  args->GetNext(&level);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  args->GetNext(&relative_level);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-24 15:58:51 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ui::ZOrderLevel z_order =
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      top ? ui::ZOrderLevel::kFloatingWindow : ui::ZOrderLevel::kNormal;
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-18 15:57:34 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  window_->SetAlwaysOnTop(z_order, level, relative_level);
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsAlwaysOnTop() {
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-24 15:58:51 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return window_->GetZOrderLevel() != ui::ZOrderLevel::kNormal;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::Center() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->Center();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetPosition(int x, int y, gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bool animate = false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  args->GetNext(&animate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetPosition(gfx::Point(x, y), animate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::vector<int> BaseWindow::GetPosition() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  std::vector<int> result(2);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gfx::Point pos = window_->GetPosition();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  result[0] = pos.x();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  result[1] = pos.y();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return result;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::MoveAbove(const std::string& sourceId,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                           gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-21 18:16:43 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#if BUILDFLAG(ENABLE_DESKTOP_CAPTURER)
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-14 23:51:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (!window_->MoveAbove(sourceId))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    args->ThrowError("Invalid media source id");
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-21 18:16:43 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  args->ThrowError("enable_desktop_capturer=true to use this feature");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-14 23:51:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::MoveTop() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->MoveTop();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetTitle(const std::string& title) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetTitle(title);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::string BaseWindow::GetTitle() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->GetTitle();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetAccessibleTitle(const std::string& title) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-28 00:35:34 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  window_->SetAccessibleTitle(title);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::string BaseWindow::GetAccessibleTitle() {
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-28 00:35:34 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return window_->GetAccessibleTitle();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::FlashFrame(bool flash) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->FlashFrame(flash);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetSkipTaskbar(bool skip) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetSkipTaskbar(skip);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetExcludedFromShownWindowsMenu(bool excluded) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 08:10:23 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  window_->SetExcludedFromShownWindowsMenu(excluded);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsExcludedFromShownWindowsMenu() {
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 08:10:23 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return window_->IsExcludedFromShownWindowsMenu();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetSimpleFullScreen(bool simple_fullscreen) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetSimpleFullScreen(simple_fullscreen);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsSimpleFullScreen() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsSimpleFullScreen();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetKiosk(bool kiosk) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetKiosk(kiosk);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsKiosk() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsKiosk();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-09-22 14:40:42 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsTabletMode() const {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsTabletMode();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetBackgroundColor(const std::string& color_name) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  SkColor color = ParseHexColor(color_name);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetBackgroundColor(color);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::string BaseWindow::GetBackgroundColor() {
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-13 17:08:30 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return ToRGBHex(window_->GetBackgroundColor());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetHasShadow(bool has_shadow) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetHasShadow(has_shadow);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::HasShadow() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->HasShadow();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetOpacity(const double opacity) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetOpacity(opacity);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								double BaseWindow::GetOpacity() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->GetOpacity();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetShape(const std::vector<gfx::Rect>& rects) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-30 13:37:40 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  window_->widget()->SetShape(std::make_unique<std::vector<gfx::Rect>>(rects));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetRepresentedFilename(const std::string& filename) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetRepresentedFilename(filename);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::string BaseWindow::GetRepresentedFilename() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->GetRepresentedFilename();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetDocumentEdited(bool edited) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetDocumentEdited(edited);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsDocumentEdited() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsDocumentEdited();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetIgnoreMouseEvents(bool ignore,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                      gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin_helper::Dictionary options;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bool forward = false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  args->GetNext(&options) && options.Get("forward", &forward);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->SetIgnoreMouseEvents(ignore, forward);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetContentProtection(bool enable) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->SetContentProtection(enable);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetFocusable(bool focusable) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->SetFocusable(focusable);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetMenu(v8::Isolate* isolate, v8::Local<v8::Value> value) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-20 13:20:37 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  auto context = isolate->GetCurrentContext();
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-25 22:03:28 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin::Handle<Menu> menu;
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-20 13:20:37 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  v8::Local<v8::Object> object;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (value->IsObject() && value->ToObject(context).ToLocal(&object) &&
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      gin::ConvertFromV8(isolate, value, &menu) && !menu.IsEmpty()) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    menu_.Reset(isolate, menu.ToV8());
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-04 08:19:21 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    // We only want to update the menu if the menu has a non-zero item count,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    // or we risk crashes.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (menu->model()->GetItemCount() == 0) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      RemoveMenu();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      window_->SetMenu(menu->model());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  } else if (value->IsNull()) {
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-04 08:19:21 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    RemoveMenu();
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  } else {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    isolate->ThrowException(
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        v8::Exception::TypeError(gin::StringToV8(isolate, "Invalid Menu")));
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::RemoveMenu() {
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-31 10:58:23 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  menu_.Reset();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetMenu(nullptr);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetParentWindow(v8::Local<v8::Value> value,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                 gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (IsModal()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    args->ThrowError("Can not be called for modal window");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin::Handle<BaseWindow> parent;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (value->IsNull() || value->IsUndefined()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    RemoveFromParentChildWindows();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    parent_window_.Reset();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    window_->SetParentWindow(nullptr);
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-25 22:03:28 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  } else if (gin::ConvertFromV8(isolate(), value, &parent)) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-13 01:05:16 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    RemoveFromParentChildWindows();
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    parent_window_.Reset(isolate(), value);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    window_->SetParentWindow(parent->window_.get());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    parent->child_windows_.Set(isolate(), weak_map_id(), GetWrapper());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  } else {
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    args->ThrowError("Must pass BaseWindow instance or null");
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetBrowserView(v8::Local<v8::Value> value) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ResetBrowserViews();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  AddBrowserView(value);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::AddBrowserView(v8::Local<v8::Value> value) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-25 22:03:28 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin::Handle<BrowserView> browser_view;
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (value->IsObject() &&
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      gin::ConvertFromV8(isolate(), value, &browser_view)) {
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-09 08:48:39 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    auto get_that_view = browser_views_.find(browser_view->ID());
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if (get_that_view == browser_views_.end()) {
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-27 13:04:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if (browser_view->web_contents()) {
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-04 16:34:22 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        // If we're reparenting a BrowserView, ensure that it's detached from
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        // its previous owner window.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        auto* owner_window = browser_view->web_contents()->owner_window();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if (owner_window && owner_window != window_.get()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          owner_window->RemoveBrowserView(browser_view->view());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          browser_view->web_contents()->SetOwnerWindow(nullptr);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-27 13:04:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        window_->AddBrowserView(browser_view->view());
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-25 20:04:13 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        browser_view->web_contents()->SetOwnerWindow(window_.get());
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-27 13:04:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-09 08:48:39 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      browser_views_[browser_view->ID()].Reset(isolate(), value);
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::RemoveBrowserView(v8::Local<v8::Value> value) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-25 22:03:28 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin::Handle<BrowserView> browser_view;
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (value->IsObject() &&
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      gin::ConvertFromV8(isolate(), value, &browser_view)) {
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-09 08:48:39 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    auto get_that_view = browser_views_.find(browser_view->ID());
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if (get_that_view != browser_views_.end()) {
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-27 13:04:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if (browser_view->web_contents()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        window_->RemoveBrowserView(browser_view->view());
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-25 20:04:13 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        browser_view->web_contents()->SetOwnerWindow(nullptr);
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-27 13:04:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      (*get_that_view).second.Reset(isolate(), value);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      browser_views_.erase(get_that_view);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-14 23:51:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-09 23:23:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetTopBrowserView(v8::Local<v8::Value> value,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                   gin_helper::Arguments* args) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gin::Handle<BrowserView> browser_view;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (value->IsObject() &&
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      gin::ConvertFromV8(isolate(), value, &browser_view)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (!browser_view->web_contents())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    auto* owner_window = browser_view->web_contents()->owner_window();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    auto get_that_view = browser_views_.find(browser_view->ID());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (get_that_view == browser_views_.end() ||
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        (owner_window && owner_window != window_.get())) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      args->ThrowError("Given BrowserView is not attached to the window");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    window_->SetTopBrowserView(browser_view->view());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::string BaseWindow::GetMediaSourceId() const {
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-14 23:51:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return window_->GetDesktopMediaID().ToString();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								v8::Local<v8::Value> BaseWindow::GetNativeWindowHandle() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-09 04:03:19 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // TODO(MarshallOfSound): Replace once
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // https://chromium-review.googlesource.com/c/chromium/src/+/1253094/ has
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // landed
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-12 02:45:55 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  NativeWindowHandle handle = window_->GetNativeWindowHandle();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return ToBuffer(isolate(), &handle, sizeof(handle));
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetProgressBar(double progress, gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin_helper::Dictionary options;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  std::string mode;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  args->GetNext(&options) && options.Get("mode", &mode);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-03 20:11:41 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  NativeWindow::ProgressState state = NativeWindow::ProgressState::kNormal;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (mode == "error")
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-03 20:11:41 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    state = NativeWindow::ProgressState::kError;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  else if (mode == "paused")
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-03 20:11:41 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    state = NativeWindow::ProgressState::kPaused;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  else if (mode == "indeterminate")
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-03 20:11:41 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    state = NativeWindow::ProgressState::kIndeterminate;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  else if (mode == "none")
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-03 20:11:41 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    state = NativeWindow::ProgressState::kNone;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetProgressBar(progress, state);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetOverlayIcon(const gfx::Image& overlay,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                const std::string& description) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetOverlayIcon(overlay, description);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-19 13:31:25 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetVisibleOnAllWorkspaces(bool visible,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                           gin_helper::Arguments* args) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gin_helper::Dictionary options;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bool visibleOnFullScreen = false;
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-02 04:24:04 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  bool skipTransformProcessType = false;
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-19 13:31:25 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  args->GetNext(&options) &&
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      options.Get("visibleOnFullScreen", &visibleOnFullScreen);
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-02 04:24:04 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  args->GetNext(&options) &&
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      options.Get("skipTransformProcessType", &skipTransformProcessType);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->SetVisibleOnAllWorkspaces(visible, visibleOnFullScreen,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                            skipTransformProcessType);
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsVisibleOnAllWorkspaces() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsVisibleOnAllWorkspaces();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetAutoHideCursor(bool auto_hide) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetAutoHideCursor(auto_hide);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetVibrancy(v8::Isolate* isolate, v8::Local<v8::Value> value) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-29 07:25:03 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  std::string type = gin::V8ToString(isolate, value);
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetVibrancy(type);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-12 11:33:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#if defined(OS_MAC)
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-19 19:12:09 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetWindowButtonVisibility(bool visible) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetWindowButtonVisibility(visible);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::GetWindowButtonVisibility() const {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->GetWindowButtonVisibility();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetTrafficLightPosition(const gfx::Point& position) {
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-08 10:18:08 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // For backward compatibility we treat (0, 0) as resetting to default.
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-16 14:30:39 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (position.IsOrigin())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    window_->SetTrafficLightPosition(base::nullopt);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    window_->SetTrafficLightPosition(position);
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-05 14:22:12 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								gfx::Point BaseWindow::GetTrafficLightPosition() const {
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-16 14:30:39 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // For backward compatibility we treat default value as (0, 0).
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->GetTrafficLightPosition().value_or(gfx::Point());
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-05 14:22:12 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetTouchBar(
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-31 16:56:00 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    std::vector<gin_helper::PersistentDictionary> items) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetTouchBar(std::move(items));
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::RefreshTouchBarItem(const std::string& item_id) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->RefreshTouchBarItem(item_id);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetEscapeTouchBarItem(gin_helper::PersistentDictionary item) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-31 16:56:00 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  window_->SetEscapeTouchBarItem(std::move(item));
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SelectPreviousTab() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SelectPreviousTab();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SelectNextTab() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SelectNextTab();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::MergeAllWindows() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->MergeAllWindows();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::MoveTabToNewWindow() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->MoveTabToNewWindow();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::ToggleTabBar() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->ToggleTabBar();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::AddTabbedWindow(NativeWindow* window,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                 gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!window_->AddTabbedWindow(window))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    args->ThrowError("AddTabbedWindow cannot be called by a window on itself.");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetAutoHideMenuBar(bool auto_hide) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetAutoHideMenuBar(auto_hide);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsMenuBarAutoHide() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsMenuBarAutoHide();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetMenuBarVisibility(bool visible) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetMenuBarVisibility(visible);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsMenuBarVisible() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->IsMenuBarVisible();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetAspectRatio(double aspect_ratio,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gfx::Size extra_size;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  args->GetNext(&extra_size);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetAspectRatio(aspect_ratio, extra_size);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::PreviewFile(const std::string& path,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                             gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  std::string display_name;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!args->GetNext(&display_name))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    display_name = path;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->PreviewFile(path, display_name);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::CloseFilePreview() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->CloseFilePreview();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-20 15:53:06 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetGTKDarkThemeEnabled(bool use_dark_theme) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  window_->SetGTKDarkThemeEnabled(use_dark_theme);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								v8::Local<v8::Value> BaseWindow::GetContentView() const {
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-08 14:47:26 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (content_view_.IsEmpty())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return v8::Null(isolate());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return v8::Local<v8::Value>::New(isolate(), content_view_);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								v8::Local<v8::Value> BaseWindow::GetParentWindow() const {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (parent_window_.IsEmpty())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return v8::Null(isolate());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return v8::Local<v8::Value>::New(isolate(), parent_window_);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::vector<v8::Local<v8::Object>> BaseWindow::GetChildWindows() const {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return child_windows_.Values(isolate());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								v8::Local<v8::Value> BaseWindow::GetBrowserView(
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    gin_helper::Arguments* args) const {
							 | 
						
					
						
							
								
									
										
										
										
											2020-10-22 13:24:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (browser_views_.empty()) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return v8::Null(isolate());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  } else if (browser_views_.size() == 1) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    auto first_view = browser_views_.begin();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return v8::Local<v8::Value>::New(isolate(), (*first_view).second);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    args->ThrowError(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "BrowserWindow have multiple BrowserViews, "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "Use getBrowserViews() instead");
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return v8::Null(isolate());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::vector<v8::Local<v8::Value>> BaseWindow::GetBrowserViews() const {
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  std::vector<v8::Local<v8::Value>> ret;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  for (auto const& views_iter : browser_views_) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ret.push_back(v8::Local<v8::Value>::New(isolate(), views_iter.second));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return ret;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsModal() const {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window_->is_modal();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::SetThumbarButtons(gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#if defined(OS_WIN)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  std::vector<TaskbarHost::ThumbarButton> buttons;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!args->GetNext(&buttons)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    args->ThrowError();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-25 22:30:00 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  auto* window = static_cast<NativeWindowViews*>(window_.get());
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window->taskbar_host().SetThumbarButtons(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      window_->GetAcceleratedWidget(), buttons);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#if defined(TOOLKIT_VIEWS)
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-04 12:58:31 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetIcon(v8::Isolate* isolate, v8::Local<v8::Value> icon) {
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-24 19:24:10 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  SetIconImpl(isolate, icon, NativeImage::OnConvertError::kThrow);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetIconImpl(v8::Isolate* isolate,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                             v8::Local<v8::Value> icon,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                             NativeImage::OnConvertError on_error) {
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-04 12:58:31 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  NativeImage* native_image = nullptr;
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-24 19:24:10 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (!NativeImage::TryConvertNativeImage(isolate, icon, &native_image,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                          on_error))
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-04 12:58:31 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#if defined(OS_WIN)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  static_cast<NativeWindowViews*>(window_.get())
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-04 12:58:31 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      ->SetIcon(native_image->GetHICON(GetSystemMetrics(SM_CXSMICON)),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                native_image->GetHICON(GetSystemMetrics(SM_CXICON)));
							 | 
						
					
						
							
								
									
										
										
										
											2020-10-20 20:24:52 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#elif defined(OS_LINUX)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  static_cast<NativeWindowViews*>(window_.get())
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-04 12:58:31 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      ->SetIcon(native_image->image().AsImageSkia());
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#if defined(OS_WIN)
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::HookWindowMessage(UINT message,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                   const MessageCallback& callback) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  messages_callback_map_[message] = callback;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::UnhookWindowMessage(UINT message) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  messages_callback_map_.erase(message);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::IsWindowMessageHooked(UINT message) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-02 18:22:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return base::Contains(messages_callback_map_, message);
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::UnhookAllWindowMessages() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  messages_callback_map_.clear();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::SetThumbnailClip(const gfx::Rect& region) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  auto* window = static_cast<NativeWindowViews*>(window_.get());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window->taskbar_host().SetThumbnailClip(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      window_->GetAcceleratedWidget(), region);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool BaseWindow::SetThumbnailToolTip(const std::string& tooltip) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  auto* window = static_cast<NativeWindowViews*>(window_.get());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return window->taskbar_host().SetThumbnailToolTip(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      window_->GetAcceleratedWidget(), tooltip);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::SetAppDetails(const gin_helper::Dictionary& options) {
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-16 12:18:45 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  std::u16string app_id;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  base::FilePath app_icon_path;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  int app_icon_index = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-16 12:18:45 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  std::u16string relaunch_command;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  std::u16string relaunch_display_name;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  options.Get("appId", &app_id);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  options.Get("appIconPath", &app_icon_path);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  options.Get("appIconIndex", &app_icon_index);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  options.Get("relaunchCommand", &relaunch_command);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  options.Get("relaunchDisplayName", &relaunch_display_name);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-18 15:55:51 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ui::win::SetAppDetailsForWindow(base::UTF16ToWide(app_id), app_icon_path,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                  app_icon_index,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                  base::UTF16ToWide(relaunch_command),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                  base::UTF16ToWide(relaunch_display_name),
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                  window_->GetAcceleratedWidget());
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								int32_t BaseWindow::GetID() const {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return weak_map_id();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::ResetBrowserViews() {
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-18 18:24:55 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  v8::HandleScope scope(isolate());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  for (auto& item : browser_views_) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-25 22:03:28 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    gin::Handle<BrowserView> browser_view;
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if (gin::ConvertFromV8(isolate(),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                           v8::Local<v8::Value>::New(isolate(), item.second),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                           &browser_view) &&
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        !browser_view.IsEmpty()) {
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-04 16:34:22 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      // There's a chance that the BrowserView may have been reparented - only
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // reset if the owner window is *this* window.
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-27 13:04:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if (browser_view->web_contents()) {
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-04 16:34:22 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        auto* owner_window = browser_view->web_contents()->owner_window();
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-01 21:26:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if (owner_window && owner_window == window_.get()) {
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-04 16:34:22 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          browser_view->web_contents()->SetOwnerWindow(nullptr);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          owner_window->RemoveBrowserView(browser_view->view());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-27 13:04:06 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    item.second.Reset();
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 04:49:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  browser_views_.clear();
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::RemoveFromParentChildWindows() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (parent_window_.IsEmpty())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin::Handle<BaseWindow> parent;
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (!gin::ConvertFromV8(isolate(), GetParentWindow(), &parent) ||
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      parent.IsEmpty()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  parent->child_windows_.Remove(weak_map_id());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// static
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								gin_helper::WrappableBase* BaseWindow::New(gin_helper::Arguments* args) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-25 22:03:28 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin_helper::Dictionary options =
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      gin::Dictionary::CreateEmpty(args->isolate());
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-26 16:18:13 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  args->GetNext(&options);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return new BaseWindow(args, options);
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// static
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void BaseWindow::BuildPrototype(v8::Isolate* isolate,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                v8::Local<v8::FunctionTemplate> prototype) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  prototype->SetClassName(gin::StringToV8(isolate, "BaseWindow"));
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-04 11:14:16 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin_helper::Destroyable::MakeDestroyable(isolate, prototype);
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setContentView", &BaseWindow::SetContentView)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("close", &BaseWindow::Close)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("focus", &BaseWindow::Focus)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("blur", &BaseWindow::Blur)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isFocused", &BaseWindow::IsFocused)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("show", &BaseWindow::Show)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("showInactive", &BaseWindow::ShowInactive)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("hide", &BaseWindow::Hide)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isVisible", &BaseWindow::IsVisible)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isEnabled", &BaseWindow::IsEnabled)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setEnabled", &BaseWindow::SetEnabled)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("maximize", &BaseWindow::Maximize)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("unmaximize", &BaseWindow::Unmaximize)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isMaximized", &BaseWindow::IsMaximized)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("minimize", &BaseWindow::Minimize)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("restore", &BaseWindow::Restore)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isMinimized", &BaseWindow::IsMinimized)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setFullScreen", &BaseWindow::SetFullScreen)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isFullScreen", &BaseWindow::IsFullscreen)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setBounds", &BaseWindow::SetBounds)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getBounds", &BaseWindow::GetBounds)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isNormal", &BaseWindow::IsNormal)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getNormalBounds", &BaseWindow::GetNormalBounds)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setSize", &BaseWindow::SetSize)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getSize", &BaseWindow::GetSize)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setContentBounds", &BaseWindow::SetContentBounds)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getContentBounds", &BaseWindow::GetContentBounds)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setContentSize", &BaseWindow::SetContentSize)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getContentSize", &BaseWindow::GetContentSize)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setMinimumSize", &BaseWindow::SetMinimumSize)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getMinimumSize", &BaseWindow::GetMinimumSize)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setMaximumSize", &BaseWindow::SetMaximumSize)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getMaximumSize", &BaseWindow::GetMaximumSize)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setSheetOffset", &BaseWindow::SetSheetOffset)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("moveAbove", &BaseWindow::MoveAbove)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("moveTop", &BaseWindow::MoveTop)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setResizable", &BaseWindow::SetResizable)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isResizable", &BaseWindow::IsResizable)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setMovable", &BaseWindow::SetMovable)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isMovable", &BaseWindow::IsMovable)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setMinimizable", &BaseWindow::SetMinimizable)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isMinimizable", &BaseWindow::IsMinimizable)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setMaximizable", &BaseWindow::SetMaximizable)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isMaximizable", &BaseWindow::IsMaximizable)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setFullScreenable", &BaseWindow::SetFullScreenable)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isFullScreenable", &BaseWindow::IsFullScreenable)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setClosable", &BaseWindow::SetClosable)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isClosable", &BaseWindow::IsClosable)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setAlwaysOnTop", &BaseWindow::SetAlwaysOnTop)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isAlwaysOnTop", &BaseWindow::IsAlwaysOnTop)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("center", &BaseWindow::Center)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setPosition", &BaseWindow::SetPosition)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getPosition", &BaseWindow::GetPosition)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setTitle", &BaseWindow::SetTitle)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getTitle", &BaseWindow::GetTitle)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetProperty("accessibleTitle", &BaseWindow::GetAccessibleTitle,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                   &BaseWindow::SetAccessibleTitle)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("flashFrame", &BaseWindow::FlashFrame)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setSkipTaskbar", &BaseWindow::SetSkipTaskbar)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setSimpleFullScreen", &BaseWindow::SetSimpleFullScreen)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isSimpleFullScreen", &BaseWindow::IsSimpleFullScreen)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setKiosk", &BaseWindow::SetKiosk)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isKiosk", &BaseWindow::IsKiosk)
							 | 
						
					
						
							
								
									
										
										
										
											2020-09-22 14:40:42 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isTabletMode", &BaseWindow::IsTabletMode)
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setBackgroundColor", &BaseWindow::SetBackgroundColor)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getBackgroundColor", &BaseWindow::GetBackgroundColor)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setHasShadow", &BaseWindow::SetHasShadow)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("hasShadow", &BaseWindow::HasShadow)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setOpacity", &BaseWindow::SetOpacity)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getOpacity", &BaseWindow::GetOpacity)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setShape", &BaseWindow::SetShape)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setRepresentedFilename", &BaseWindow::SetRepresentedFilename)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getRepresentedFilename", &BaseWindow::GetRepresentedFilename)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setDocumentEdited", &BaseWindow::SetDocumentEdited)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isDocumentEdited", &BaseWindow::IsDocumentEdited)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setIgnoreMouseEvents", &BaseWindow::SetIgnoreMouseEvents)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setContentProtection", &BaseWindow::SetContentProtection)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setFocusable", &BaseWindow::SetFocusable)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setMenu", &BaseWindow::SetMenu)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("removeMenu", &BaseWindow::RemoveMenu)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setParentWindow", &BaseWindow::SetParentWindow)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setBrowserView", &BaseWindow::SetBrowserView)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("addBrowserView", &BaseWindow::AddBrowserView)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("removeBrowserView", &BaseWindow::RemoveBrowserView)
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-09 23:23:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setTopBrowserView", &BaseWindow::SetTopBrowserView)
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getMediaSourceId", &BaseWindow::GetMediaSourceId)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getNativeWindowHandle", &BaseWindow::GetNativeWindowHandle)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setProgressBar", &BaseWindow::SetProgressBar)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setOverlayIcon", &BaseWindow::SetOverlayIcon)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setVisibleOnAllWorkspaces",
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                 &BaseWindow::SetVisibleOnAllWorkspaces)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isVisibleOnAllWorkspaces",
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                 &BaseWindow::IsVisibleOnAllWorkspaces)
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-12 11:33:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#if defined(OS_MAC)
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setAutoHideCursor", &BaseWindow::SetAutoHideCursor)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setVibrancy", &BaseWindow::SetVibrancy)
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-12 11:33:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#if defined(OS_MAC)
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-05 14:22:12 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setTrafficLightPosition",
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                 &BaseWindow::SetTrafficLightPosition)
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-05 14:22:12 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getTrafficLightPosition",
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                 &BaseWindow::GetTrafficLightPosition)
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-05 14:22:12 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("_setTouchBarItems", &BaseWindow::SetTouchBar)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("_refreshTouchBarItem", &BaseWindow::RefreshTouchBarItem)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("_setEscapeTouchBarItem", &BaseWindow::SetEscapeTouchBarItem)
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-12 11:33:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#if defined(OS_MAC)
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("selectPreviousTab", &BaseWindow::SelectPreviousTab)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("selectNextTab", &BaseWindow::SelectNextTab)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("mergeAllWindows", &BaseWindow::MergeAllWindows)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("moveTabToNewWindow", &BaseWindow::MoveTabToNewWindow)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("toggleTabBar", &BaseWindow::ToggleTabBar)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("addTabbedWindow", &BaseWindow::AddTabbedWindow)
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-03 10:20:56 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setWindowButtonVisibility",
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                 &BaseWindow::SetWindowButtonVisibility)
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-19 19:12:09 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("_getWindowButtonVisibility",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 &BaseWindow::GetWindowButtonVisibility)
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 08:10:23 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetProperty("excludedFromShownWindowsMenu",
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                   &BaseWindow::IsExcludedFromShownWindowsMenu,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                   &BaseWindow::SetExcludedFromShownWindowsMenu)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setAutoHideMenuBar", &BaseWindow::SetAutoHideMenuBar)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isMenuBarAutoHide", &BaseWindow::IsMenuBarAutoHide)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setMenuBarVisibility", &BaseWindow::SetMenuBarVisibility)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isMenuBarVisible", &BaseWindow::IsMenuBarVisible)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setAspectRatio", &BaseWindow::SetAspectRatio)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("previewFile", &BaseWindow::PreviewFile)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("closeFilePreview", &BaseWindow::CloseFilePreview)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getContentView", &BaseWindow::GetContentView)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getParentWindow", &BaseWindow::GetParentWindow)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getChildWindows", &BaseWindow::GetChildWindows)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getBrowserView", &BaseWindow::GetBrowserView)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("getBrowserViews", &BaseWindow::GetBrowserViews)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isModal", &BaseWindow::IsModal)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setThumbarButtons", &BaseWindow::SetThumbarButtons)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#if defined(TOOLKIT_VIEWS)
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setIcon", &BaseWindow::SetIcon)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#if defined(OS_WIN)
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("hookWindowMessage", &BaseWindow::HookWindowMessage)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("isWindowMessageHooked", &BaseWindow::IsWindowMessageHooked)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("unhookWindowMessage", &BaseWindow::UnhookWindowMessage)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("unhookAllWindowMessages",
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                 &BaseWindow::UnhookAllWindowMessages)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setThumbnailClip", &BaseWindow::SetThumbnailClip)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setThumbnailToolTip", &BaseWindow::SetThumbnailToolTip)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      .SetMethod("setAppDetails", &BaseWindow::SetAppDetails)
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      .SetProperty("id", &BaseWindow::GetID);
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}  // namespace api
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-19 14:23:04 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}  // namespace electron
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								namespace {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								using electron::api::BaseWindow;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void Initialize(v8::Local<v8::Object> exports,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                v8::Local<v8::Value> unused,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                v8::Local<v8::Context> context,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                void* priv) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  v8::Isolate* isolate = context->GetIsolate();
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  BaseWindow::SetConstructor(isolate, base::BindRepeating(&BaseWindow::New));
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin_helper::Dictionary constructor(isolate,
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                     BaseWindow::GetConstructor(isolate)
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                         ->GetFunction(context)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                         .ToLocalChecked());
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  constructor.SetMethod("fromId", &BaseWindow::FromWeakMapID);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  constructor.SetMethod("getAllWindows", &BaseWindow::GetAll);
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-21 16:05:40 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin_helper::Dictionary dict(isolate, exports);
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  dict.Set("BaseWindow", constructor);
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-14 11:04:23 +09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}  // namespace
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-29 16:06:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								NODE_LINKED_MODULE_CONTEXT_AWARE(electron_browser_base_window, Initialize)
							 |