2014-07-03 08:44:58 +00:00
|
|
|
// Copyright (c) 2014 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE-CHROMIUM file.
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_UI_VIEWS_ELECTRON_VIEWS_DELEGATE_H_
|
|
|
|
#define ELECTRON_SHELL_BROWSER_UI_VIEWS_ELECTRON_VIEWS_DELEGATE_H_
|
2014-07-03 08:44:58 +00:00
|
|
|
|
2020-07-14 01:13:34 +00:00
|
|
|
#include <memory>
|
2017-05-18 22:06:57 +00:00
|
|
|
#include <string>
|
|
|
|
|
2024-01-05 11:18:31 +00:00
|
|
|
#include "base/containers/flat_map.h"
|
2014-07-03 08:44:58 +00:00
|
|
|
#include "ui/views/views_delegate.h"
|
|
|
|
|
2018-10-19 13:50:30 +00:00
|
|
|
namespace electron {
|
2014-07-03 08:44:58 +00:00
|
|
|
|
|
|
|
class ViewsDelegate : public views::ViewsDelegate {
|
|
|
|
public:
|
|
|
|
ViewsDelegate();
|
2018-04-17 23:03:51 +00:00
|
|
|
~ViewsDelegate() override;
|
2014-07-03 08:44:58 +00:00
|
|
|
|
2021-11-03 11:41:45 +00:00
|
|
|
// disable copy
|
|
|
|
ViewsDelegate(const ViewsDelegate&) = delete;
|
|
|
|
ViewsDelegate& operator=(const ViewsDelegate&) = delete;
|
|
|
|
|
2014-07-03 08:44:58 +00:00
|
|
|
protected:
|
|
|
|
// views::ViewsDelegate:
|
2015-06-05 04:07:27 +00:00
|
|
|
void SaveWindowPlacement(const views::Widget* window,
|
|
|
|
const std::string& window_name,
|
|
|
|
const gfx::Rect& bounds,
|
2024-09-30 12:54:44 +00:00
|
|
|
ui::mojom::WindowShowState show_state) override;
|
|
|
|
bool GetSavedWindowPlacement(
|
|
|
|
const views::Widget* widget,
|
|
|
|
const std::string& window_name,
|
|
|
|
gfx::Rect* bounds,
|
|
|
|
ui::mojom::WindowShowState* show_state) const override;
|
2021-03-16 16:18:45 +00:00
|
|
|
void NotifyMenuItemFocused(const std::u16string& menu_name,
|
|
|
|
const std::u16string& menu_item_name,
|
2015-06-05 04:07:27 +00:00
|
|
|
int item_index,
|
|
|
|
int item_count,
|
|
|
|
bool has_submenu) override;
|
2014-07-03 08:44:58 +00:00
|
|
|
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_WIN)
|
2015-06-05 04:07:27 +00:00
|
|
|
HICON GetDefaultWindowIcon() const override;
|
|
|
|
HICON GetSmallWindowIcon() const override;
|
2019-11-19 14:07:10 +00:00
|
|
|
int GetAppbarAutohideEdges(HMONITOR monitor,
|
|
|
|
base::OnceClosure callback) override;
|
2022-02-10 02:58:52 +00:00
|
|
|
#elif BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
|
2015-06-05 04:07:27 +00:00
|
|
|
gfx::ImageSkia* GetDefaultWindowIcon() const override;
|
2014-07-03 08:44:58 +00:00
|
|
|
#endif
|
2020-07-14 01:13:34 +00:00
|
|
|
std::unique_ptr<views::NonClientFrameView> CreateDefaultNonClientFrameView(
|
2014-10-23 03:10:39 +00:00
|
|
|
views::Widget* widget) override;
|
refactor: put empty virtual function definitions in header (#43285)
* refactor: in FramelessView, move empty function decls to header
* refactor: in electron::api::WebContents, move empty function decls to header
* refactor: in electron::api::NativeWindow, move empty function decls to header
* refactor: in electron::OffScreenWebContentsView, move empty function decls to header
* refactor: in electron::OffScreenRenderWidgetHostView, move empty function decls to header
* refactor: in auto_updater::AutoUpdater, move empty function decls to header
* refactor: in electorn::api::FrameSubscriber, move empty function decls to header
* refactor: in electorn::api::SimpleURLLoaderWrapper, move empty function decls to header
* refactor: in electorn::InspectableWebContents, move empty function decls to header
* refactor: in electorn::OffScreenVideoConsumer, move empty function decls to header
* refactor: in electron::OffScreenWebContentsView, move empty function decls to header
* refactor: in electron::TrayIcon, move empty function decls to header
* refactor: in electron::ViewsDelegate, move empty function decls to header
* refactor: in electron::MediaCaptureDevicesDispatcher, move empty function decls to header
* refactor: in electron::UsbChooserContext::DeviceObserver, move empty function decls to header
* refactor: in electron::ProxyingWebSocket, move empty function decls to header
* refactor: in electron::Notification, move empty function decls to header
* refactor: in electron::PlatformNotificationService, move empty function decls to header
* Revert "refactor: in electron::PlatformNotificationService, move empty function decls to header"
This reverts commit 9103750d03b9ba1ceccba43d11dfdc2404ff6191.
* refactor: in electron::ElectronPDFDocumentHelperClient, move empty function decls to header
* refactor: in electron::api::SpellCheckClient, move empty function decls to header
* refactor: in electron::ElectronExtensionHostDelegate, move empty function decls to header
* refactor: in electron::PlatformNotificationService, move empty function decls to header
* refactor: in electron::NativeWindowViews, move empty function decls to header
* chore: move SetTouchBar() back to cc
* Revert "refactor: in auto_updater::AutoUpdater, move empty function decls to header"
This reverts commit c43d6862d32c74f63f82700a7546a732ac05ecb8.
2024-08-12 07:56:51 +00:00
|
|
|
void AddRef() override {}
|
|
|
|
void ReleaseRef() override {}
|
2015-06-05 04:07:27 +00:00
|
|
|
void OnBeforeWidgetInit(
|
2014-07-03 08:44:58 +00:00
|
|
|
views::Widget::InitParams* params,
|
2014-10-23 03:10:39 +00:00
|
|
|
views::internal::NativeWidgetDelegate* delegate) override;
|
2015-06-05 04:07:27 +00:00
|
|
|
bool WindowManagerProvidesTitleBar(bool maximized) override;
|
2014-07-03 08:44:58 +00:00
|
|
|
|
|
|
|
private:
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_WIN)
|
2019-11-19 14:07:10 +00:00
|
|
|
// Callback on main thread with the edges. |returned_edges| is the value that
|
|
|
|
// was returned from the call to GetAutohideEdges() that initiated the lookup.
|
|
|
|
void OnGotAppbarAutohideEdges(base::OnceClosure callback,
|
|
|
|
HMONITOR monitor,
|
|
|
|
int returned_edges,
|
|
|
|
int edges);
|
|
|
|
|
2024-01-05 11:18:31 +00:00
|
|
|
base::flat_map<HMONITOR, int> appbar_autohide_edge_map_;
|
2019-11-19 14:07:10 +00:00
|
|
|
// If true we're in the process of notifying a callback from
|
|
|
|
// GetAutohideEdges().start a new query.
|
|
|
|
bool in_autohide_edges_callback_ = false;
|
|
|
|
|
|
|
|
base::WeakPtrFactory<ViewsDelegate> weak_factory_{this};
|
|
|
|
#endif
|
2014-07-03 08:44:58 +00:00
|
|
|
};
|
|
|
|
|
2018-10-19 13:50:30 +00:00
|
|
|
} // namespace electron
|
2014-07-03 08:44:58 +00:00
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#endif // ELECTRON_SHELL_BROWSER_UI_VIEWS_ELECTRON_VIEWS_DELEGATE_H_
|