Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 2753933003: Fix theme change paint issue on linux. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | ui/views/widget/widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 window_title); 1641 window_title);
1642 case TabAlertState::TAB_CAPTURING: 1642 case TabAlertState::TAB_CAPTURING:
1643 return l10n_util::GetStringFUTF16(IDS_TAB_AX_LABEL_TAB_CAPTURING_FORMAT, 1643 return l10n_util::GetStringFUTF16(IDS_TAB_AX_LABEL_TAB_CAPTURING_FORMAT,
1644 window_title); 1644 window_title);
1645 case TabAlertState::NONE: 1645 case TabAlertState::NONE:
1646 return window_title; 1646 return window_title;
1647 } 1647 }
1648 return base::string16(); 1648 return base::string16();
1649 } 1649 }
1650 1650
1651 void BrowserView::NativeThemeUpdated(const ui::NativeTheme* theme) {
1652 // We don't handle theme updates in OnThemeChanged() as that function is
1653 // called while views are being iterated over. Please see
1654 // View::PropagateNativeThemeChanged() for details. The theme update
1655 // handling in UserChangedTheme() can cause views to be nuked or created
1656 // which is a bad thing during iteration.
1657
1658 // Do not handle native theme changes before the browser view is initialized.
1659 if (!initialized_)
1660 return;
1661 // Don't infinitely recurse.
1662 if (!handling_theme_changed_)
1663 UserChangedTheme();
1664 chrome::MaybeShowInvertBubbleView(this);
1665 }
1666
1651 views::View* BrowserView::GetInitiallyFocusedView() { 1667 views::View* BrowserView::GetInitiallyFocusedView() {
1652 return nullptr; 1668 return nullptr;
1653 } 1669 }
1654 1670
1655 bool BrowserView::ShouldShowWindowTitle() const { 1671 bool BrowserView::ShouldShowWindowTitle() const {
1656 #if defined(OS_CHROMEOS) 1672 #if defined(OS_CHROMEOS)
1657 // For Chrome OS only, trusted windows (apps and settings) do not show a 1673 // For Chrome OS only, trusted windows (apps and settings) do not show a
1658 // title, crbug.com/119411. Child windows (i.e. popups) do show a title. 1674 // title, crbug.com/119411. Child windows (i.e. popups) do show a title.
1659 if (browser_->is_trusted_source()) 1675 if (browser_->is_trusted_source())
1660 return false; 1676 return false;
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1963 base::AutoReset<bool> reset(&handling_theme_changed_, true); 1979 base::AutoReset<bool> reset(&handling_theme_changed_, true);
1964 #if defined(USE_AURA) 1980 #if defined(USE_AURA)
1965 ui::NativeThemeDarkAura::instance()->NotifyObservers(); 1981 ui::NativeThemeDarkAura::instance()->NotifyObservers();
1966 #endif 1982 #endif
1967 ui::NativeTheme::GetInstanceForNativeUi()->NotifyObservers(); 1983 ui::NativeTheme::GetInstanceForNativeUi()->NotifyObservers();
1968 } 1984 }
1969 1985
1970 views::View::OnThemeChanged(); 1986 views::View::OnThemeChanged();
1971 } 1987 }
1972 1988
1973 void BrowserView::OnNativeThemeChanged(const ui::NativeTheme* theme) {
1974 // Do not handle native theme changes before the browser view is initialized.
1975 if (!initialized_)
1976 return;
1977 ClientView::OnNativeThemeChanged(theme);
1978 // Don't infinitely recurse.
1979 if (!handling_theme_changed_)
1980 UserChangedTheme();
1981 chrome::MaybeShowInvertBubbleView(this);
1982 }
1983
1984 /////////////////////////////////////////////////////////////////////////////// 1989 ///////////////////////////////////////////////////////////////////////////////
1985 // BrowserView, ui::AcceleratorTarget overrides: 1990 // BrowserView, ui::AcceleratorTarget overrides:
1986 1991
1987 bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) { 1992 bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) {
1988 std::map<ui::Accelerator, int>::const_iterator iter = 1993 std::map<ui::Accelerator, int>::const_iterator iter =
1989 accelerator_table_.find(accelerator); 1994 accelerator_table_.find(accelerator);
1990 DCHECK(iter != accelerator_table_.end()); 1995 DCHECK(iter != accelerator_table_.end());
1991 int command_id = iter->second; 1996 int command_id = iter->second;
1992 1997
1993 if (accelerator.IsRepeat() && !IsCommandRepeatable(command_id)) 1998 if (accelerator.IsRepeat() && !IsCommandRepeatable(command_id))
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
2638 } 2643 }
2639 2644
2640 extensions::ActiveTabPermissionGranter* 2645 extensions::ActiveTabPermissionGranter*
2641 BrowserView::GetActiveTabPermissionGranter() { 2646 BrowserView::GetActiveTabPermissionGranter() {
2642 content::WebContents* web_contents = GetActiveWebContents(); 2647 content::WebContents* web_contents = GetActiveWebContents();
2643 if (!web_contents) 2648 if (!web_contents)
2644 return nullptr; 2649 return nullptr;
2645 return extensions::TabHelper::FromWebContents(web_contents) 2650 return extensions::TabHelper::FromWebContents(web_contents)
2646 ->active_tab_permission_granter(); 2651 ->active_tab_permission_granter();
2647 } 2652 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | ui/views/widget/widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698