2014-10-31 11:17:05 -07:00
|
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
2014-04-25 17:49:37 +08:00
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
2013-05-02 23:43:23 +08:00
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_BROWSER_H_
|
|
|
|
|
#define ELECTRON_SHELL_BROWSER_BROWSER_H_
|
2013-05-02 23:43:23 +08:00
|
|
|
|
|
2018-09-12 19:25:56 -05:00
|
|
|
|
#include <memory>
|
2024-01-10 23:23:35 +01:00
|
|
|
|
#include <optional>
|
2014-03-16 09:13:06 +08:00
|
|
|
|
#include <string>
|
2014-11-17 17:19:41 +08:00
|
|
|
|
#include <vector>
|
2014-03-16 09:13:06 +08:00
|
|
|
|
|
2013-05-02 23:43:23 +08:00
|
|
|
|
#include "base/compiler_specific.h"
|
2013-05-03 10:53:54 +08:00
|
|
|
|
#include "base/observer_list.h"
|
2020-06-30 12:22:30 -07:00
|
|
|
|
#include "base/task/cancelable_task_tracker.h"
|
2016-10-10 13:30:58 -07:00
|
|
|
|
#include "base/values.h"
|
2020-06-30 12:22:30 -07:00
|
|
|
|
#include "gin/dictionary.h"
|
2019-06-19 13:46:59 -07:00
|
|
|
|
#include "shell/browser/browser_observer.h"
|
|
|
|
|
#include "shell/browser/window_list_observer.h"
|
2024-03-22 14:00:21 +01:00
|
|
|
|
#include "shell/common/gin_converters/login_item_settings_converter.h"
|
2019-11-01 15:10:32 +09:00
|
|
|
|
#include "shell/common/gin_helper/promise.h"
|
2013-05-02 23:43:23 +08:00
|
|
|
|
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#if BUILDFLAG(IS_WIN)
|
2018-04-19 14:27:57 +02:00
|
|
|
|
#include <windows.h>
|
2014-11-17 17:19:41 +08:00
|
|
|
|
#include "base/files/file_path.h"
|
2021-01-21 00:45:06 -05:00
|
|
|
|
#include "shell/browser/ui/win/taskbar_host.h"
|
2014-11-17 15:55:49 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#if BUILDFLAG(IS_MAC)
|
2020-05-22 00:53:44 +09:00
|
|
|
|
#include "ui/base/cocoa/secure_password_input.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-11-17 13:05:06 +08:00
|
|
|
|
namespace base {
|
|
|
|
|
class FilePath;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-24 14:47:58 +09:00
|
|
|
|
namespace gin_helper {
|
|
|
|
|
class Arguments;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-02 23:43:23 +08:00
|
|
|
|
namespace electron {
|
|
|
|
|
|
2016-07-02 11:47:40 +09:00
|
|
|
|
class ElectronMenuModel;
|
2015-10-28 19:34:01 +08:00
|
|
|
|
|
2024-03-22 14:00:21 +01:00
|
|
|
|
#if BUILDFLAG(IS_WIN)
|
|
|
|
|
struct LaunchItem {
|
|
|
|
|
std::wstring name;
|
|
|
|
|
std::wstring path;
|
|
|
|
|
std::wstring scope;
|
|
|
|
|
std::vector<std::wstring> args;
|
|
|
|
|
bool enabled = true;
|
|
|
|
|
|
|
|
|
|
LaunchItem();
|
|
|
|
|
~LaunchItem();
|
|
|
|
|
LaunchItem(const LaunchItem&);
|
|
|
|
|
};
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
struct LoginItemSettings {
|
|
|
|
|
bool open_at_login = false;
|
|
|
|
|
bool open_as_hidden = false;
|
|
|
|
|
bool restore_state = false;
|
|
|
|
|
bool opened_at_login = false;
|
|
|
|
|
bool opened_as_hidden = false;
|
|
|
|
|
std::u16string path;
|
|
|
|
|
std::vector<std::u16string> args;
|
|
|
|
|
|
|
|
|
|
#if BUILDFLAG(IS_MAC)
|
|
|
|
|
std::string type = "mainAppService";
|
|
|
|
|
std::string service_name;
|
|
|
|
|
std::string status;
|
|
|
|
|
#elif BUILDFLAG(IS_WIN)
|
|
|
|
|
// used in browser::setLoginItemSettings
|
|
|
|
|
bool enabled = true;
|
|
|
|
|
std::wstring name;
|
|
|
|
|
|
|
|
|
|
// used in browser::getLoginItemSettings
|
|
|
|
|
bool executable_will_launch_at_login = false;
|
|
|
|
|
std::vector<LaunchItem> launch_items;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
LoginItemSettings();
|
|
|
|
|
~LoginItemSettings();
|
|
|
|
|
LoginItemSettings(const LoginItemSettings&);
|
|
|
|
|
};
|
|
|
|
|
|
2013-05-02 23:43:23 +08:00
|
|
|
|
// This class is used for control application-wide operations.
|
2024-05-21 14:21:31 -05:00
|
|
|
|
class Browser : private WindowListObserver {
|
2013-05-02 23:43:23 +08:00
|
|
|
|
public:
|
|
|
|
|
Browser();
|
2018-04-17 16:03:51 -07:00
|
|
|
|
~Browser() override;
|
2013-05-02 23:43:23 +08:00
|
|
|
|
|
2021-11-03 12:41:45 +01:00
|
|
|
|
// disable copy
|
|
|
|
|
Browser(const Browser&) = delete;
|
|
|
|
|
Browser& operator=(const Browser&) = delete;
|
|
|
|
|
|
2013-05-02 23:43:23 +08:00
|
|
|
|
static Browser* Get();
|
|
|
|
|
|
|
|
|
|
// Try to close all windows and quit the application.
|
|
|
|
|
void Quit();
|
|
|
|
|
|
2015-11-06 18:27:13 +08:00
|
|
|
|
// Exit the application immediately and set exit code.
|
2020-07-28 16:43:43 -07:00
|
|
|
|
void Exit(gin::Arguments* args);
|
2015-11-06 18:27:13 +08:00
|
|
|
|
|
2014-04-10 15:22:17 +08:00
|
|
|
|
// Cleanup everything and shutdown the application gracefully.
|
|
|
|
|
void Shutdown();
|
2013-05-02 23:43:23 +08:00
|
|
|
|
|
2013-05-30 19:24:47 +08:00
|
|
|
|
// Focus the application.
|
2020-07-28 16:43:43 -07:00
|
|
|
|
void Focus(gin::Arguments* args);
|
2013-05-30 19:24:47 +08:00
|
|
|
|
|
2013-06-19 13:41:54 +08:00
|
|
|
|
// Returns the version of the executable (or bundle).
|
2013-12-05 10:26:01 +08:00
|
|
|
|
std::string GetVersion() const;
|
|
|
|
|
|
|
|
|
|
// Overrides the application version.
|
|
|
|
|
void SetVersion(const std::string& version);
|
2013-06-19 13:41:54 +08:00
|
|
|
|
|
2016-09-16 15:57:07 -07:00
|
|
|
|
// Returns the application's name, default is just Electron.
|
2013-12-05 10:32:58 +08:00
|
|
|
|
std::string GetName() const;
|
|
|
|
|
|
|
|
|
|
// Overrides the application name.
|
|
|
|
|
void SetName(const std::string& name);
|
|
|
|
|
|
2014-11-17 13:05:06 +08:00
|
|
|
|
// Add the |path| to recent documents list.
|
|
|
|
|
void AddRecentDocument(const base::FilePath& path);
|
|
|
|
|
|
2014-11-17 16:13:47 +08:00
|
|
|
|
// Clear the recent documents list.
|
|
|
|
|
void ClearRecentDocuments();
|
|
|
|
|
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#if BUILDFLAG(IS_WIN)
|
2015-11-03 15:09:31 +08:00
|
|
|
|
// Set the application user model ID.
|
2021-03-24 10:22:04 -07:00
|
|
|
|
void SetAppUserModelID(const std::wstring& name);
|
2021-05-03 18:13:19 +02:00
|
|
|
|
#endif
|
2015-11-03 15:09:31 +08:00
|
|
|
|
|
2016-03-24 10:55:09 -07:00
|
|
|
|
// Remove the default protocol handler registry key
|
2016-08-16 15:54:30 +10:00
|
|
|
|
bool RemoveAsDefaultProtocolClient(const std::string& protocol,
|
2020-07-28 16:43:43 -07:00
|
|
|
|
gin::Arguments* args);
|
2016-03-24 10:55:09 -07:00
|
|
|
|
|
2016-03-21 11:24:25 -07:00
|
|
|
|
// Set as default handler for a protocol.
|
2016-08-16 15:54:30 +10:00
|
|
|
|
bool SetAsDefaultProtocolClient(const std::string& protocol,
|
2020-07-28 16:43:43 -07:00
|
|
|
|
gin::Arguments* args);
|
2016-03-21 11:24:25 -07:00
|
|
|
|
|
2016-04-24 22:17:01 -07:00
|
|
|
|
// Query the current state of default handler for a protocol.
|
2016-08-16 15:54:30 +10:00
|
|
|
|
bool IsDefaultProtocolClient(const std::string& protocol,
|
2020-07-28 16:43:43 -07:00
|
|
|
|
gin::Arguments* args);
|
2016-04-24 22:17:01 -07:00
|
|
|
|
|
2021-03-16 12:18:45 -04:00
|
|
|
|
std::u16string GetApplicationNameForProtocol(const GURL& url);
|
2019-11-06 17:50:33 -08:00
|
|
|
|
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#if !BUILDFLAG(IS_LINUX)
|
2020-06-30 12:22:30 -07:00
|
|
|
|
// get the name, icon and path for an application
|
|
|
|
|
v8::Local<v8::Promise> GetApplicationInfoForProtocol(v8::Isolate* isolate,
|
|
|
|
|
const GURL& url);
|
|
|
|
|
#endif
|
|
|
|
|
|
2016-07-01 17:39:01 +09:00
|
|
|
|
// Set/Get the badge count.
|
2024-01-10 23:23:35 +01:00
|
|
|
|
bool SetBadgeCount(std::optional<int> count);
|
2024-02-09 03:29:14 -06:00
|
|
|
|
[[nodiscard]] int badge_count() const { return badge_count_; }
|
2016-07-01 17:39:01 +09:00
|
|
|
|
|
2017-01-30 14:01:40 -08:00
|
|
|
|
void SetLoginItemSettings(LoginItemSettings settings);
|
2024-03-22 14:00:21 +01:00
|
|
|
|
v8::Local<v8::Value> GetLoginItemSettings(const LoginItemSettings& options);
|
2016-07-07 16:29:09 -07:00
|
|
|
|
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#if BUILDFLAG(IS_MAC)
|
2018-02-05 16:13:35 +09:00
|
|
|
|
// Set the handler which decides whether to shutdown.
|
2021-05-06 15:01:04 -07:00
|
|
|
|
void SetShutdownHandler(base::RepeatingCallback<bool()> handler);
|
2018-02-05 16:13:35 +09:00
|
|
|
|
|
2016-01-29 22:51:06 +01:00
|
|
|
|
// Hide the application.
|
|
|
|
|
void Hide();
|
2022-03-29 21:34:07 -04:00
|
|
|
|
bool IsHidden();
|
2016-01-29 22:51:06 +01:00
|
|
|
|
|
2016-01-30 21:40:32 +01:00
|
|
|
|
// Show the application.
|
|
|
|
|
void Show();
|
|
|
|
|
|
2016-04-29 17:35:07 -07:00
|
|
|
|
// Creates an activity and sets it as the one currently in use.
|
2016-04-29 22:05:36 -07:00
|
|
|
|
void SetUserActivity(const std::string& type,
|
2022-07-05 08:25:18 -07:00
|
|
|
|
base::Value::Dict user_info,
|
2020-07-28 16:43:43 -07:00
|
|
|
|
gin::Arguments* args);
|
2016-04-29 22:05:36 -07:00
|
|
|
|
|
2016-05-03 15:51:31 -07:00
|
|
|
|
// Returns the type name of the current user activity.
|
|
|
|
|
std::string GetCurrentActivityType();
|
|
|
|
|
|
2019-06-06 22:16:03 -07:00
|
|
|
|
// Invalidates an activity and marks it as no longer eligible for
|
|
|
|
|
// continuation
|
2017-06-26 16:14:44 -03:00
|
|
|
|
void InvalidateCurrentActivity();
|
|
|
|
|
|
2019-06-06 22:16:03 -07:00
|
|
|
|
// Marks this activity object as inactive without invalidating it.
|
|
|
|
|
void ResignCurrentActivity();
|
|
|
|
|
|
2017-06-26 16:14:44 -03:00
|
|
|
|
// Updates the current user activity
|
|
|
|
|
void UpdateCurrentActivity(const std::string& type,
|
2022-07-05 08:25:18 -07:00
|
|
|
|
base::Value::Dict user_info);
|
2017-06-26 16:14:44 -03:00
|
|
|
|
|
|
|
|
|
// Indicates that an user activity is about to be resumed.
|
|
|
|
|
bool WillContinueUserActivity(const std::string& type);
|
|
|
|
|
|
|
|
|
|
// Indicates a failure to resume a Handoff activity.
|
|
|
|
|
void DidFailToContinueUserActivity(const std::string& type,
|
|
|
|
|
const std::string& error);
|
|
|
|
|
|
2016-04-29 17:36:04 -07:00
|
|
|
|
// Resumes an activity via hand-off.
|
2016-05-05 16:26:44 +09:00
|
|
|
|
bool ContinueUserActivity(const std::string& type,
|
2022-06-22 23:28:41 -07:00
|
|
|
|
base::Value::Dict user_info,
|
|
|
|
|
base::Value::Dict details);
|
2016-04-29 17:36:04 -07:00
|
|
|
|
|
2017-06-26 16:14:44 -03:00
|
|
|
|
// Indicates that an activity was continued on another device.
|
|
|
|
|
void UserActivityWasContinued(const std::string& type,
|
2022-06-22 23:28:41 -07:00
|
|
|
|
base::Value::Dict user_info);
|
2017-06-26 16:14:44 -03:00
|
|
|
|
|
2020-10-13 10:25:21 -07:00
|
|
|
|
// Gives an opportunity to update the Handoff payload.
|
2017-08-09 12:09:47 -03:00
|
|
|
|
bool UpdateUserActivityState(const std::string& type,
|
2022-06-22 23:28:41 -07:00
|
|
|
|
base::Value::Dict user_info);
|
2017-06-26 16:14:44 -03:00
|
|
|
|
|
2023-01-10 12:19:00 +01:00
|
|
|
|
void ApplyForcedRTL();
|
|
|
|
|
|
2013-08-06 16:19:56 +08:00
|
|
|
|
// Bounce the dock icon.
|
2023-10-16 18:25:11 +02:00
|
|
|
|
enum class BounceType{
|
|
|
|
|
kCritical = 0, // NSCriticalRequest
|
|
|
|
|
kInformational = 10, // NSInformationalRequest
|
2013-08-06 16:19:56 +08:00
|
|
|
|
};
|
|
|
|
|
int DockBounce(BounceType type);
|
|
|
|
|
void DockCancelBounce(int request_id);
|
|
|
|
|
|
2016-05-10 15:02:56 -04:00
|
|
|
|
// Bounce the Downloads stack.
|
|
|
|
|
void DockDownloadFinished(const std::string& filePath);
|
|
|
|
|
|
2013-08-06 16:39:31 +08:00
|
|
|
|
// Set/Get dock's badge text.
|
2013-08-06 16:19:56 +08:00
|
|
|
|
void DockSetBadgeText(const std::string& label);
|
2013-08-06 16:39:31 +08:00
|
|
|
|
std::string DockGetBadgeText();
|
2014-06-25 11:55:33 +08:00
|
|
|
|
|
|
|
|
|
// Hide/Show dock.
|
|
|
|
|
void DockHide();
|
2019-02-12 21:06:33 -08:00
|
|
|
|
v8::Local<v8::Promise> DockShow(v8::Isolate* isolate);
|
2016-08-01 15:22:37 -07:00
|
|
|
|
bool DockIsVisible();
|
2014-11-16 23:04:31 +08:00
|
|
|
|
|
|
|
|
|
// Set docks' menu.
|
2016-07-02 11:47:40 +09:00
|
|
|
|
void DockSetMenu(ElectronMenuModel* model);
|
2016-01-24 08:30:14 +09:00
|
|
|
|
|
|
|
|
|
// Set docks' icon.
|
2021-01-04 12:58:31 -08:00
|
|
|
|
void DockSetIcon(v8::Isolate* isolate, v8::Local<v8::Value> icon);
|
2016-10-10 13:30:58 -07:00
|
|
|
|
|
2024-06-10 09:39:56 -05:00
|
|
|
|
void SetLaunchedAtLogin(bool launched_at_login) {
|
|
|
|
|
was_launched_at_login_ = launched_at_login;
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#endif // BUILDFLAG(IS_MAC)
|
2018-11-13 17:12:24 -05:00
|
|
|
|
|
2016-10-10 13:30:58 -07:00
|
|
|
|
void ShowAboutPanel();
|
2022-07-05 08:25:18 -07:00
|
|
|
|
void SetAboutPanelOptions(base::Value::Dict options);
|
2013-08-06 16:19:56 +08:00
|
|
|
|
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
|
2019-03-14 13:39:52 -07:00
|
|
|
|
void ShowEmojiPanel();
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#if BUILDFLAG(IS_WIN)
|
2014-11-17 17:19:41 +08:00
|
|
|
|
struct UserTask {
|
|
|
|
|
base::FilePath program;
|
2021-03-18 15:55:51 -04:00
|
|
|
|
std::wstring arguments;
|
|
|
|
|
std::wstring title;
|
|
|
|
|
std::wstring description;
|
2019-05-13 18:17:12 +02:00
|
|
|
|
base::FilePath working_dir;
|
2014-11-17 17:35:51 +08:00
|
|
|
|
base::FilePath icon_path;
|
|
|
|
|
int icon_index;
|
2018-06-25 22:30:00 +02:00
|
|
|
|
|
|
|
|
|
UserTask();
|
|
|
|
|
UserTask(const UserTask&);
|
|
|
|
|
~UserTask();
|
2014-11-17 17:19:41 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Add a custom task to jump list.
|
2016-08-08 00:22:32 +02:00
|
|
|
|
bool SetUserTasks(const std::vector<UserTask>& tasks);
|
2014-11-17 17:19:41 +08:00
|
|
|
|
|
2015-11-03 14:55:43 +08:00
|
|
|
|
// Returns the application user model ID, if there isn't one, then create
|
|
|
|
|
// one from app's name.
|
|
|
|
|
// The returned string managed by Browser, and should not be modified.
|
|
|
|
|
PCWSTR GetAppUserModelID();
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#endif // BUILDFLAG(IS_WIN)
|
2016-06-26 01:55:24 +02:00
|
|
|
|
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#if BUILDFLAG(IS_LINUX)
|
2016-07-01 17:39:01 +09:00
|
|
|
|
// Whether Unity launcher is running.
|
|
|
|
|
bool IsUnityRunning();
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#endif // BUILDFLAG(IS_LINUX)
|
2014-11-17 15:55:49 +08:00
|
|
|
|
|
2013-05-30 16:03:10 +08:00
|
|
|
|
// Tell the application to open a file.
|
|
|
|
|
bool OpenFile(const std::string& file_path);
|
|
|
|
|
|
2013-07-10 16:10:38 +08:00
|
|
|
|
// Tell the application to open a url.
|
|
|
|
|
void OpenURL(const std::string& url);
|
|
|
|
|
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#if BUILDFLAG(IS_MAC)
|
2017-06-11 01:19:01 -07:00
|
|
|
|
// Tell the application to create a new window for a tab.
|
|
|
|
|
void NewWindowForTab();
|
2020-06-16 19:03:41 +02:00
|
|
|
|
|
2023-04-18 16:53:39 +02:00
|
|
|
|
// Indicate that the app is now active.
|
2020-06-16 19:03:41 +02:00
|
|
|
|
void DidBecomeActive();
|
2023-04-18 16:53:39 +02:00
|
|
|
|
// Indicate that the app is no longer active and doesn’t have focus.
|
|
|
|
|
void DidResignActive();
|
|
|
|
|
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#endif // BUILDFLAG(IS_MAC)
|
2017-06-11 01:19:01 -07:00
|
|
|
|
|
2015-09-14 18:34:27 -07:00
|
|
|
|
// Tell the application that application is activated with visible/invisible
|
|
|
|
|
// windows.
|
2015-09-14 19:05:53 -07:00
|
|
|
|
void Activate(bool has_visible_windows);
|
2015-09-14 19:28:13 +08:00
|
|
|
|
|
2019-03-14 13:39:52 -07:00
|
|
|
|
bool IsEmojiPanelSupported();
|
|
|
|
|
|
2013-05-30 19:12:14 +08:00
|
|
|
|
// Tell the application the loading has been done.
|
2013-06-03 15:31:46 +08:00
|
|
|
|
void WillFinishLaunching();
|
2022-06-22 23:28:41 -07:00
|
|
|
|
void DidFinishLaunching(base::Value::Dict launch_info);
|
2013-05-30 19:12:14 +08:00
|
|
|
|
|
2016-07-11 14:32:14 -07:00
|
|
|
|
void OnAccessibilitySupportChanged();
|
2016-07-11 14:04:56 -07:00
|
|
|
|
|
2017-09-16 05:33:12 +10:00
|
|
|
|
void PreMainMessageLoopRun();
|
2020-04-13 16:39:26 -07:00
|
|
|
|
void PreCreateThreads();
|
2017-09-16 05:33:12 +10:00
|
|
|
|
|
2018-10-03 14:47:00 -07:00
|
|
|
|
// Stores the supplied |quit_closure|, to be run when the last Browser
|
|
|
|
|
// instance is destroyed.
|
2019-02-02 00:21:49 +09:00
|
|
|
|
void SetMainMessageLoopQuitClosure(base::OnceClosure quit_closure);
|
2018-10-03 14:47:00 -07:00
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
|
void AddObserver(BrowserObserver* obs) { observers_.AddObserver(obs); }
|
2013-05-03 10:53:54 +08:00
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
|
void RemoveObserver(BrowserObserver* obs) { observers_.RemoveObserver(obs); }
|
2013-05-02 23:43:23 +08:00
|
|
|
|
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#if BUILDFLAG(IS_MAC)
|
2020-05-22 00:53:44 +09:00
|
|
|
|
// Returns whether secure input is enabled
|
|
|
|
|
bool IsSecureKeyboardEntryEnabled();
|
|
|
|
|
void SetSecureKeyboardEntryEnabled(bool enabled);
|
|
|
|
|
#endif
|
|
|
|
|
|
2015-10-22 16:24:35 +08:00
|
|
|
|
bool is_shutting_down() const { return is_shutdown_; }
|
2021-07-05 12:45:50 -07:00
|
|
|
|
bool is_quitting() const { return is_quitting_; }
|
2014-10-30 21:32:35 +08:00
|
|
|
|
bool is_ready() const { return is_ready_; }
|
2019-10-24 14:47:58 +09:00
|
|
|
|
v8::Local<v8::Value> WhenReady(v8::Isolate* isolate);
|
2013-06-26 17:22:24 +08:00
|
|
|
|
|
2013-05-02 23:43:23 +08:00
|
|
|
|
protected:
|
2013-12-05 10:26:01 +08:00
|
|
|
|
// Returns the version of application bundle or executable file.
|
|
|
|
|
std::string GetExecutableFileVersion() const;
|
|
|
|
|
|
2013-12-05 10:42:04 +08:00
|
|
|
|
// Returns the name of application bundle or executable file.
|
|
|
|
|
std::string GetExecutableFileProductName() const;
|
|
|
|
|
|
2014-04-10 15:22:17 +08:00
|
|
|
|
// Send the will-quit message and then shutdown the application.
|
|
|
|
|
void NotifyAndShutdown();
|
2013-05-03 10:53:54 +08:00
|
|
|
|
|
2015-02-25 19:33:42 -08:00
|
|
|
|
// Send the before-quit message and start closing windows.
|
|
|
|
|
bool HandleBeforeQuit();
|
|
|
|
|
|
2021-07-05 12:45:50 -07:00
|
|
|
|
bool is_quitting_ = false;
|
2013-05-02 23:43:23 +08:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
// WindowListObserver implementations:
|
2014-11-16 19:47:04 +08:00
|
|
|
|
void OnWindowCloseCancelled(NativeWindow* window) override;
|
|
|
|
|
void OnWindowAllClosed() override;
|
2013-05-02 23:43:23 +08:00
|
|
|
|
|
2013-05-03 10:53:54 +08:00
|
|
|
|
// Observers of the browser.
|
2015-09-02 15:16:49 +08:00
|
|
|
|
base::ObserverList<BrowserObserver> observers_;
|
2013-05-03 10:53:54 +08:00
|
|
|
|
|
2020-06-30 12:22:30 -07:00
|
|
|
|
// Tracks tasks requesting file icons.
|
|
|
|
|
base::CancelableTaskTracker cancelable_task_tracker_;
|
|
|
|
|
|
2016-03-31 10:12:03 -04:00
|
|
|
|
// Whether `app.exit()` has been called
|
2018-05-22 00:18:38 +02:00
|
|
|
|
bool is_exiting_ = false;
|
2016-03-31 10:12:03 -04:00
|
|
|
|
|
2014-10-30 21:32:35 +08:00
|
|
|
|
// Whether "ready" event has been emitted.
|
2018-05-22 00:18:38 +02:00
|
|
|
|
bool is_ready_ = false;
|
2014-10-30 21:32:35 +08:00
|
|
|
|
|
2016-03-31 10:12:03 -04:00
|
|
|
|
// The browser is being shutdown.
|
2018-05-22 00:18:38 +02:00
|
|
|
|
bool is_shutdown_ = false;
|
2015-10-04 19:20:52 +08:00
|
|
|
|
|
2019-02-02 00:21:49 +09:00
|
|
|
|
// Null until/unless the default main message loop is running.
|
|
|
|
|
base::OnceClosure quit_main_message_loop_;
|
|
|
|
|
|
2016-07-02 10:36:11 +09:00
|
|
|
|
int badge_count_ = 0;
|
2016-06-26 01:55:24 +02:00
|
|
|
|
|
2019-11-01 15:10:32 +09:00
|
|
|
|
std::unique_ptr<gin_helper::Promise<void>> ready_promise_;
|
2018-06-28 07:06:08 +10:00
|
|
|
|
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#if BUILDFLAG(IS_MAC)
|
2020-05-22 00:53:44 +09:00
|
|
|
|
std::unique_ptr<ui::ScopedPasswordInputEnabler> password_input_enabler_;
|
2020-09-03 20:46:24 +09:00
|
|
|
|
base::Time last_dock_show_;
|
2024-06-10 09:39:56 -05:00
|
|
|
|
bool was_launched_at_login_;
|
2020-05-22 00:53:44 +09:00
|
|
|
|
#endif
|
|
|
|
|
|
2023-02-28 15:26:00 -07:00
|
|
|
|
base::Value::Dict about_panel_options_;
|
2016-10-10 13:30:58 -07:00
|
|
|
|
|
2022-02-09 18:58:52 -08:00
|
|
|
|
#if BUILDFLAG(IS_WIN)
|
2021-01-21 00:45:06 -05:00
|
|
|
|
void UpdateBadgeContents(HWND hwnd,
|
2024-01-10 23:23:35 +01:00
|
|
|
|
const std::optional<std::string>& badge_content,
|
2021-01-21 00:45:06 -05:00
|
|
|
|
const std::string& badge_alt_string);
|
|
|
|
|
|
|
|
|
|
// In charge of running taskbar related APIs.
|
|
|
|
|
TaskbarHost taskbar_host_;
|
|
|
|
|
#endif
|
2013-05-02 23:43:23 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace electron
|
|
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
|
#endif // ELECTRON_SHELL_BROWSER_BROWSER_H_
|