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_win.h" | 5 #include "chrome/browser/ui/views/frame/browser_frame_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "base/win/metro.h" | 13 #include "base/win/metro.h" |
14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
15 #include "chrome/browser/lifetime/application_lifetime.h" | 15 #include "chrome/browser/lifetime/application_lifetime.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/search_engines/template_url.h" | 17 #include "chrome/browser/search_engines/template_url.h" |
18 #include "chrome/browser/search_engines/template_url_service.h" | 18 #include "chrome/browser/search_engines/template_url_service.h" |
19 #include "chrome/browser/search_engines/template_url_service_factory.h" | 19 #include "chrome/browser/search_engines/template_url_service_factory.h" |
20 #include "chrome/browser/ui/browser_commands.h" | 20 #include "chrome/browser/ui/browser_commands.h" |
21 #include "chrome/browser/ui/browser_finder.h" | 21 #include "chrome/browser/ui/browser_finder.h" |
22 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 23 #include "chrome/browser/ui/views/frame/browser_frame_common_win.h" |
23 #include "chrome/browser/ui/views/frame/browser_view.h" | 24 #include "chrome/browser/ui/views/frame/browser_view.h" |
24 #include "chrome/browser/ui/views/frame/system_menu_insertion_delegate_win.h" | 25 #include "chrome/browser/ui/views/frame/system_menu_insertion_delegate_win.h" |
25 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 26 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
26 #include "chrome/common/chrome_constants.h" | 27 #include "chrome/common/chrome_constants.h" |
27 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
28 #include "content/public/browser/browser_accessibility_state.h" | 29 #include "content/public/browser/browser_accessibility_state.h" |
29 #include "content/public/browser/page_navigator.h" | 30 #include "content/public/browser/page_navigator.h" |
30 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
31 #include "content/public/common/page_transition_types.h" | 32 #include "content/public/common/page_transition_types.h" |
32 #include "googleurl/src/gurl.h" | 33 #include "googleurl/src/gurl.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 break; | 270 break; |
270 } | 271 } |
271 } | 272 } |
272 | 273 |
273 void BrowserFrameWin::OnScreenReaderDetected() { | 274 void BrowserFrameWin::OnScreenReaderDetected() { |
274 content::BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); | 275 content::BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); |
275 NativeWidgetWin::OnScreenReaderDetected(); | 276 NativeWidgetWin::OnScreenReaderDetected(); |
276 } | 277 } |
277 | 278 |
278 bool BrowserFrameWin::ShouldUseNativeFrame() const { | 279 bool BrowserFrameWin::ShouldUseNativeFrame() const { |
279 // App panel windows draw their own frame. | 280 if (!NativeWidgetWin::ShouldUseNativeFrame()) |
280 if (browser_view_->IsPanel()) | |
281 return false; | 281 return false; |
282 | 282 return chrome::ShouldUseNativeFrame(browser_view_, |
283 // We don't theme popup or app windows, so regardless of whether or not a | 283 GetWidget()->GetThemeProvider()); |
284 // theme is active for normal browser windows, we don't want to use the custom | |
285 // frame for popups/apps. | |
286 if (!browser_view_->IsBrowserTypeNormal() && | |
287 NativeWidgetWin::ShouldUseNativeFrame()) { | |
288 return true; | |
289 } | |
290 | |
291 // Otherwise, we use the native frame when we're told we should by the theme | |
292 // provider (e.g. no custom theme is active). | |
293 return GetWidget()->GetThemeProvider()->ShouldUseNativeFrame(); | |
294 } | 284 } |
295 | 285 |
296 void BrowserFrameWin::Show() { | 286 void BrowserFrameWin::Show() { |
297 AdjustFrameForImmersiveMode(); | 287 AdjustFrameForImmersiveMode(); |
298 views::NativeWidgetWin::Show(); | 288 views::NativeWidgetWin::Show(); |
299 } | 289 } |
300 | 290 |
301 void BrowserFrameWin::ShowMaximizedWithBounds( | 291 void BrowserFrameWin::ShowMaximizedWithBounds( |
302 const gfx::Rect& restored_bounds) { | 292 const gfx::Rect& restored_bounds) { |
303 AdjustFrameForImmersiveMode(); | 293 AdjustFrameForImmersiveMode(); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 | 541 |
552 //////////////////////////////////////////////////////////////////////////////// | 542 //////////////////////////////////////////////////////////////////////////////// |
553 // NativeBrowserFrame, public: | 543 // NativeBrowserFrame, public: |
554 | 544 |
555 // static | 545 // static |
556 NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame( | 546 NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame( |
557 BrowserFrame* browser_frame, | 547 BrowserFrame* browser_frame, |
558 BrowserView* browser_view) { | 548 BrowserView* browser_view) { |
559 return new BrowserFrameWin(browser_frame, browser_view); | 549 return new BrowserFrameWin(browser_frame, browser_view); |
560 } | 550 } |
OLD | NEW |