81c143318b
* chore: bump chromium in DEPS to 94.0.4587.0 * chore: update patches * 2823155: fix GPU video decoding capabilities enumeration Ref: https://chromium-review.googlesource.com/c/chromium/src/+/2823155 * 3041383: Reduce includes in url_request_mojom_traits.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3041383 * chore: bump chromium in DEPS to 94.0.4588.0 * chore: update patches * chore: bump chromium in DEPS to 94.0.4589.0 * chore: update patches * 3050633: Rename ScaleFactor to ResourceScaleFactor Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3050633 * 3048296: Create new mojo target to prevent traits header spreading Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3048296 * 3046186: Rename base::ClampToRange Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3046186 * chore: update picture-in-picture patch Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3056037 * chore: bump chromium in DEPS to 94.0.4590.0 * chore: update patches * 3057495: Fix base::NoDestructor usage in Mac KeychainPassword Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3057495 * 3056134: Remove NetworkIsolationKey unused methods Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3056134 * 3035091: [rab/gsab] Fix gsab maxByteLength after transferring to worker Adds a patch to v8 to disable a DCHECK that is also firing on node streams in child processes. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3035091 * chore: bump chromium in DEPS to 94.0.4590.2 * chore: fix mas_no_private_api.patch Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3049052 * 3049555: [views] Add CHECK to prevent fallthrough to global NativeTheme Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3049555 * chore: empty commit * chore: fix whitespace for lint * chore: cherry-pick chromium woa fix * Revert "chore: cherry-pick chromium woa fix" This reverts commit 64f3082e2d5f93ef0e2ac5d98246532a105fd4a1. * chore: fix the build on Windows on ARM * chore: remove commented code in printing.patch * fixup! chore: remove commented code in printing.patch do not remove the new weak_ptr check * build: sync disable_use_lld_for_macos.patch Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <khammond@slack-corp.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <keeleymhammond@gmail.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
92 lines
2.6 KiB
C++
92 lines
2.6 KiB
C++
// Copyright (c) 2014 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef SHELL_BROWSER_UI_VIEWS_MENU_BAR_H_
|
|
#define SHELL_BROWSER_UI_VIEWS_MENU_BAR_H_
|
|
|
|
#include "shell/browser/native_window_observer.h"
|
|
#include "shell/browser/ui/electron_menu_model.h"
|
|
#include "shell/browser/ui/views/menu_delegate.h"
|
|
#include "shell/browser/ui/views/root_view.h"
|
|
#include "ui/views/accessible_pane_view.h"
|
|
|
|
namespace views {
|
|
class MenuButton;
|
|
}
|
|
|
|
namespace electron {
|
|
|
|
class MenuBar : public views::AccessiblePaneView,
|
|
public MenuDelegate::Observer,
|
|
public NativeWindowObserver {
|
|
public:
|
|
static const char kViewClassName[];
|
|
|
|
MenuBar(NativeWindow* window, RootView* root_view);
|
|
~MenuBar() override;
|
|
|
|
// Replaces current menu with a new one.
|
|
void SetMenu(ElectronMenuModel* menu_model);
|
|
|
|
// Shows underline under accelerators.
|
|
void SetAcceleratorVisibility(bool visible);
|
|
|
|
// Returns true if the submenu has accelerator |key|
|
|
bool HasAccelerator(char16_t key);
|
|
|
|
// Shows the submenu whose accelerator is |key|.
|
|
void ActivateAccelerator(char16_t key);
|
|
|
|
// Returns there are how many items in the root menu.
|
|
int GetItemCount() const;
|
|
|
|
// Get the menu under specified screen point.
|
|
bool GetMenuButtonFromScreenPoint(const gfx::Point& point,
|
|
ElectronMenuModel** menu_model,
|
|
views::MenuButton** button);
|
|
|
|
private:
|
|
// MenuDelegate::Observer:
|
|
void OnBeforeExecuteCommand() override;
|
|
void OnMenuClosed() override;
|
|
|
|
// NativeWindowObserver:
|
|
void OnWindowBlur() override;
|
|
void OnWindowFocus() override;
|
|
|
|
// views::AccessiblePaneView:
|
|
bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
|
|
bool SetPaneFocusAndFocusDefault() override;
|
|
void OnThemeChanged() override;
|
|
|
|
// views::FocusChangeListener:
|
|
void OnDidChangeFocus(View* focused_before, View* focused_now) override;
|
|
|
|
// views::View:
|
|
const char* GetClassName() const override;
|
|
|
|
void ButtonPressed(int id, const ui::Event& event);
|
|
|
|
void RebuildChildren();
|
|
void UpdateViewColors();
|
|
void RefreshColorCache(const ui::NativeTheme* theme);
|
|
View* FindAccelChild(char16_t key);
|
|
|
|
SkColor background_color_;
|
|
#if defined(OS_LINUX)
|
|
SkColor enabled_color_;
|
|
SkColor disabled_color_;
|
|
#endif
|
|
|
|
NativeWindow* window_;
|
|
RootView* root_view_;
|
|
ElectronMenuModel* menu_model_ = nullptr;
|
|
bool accelerator_installed_ = false;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(MenuBar);
|
|
};
|
|
|
|
} // namespace electron
|
|
|
|
#endif // SHELL_BROWSER_UI_VIEWS_MENU_BAR_H_
|