electron/shell/browser/ui/views/electron_views_delegate.h
Charles Kerr 23bcca3ffc
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 09:56:51 +02:00

78 lines
2.9 KiB
C++

// 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.
#ifndef ELECTRON_SHELL_BROWSER_UI_VIEWS_ELECTRON_VIEWS_DELEGATE_H_
#define ELECTRON_SHELL_BROWSER_UI_VIEWS_ELECTRON_VIEWS_DELEGATE_H_
#include <memory>
#include <string>
#include "base/containers/flat_map.h"
#include "ui/views/views_delegate.h"
namespace electron {
class ViewsDelegate : public views::ViewsDelegate {
public:
ViewsDelegate();
~ViewsDelegate() override;
// disable copy
ViewsDelegate(const ViewsDelegate&) = delete;
ViewsDelegate& operator=(const ViewsDelegate&) = delete;
protected:
// views::ViewsDelegate:
void SaveWindowPlacement(const views::Widget* window,
const std::string& window_name,
const gfx::Rect& bounds,
ui::WindowShowState show_state) override;
bool GetSavedWindowPlacement(const views::Widget* widget,
const std::string& window_name,
gfx::Rect* bounds,
ui::WindowShowState* show_state) const override;
void NotifyMenuItemFocused(const std::u16string& menu_name,
const std::u16string& menu_item_name,
int item_index,
int item_count,
bool has_submenu) override;
#if BUILDFLAG(IS_WIN)
HICON GetDefaultWindowIcon() const override;
HICON GetSmallWindowIcon() const override;
int GetAppbarAutohideEdges(HMONITOR monitor,
base::OnceClosure callback) override;
#elif BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
gfx::ImageSkia* GetDefaultWindowIcon() const override;
#endif
std::unique_ptr<views::NonClientFrameView> CreateDefaultNonClientFrameView(
views::Widget* widget) override;
void AddRef() override {}
void ReleaseRef() override {}
void OnBeforeWidgetInit(
views::Widget::InitParams* params,
views::internal::NativeWidgetDelegate* delegate) override;
bool WindowManagerProvidesTitleBar(bool maximized) override;
private:
#if BUILDFLAG(IS_WIN)
// 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);
base::flat_map<HMONITOR, int> appbar_autohide_edge_map_;
// 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
};
} // namespace electron
#endif // ELECTRON_SHELL_BROWSER_UI_VIEWS_ELECTRON_VIEWS_DELEGATE_H_