mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: aggregate RootView::main_view_
its lifespan always equals the RootView's, so let's aggregate it.
This commit is contained in:
@@ -38,9 +38,9 @@ RootView::RootView(NativeWindow* window)
|
||||
views::BoxLayout* layout =
|
||||
SetLayoutManager(std::make_unique<views::BoxLayout>(
|
||||
views::BoxLayout::Orientation::kVertical));
|
||||
main_view_ = AddChildView(std::make_unique<views::View>());
|
||||
main_view_->SetUseDefaultFillLayout(true);
|
||||
layout->SetFlexForView(main_view_, 1);
|
||||
AddChildView(&main_view_);
|
||||
main_view_.SetUseDefaultFillLayout(true);
|
||||
layout->SetFlexForView(&main_view_, 1);
|
||||
}
|
||||
|
||||
RootView::~RootView() = default;
|
||||
|
||||
@@ -46,7 +46,7 @@ class RootView : public views::View {
|
||||
void RegisterAcceleratorsWithFocusManager(ElectronMenuModel* menu_model);
|
||||
void UnregisterAcceleratorsWithFocusManager();
|
||||
|
||||
views::View* GetMainView() { return main_view_; }
|
||||
views::View* GetMainView() { return &main_view_; }
|
||||
|
||||
// views::View:
|
||||
gfx::Size GetMinimumSize() const override;
|
||||
@@ -64,7 +64,7 @@ class RootView : public views::View {
|
||||
bool menu_bar_alt_pressed_ = false;
|
||||
|
||||
// Main view area.
|
||||
raw_ptr<views::View> main_view_;
|
||||
views::View main_view_;
|
||||
|
||||
// Map from accelerator to menu item's command id.
|
||||
accelerator_util::AcceleratorTable accelerator_table_;
|
||||
|
||||
Reference in New Issue
Block a user