refactor: remove accessible_pane_view.patch (#29262)
This commit is contained in:
parent
4e2934a872
commit
259bf8c4f7
5 changed files with 63 additions and 217 deletions
|
@ -65,7 +65,6 @@ ignore_rc_check.patch
|
||||||
remove_usage_of_incognito_apis_in_the_spellchecker.patch
|
remove_usage_of_incognito_apis_in_the_spellchecker.patch
|
||||||
chore_use_electron_resources_not_chrome_for_spellchecker.patch
|
chore_use_electron_resources_not_chrome_for_spellchecker.patch
|
||||||
feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch
|
feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch
|
||||||
accessible_pane_view.patch
|
|
||||||
hack_plugin_response_interceptor_to_point_to_electron.patch
|
hack_plugin_response_interceptor_to_point_to_electron.patch
|
||||||
feat_add_support_for_overriding_the_base_spellchecker_download_url.patch
|
feat_add_support_for_overriding_the_base_spellchecker_download_url.patch
|
||||||
feat_enable_offscreen_rendering_with_viz_compositor.patch
|
feat_enable_offscreen_rendering_with_viz_compositor.patch
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Cheng Zhao <zcbenz@gmail.com>
|
|
||||||
Date: Thu, 4 Oct 2018 14:57:02 -0700
|
|
||||||
Subject: fix: add back virtual methods in AccessiblePaneView
|
|
||||||
|
|
||||||
Mark SetPaneFocus and RemovePaneFocus as virtual in AccessiblePaneView, as we
|
|
||||||
need to override them in MenuBar.
|
|
||||||
|
|
||||||
Pending upstream patch: https://crrev.com/c/1959189
|
|
||||||
|
|
||||||
diff --git a/ui/views/accessible_pane_view.h b/ui/views/accessible_pane_view.h
|
|
||||||
index 813fd13860a863cd1e6e5bfec38d15f798418673..990c905e8f19dd015a625010ea30adfcb6f51ea6 100644
|
|
||||||
--- a/ui/views/accessible_pane_view.h
|
|
||||||
+++ b/ui/views/accessible_pane_view.h
|
|
||||||
@@ -35,7 +35,7 @@ class VIEWS_EXPORT AccessiblePaneView : public View,
|
|
||||||
// If |initial_focus| is not NULL, that control will get
|
|
||||||
// the initial focus, if it's enabled and focusable. Returns true if
|
|
||||||
// the pane was able to receive focus.
|
|
||||||
- bool SetPaneFocus(View* initial_focus);
|
|
||||||
+ virtual bool SetPaneFocus(View* initial_focus);
|
|
||||||
|
|
||||||
bool pane_has_focus() const { return pane_has_focus_; }
|
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ class VIEWS_EXPORT AccessiblePaneView : public View,
|
|
||||||
bool ContainsForFocusSearch(View* root, const View* v);
|
|
||||||
|
|
||||||
// Remove pane focus.
|
|
||||||
- void RemovePaneFocus();
|
|
||||||
+ virtual void RemovePaneFocus();
|
|
||||||
|
|
||||||
View* GetFirstFocusableChild();
|
|
||||||
View* GetLastFocusableChild();
|
|
|
@ -5,17 +5,12 @@
|
||||||
#include "shell/browser/ui/views/menu_bar.h"
|
#include "shell/browser/ui/views/menu_bar.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
|
#include "shell/browser/native_window.h"
|
||||||
#include "shell/browser/ui/views/submenu_button.h"
|
#include "shell/browser/ui/views/submenu_button.h"
|
||||||
#include "shell/common/keyboard_util.h"
|
|
||||||
#include "ui/aura/window.h"
|
|
||||||
#include "ui/base/models/menu_model.h"
|
|
||||||
#include "ui/native_theme/common_theme.h"
|
#include "ui/native_theme/common_theme.h"
|
||||||
#include "ui/views/background.h"
|
#include "ui/views/background.h"
|
||||||
#include "ui/views/layout/box_layout.h"
|
#include "ui/views/layout/box_layout.h"
|
||||||
#include "ui/views/widget/widget.h"
|
|
||||||
|
|
||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
#include "ui/gtk/gtk_util.h"
|
#include "ui/gtk/gtk_util.h"
|
||||||
|
@ -36,36 +31,18 @@ const SkColor kDefaultColor = SkColorSetARGB(255, 233, 233, 233);
|
||||||
|
|
||||||
const char MenuBar::kViewClassName[] = "ElectronMenuBar";
|
const char MenuBar::kViewClassName[] = "ElectronMenuBar";
|
||||||
|
|
||||||
MenuBarColorUpdater::MenuBarColorUpdater(MenuBar* menu_bar)
|
MenuBar::MenuBar(NativeWindow* window, RootView* root_view)
|
||||||
: menu_bar_(menu_bar) {}
|
: background_color_(kDefaultColor), window_(window), root_view_(root_view) {
|
||||||
|
|
||||||
MenuBarColorUpdater::~MenuBarColorUpdater() = default;
|
|
||||||
|
|
||||||
void MenuBarColorUpdater::OnDidChangeFocus(views::View* focused_before,
|
|
||||||
views::View* focused_now) {
|
|
||||||
if (menu_bar_) {
|
|
||||||
// if we've changed window focus, update menu bar colors
|
|
||||||
const auto had_focus = menu_bar_->has_focus_;
|
|
||||||
menu_bar_->has_focus_ = focused_now != nullptr;
|
|
||||||
if (menu_bar_->has_focus_ != had_focus)
|
|
||||||
menu_bar_->UpdateViewColors();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuBar::MenuBar(RootView* window)
|
|
||||||
: background_color_(kDefaultColor),
|
|
||||||
window_(window),
|
|
||||||
color_updater_(new MenuBarColorUpdater(this)) {
|
|
||||||
RefreshColorCache();
|
RefreshColorCache();
|
||||||
UpdateViewColors();
|
UpdateViewColors();
|
||||||
SetFocusBehavior(FocusBehavior::ALWAYS);
|
SetFocusBehavior(FocusBehavior::ALWAYS);
|
||||||
SetLayoutManager(std::make_unique<views::BoxLayout>(
|
SetLayoutManager(std::make_unique<views::BoxLayout>(
|
||||||
views::BoxLayout::Orientation::kHorizontal));
|
views::BoxLayout::Orientation::kHorizontal));
|
||||||
window_->GetFocusManager()->AddFocusChangeListener(color_updater_.get());
|
window_->AddObserver(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuBar::~MenuBar() {
|
MenuBar::~MenuBar() {
|
||||||
window_->GetFocusManager()->RemoveFocusChangeListener(color_updater_.get());
|
window_->RemoveObserver(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuBar::SetMenu(ElectronMenuModel* model) {
|
void MenuBar::SetMenu(ElectronMenuModel* model) {
|
||||||
|
@ -123,131 +100,55 @@ void MenuBar::OnBeforeExecuteCommand() {
|
||||||
if (GetPaneFocusTraversable() != nullptr) {
|
if (GetPaneFocusTraversable() != nullptr) {
|
||||||
RemovePaneFocus();
|
RemovePaneFocus();
|
||||||
}
|
}
|
||||||
window_->RestoreFocus();
|
root_view_->RestoreFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuBar::OnMenuClosed() {
|
void MenuBar::OnMenuClosed() {
|
||||||
SetAcceleratorVisibility(true);
|
SetAcceleratorVisibility(pane_has_focus());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuBar::OnWindowBlur() {
|
||||||
|
UpdateViewColors();
|
||||||
|
SetAcceleratorVisibility(pane_has_focus());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuBar::OnWindowFocus() {
|
||||||
|
UpdateViewColors();
|
||||||
|
SetAcceleratorVisibility(pane_has_focus());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MenuBar::AcceleratorPressed(const ui::Accelerator& accelerator) {
|
bool MenuBar::AcceleratorPressed(const ui::Accelerator& accelerator) {
|
||||||
views::View* focused_view = GetFocusManager()->GetFocusedView();
|
// Treat pressing Alt the same as pressing Esc.
|
||||||
if (!ContainsForFocusSearch(this, focused_view))
|
const ui::Accelerator& translated =
|
||||||
return false;
|
accelerator.key_code() == ui::VKEY_MENU
|
||||||
|
? ui::Accelerator(ui::VKEY_ESCAPE, accelerator.modifiers(),
|
||||||
switch (accelerator.key_code()) {
|
accelerator.key_state(), accelerator.time_stamp())
|
||||||
case ui::VKEY_MENU:
|
: accelerator;
|
||||||
case ui::VKEY_ESCAPE: {
|
return views::AccessiblePaneView::AcceleratorPressed(translated);
|
||||||
RemovePaneFocus();
|
|
||||||
window_->RestoreFocus();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
case ui::VKEY_LEFT:
|
|
||||||
GetFocusManager()->AdvanceFocus(true);
|
|
||||||
return true;
|
|
||||||
case ui::VKEY_RIGHT:
|
|
||||||
GetFocusManager()->AdvanceFocus(false);
|
|
||||||
return true;
|
|
||||||
case ui::VKEY_HOME:
|
|
||||||
GetFocusManager()->SetFocusedViewWithReason(
|
|
||||||
GetFirstFocusableChild(),
|
|
||||||
views::FocusManager::FocusChangeReason::kFocusTraversal);
|
|
||||||
return true;
|
|
||||||
case ui::VKEY_END:
|
|
||||||
GetFocusManager()->SetFocusedViewWithReason(
|
|
||||||
GetLastFocusableChild(),
|
|
||||||
views::FocusManager::FocusChangeReason::kFocusTraversal);
|
|
||||||
return true;
|
|
||||||
default: {
|
|
||||||
for (auto* child : GetChildrenInZOrder()) {
|
|
||||||
auto* button = static_cast<SubmenuButton*>(child);
|
|
||||||
bool shifted = false;
|
|
||||||
auto keycode =
|
|
||||||
electron::KeyboardCodeFromCharCode(button->accelerator(), &shifted);
|
|
||||||
|
|
||||||
if (keycode == accelerator.key_code()) {
|
|
||||||
auto event = accelerator.ToKeyEvent();
|
|
||||||
ButtonPressed(button->tag(), event);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MenuBar::SetPaneFocus(views::View* initial_focus) {
|
bool MenuBar::SetPaneFocusAndFocusDefault() {
|
||||||
// TODO(zcbenz): Submit patch to upstream Chromium to fix the crash.
|
bool result = views::AccessiblePaneView::SetPaneFocusAndFocusDefault();
|
||||||
//
|
if (result && !accelerator_installed_) {
|
||||||
// Without this check, Electron would crash when running tests.
|
// Listen to Alt key events.
|
||||||
//
|
// Note that there is no need to unregister the accelerator.
|
||||||
// Check failed: rules_->CanFocusWindow(window, nullptr).
|
accelerator_installed_ = true;
|
||||||
// logging::LogMessage::~LogMessage
|
|
||||||
// wm::FocusController::SetFocusedWindow
|
|
||||||
// wm::FocusController::ResetFocusWithinActiveWindow
|
|
||||||
// views::View::OnFocus
|
|
||||||
// views::Button::OnFocus
|
|
||||||
// views::LabelButton::OnFocus
|
|
||||||
// views::View::Focus
|
|
||||||
// views::FocusManager::SetFocusedViewWithReason
|
|
||||||
// views::AccessiblePaneView::SetPaneFocus
|
|
||||||
// electron::MenuBar::SetPaneFocus
|
|
||||||
if (initial_focus && initial_focus->GetWidget()) {
|
|
||||||
aura::Window* window = initial_focus->GetWidget()->GetNativeWindow();
|
|
||||||
if (!window || !window->GetRootWindow())
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool result = views::AccessiblePaneView::SetPaneFocus(initial_focus);
|
|
||||||
|
|
||||||
if (result) {
|
|
||||||
std::set<ui::KeyboardCode> reg;
|
|
||||||
for (auto* child : GetChildrenInZOrder()) {
|
|
||||||
auto* button = static_cast<SubmenuButton*>(child);
|
|
||||||
bool shifted = false;
|
|
||||||
auto keycode =
|
|
||||||
electron::KeyboardCodeFromCharCode(button->accelerator(), &shifted);
|
|
||||||
|
|
||||||
// We want the menu items to activate if the user presses the accelerator
|
|
||||||
// key, even without alt, since we are now focused on the menu bar
|
|
||||||
if (keycode != ui::VKEY_UNKNOWN && reg.find(keycode) != reg.end()) {
|
|
||||||
reg.insert(keycode);
|
|
||||||
focus_manager()->RegisterAccelerator(
|
|
||||||
ui::Accelerator(keycode, ui::EF_NONE),
|
|
||||||
ui::AcceleratorManager::kNormalPriority, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// We want to remove focus / hide menu bar when alt is pressed again
|
|
||||||
focus_manager()->RegisterAccelerator(
|
focus_manager()->RegisterAccelerator(
|
||||||
ui::Accelerator(ui::VKEY_MENU, ui::EF_ALT_DOWN),
|
ui::Accelerator(ui::VKEY_MENU, ui::EF_ALT_DOWN),
|
||||||
ui::AcceleratorManager::kNormalPriority, this);
|
ui::AcceleratorManager::kNormalPriority, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuBar::RemovePaneFocus() {
|
void MenuBar::OnThemeChanged() {
|
||||||
views::AccessiblePaneView::RemovePaneFocus();
|
views::AccessiblePaneView::OnThemeChanged();
|
||||||
SetAcceleratorVisibility(false);
|
RefreshColorCache();
|
||||||
|
UpdateViewColors();
|
||||||
|
}
|
||||||
|
|
||||||
std::set<ui::KeyboardCode> unreg;
|
void MenuBar::OnDidChangeFocus(View* focused_before, View* focused_now) {
|
||||||
for (auto* child : GetChildrenInZOrder()) {
|
views::AccessiblePaneView::OnDidChangeFocus(focused_before, focused_now);
|
||||||
auto* button = static_cast<SubmenuButton*>(child);
|
SetAcceleratorVisibility(pane_has_focus());
|
||||||
bool shifted = false;
|
|
||||||
auto keycode =
|
|
||||||
electron::KeyboardCodeFromCharCode(button->accelerator(), &shifted);
|
|
||||||
|
|
||||||
if (keycode != ui::VKEY_UNKNOWN && unreg.find(keycode) != unreg.end()) {
|
|
||||||
unreg.insert(keycode);
|
|
||||||
focus_manager()->UnregisterAccelerator(
|
|
||||||
ui::Accelerator(keycode, ui::EF_NONE), this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
focus_manager()->UnregisterAccelerator(
|
|
||||||
ui::Accelerator(ui::VKEY_MENU, ui::EF_ALT_DOWN), this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* MenuBar::GetClassName() const {
|
const char* MenuBar::GetClassName() const {
|
||||||
|
@ -256,13 +157,13 @@ const char* MenuBar::GetClassName() const {
|
||||||
|
|
||||||
void MenuBar::ButtonPressed(int id, const ui::Event& event) {
|
void MenuBar::ButtonPressed(int id, const ui::Event& event) {
|
||||||
// Hide the accelerator when a submenu is activated.
|
// Hide the accelerator when a submenu is activated.
|
||||||
SetAcceleratorVisibility(false);
|
SetAcceleratorVisibility(pane_has_focus());
|
||||||
|
|
||||||
if (!menu_model_)
|
if (!menu_model_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!window_->HasFocus())
|
if (!root_view_->HasFocus())
|
||||||
window_->RequestFocus();
|
root_view_->RequestFocus();
|
||||||
|
|
||||||
ElectronMenuModel::ItemType type = menu_model_->GetTypeAt(id);
|
ElectronMenuModel::ItemType type = menu_model_->GetTypeAt(id);
|
||||||
if (type != ElectronMenuModel::TYPE_SUBMENU) {
|
if (type != ElectronMenuModel::TYPE_SUBMENU) {
|
||||||
|
@ -304,12 +205,6 @@ void MenuBar::RefreshColorCache() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuBar::OnThemeChanged() {
|
|
||||||
views::AccessiblePaneView::OnThemeChanged();
|
|
||||||
RefreshColorCache();
|
|
||||||
UpdateViewColors();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuBar::RebuildChildren() {
|
void MenuBar::RebuildChildren() {
|
||||||
RemoveAllChildViews(true);
|
RemoveAllChildViews(true);
|
||||||
for (int i = 0, n = GetItemCount(); i < n; ++i) {
|
for (int i = 0, n = GetItemCount(); i < n; ++i) {
|
||||||
|
@ -330,7 +225,8 @@ void MenuBar::UpdateViewColors() {
|
||||||
if (menu_model_ == nullptr)
|
if (menu_model_ == nullptr)
|
||||||
return;
|
return;
|
||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
const auto& textColor = has_focus_ ? enabled_color_ : disabled_color_;
|
const auto& textColor =
|
||||||
|
window_->IsFocused() ? enabled_color_ : disabled_color_;
|
||||||
for (auto* child : GetChildrenInZOrder()) {
|
for (auto* child : GetChildrenInZOrder()) {
|
||||||
auto* button = static_cast<SubmenuButton*>(child);
|
auto* button = static_cast<SubmenuButton*>(child);
|
||||||
button->SetTextColor(views::Button::STATE_NORMAL, textColor);
|
button->SetTextColor(views::Button::STATE_NORMAL, textColor);
|
||||||
|
|
|
@ -5,43 +5,25 @@
|
||||||
#ifndef SHELL_BROWSER_UI_VIEWS_MENU_BAR_H_
|
#ifndef SHELL_BROWSER_UI_VIEWS_MENU_BAR_H_
|
||||||
#define SHELL_BROWSER_UI_VIEWS_MENU_BAR_H_
|
#define SHELL_BROWSER_UI_VIEWS_MENU_BAR_H_
|
||||||
|
|
||||||
#include <memory>
|
#include "shell/browser/native_window_observer.h"
|
||||||
|
|
||||||
#include "shell/browser/ui/electron_menu_model.h"
|
#include "shell/browser/ui/electron_menu_model.h"
|
||||||
#include "shell/browser/ui/views/menu_delegate.h"
|
#include "shell/browser/ui/views/menu_delegate.h"
|
||||||
#include "shell/browser/ui/views/root_view.h"
|
#include "shell/browser/ui/views/root_view.h"
|
||||||
#include "ui/views/accessible_pane_view.h"
|
#include "ui/views/accessible_pane_view.h"
|
||||||
#include "ui/views/controls/button/button.h"
|
|
||||||
#include "ui/views/focus/focus_manager.h"
|
|
||||||
#include "ui/views/view.h"
|
|
||||||
|
|
||||||
namespace views {
|
namespace views {
|
||||||
class Button;
|
|
||||||
class MenuButton;
|
class MenuButton;
|
||||||
} // namespace views
|
}
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
|
|
||||||
class MenuBarColorUpdater : public views::FocusChangeListener {
|
|
||||||
public:
|
|
||||||
explicit MenuBarColorUpdater(MenuBar* menu_bar);
|
|
||||||
~MenuBarColorUpdater() override;
|
|
||||||
|
|
||||||
void OnDidChangeFocus(views::View* focused_before,
|
|
||||||
views::View* focused_now) override;
|
|
||||||
void OnWillChangeFocus(views::View* focused_before,
|
|
||||||
views::View* focused_now) override {}
|
|
||||||
|
|
||||||
private:
|
|
||||||
MenuBar* menu_bar_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class MenuBar : public views::AccessiblePaneView,
|
class MenuBar : public views::AccessiblePaneView,
|
||||||
public electron::MenuDelegate::Observer {
|
public MenuDelegate::Observer,
|
||||||
|
public NativeWindowObserver {
|
||||||
public:
|
public:
|
||||||
static const char kViewClassName[];
|
static const char kViewClassName[];
|
||||||
|
|
||||||
explicit MenuBar(RootView* window);
|
MenuBar(NativeWindow* window, RootView* root_view);
|
||||||
~MenuBar() override;
|
~MenuBar() override;
|
||||||
|
|
||||||
// Replaces current menu with a new one.
|
// Replaces current menu with a new one.
|
||||||
|
@ -64,18 +46,22 @@ class MenuBar : public views::AccessiblePaneView,
|
||||||
ElectronMenuModel** menu_model,
|
ElectronMenuModel** menu_model,
|
||||||
views::MenuButton** button);
|
views::MenuButton** button);
|
||||||
|
|
||||||
// electron::MenuDelegate::Observer:
|
private:
|
||||||
|
// MenuDelegate::Observer:
|
||||||
void OnBeforeExecuteCommand() override;
|
void OnBeforeExecuteCommand() override;
|
||||||
void OnMenuClosed() override;
|
void OnMenuClosed() override;
|
||||||
|
|
||||||
|
// NativeWindowObserver:
|
||||||
|
void OnWindowBlur() override;
|
||||||
|
void OnWindowFocus() override;
|
||||||
|
|
||||||
// views::AccessiblePaneView:
|
// views::AccessiblePaneView:
|
||||||
bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
|
bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
|
||||||
bool SetPaneFocus(views::View* initial_focus) override;
|
bool SetPaneFocusAndFocusDefault() override;
|
||||||
void RemovePaneFocus() override;
|
|
||||||
void OnThemeChanged() override;
|
void OnThemeChanged() override;
|
||||||
|
|
||||||
private:
|
// views::FocusChangeListener:
|
||||||
friend class MenuBarColorUpdater;
|
void OnDidChangeFocus(View* focused_before, View* focused_now) override;
|
||||||
|
|
||||||
// views::View:
|
// views::View:
|
||||||
const char* GetClassName() const override;
|
const char* GetClassName() const override;
|
||||||
|
@ -84,22 +70,19 @@ class MenuBar : public views::AccessiblePaneView,
|
||||||
|
|
||||||
void RebuildChildren();
|
void RebuildChildren();
|
||||||
void UpdateViewColors();
|
void UpdateViewColors();
|
||||||
|
|
||||||
void RefreshColorCache();
|
void RefreshColorCache();
|
||||||
|
View* FindAccelChild(char16_t key);
|
||||||
|
|
||||||
SkColor background_color_;
|
SkColor background_color_;
|
||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
SkColor enabled_color_;
|
SkColor enabled_color_;
|
||||||
SkColor disabled_color_;
|
SkColor disabled_color_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RootView* window_ = nullptr;
|
NativeWindow* window_;
|
||||||
|
RootView* root_view_;
|
||||||
ElectronMenuModel* menu_model_ = nullptr;
|
ElectronMenuModel* menu_model_ = nullptr;
|
||||||
|
bool accelerator_installed_ = false;
|
||||||
View* FindAccelChild(char16_t key);
|
|
||||||
|
|
||||||
bool has_focus_ = true;
|
|
||||||
|
|
||||||
std::unique_ptr<MenuBarColorUpdater> color_updater_;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(MenuBar);
|
DISALLOW_COPY_AND_ASSIGN(MenuBar);
|
||||||
};
|
};
|
||||||
|
|
|
@ -62,7 +62,7 @@ void RootView::SetMenu(ElectronMenuModel* menu_model) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!menu_bar_) {
|
if (!menu_bar_) {
|
||||||
menu_bar_ = std::make_unique<MenuBar>(this);
|
menu_bar_ = std::make_unique<MenuBar>(window_, this);
|
||||||
menu_bar_->set_owned_by_client();
|
menu_bar_->set_owned_by_client();
|
||||||
if (!menu_bar_autohide_)
|
if (!menu_bar_autohide_)
|
||||||
SetMenuBarVisibility(true);
|
SetMenuBarVisibility(true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue