OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/window/window_win.h" | 5 #include "views/window/window_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include "app/theme_provider.h" | 10 #include "app/theme_provider.h" |
11 #include "app/win/hwnd_util.h" | |
12 #include "app/win/win_util.h" | 11 #include "app/win/win_util.h" |
13 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
14 #include "base/win/windows_version.h" | 13 #include "base/win/windows_version.h" |
15 #include "gfx/canvas_skia_paint.h" | 14 #include "gfx/canvas_skia_paint.h" |
16 #include "gfx/font.h" | 15 #include "gfx/font.h" |
17 #include "gfx/icon_util.h" | 16 #include "gfx/icon_util.h" |
18 #include "gfx/path.h" | 17 #include "gfx/path.h" |
19 #include "ui/base/keycodes/keyboard_code_conversion_win.h" | 18 #include "ui/base/keycodes/keyboard_code_conversion_win.h" |
| 19 #include "ui/base/win/hwnd_util.h" |
20 #include "views/accessibility/view_accessibility.h" | 20 #include "views/accessibility/view_accessibility.h" |
21 #include "views/widget/root_view.h" | 21 #include "views/widget/root_view.h" |
22 #include "views/window/client_view.h" | 22 #include "views/window/client_view.h" |
23 #include "views/window/custom_frame_view.h" | 23 #include "views/window/custom_frame_view.h" |
24 #include "views/window/native_frame_view.h" | 24 #include "views/window/native_frame_view.h" |
25 #include "views/window/non_client_view.h" | 25 #include "views/window/non_client_view.h" |
26 #include "views/window/window_delegate.h" | 26 #include "views/window/window_delegate.h" |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 return non_client_view_->client_view(); | 533 return non_client_view_->client_view(); |
534 } | 534 } |
535 | 535 |
536 gfx::NativeWindow WindowWin::GetNativeWindow() const { | 536 gfx::NativeWindow WindowWin::GetNativeWindow() const { |
537 return GetNativeView(); | 537 return GetNativeView(); |
538 } | 538 } |
539 | 539 |
540 bool WindowWin::ShouldUseNativeFrame() const { | 540 bool WindowWin::ShouldUseNativeFrame() const { |
541 ThemeProvider* tp = GetThemeProvider(); | 541 ThemeProvider* tp = GetThemeProvider(); |
542 if (!tp) | 542 if (!tp) |
543 return app::win::ShouldUseVistaFrame(); | 543 return ui::ShouldUseVistaFrame(); |
544 return tp->ShouldUseNativeFrame(); | 544 return tp->ShouldUseNativeFrame(); |
545 } | 545 } |
546 | 546 |
547 /////////////////////////////////////////////////////////////////////////////// | 547 /////////////////////////////////////////////////////////////////////////////// |
548 // WindowWin, protected: | 548 // WindowWin, protected: |
549 | 549 |
550 WindowWin::WindowWin(WindowDelegate* window_delegate) | 550 WindowWin::WindowWin(WindowDelegate* window_delegate) |
551 : WidgetWin(), | 551 : WidgetWin(), |
552 focus_on_creation_(true), | 552 focus_on_creation_(true), |
553 window_delegate_(window_delegate), | 553 window_delegate_(window_delegate), |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 is_modal_ = window_delegate_->IsModal(); | 588 is_modal_ = window_delegate_->IsModal(); |
589 if (is_modal_) | 589 if (is_modal_) |
590 BecomeModal(); | 590 BecomeModal(); |
591 | 591 |
592 if (window_style() == 0) | 592 if (window_style() == 0) |
593 set_window_style(CalculateWindowStyle()); | 593 set_window_style(CalculateWindowStyle()); |
594 if (window_ex_style() == 0) | 594 if (window_ex_style() == 0) |
595 set_window_ex_style(CalculateWindowExStyle()); | 595 set_window_ex_style(CalculateWindowExStyle()); |
596 | 596 |
597 WidgetWin::Init(parent, bounds); | 597 WidgetWin::Init(parent, bounds); |
598 app::win::SetWindowUserData(GetNativeView(), this); | 598 ui::SetWindowUserData(GetNativeView(), this); |
599 | 599 |
600 // Create the ClientView, add it to the NonClientView and add the | 600 // Create the ClientView, add it to the NonClientView and add the |
601 // NonClientView to the RootView. This will cause everything to be parented. | 601 // NonClientView to the RootView. This will cause everything to be parented. |
602 non_client_view_->set_client_view(window_delegate_->CreateClientView(this)); | 602 non_client_view_->set_client_view(window_delegate_->CreateClientView(this)); |
603 WidgetWin::SetContentsView(non_client_view_); | 603 WidgetWin::SetContentsView(non_client_view_); |
604 | 604 |
605 UpdateWindowTitle(); | 605 UpdateWindowTitle(); |
606 UpdateAccessibleRole(); | 606 UpdateAccessibleRole(); |
607 UpdateAccessibleState(); | 607 UpdateAccessibleState(); |
608 | 608 |
609 SetInitialBounds(bounds); | 609 SetInitialBounds(bounds); |
610 | 610 |
611 GetMonitorAndRects(bounds.ToRECT(), &last_monitor_, &last_monitor_rect_, | 611 GetMonitorAndRects(bounds.ToRECT(), &last_monitor_, &last_monitor_rect_, |
612 &last_work_area_); | 612 &last_work_area_); |
613 ResetWindowRegion(false); | 613 ResetWindowRegion(false); |
614 } | 614 } |
615 | 615 |
616 void WindowWin::SizeWindowToDefault() { | 616 void WindowWin::SizeWindowToDefault() { |
617 app::win::CenterAndSizeWindow(owning_window(), GetNativeView(), | 617 ui::CenterAndSizeWindow(owning_window(), GetNativeView(), |
618 non_client_view_->GetPreferredSize(), | 618 non_client_view_->GetPreferredSize(), |
619 false); | 619 false); |
620 } | 620 } |
621 | 621 |
622 gfx::Insets WindowWin::GetClientAreaInsets() const { | 622 gfx::Insets WindowWin::GetClientAreaInsets() const { |
623 // Returning an empty Insets object causes the default handling in | 623 // Returning an empty Insets object causes the default handling in |
624 // WidgetWin::OnNCCalcSize() to be invoked. | 624 // WidgetWin::OnNCCalcSize() to be invoked. |
625 if (GetNonClientView()->UseNativeFrame()) | 625 if (GetNonClientView()->UseNativeFrame()) |
626 return gfx::Insets(); | 626 return gfx::Insets(); |
627 | 627 |
628 if (IsMaximized()) { | 628 if (IsMaximized()) { |
629 // Windows automatically adds a standard width border to all sides when a | 629 // Windows automatically adds a standard width border to all sides when a |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1575 Window::CloseSecondaryWidget(root_view->GetWidget()); | 1575 Window::CloseSecondaryWidget(root_view->GetWidget()); |
1576 return TRUE; | 1576 return TRUE; |
1577 } | 1577 } |
1578 } // namespace | 1578 } // namespace |
1579 | 1579 |
1580 void Window::CloseAllSecondaryWindows() { | 1580 void Window::CloseAllSecondaryWindows() { |
1581 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, 0); | 1581 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, 0); |
1582 } | 1582 } |
1583 | 1583 |
1584 } // namespace views | 1584 } // namespace views |
OLD | NEW |