OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_frame.h" | 5 #include "chrome/browser/ui/views/frame/browser_frame.h" |
6 | 6 |
7 #include "base/debug/leak_annotations.h" | 7 #include "base/debug/leak_annotations.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "chrome/browser/app_mode/app_mode_utils.h" | 9 #include "chrome/browser/app_mode/app_mode_utils.h" |
10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 #include "ui/base/theme_provider.h" | 24 #include "ui/base/theme_provider.h" |
25 #include "ui/events/event_handler.h" | 25 #include "ui/events/event_handler.h" |
26 #include "ui/gfx/font_list.h" | 26 #include "ui/gfx/font_list.h" |
27 #include "ui/gfx/screen.h" | 27 #include "ui/gfx/screen.h" |
28 #include "ui/views/controls/menu/menu_runner.h" | 28 #include "ui/views/controls/menu/menu_runner.h" |
29 #include "ui/views/widget/native_widget.h" | 29 #include "ui/views/widget/native_widget.h" |
30 | 30 |
31 #if defined(OS_CHROMEOS) | 31 #if defined(OS_CHROMEOS) |
32 #include "ash/session/session_state_delegate.h" | 32 #include "ash/session/session_state_delegate.h" |
33 #include "ash/shell.h" | 33 #include "ash/shell.h" |
34 #include "ui/native_theme/native_theme_dark_aura.h" | |
34 #endif | 35 #endif |
35 | 36 |
36 #if defined(OS_LINUX) | 37 #if defined(OS_LINUX) |
37 #include "chrome/browser/ui/views/frame/browser_command_handler_linux.h" | 38 #include "chrome/browser/ui/views/frame/browser_command_handler_linux.h" |
38 #endif | 39 #endif |
39 | 40 |
41 #if defined(OS_WIN) | |
42 #include "ui/native_theme/native_theme_dark_win.h" | |
43 #endif | |
44 | |
40 //////////////////////////////////////////////////////////////////////////////// | 45 //////////////////////////////////////////////////////////////////////////////// |
41 // BrowserFrame, public: | 46 // BrowserFrame, public: |
42 | 47 |
43 BrowserFrame::BrowserFrame(BrowserView* browser_view) | 48 BrowserFrame::BrowserFrame(BrowserView* browser_view) |
44 : native_browser_frame_(nullptr), | 49 : native_browser_frame_(nullptr), |
45 root_view_(nullptr), | 50 root_view_(nullptr), |
46 browser_frame_view_(nullptr), | 51 browser_frame_view_(nullptr), |
47 browser_view_(browser_view), | 52 browser_view_(browser_view), |
48 theme_provider_(ThemeServiceFactory::GetForProfile( | 53 theme_provider_(ThemeServiceFactory::GetForProfile( |
49 browser_view_->browser()->profile())) { | 54 browser_view_->browser()->profile())) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 | 160 |
156 bool BrowserFrame::GetAccelerator(int command_id, | 161 bool BrowserFrame::GetAccelerator(int command_id, |
157 ui::Accelerator* accelerator) const { | 162 ui::Accelerator* accelerator) const { |
158 return browser_view_->GetAccelerator(command_id, accelerator); | 163 return browser_view_->GetAccelerator(command_id, accelerator); |
159 } | 164 } |
160 | 165 |
161 ui::ThemeProvider* BrowserFrame::GetThemeProvider() const { | 166 ui::ThemeProvider* BrowserFrame::GetThemeProvider() const { |
162 return theme_provider_; | 167 return theme_provider_; |
163 } | 168 } |
164 | 169 |
170 const ui::NativeTheme* BrowserFrame::GetNativeTheme() const { | |
sky
2015/11/16 16:10:17
You sure you don't want to specify the NativeTheme
Evan Stade
2015/11/16 17:52:25
Isn't it the same amount of subclassing? These two
| |
171 if (browser_view_->browser()->profile()->IsOffTheRecord()) { | |
172 #if defined(OS_WIN) | |
173 return ui::NativeThemeDarkWin::instance(); | |
174 #elif defined(OS_CHROMEOS) | |
175 return ui::NativeThemeDarkAura::instance(); | |
176 #endif | |
177 } | |
178 return views::Widget::GetNativeTheme(); | |
179 } | |
180 | |
165 void BrowserFrame::SchedulePaintInRect(const gfx::Rect& rect) { | 181 void BrowserFrame::SchedulePaintInRect(const gfx::Rect& rect) { |
166 views::Widget::SchedulePaintInRect(rect); | 182 views::Widget::SchedulePaintInRect(rect); |
167 | 183 |
168 // Paint the frame caption area and window controls during immersive reveal. | 184 // Paint the frame caption area and window controls during immersive reveal. |
169 if (browser_view_ && | 185 if (browser_view_ && |
170 browser_view_->immersive_mode_controller()->IsRevealed()) { | 186 browser_view_->immersive_mode_controller()->IsRevealed()) { |
171 // This function should not be reentrant because the TopContainerView | 187 // This function should not be reentrant because the TopContainerView |
172 // paints to a layer for the duration of the immersive reveal. | 188 // paints to a layer for the duration of the immersive reveal. |
173 views::View* top_container = browser_view_->top_container(); | 189 views::View* top_container = browser_view_->top_container(); |
174 CHECK(top_container->layer()); | 190 CHECK(top_container->layer()); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 | 255 |
240 AvatarMenuButton* BrowserFrame::GetAvatarMenuButton() { | 256 AvatarMenuButton* BrowserFrame::GetAvatarMenuButton() { |
241 return browser_frame_view_->avatar_button(); | 257 return browser_frame_view_->avatar_button(); |
242 } | 258 } |
243 | 259 |
244 #if defined(FRAME_AVATAR_BUTTON) | 260 #if defined(FRAME_AVATAR_BUTTON) |
245 NewAvatarButton* BrowserFrame::GetNewAvatarMenuButton() { | 261 NewAvatarButton* BrowserFrame::GetNewAvatarMenuButton() { |
246 return browser_frame_view_->new_avatar_button(); | 262 return browser_frame_view_->new_avatar_button(); |
247 } | 263 } |
248 #endif | 264 #endif |
OLD | NEW |