| OLD | NEW |
| 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 Loading... |
| 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) { |
| 1660 // We don't handle theme updates in OnThemeChanged() as that function is |
| 1661 // called while views are being iterated over. Please see |
| 1662 // View::PropagateNativeThemeChanged() for details. The theme update |
| 1663 // handling in UserChangedTheme() can cause views to be nuked or created |
| 1664 // which is a bad thing during iteration. |
| 1665 |
| 1666 // Do not handle native theme changes before the browser view is initialized. |
| 1667 if (!initialized_) |
| 1668 return; |
| 1669 // Don't infinitely recurse. |
| 1670 if (!handling_theme_changed_) |
| 1671 UserChangedTheme(); |
| 1672 chrome::MaybeShowInvertBubbleView(this); |
| 1673 } |
| 1674 |
| 1659 views::View* BrowserView::GetInitiallyFocusedView() { | 1675 views::View* BrowserView::GetInitiallyFocusedView() { |
| 1660 return nullptr; | 1676 return nullptr; |
| 1661 } | 1677 } |
| 1662 | 1678 |
| 1663 bool BrowserView::ShouldShowWindowTitle() const { | 1679 bool BrowserView::ShouldShowWindowTitle() const { |
| 1664 #if defined(OS_CHROMEOS) | 1680 #if defined(OS_CHROMEOS) |
| 1665 // For Chrome OS only, trusted windows (apps and settings) do not show a | 1681 // 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. | 1682 // title, crbug.com/119411. Child windows (i.e. popups) do show a title. |
| 1667 if (browser_->is_trusted_source()) | 1683 if (browser_->is_trusted_source()) |
| 1668 return false; | 1684 return false; |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1983 base::AutoReset<bool> reset(&handling_theme_changed_, true); | 1999 base::AutoReset<bool> reset(&handling_theme_changed_, true); |
| 1984 #if defined(USE_AURA) | 2000 #if defined(USE_AURA) |
| 1985 ui::NativeThemeDarkAura::instance()->NotifyObservers(); | 2001 ui::NativeThemeDarkAura::instance()->NotifyObservers(); |
| 1986 #endif | 2002 #endif |
| 1987 ui::NativeTheme::GetInstanceForNativeUi()->NotifyObservers(); | 2003 ui::NativeTheme::GetInstanceForNativeUi()->NotifyObservers(); |
| 1988 } | 2004 } |
| 1989 | 2005 |
| 1990 views::View::OnThemeChanged(); | 2006 views::View::OnThemeChanged(); |
| 1991 } | 2007 } |
| 1992 | 2008 |
| 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 /////////////////////////////////////////////////////////////////////////////// | 2009 /////////////////////////////////////////////////////////////////////////////// |
| 2005 // BrowserView, ui::AcceleratorTarget overrides: | 2010 // BrowserView, ui::AcceleratorTarget overrides: |
| 2006 | 2011 |
| 2007 bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 2012 bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| 2008 std::map<ui::Accelerator, int>::const_iterator iter = | 2013 std::map<ui::Accelerator, int>::const_iterator iter = |
| 2009 accelerator_table_.find(accelerator); | 2014 accelerator_table_.find(accelerator); |
| 2010 DCHECK(iter != accelerator_table_.end()); | 2015 DCHECK(iter != accelerator_table_.end()); |
| 2011 int command_id = iter->second; | 2016 int command_id = iter->second; |
| 2012 | 2017 |
| 2013 if (accelerator.IsRepeat() && !IsCommandRepeatable(command_id)) | 2018 if (accelerator.IsRepeat() && !IsCommandRepeatable(command_id)) |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2667 } | 2672 } |
| 2668 | 2673 |
| 2669 extensions::ActiveTabPermissionGranter* | 2674 extensions::ActiveTabPermissionGranter* |
| 2670 BrowserView::GetActiveTabPermissionGranter() { | 2675 BrowserView::GetActiveTabPermissionGranter() { |
| 2671 content::WebContents* web_contents = GetActiveWebContents(); | 2676 content::WebContents* web_contents = GetActiveWebContents(); |
| 2672 if (!web_contents) | 2677 if (!web_contents) |
| 2673 return nullptr; | 2678 return nullptr; |
| 2674 return extensions::TabHelper::FromWebContents(web_contents) | 2679 return extensions::TabHelper::FromWebContents(web_contents) |
| 2675 ->active_tab_permission_granter(); | 2680 ->active_tab_permission_granter(); |
| 2676 } | 2681 } |
| OLD | NEW |