-
Notifications
You must be signed in to change notification settings - Fork 868
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
4e681eb
commit 89cb653
Showing
17 changed files
with
177 additions
and
13 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
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
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
37 changes: 37 additions & 0 deletions
37
chromium_src/chrome/browser/ui/views/tabs/alert_indicator_button.cc
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,37 @@ | ||
// Copyright (c) 2022 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/tabs/alert_indicator_button.h" | ||
|
||
#include "brave/components/constants/pref_names.h" | ||
#include "chrome/browser/profiles/profile.h" | ||
#include "chrome/browser/ui/browser.h" | ||
#include "chrome/browser/ui/views/tabs/tab.h" | ||
#include "chrome/browser/ui/views/tabs/tab_slot_controller.h" | ||
#include "components/prefs/pref_service.h" | ||
|
||
#define AlertIndicatorButton AlertIndicatorButtonBase | ||
|
||
#include "src/chrome/browser/ui/views/tabs/alert_indicator_button.cc" | ||
|
||
#undef AlertIndicatorButton | ||
|
||
void AlertIndicatorButton::UpdateEnabledForMuteToggle() { | ||
const bool was_enabled = GetEnabled(); | ||
auto* browser = GetTab()->controller()->GetBrowser(); | ||
|
||
// We have clickable mute indicators enabled by default. Thus, if our pref is | ||
// disabled we can force the indicator off. | ||
// Note: We have a test which checks the feature is enabled by default. If | ||
// that changes this may need to as well. | ||
// Note: |browser| is |nullptr| in some unit_tests. | ||
if (browser && browser->profile()->GetPrefs()->GetBoolean( | ||
kTabMuteIndicatorNotClickable)) { | ||
if (was_enabled) | ||
SetEnabled(false); | ||
return; | ||
} | ||
AlertIndicatorButtonBase::UpdateEnabledForMuteToggle(); | ||
} |
29 changes: 29 additions & 0 deletions
29
chromium_src/chrome/browser/ui/views/tabs/alert_indicator_button.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,29 @@ | ||
// Copyright (c) 2022 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_TABS_ALERT_INDICATOR_BUTTON_H_ | ||
#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_TABS_ALERT_INDICATOR_BUTTON_H_ | ||
|
||
class AlertIndicatorButton; | ||
#define AlertIndicatorButton AlertIndicatorButtonBase | ||
#define GetTab \ | ||
GetTab_Unused(); \ | ||
\ | ||
protected: \ | ||
Tab* GetTab | ||
|
||
#define UpdateEnabledForMuteToggle virtual UpdateEnabledForMuteToggle | ||
#include "src/chrome/browser/ui/views/tabs/alert_indicator_button.h" | ||
#undef UpdateEnabledForMuteToggle | ||
#undef GetTab | ||
#undef AlertIndicatorButton | ||
|
||
class AlertIndicatorButton : public AlertIndicatorButtonBase { | ||
public: | ||
using AlertIndicatorButtonBase::AlertIndicatorButtonBase; | ||
void UpdateEnabledForMuteToggle() override; | ||
}; | ||
|
||
#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_TABS_ALERT_INDICATOR_BUTTON_H_ |
Oops, something went wrong.