Skip to content

Commit

Permalink
Merge pull request #18922 from brave/linux_dark_theme
Browse files Browse the repository at this point in the history
Prevent system theme change affect brave's theme in linux
  • Loading branch information
simonhong committed Jun 23, 2023
1 parent cd741c4 commit c3d7f3e
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* 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 "chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h"

#if defined(USE_DBUS)
#include "chrome/browser/ui/views/dark_mode_manager_linux.h"
#endif

#if defined(USE_DBUS)
namespace ui {

class BraveDarkModeManagerLinux {
public:
BraveDarkModeManagerLinux() = default;
~BraveDarkModeManagerLinux() = default;
BraveDarkModeManagerLinux(const BraveDarkModeManagerLinux&) = delete;
BraveDarkModeManagerLinux& operator=(const BraveDarkModeManagerLinux&) =
delete;
};

} // namespace ui

#define DarkModeManagerLinux BraveDarkModeManagerLinux
#endif

#include "src/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.cc"

#if defined(USE_DBUS)
#undef DarkModeManagerLinux
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* 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_CHROME_BROWSER_MAIN_EXTRA_PARTS_VIEWS_LINUX_H_
#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_CHROME_BROWSER_MAIN_EXTRA_PARTS_VIEWS_LINUX_H_

#if defined(USE_DBUS)
namespace ui {
class BraveDarkModeManagerLinux;
} // namespace ui

// Remove this overriding when linux also supports system default theme option.
#define DarkModeManagerLinux BraveDarkModeManagerLinux
#endif

#include "src/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h" // IWYU pragma: export

#if defined(USE_DBUS)
#undef DarkModeManagerLinux
#endif

#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_CHROME_BROWSER_MAIN_EXTRA_PARTS_VIEWS_LINUX_H_

0 comments on commit c3d7f3e

Please sign in to comment.