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

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

Issue 2743793003: Fix theme change paint issue on linux. (Closed)
Patch Set: Revert changes to DesktopWindowTreeHostWin 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
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 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 window_title); 1649 window_title);
1650 case TabAlertState::TAB_CAPTURING: 1650 case TabAlertState::TAB_CAPTURING:
1651 return l10n_util::GetStringFUTF16(IDS_TAB_AX_LABEL_TAB_CAPTURING_FORMAT, 1651 return l10n_util::GetStringFUTF16(IDS_TAB_AX_LABEL_TAB_CAPTURING_FORMAT,
1652 window_title); 1652 window_title);
1653 case TabAlertState::NONE: 1653 case TabAlertState::NONE:
1654 return window_title; 1654 return window_title;
1655 } 1655 }
1656 return base::string16(); 1656 return base::string16();
1657 } 1657 }
1658 1658
1659 void BrowserView::NativeThemeUpdated(const ui::NativeTheme* theme) {
sky 2017/03/13 15:41:42 Please comment why NativeThemeUpdated is used rath
ananta 2017/03/13 19:48:03 Done.
1660 // Do not handle native theme changes before the browser view is initialized.
1661 if (!initialized_)
1662 return;
1663 // Don't infinitely recurse.
1664 if (!handling_theme_changed_)
1665 UserChangedTheme();
1666 chrome::MaybeShowInvertBubbleView(this);
1667 }
1668
1659 views::View* BrowserView::GetInitiallyFocusedView() { 1669 views::View* BrowserView::GetInitiallyFocusedView() {
1660 return nullptr; 1670 return nullptr;
1661 } 1671 }
1662 1672
1663 bool BrowserView::ShouldShowWindowTitle() const { 1673 bool BrowserView::ShouldShowWindowTitle() const {
1664 #if defined(OS_CHROMEOS) 1674 #if defined(OS_CHROMEOS)
1665 // For Chrome OS only, trusted windows (apps and settings) do not show a 1675 // For Chrome OS only, trusted windows (apps and settings) do not show a
1666 // title, crbug.com/119411. Child windows (i.e. popups) do show a title. 1676 // title, crbug.com/119411. Child windows (i.e. popups) do show a title.
1667 if (browser_->is_trusted_source()) 1677 if (browser_->is_trusted_source())
1668 return false; 1678 return false;
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1983 base::AutoReset<bool> reset(&handling_theme_changed_, true); 1993 base::AutoReset<bool> reset(&handling_theme_changed_, true);
1984 #if defined(USE_AURA) 1994 #if defined(USE_AURA)
1985 ui::NativeThemeDarkAura::instance()->NotifyObservers(); 1995 ui::NativeThemeDarkAura::instance()->NotifyObservers();
1986 #endif 1996 #endif
1987 ui::NativeTheme::GetInstanceForNativeUi()->NotifyObservers(); 1997 ui::NativeTheme::GetInstanceForNativeUi()->NotifyObservers();
1988 } 1998 }
1989 1999
1990 views::View::OnThemeChanged(); 2000 views::View::OnThemeChanged();
1991 } 2001 }
1992 2002
1993 void BrowserView::OnNativeThemeChanged(const ui::NativeTheme* theme) {
1994 // Do not handle native theme changes before the browser view is initialized.
1995 if (!initialized_)
1996 return;
1997 ClientView::OnNativeThemeChanged(theme);
1998 // Don't infinitely recurse.
1999 if (!handling_theme_changed_)
2000 UserChangedTheme();
2001 chrome::MaybeShowInvertBubbleView(this);
2002 }
2003
2004 /////////////////////////////////////////////////////////////////////////////// 2003 ///////////////////////////////////////////////////////////////////////////////
2005 // BrowserView, ui::AcceleratorTarget overrides: 2004 // BrowserView, ui::AcceleratorTarget overrides:
2006 2005
2007 bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) { 2006 bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) {
2008 std::map<ui::Accelerator, int>::const_iterator iter = 2007 std::map<ui::Accelerator, int>::const_iterator iter =
2009 accelerator_table_.find(accelerator); 2008 accelerator_table_.find(accelerator);
2010 DCHECK(iter != accelerator_table_.end()); 2009 DCHECK(iter != accelerator_table_.end());
2011 int command_id = iter->second; 2010 int command_id = iter->second;
2012 2011
2013 if (accelerator.IsRepeat() && !IsCommandRepeatable(command_id)) 2012 if (accelerator.IsRepeat() && !IsCommandRepeatable(command_id))
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
2667 } 2666 }
2668 2667
2669 extensions::ActiveTabPermissionGranter* 2668 extensions::ActiveTabPermissionGranter*
2670 BrowserView::GetActiveTabPermissionGranter() { 2669 BrowserView::GetActiveTabPermissionGranter() {
2671 content::WebContents* web_contents = GetActiveWebContents(); 2670 content::WebContents* web_contents = GetActiveWebContents();
2672 if (!web_contents) 2671 if (!web_contents)
2673 return nullptr; 2672 return nullptr;
2674 return extensions::TabHelper::FromWebContents(web_contents) 2673 return extensions::TabHelper::FromWebContents(web_contents)
2675 ->active_tab_permission_granter(); 2674 ->active_tab_permission_granter();
2676 } 2675 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698