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" | |
24 #include "chrome/browser/ui/views/frame/browser_view.h" | 23 #include "chrome/browser/ui/views/frame/browser_view.h" |
25 #include "chrome/browser/ui/views/frame/system_menu_insertion_delegate_win.h" | 24 #include "chrome/browser/ui/views/frame/system_menu_insertion_delegate_win.h" |
26 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 25 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
27 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
28 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
29 #include "content/public/browser/browser_accessibility_state.h" | 28 #include "content/public/browser/browser_accessibility_state.h" |
30 #include "content/public/browser/page_navigator.h" | 29 #include "content/public/browser/page_navigator.h" |
31 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
32 #include "content/public/common/page_transition_types.h" | 31 #include "content/public/common/page_transition_types.h" |
33 #include "googleurl/src/gurl.h" | 32 #include "googleurl/src/gurl.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 break; | 269 break; |
271 } | 270 } |
272 } | 271 } |
273 | 272 |
274 void BrowserFrameWin::OnScreenReaderDetected() { | 273 void BrowserFrameWin::OnScreenReaderDetected() { |
275 content::BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); | 274 content::BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); |
276 NativeWidgetWin::OnScreenReaderDetected(); | 275 NativeWidgetWin::OnScreenReaderDetected(); |
277 } | 276 } |
278 | 277 |
279 bool BrowserFrameWin::ShouldUseNativeFrame() const { | 278 bool BrowserFrameWin::ShouldUseNativeFrame() const { |
280 return chrome::ShouldUseNativeFrame(this, | 279 // App panel windows draw their own frame. |
281 browser_view_, | 280 if (browser_view_->IsPanel()) |
282 GetWidget()->GetThemeProvider()); | 281 return false; |
| 282 |
| 283 // We don't theme popup or app windows, so regardless of whether or not a |
| 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(); |
283 } | 294 } |
284 | 295 |
285 void BrowserFrameWin::Show() { | 296 void BrowserFrameWin::Show() { |
286 AdjustFrameForImmersiveMode(); | 297 AdjustFrameForImmersiveMode(); |
287 views::NativeWidgetWin::Show(); | 298 views::NativeWidgetWin::Show(); |
288 } | 299 } |
289 | 300 |
290 void BrowserFrameWin::ShowMaximizedWithBounds( | 301 void BrowserFrameWin::ShowMaximizedWithBounds( |
291 const gfx::Rect& restored_bounds) { | 302 const gfx::Rect& restored_bounds) { |
292 AdjustFrameForImmersiveMode(); | 303 AdjustFrameForImmersiveMode(); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 | 551 |
541 //////////////////////////////////////////////////////////////////////////////// | 552 //////////////////////////////////////////////////////////////////////////////// |
542 // NativeBrowserFrame, public: | 553 // NativeBrowserFrame, public: |
543 | 554 |
544 // static | 555 // static |
545 NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame( | 556 NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame( |
546 BrowserFrame* browser_frame, | 557 BrowserFrame* browser_frame, |
547 BrowserView* browser_view) { | 558 BrowserView* browser_view) { |
548 return new BrowserFrameWin(browser_frame, browser_view); | 559 return new BrowserFrameWin(browser_frame, browser_view); |
549 } | 560 } |
OLD | NEW |