60c4c9fec6
* chore: iwyu buildflags.h * chore: iwyu dictionary.h * chore: iwyu arguments.h * chore: iwyu values.h * chore: iwyu compiler_specific.h * chore: iwyu binder_map.h * chore: iwyu <vector> * chore: iwyu <set> * chore: iwyu raw_ptr * chore: iwyu gfx/canvas.h * chore: iwyu gfx/color_utils.h * chore: iwyu base/strings/stringprintf.h * chore: iwyu base/task/thread_pool.h * chore: iwyu base/no_destructor.h * chore: iwyu base/path_service.h * chore: iwyu base/files/file_pathh * chore: iwyu base/strings/sys_string_conversions.h * chore: iwyu base/logging.h * chore: iwyu base/command_line.h * chore: iwyu base/files/file_util.h * chore: iwyu base/files/scoped_file.h * chore: iwyu base/strings/utf_string_conversions.h * chore: iwyu base/environment.h * chore: iwyu base/scoped_observation.h * chore: iwyu base/strings/string_split.h * chore: iwyu base/strings/pattern.h * chore: iwyu base/json/string_escape.h * chore: iwyu base/json/json_reader.h * chore: iwyu base/memory/singleton.h * chore: iwyu base/observer_list.h * chore: iwyu base/timer/timer.h * fixup! chore: iwyu values.h * chore: iwyu shell/browser/browser.h * chore: iwyu base/stl_util.h * chore: iwyu base/strings/string_util.h * chore: iwyu shell/browser/javascript_environment.h * chore: iwyu base/memory/ref_counted.h * chore: iwyu base/environment.h * chore: iwyu content/public/browser/browser_thread.h * chore: remove unused typedef gin_helper::EventEmitter::ValueArray * chore: iwyu gin/wrappable.h * chore: iwyu shell/common/gin_helper/function_template_extensions.h * chore: iwyu shell/common/gin_converters/login_item_settings_converter.h * chore: iwyu shell/common/gin_helper/arguments.h * chore: iwyu ui/gfx/skia_util.h * chore: iwyu ui/gfx/geometry/rect.h * chore: iwyu ui/gfx/image/image.h * chore: iwyu base/strings/strcat.h * chore: iwyu ui/native_theme/native_theme.h * fixup! chore: iwyu shell/browser/javascript_environment.h * fixup! chore: iwyu gfx/canvas.h * fixup! chore: iwyu content/public/browser/browser_thread.h * fixup! chore: iwyu ui/native_theme/native_theme.h * fixup! chore: iwyu ui/native_theme/native_theme.h
78 lines
2.9 KiB
C++
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_
|