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

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

Issue 1637203002: [MD] Don't use new OTR native-theming when using a custom browser theme. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move lifetime comment Created 4 years, 11 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 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 #if defined(USE_AURA) 158 #if defined(USE_AURA)
159 #include "ui/aura/client/window_tree_client.h" 159 #include "ui/aura/client/window_tree_client.h"
160 #include "ui/aura/window.h" 160 #include "ui/aura/window.h"
161 #include "ui/aura/window_tree_host.h" 161 #include "ui/aura/window_tree_host.h"
162 #endif 162 #endif
163 163
164 #if defined(OS_WIN) 164 #if defined(OS_WIN)
165 #include "base/win/windows_version.h" 165 #include "base/win/windows_version.h"
166 #include "chrome/browser/jumplist_win.h" 166 #include "chrome/browser/jumplist_win.h"
167 #include "ui/gfx/color_palette.h" 167 #include "ui/gfx/color_palette.h"
168 #include "ui/native_theme/native_theme_dark_win.h"
168 #include "ui/views/win/scoped_fullscreen_visibility.h" 169 #include "ui/views/win/scoped_fullscreen_visibility.h"
169 #endif 170 #endif
170 171
171 #if defined(ENABLE_ONE_CLICK_SIGNIN) 172 #if defined(ENABLE_ONE_CLICK_SIGNIN)
172 #include "chrome/browser/ui/sync/one_click_signin_bubble_delegate.h" 173 #include "chrome/browser/ui/sync/one_click_signin_bubble_delegate.h"
173 #include "chrome/browser/ui/sync/one_click_signin_bubble_links_delegate.h" 174 #include "chrome/browser/ui/sync/one_click_signin_bubble_links_delegate.h"
174 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h" 175 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h"
175 #endif 176 #endif
176 177
177 #if defined(OS_CHROMEOS) 178 #if defined(OS_CHROMEOS)
178 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 179 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
179 #endif 180 #endif
180 181
181 #if defined(MOJO_SHELL_CLIENT) 182 #if defined(MOJO_SHELL_CLIENT)
182 #include "content/public/common/mojo_shell_connection.h" 183 #include "content/public/common/mojo_shell_connection.h"
183 #endif 184 #endif
184 185
186 #if defined(OS_LINUX)
187 #include "ui/native_theme/native_theme_dark_aura.h"
188 #endif
189
185 using base::TimeDelta; 190 using base::TimeDelta;
186 using base::UserMetricsAction; 191 using base::UserMetricsAction;
187 using content::NativeWebKeyboardEvent; 192 using content::NativeWebKeyboardEvent;
188 using content::WebContents; 193 using content::WebContents;
189 using views::ColumnSet; 194 using views::ColumnSet;
190 using views::GridLayout; 195 using views::GridLayout;
191 using web_modal::WebContentsModalDialogHost; 196 using web_modal::WebContentsModalDialogHost;
192 197
193 namespace { 198 namespace {
194 199
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 } 448 }
444 449
445 /////////////////////////////////////////////////////////////////////////////// 450 ///////////////////////////////////////////////////////////////////////////////
446 // BrowserView, public: 451 // BrowserView, public:
447 452
448 // static 453 // static
449 const char BrowserView::kViewClassName[] = "BrowserView"; 454 const char BrowserView::kViewClassName[] = "BrowserView";
450 455
451 BrowserView::BrowserView() 456 BrowserView::BrowserView()
452 : views::ClientView(nullptr, nullptr), 457 : views::ClientView(nullptr, nullptr),
453 last_focused_view_storage_id_(views::ViewStorage::GetInstance() 458 last_focused_view_storage_id_(
454 ->CreateStorageID()), 459 views::ViewStorage::GetInstance()->CreateStorageID()),
455 frame_(nullptr), 460 frame_(nullptr),
456 top_container_(nullptr), 461 top_container_(nullptr),
457 tabstrip_(nullptr), 462 tabstrip_(nullptr),
458 toolbar_(nullptr), 463 toolbar_(nullptr),
459 find_bar_host_view_(nullptr), 464 find_bar_host_view_(nullptr),
460 infobar_container_(nullptr), 465 infobar_container_(nullptr),
461 contents_web_view_(nullptr), 466 contents_web_view_(nullptr),
462 devtools_web_view_(nullptr), 467 devtools_web_view_(nullptr),
463 contents_container_(nullptr), 468 contents_container_(nullptr),
464 initialized_(false), 469 initialized_(false),
470 handling_theme_changed_(false),
465 in_process_fullscreen_(false), 471 in_process_fullscreen_(false),
466 #if defined(OS_WIN) 472 #if defined(OS_WIN)
467 ticker_(0), 473 ticker_(0),
468 hung_window_detector_(&hung_plugin_action_), 474 hung_window_detector_(&hung_plugin_action_),
469 #endif 475 #endif
470 force_location_bar_focus_(false), 476 force_location_bar_focus_(false),
471 activate_modal_dialog_factory_(this) { 477 activate_modal_dialog_factory_(this) {
472 } 478 }
473 479
474 BrowserView::~BrowserView() { 480 BrowserView::~BrowserView() {
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 } 2009 }
2004 2010
2005 void BrowserView::ChildPreferredSizeChanged(View* child) { 2011 void BrowserView::ChildPreferredSizeChanged(View* child) {
2006 Layout(); 2012 Layout();
2007 } 2013 }
2008 2014
2009 void BrowserView::GetAccessibleState(ui::AXViewState* state) { 2015 void BrowserView::GetAccessibleState(ui::AXViewState* state) {
2010 state->role = ui::AX_ROLE_CLIENT; 2016 state->role = ui::AX_ROLE_CLIENT;
2011 } 2017 }
2012 2018
2019 void BrowserView::OnThemeChanged() {
2020 if (!IsRegularOrGuestSession() &&
2021 ui::MaterialDesignController::IsModeMaterial()) {
2022 // When the theme changes, the native theme may also change (in OTR, the
2023 // usage of dark or normal hinges on the browser theme), so we have to
2024 // propagate both kinds of change.
2025 base::AutoReset<bool> reset(&handling_theme_changed_, true);
2026 #if defined(OS_WIN)
2027 ui::NativeThemeDarkWin::instance()->NotifyObservers();
2028 ui::NativeThemeWin::instance()->NotifyObservers();
2029 #elif defined(OS_LINUX)
2030 ui::NativeThemeDarkAura::instance()->NotifyObservers();
2031 ui::NativeThemeAura::instance()->NotifyObservers();
2032 #endif
2033 }
2034
2035 views::View::OnThemeChanged();
2036 }
2037
2013 void BrowserView::OnNativeThemeChanged(const ui::NativeTheme* theme) { 2038 void BrowserView::OnNativeThemeChanged(const ui::NativeTheme* theme) {
2014 // Do not handle native theme changes before the browser view is initialized. 2039 // Do not handle native theme changes before the browser view is initialized.
2015 if (!initialized_) 2040 if (!initialized_)
2016 return; 2041 return;
2017 ClientView::OnNativeThemeChanged(theme); 2042 ClientView::OnNativeThemeChanged(theme);
2018 UserChangedTheme(); 2043 // Don't infinitely recurse.
2044 if (!handling_theme_changed_)
2045 UserChangedTheme();
2019 chrome::MaybeShowInvertBubbleView(this); 2046 chrome::MaybeShowInvertBubbleView(this);
2020 } 2047 }
2021 2048
2022 /////////////////////////////////////////////////////////////////////////////// 2049 ///////////////////////////////////////////////////////////////////////////////
2023 // BrowserView, ui::AcceleratorTarget overrides: 2050 // BrowserView, ui::AcceleratorTarget overrides:
2024 2051
2025 bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) { 2052 bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) {
2026 std::map<ui::Accelerator, int>::const_iterator iter = 2053 std::map<ui::Accelerator, int>::const_iterator iter =
2027 accelerator_table_.find(accelerator); 2054 accelerator_table_.find(accelerator);
2028 DCHECK(iter != accelerator_table_.end()); 2055 DCHECK(iter != accelerator_table_.end());
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
2687 return immersive_mode_controller()->IsEnabled(); 2714 return immersive_mode_controller()->IsEnabled();
2688 } 2715 }
2689 2716
2690 views::Widget* BrowserView::GetBubbleAssociatedWidget() { 2717 views::Widget* BrowserView::GetBubbleAssociatedWidget() {
2691 return GetWidget(); 2718 return GetWidget();
2692 } 2719 }
2693 2720
2694 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { 2721 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() {
2695 return top_container_->GetBoundsInScreen(); 2722 return top_container_->GetBoundsInScreen();
2696 } 2723 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698