Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: make NativeWindow getter methods const #40887

Merged
merged 1 commit into from Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
74 changes: 37 additions & 37 deletions shell/browser/api/electron_api_base_window.cc
Expand Up @@ -333,7 +333,7 @@ void BaseWindow::Blur() {
window_->Focus(false);
}

bool BaseWindow::IsFocused() {
bool BaseWindow::IsFocused() const {
return window_->IsFocused();
}

Expand All @@ -352,11 +352,11 @@ void BaseWindow::Hide() {
window_->Hide();
}

bool BaseWindow::IsVisible() {
bool BaseWindow::IsVisible() const {
return window_->IsVisible();
}

bool BaseWindow::IsEnabled() {
bool BaseWindow::IsEnabled() const {
return window_->IsEnabled();
}

Expand All @@ -372,7 +372,7 @@ void BaseWindow::Unmaximize() {
window_->Unmaximize();
}

bool BaseWindow::IsMaximized() {
bool BaseWindow::IsMaximized() const {
return window_->IsMaximized();
}

Expand All @@ -384,15 +384,15 @@ void BaseWindow::Restore() {
window_->Restore();
}

bool BaseWindow::IsMinimized() {
bool BaseWindow::IsMinimized() const {
return window_->IsMinimized();
}

void BaseWindow::SetFullScreen(bool fullscreen) {
window_->SetFullScreen(fullscreen);
}

bool BaseWindow::IsFullscreen() {
bool BaseWindow::IsFullscreen() const {
return window_->IsFullscreen();
}

Expand All @@ -403,15 +403,15 @@ void BaseWindow::SetBounds(const gfx::Rect& bounds,
window_->SetBounds(bounds, animate);
}

gfx::Rect BaseWindow::GetBounds() {
gfx::Rect BaseWindow::GetBounds() const {
return window_->GetBounds();
}

bool BaseWindow::IsNormal() {
bool BaseWindow::IsNormal() const {
return window_->IsNormal();
}

gfx::Rect BaseWindow::GetNormalBounds() {
gfx::Rect BaseWindow::GetNormalBounds() const {
return window_->GetNormalBounds();
}

Expand All @@ -422,7 +422,7 @@ void BaseWindow::SetContentBounds(const gfx::Rect& bounds,
window_->SetContentBounds(bounds, animate);
}

gfx::Rect BaseWindow::GetContentBounds() {
gfx::Rect BaseWindow::GetContentBounds() const {
return window_->GetContentBounds();
}

Expand All @@ -434,7 +434,7 @@ void BaseWindow::SetSize(int width, int height, gin_helper::Arguments* args) {
window_->SetSize(size, animate);
}

std::vector<int> BaseWindow::GetSize() {
std::vector<int> BaseWindow::GetSize() const {
std::vector<int> result(2);
gfx::Size size = window_->GetSize();
result[0] = size.width();
Expand All @@ -450,7 +450,7 @@ void BaseWindow::SetContentSize(int width,
window_->SetContentSize(gfx::Size(width, height), animate);
}

std::vector<int> BaseWindow::GetContentSize() {
std::vector<int> BaseWindow::GetContentSize() const {
std::vector<int> result(2);
gfx::Size size = window_->GetContentSize();
result[0] = size.width();
Expand All @@ -462,7 +462,7 @@ void BaseWindow::SetMinimumSize(int width, int height) {
window_->SetMinimumSize(gfx::Size(width, height));
}

std::vector<int> BaseWindow::GetMinimumSize() {
std::vector<int> BaseWindow::GetMinimumSize() const {
std::vector<int> result(2);
gfx::Size size = window_->GetMinimumSize();
result[0] = size.width();
Expand All @@ -474,7 +474,7 @@ void BaseWindow::SetMaximumSize(int width, int height) {
window_->SetMaximumSize(gfx::Size(width, height));
}

std::vector<int> BaseWindow::GetMaximumSize() {
std::vector<int> BaseWindow::GetMaximumSize() const {
std::vector<int> result(2);
gfx::Size size = window_->GetMaximumSize();
result[0] = size.width();
Expand All @@ -492,47 +492,47 @@ void BaseWindow::SetResizable(bool resizable) {
window_->SetResizable(resizable);
}

bool BaseWindow::IsResizable() {
bool BaseWindow::IsResizable() const {
return window_->IsResizable();
}

void BaseWindow::SetMovable(bool movable) {
window_->SetMovable(movable);
}

bool BaseWindow::IsMovable() {
bool BaseWindow::IsMovable() const {
return window_->IsMovable();
}

void BaseWindow::SetMinimizable(bool minimizable) {
window_->SetMinimizable(minimizable);
}

bool BaseWindow::IsMinimizable() {
bool BaseWindow::IsMinimizable() const {
return window_->IsMinimizable();
}

void BaseWindow::SetMaximizable(bool maximizable) {
window_->SetMaximizable(maximizable);
}

bool BaseWindow::IsMaximizable() {
bool BaseWindow::IsMaximizable() const {
return window_->IsMaximizable();
}

void BaseWindow::SetFullScreenable(bool fullscreenable) {
window_->SetFullScreenable(fullscreenable);
}

bool BaseWindow::IsFullScreenable() {
bool BaseWindow::IsFullScreenable() const {
return window_->IsFullScreenable();
}

void BaseWindow::SetClosable(bool closable) {
window_->SetClosable(closable);
}

bool BaseWindow::IsClosable() {
bool BaseWindow::IsClosable() const {
return window_->IsClosable();
}

Expand All @@ -547,7 +547,7 @@ void BaseWindow::SetAlwaysOnTop(bool top, gin_helper::Arguments* args) {
window_->SetAlwaysOnTop(z_order, level, relative_level);
}

bool BaseWindow::IsAlwaysOnTop() {
bool BaseWindow::IsAlwaysOnTop() const {
return window_->GetZOrderLevel() != ui::ZOrderLevel::kNormal;
}

Expand All @@ -561,7 +561,7 @@ void BaseWindow::SetPosition(int x, int y, gin_helper::Arguments* args) {
window_->SetPosition(gfx::Point(x, y), animate);
}

std::vector<int> BaseWindow::GetPosition() {
std::vector<int> BaseWindow::GetPosition() const {
std::vector<int> result(2);
gfx::Point pos = window_->GetPosition();
result[0] = pos.x();
Expand All @@ -582,15 +582,15 @@ void BaseWindow::SetTitle(const std::string& title) {
window_->SetTitle(title);
}

std::string BaseWindow::GetTitle() {
std::string BaseWindow::GetTitle() const {
return window_->GetTitle();
}

void BaseWindow::SetAccessibleTitle(const std::string& title) {
window_->SetAccessibleTitle(title);
}

std::string BaseWindow::GetAccessibleTitle() {
std::string BaseWindow::GetAccessibleTitle() const {
return window_->GetAccessibleTitle();
}

Expand All @@ -606,23 +606,23 @@ void BaseWindow::SetExcludedFromShownWindowsMenu(bool excluded) {
window_->SetExcludedFromShownWindowsMenu(excluded);
}

bool BaseWindow::IsExcludedFromShownWindowsMenu() {
bool BaseWindow::IsExcludedFromShownWindowsMenu() const {
return window_->IsExcludedFromShownWindowsMenu();
}

void BaseWindow::SetSimpleFullScreen(bool simple_fullscreen) {
window_->SetSimpleFullScreen(simple_fullscreen);
}

bool BaseWindow::IsSimpleFullScreen() {
bool BaseWindow::IsSimpleFullScreen() const {
return window_->IsSimpleFullScreen();
}

void BaseWindow::SetKiosk(bool kiosk) {
window_->SetKiosk(kiosk);
}

bool BaseWindow::IsKiosk() {
bool BaseWindow::IsKiosk() const {
return window_->IsKiosk();
}

Expand All @@ -635,7 +635,7 @@ void BaseWindow::SetBackgroundColor(const std::string& color_name) {
window_->SetBackgroundColor(color);
}

std::string BaseWindow::GetBackgroundColor(gin_helper::Arguments* args) {
std::string BaseWindow::GetBackgroundColor(gin_helper::Arguments* args) const {
return ToRGBHex(window_->GetBackgroundColor());
}

Expand All @@ -647,15 +647,15 @@ void BaseWindow::SetHasShadow(bool has_shadow) {
window_->SetHasShadow(has_shadow);
}

bool BaseWindow::HasShadow() {
bool BaseWindow::HasShadow() const {
return window_->HasShadow();
}

void BaseWindow::SetOpacity(const double opacity) {
window_->SetOpacity(opacity);
}

double BaseWindow::GetOpacity() {
double BaseWindow::GetOpacity() const {
return window_->GetOpacity();
}

Expand All @@ -667,15 +667,15 @@ void BaseWindow::SetRepresentedFilename(const std::string& filename) {
window_->SetRepresentedFilename(filename);
}

std::string BaseWindow::GetRepresentedFilename() {
std::string BaseWindow::GetRepresentedFilename() const {
return window_->GetRepresentedFilename();
}

void BaseWindow::SetDocumentEdited(bool edited) {
window_->SetDocumentEdited(edited);
}

bool BaseWindow::IsDocumentEdited() {
bool BaseWindow::IsDocumentEdited() const {
return window_->IsDocumentEdited();
}

Expand All @@ -695,7 +695,7 @@ void BaseWindow::SetFocusable(bool focusable) {
return window_->SetFocusable(focusable);
}

bool BaseWindow::IsFocusable() {
bool BaseWindow::IsFocusable() const {
return window_->IsFocusable();
}

Expand Down Expand Up @@ -861,7 +861,7 @@ void BaseWindow::SetVisibleOnAllWorkspaces(bool visible,
skipTransformProcessType);
}

bool BaseWindow::IsVisibleOnAllWorkspaces() {
bool BaseWindow::IsVisibleOnAllWorkspaces() const {
return window_->IsVisibleOnAllWorkspaces();
}

Expand All @@ -879,7 +879,7 @@ void BaseWindow::SetBackgroundMaterial(const std::string& material_type) {
}

#if BUILDFLAG(IS_MAC)
std::string BaseWindow::GetAlwaysOnTopLevel() {
std::string BaseWindow::GetAlwaysOnTopLevel() const {
return window_->GetAlwaysOnTopLevel();
}

Expand Down Expand Up @@ -965,15 +965,15 @@ void BaseWindow::SetAutoHideMenuBar(bool auto_hide) {
window_->SetAutoHideMenuBar(auto_hide);
}

bool BaseWindow::IsMenuBarAutoHide() {
bool BaseWindow::IsMenuBarAutoHide() const {
return window_->IsMenuBarAutoHide();
}

void BaseWindow::SetMenuBarVisibility(bool visible) {
window_->SetMenuBarVisibility(visible);
}

bool BaseWindow::IsMenuBarVisible() {
bool BaseWindow::IsMenuBarVisible() const {
return window_->IsMenuBarVisible();
}

Expand Down