-
Notifications
You must be signed in to change notification settings - Fork 910
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d4d1c76
commit 3e9ea28
Showing
8 changed files
with
119 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/browser/ui/views/brave_dark_mode_manager_linux.h" | ||
|
||
#include "brave/browser/themes/brave_dark_mode_utils.h" | ||
#include "ui/linux/linux_ui_factory.h" | ||
|
||
namespace ui { | ||
|
||
BraveDarkModeManagerLinux::BraveDarkModeManagerLinux() | ||
: DarkModeManagerLinux() { | ||
// In base class' ctor, |prefer_dark_theme_| is set by calling | ||
// SetColorScheme() when ui::GetDefaultLinuxUiTheme() | ||
if (ui::GetDefaultLinuxUiTheme()) { | ||
dark_mode::CacheSystemDarkModePrefs(prefer_dark_theme_); | ||
} | ||
} | ||
|
||
BraveDarkModeManagerLinux::~BraveDarkModeManagerLinux() = default; | ||
|
||
void BraveDarkModeManagerLinux::SetColorScheme(bool prefer_dark_theme, | ||
bool from_toolkit_theme) { | ||
dark_mode::CacheSystemDarkModePrefs(prefer_dark_theme); | ||
if (dark_mode::GetBraveDarkModeType() == | ||
dark_mode::BraveDarkModeType::BRAVE_DARK_MODE_TYPE_DEFAULT) { | ||
DarkModeManagerLinux::SetColorScheme(prefer_dark_theme, from_toolkit_theme); | ||
} else { | ||
// Make |prefer_dark_theme_| stores latest system theme even brave theme( | ||
// dark or light) is set. If not, system theme change could not be applied | ||
// properly later. | ||
prefer_dark_theme_ = prefer_dark_theme; | ||
} | ||
} | ||
|
||
} // namespace ui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_BROWSER_UI_VIEWS_BRAVE_DARK_MODE_MANAGER_LINUX_H_ | ||
#define BRAVE_BROWSER_UI_VIEWS_BRAVE_DARK_MODE_MANAGER_LINUX_H_ | ||
|
||
#include "chrome/browser/ui/views/dark_mode_manager_linux.h" | ||
|
||
namespace ui { | ||
|
||
class BraveDarkModeManagerLinux : public DarkModeManagerLinux { | ||
public: | ||
BraveDarkModeManagerLinux(); | ||
~BraveDarkModeManagerLinux() override; | ||
|
||
private: | ||
// DarkModeManagerLinux overrides: | ||
void SetColorScheme(bool prefer_dark_theme, bool from_toolkit_theme) override; | ||
}; | ||
|
||
} // namespace ui | ||
|
||
#endif // BRAVE_BROWSER_UI_VIEWS_BRAVE_DARK_MODE_MANAGER_LINUX_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
chromium_src/chrome/browser/ui/views/dark_mode_manager_linux.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_DARK_MODE_MANAGER_LINUX_H_ | ||
#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_DARK_MODE_MANAGER_LINUX_H_ | ||
|
||
#define SetColorScheme \ | ||
SetColorScheme_UnUsed() {} \ | ||
friend class BraveDarkModeManagerLinux; \ | ||
virtual void SetColorScheme | ||
|
||
#include "src/chrome/browser/ui/views/dark_mode_manager_linux.h" // IWYU pragma: export | ||
|
||
#undef SetColorScheme | ||
|
||
#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_DARK_MODE_MANAGER_LINUX_H_ |