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 08:34:31 +01: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-13 18:13:34 -07:00
|
|
|
#include <memory>
|
2017-05-18 15:06:57 -07:00
|
|
|
#include <string>
|
|
|
|
|
2024-01-05 05:18:31 -06:00
|
|
|
#include "base/containers/flat_map.h"
|
2014-07-03 08:44:58 +00:00
|
|
|
#include "ui/views/views_delegate.h"
|
|
|
|
|
2018-10-19 15:50:30 +02:00
|
|
|
namespace electron {
|
2014-07-03 08:44:58 +00:00
|
|
|
|
|
|
|
class ViewsDelegate : public views::ViewsDelegate {
|
|
|
|
public:
|
|
|
|
ViewsDelegate();
|
2018-04-17 16:03:51 -07:00
|
|
|
~ViewsDelegate() override;
|
2014-07-03 08:44:58 +00:00
|
|
|
|
2021-11-03 12:41:45 +01: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 12:07:27 +08:00
|
|
|
void SaveWindowPlacement(const views::Widget* window,
|
|
|
|
const std::string& window_name,
|
|
|
|
const gfx::Rect& bounds,
|
|
|
|
ui::WindowShowState show_state) override;
|
2018-04-17 21:46:27 -04:00
|
|
|
bool GetSavedWindowPlacement(const views::Widget* widget,
|
|
|
|
const std::string& window_name,
|
|
|
|
gfx::Rect* bounds,
|
|
|
|
ui::WindowShowState* show_state) const override;
|
2021-03-16 12:18:45 -04:00
|
|
|
void NotifyMenuItemFocused(const std::u16string& menu_name,
|
|
|
|
const std::u16string& menu_item_name,
|
2015-06-05 12:07:27 +08:00
|
|
|
int item_index,
|
|
|
|
int item_count,
|
|
|
|
bool has_submenu) override;
|
2014-07-03 08:44:58 +00:00
|
|
|
|
2022-02-09 18:58:52 -08:00
|
|
|
#if BUILDFLAG(IS_WIN)
|
2015-06-05 12:07:27 +08:00
|
|
|
HICON GetDefaultWindowIcon() const override;
|
|
|
|
HICON GetSmallWindowIcon() const override;
|
2019-11-19 06:07:10 -08:00
|
|
|
int GetAppbarAutohideEdges(HMONITOR monitor,
|
|
|
|
base::OnceClosure callback) override;
|
2022-02-09 18:58:52 -08:00
|
|
|
#elif BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
|
2015-06-05 12:07:27 +08:00
|
|
|
gfx::ImageSkia* GetDefaultWindowIcon() const override;
|
2014-07-03 08:44:58 +00:00
|
|
|
#endif
|
2020-07-13 18:13:34 -07:00
|
|
|
std::unique_ptr<views::NonClientFrameView> CreateDefaultNonClientFrameView(
|
2014-10-23 11:10:39 +08: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 02:56:51 -05:00
|
|
|
void AddRef() override {}
|
|
|
|
void ReleaseRef() override {}
|
2015-06-05 12:07:27 +08:00
|
|
|
void OnBeforeWidgetInit(
|
2014-07-03 08:44:58 +00:00
|
|
|
views::Widget::InitParams* params,
|
2014-10-23 11:10:39 +08:00
|
|
|
views::internal::NativeWidgetDelegate* delegate) override;
|
2015-06-05 12:07:27 +08:00
|
|
|
bool WindowManagerProvidesTitleBar(bool maximized) override;
|
2014-07-03 08:44:58 +00:00
|
|
|
|
|
|
|
private:
|
2022-02-09 18:58:52 -08:00
|
|
|
#if BUILDFLAG(IS_WIN)
|
2019-11-19 06:07:10 -08: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 05:18:31 -06:00
|
|
|
base::flat_map<HMONITOR, int> appbar_autohide_edge_map_;
|
2019-11-19 06:07:10 -08: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 15:50:30 +02:00
|
|
|
} // namespace electron
|
2014-07-03 08:44:58 +00:00
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
#endif // ELECTRON_SHELL_BROWSER_UI_VIEWS_ELECTRON_VIEWS_DELEGATE_H_
|