| 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 "ui/views/widget/native_widget_win.h" | 5 #include "ui/views/widget/native_widget_win.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 if (*it == view) | 140 if (*it == view) |
| 141 *it = NULL; | 141 *it = NULL; |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 //////////////////////////////////////////////////////////////////////////////// | 145 //////////////////////////////////////////////////////////////////////////////// |
| 146 // NativeWidgetWin, NativeWidget implementation: | 146 // NativeWidgetWin, NativeWidget implementation: |
| 147 | 147 |
| 148 void NativeWidgetWin::InitNativeWidget(const Widget::InitParams& params) { | 148 void NativeWidgetWin::InitNativeWidget(const Widget::InitParams& params) { |
| 149 SetInitParams(params); | 149 SetInitParams(params); |
| 150 | 150 message_handler_->Init(params.GetParent(), params.bounds); |
| 151 message_handler_->Init(params.bounds); | |
| 152 | |
| 153 // Create the window. | |
| 154 WindowImpl::Init(params.GetParent(), params.bounds); | |
| 155 } | 151 } |
| 156 | 152 |
| 157 NonClientFrameView* NativeWidgetWin::CreateNonClientFrameView() { | 153 NonClientFrameView* NativeWidgetWin::CreateNonClientFrameView() { |
| 158 return GetWidget()->ShouldUseNativeFrame() ? | 154 return GetWidget()->ShouldUseNativeFrame() ? |
| 159 new NativeFrameView(GetWidget()) : NULL; | 155 new NativeFrameView(GetWidget()) : NULL; |
| 160 } | 156 } |
| 161 | 157 |
| 162 void NativeWidgetWin::UpdateFrameAfterFrameChange() { | 158 void NativeWidgetWin::UpdateFrameAfterFrameChange() { |
| 163 // We've either gained or lost a custom window region, so reset it now. | 159 // We've either gained or lost a custom window region, so reset it now. |
| 164 message_handler_->ResetWindowRegion(true); | 160 message_handler_->ResetWindowRegion(true); |
| 165 } | 161 } |
| 166 | 162 |
| 167 bool NativeWidgetWin::ShouldUseNativeFrame() const { | 163 bool NativeWidgetWin::ShouldUseNativeFrame() const { |
| 168 return ui::win::IsAeroGlassEnabled(); | 164 return ui::win::IsAeroGlassEnabled(); |
| 169 } | 165 } |
| 170 | 166 |
| 171 void NativeWidgetWin::FrameTypeChanged() { | 167 void NativeWidgetWin::FrameTypeChanged() { |
| 172 message_handler_->FrameTypeChanged(); | 168 message_handler_->FrameTypeChanged(); |
| 173 } | 169 } |
| 174 | 170 |
| 175 Widget* NativeWidgetWin::GetWidget() { | 171 Widget* NativeWidgetWin::GetWidget() { |
| 176 return delegate_->AsWidget(); | 172 return delegate_->AsWidget(); |
| 177 } | 173 } |
| 178 | 174 |
| 179 const Widget* NativeWidgetWin::GetWidget() const { | 175 const Widget* NativeWidgetWin::GetWidget() const { |
| 180 return delegate_->AsWidget(); | 176 return delegate_->AsWidget(); |
| 181 } | 177 } |
| 182 | 178 |
| 183 gfx::NativeView NativeWidgetWin::GetNativeView() const { | 179 gfx::NativeView NativeWidgetWin::GetNativeView() const { |
| 184 return WindowImpl::hwnd(); | 180 return message_handler_->hwnd(); |
| 185 } | 181 } |
| 186 | 182 |
| 187 gfx::NativeWindow NativeWidgetWin::GetNativeWindow() const { | 183 gfx::NativeWindow NativeWidgetWin::GetNativeWindow() const { |
| 188 return WindowImpl::hwnd(); | 184 return message_handler_->hwnd(); |
| 189 } | 185 } |
| 190 | 186 |
| 191 Widget* NativeWidgetWin::GetTopLevelWidget() { | 187 Widget* NativeWidgetWin::GetTopLevelWidget() { |
| 192 NativeWidgetPrivate* native_widget = GetTopLevelNativeWidget(GetNativeView()); | 188 NativeWidgetPrivate* native_widget = GetTopLevelNativeWidget(GetNativeView()); |
| 193 return native_widget ? native_widget->GetWidget() : NULL; | 189 return native_widget ? native_widget->GetWidget() : NULL; |
| 194 } | 190 } |
| 195 | 191 |
| 196 const ui::Compositor* NativeWidgetWin::GetCompositor() const { | 192 const ui::Compositor* NativeWidgetWin::GetCompositor() const { |
| 197 return NULL; | 193 return NULL; |
| 198 } | 194 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 216 void NativeWidgetWin::SetNativeWindowProperty(const char* name, void* value) { | 212 void NativeWidgetWin::SetNativeWindowProperty(const char* name, void* value) { |
| 217 // Remove the existing property (if any). | 213 // Remove the existing property (if any). |
| 218 for (ViewProps::iterator i = props_.begin(); i != props_.end(); ++i) { | 214 for (ViewProps::iterator i = props_.begin(); i != props_.end(); ++i) { |
| 219 if ((*i)->Key() == name) { | 215 if ((*i)->Key() == name) { |
| 220 props_.erase(i); | 216 props_.erase(i); |
| 221 break; | 217 break; |
| 222 } | 218 } |
| 223 } | 219 } |
| 224 | 220 |
| 225 if (value) | 221 if (value) |
| 226 props_.push_back(new ViewProp(hwnd(), name, value)); | 222 props_.push_back(new ViewProp(GetNativeView(), name, value)); |
| 227 } | 223 } |
| 228 | 224 |
| 229 void* NativeWidgetWin::GetNativeWindowProperty(const char* name) const { | 225 void* NativeWidgetWin::GetNativeWindowProperty(const char* name) const { |
| 230 return ViewProp::GetValue(hwnd(), name); | 226 return ViewProp::GetValue(GetNativeView(), name); |
| 231 } | 227 } |
| 232 | 228 |
| 233 TooltipManager* NativeWidgetWin::GetTooltipManager() const { | 229 TooltipManager* NativeWidgetWin::GetTooltipManager() const { |
| 234 return tooltip_manager_.get(); | 230 return tooltip_manager_.get(); |
| 235 } | 231 } |
| 236 | 232 |
| 237 bool NativeWidgetWin::IsScreenReaderActive() const { | 233 bool NativeWidgetWin::IsScreenReaderActive() const { |
| 238 return screen_reader_active_; | 234 return screen_reader_active_; |
| 239 } | 235 } |
| 240 | 236 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 | 489 |
| 494 void NativeWidgetWin::EndMoveLoop() { | 490 void NativeWidgetWin::EndMoveLoop() { |
| 495 message_handler_->EndMoveLoop(); | 491 message_handler_->EndMoveLoop(); |
| 496 } | 492 } |
| 497 | 493 |
| 498 void NativeWidgetWin::SetVisibilityChangedAnimationsEnabled(bool value) { | 494 void NativeWidgetWin::SetVisibilityChangedAnimationsEnabled(bool value) { |
| 499 message_handler_->SetVisibilityChangedAnimationsEnabled(value); | 495 message_handler_->SetVisibilityChangedAnimationsEnabled(value); |
| 500 } | 496 } |
| 501 | 497 |
| 502 //////////////////////////////////////////////////////////////////////////////// | 498 //////////////////////////////////////////////////////////////////////////////// |
| 503 // NativeWidgetWin, WindowImpl overrides: | |
| 504 | |
| 505 HICON NativeWidgetWin::GetDefaultWindowIcon() const { | |
| 506 return message_handler_->GetDefaultWindowIcon(); | |
| 507 } | |
| 508 | |
| 509 LRESULT NativeWidgetWin::OnWndProc(UINT message, | |
| 510 WPARAM w_param, | |
| 511 LPARAM l_param) { | |
| 512 return message_handler_->OnWndProc(message, w_param, l_param); | |
| 513 } | |
| 514 | |
| 515 //////////////////////////////////////////////////////////////////////////////// | |
| 516 // NativeWidgetWin, protected: | 499 // NativeWidgetWin, protected: |
| 517 | 500 |
| 518 // Message handlers ------------------------------------------------------------ | |
| 519 | |
| 520 void NativeWidgetWin::OnActivate(UINT action, BOOL minimized, HWND window) { | |
| 521 message_handler_->OnActivate(action, minimized, window); | |
| 522 } | |
| 523 | |
| 524 void NativeWidgetWin::OnActivateApp(BOOL active, DWORD thread_id) { | |
| 525 message_handler_->OnActivateApp(active, thread_id); | |
| 526 } | |
| 527 | |
| 528 LRESULT NativeWidgetWin::OnAppCommand(HWND window, | |
| 529 short app_command, | |
| 530 WORD device, | |
| 531 int keystate) { | |
| 532 return message_handler_->OnAppCommand(window, app_command, device, keystate); | |
| 533 } | |
| 534 | |
| 535 void NativeWidgetWin::OnCancelMode() { | |
| 536 message_handler_->OnCancelMode(); | |
| 537 } | |
| 538 | |
| 539 void NativeWidgetWin::OnCaptureChanged(HWND hwnd) { | |
| 540 message_handler_->OnCaptureChanged(hwnd); | |
| 541 } | |
| 542 | |
| 543 void NativeWidgetWin::OnClose() { | |
| 544 message_handler_->OnClose(); | |
| 545 } | |
| 546 | |
| 547 void NativeWidgetWin::OnCommand(UINT notification_code, | |
| 548 int command_id, | |
| 549 HWND window) { | |
| 550 message_handler_->OnCommand(notification_code, command_id, window); | |
| 551 } | |
| 552 | |
| 553 LRESULT NativeWidgetWin::OnCreate(CREATESTRUCT* create_struct) { | |
| 554 return message_handler_->OnCreate(create_struct); | |
| 555 } | |
| 556 | |
| 557 void NativeWidgetWin::OnDestroy() { | |
| 558 message_handler_->OnDestroy(); | |
| 559 } | |
| 560 | |
| 561 void NativeWidgetWin::OnDisplayChange(UINT bits_per_pixel, CSize screen_size) { | |
| 562 message_handler_->OnDisplayChange(bits_per_pixel, screen_size); | |
| 563 } | |
| 564 | |
| 565 LRESULT NativeWidgetWin::OnDwmCompositionChanged(UINT msg, | |
| 566 WPARAM w_param, | |
| 567 LPARAM l_param) { | |
| 568 return message_handler_->OnDwmCompositionChanged(msg, w_param, l_param); | |
| 569 } | |
| 570 | |
| 571 void NativeWidgetWin::OnEndSession(BOOL ending, UINT logoff) { | |
| 572 message_handler_->OnEndSession(ending, logoff); | |
| 573 } | |
| 574 | |
| 575 void NativeWidgetWin::OnEnterSizeMove() { | |
| 576 message_handler_->OnEnterSizeMove(); | |
| 577 } | |
| 578 | |
| 579 LRESULT NativeWidgetWin::OnEraseBkgnd(HDC dc) { | |
| 580 return message_handler_->OnEraseBkgnd(dc); | |
| 581 } | |
| 582 | |
| 583 void NativeWidgetWin::OnExitMenuLoop(BOOL is_track_popup_menu) { | |
| 584 message_handler_->OnExitMenuLoop(is_track_popup_menu); | |
| 585 } | |
| 586 | |
| 587 void NativeWidgetWin::OnExitSizeMove() { | |
| 588 message_handler_->OnExitSizeMove(); | |
| 589 } | |
| 590 | |
| 591 LRESULT NativeWidgetWin::OnGetObject(UINT message, | |
| 592 WPARAM w_param, | |
| 593 LPARAM l_param) { | |
| 594 return message_handler_->OnGetObject(message, w_param, l_param); | |
| 595 } | |
| 596 | |
| 597 void NativeWidgetWin::OnGetMinMaxInfo(MINMAXINFO* minmax_info) { | |
| 598 message_handler_->OnGetMinMaxInfo(minmax_info); | |
| 599 } | |
| 600 | |
| 601 void NativeWidgetWin::OnHScroll(int scroll_type, | |
| 602 short position, | |
| 603 HWND scrollbar) { | |
| 604 message_handler_->OnHScroll(scroll_type, position, scrollbar); | |
| 605 } | |
| 606 | |
| 607 LRESULT NativeWidgetWin::OnImeMessages(UINT message, | |
| 608 WPARAM w_param, | |
| 609 LPARAM l_param) { | |
| 610 return message_handler_->OnImeMessages(message, w_param, l_param); | |
| 611 } | |
| 612 | |
| 613 void NativeWidgetWin::OnInitMenu(HMENU menu) { | |
| 614 message_handler_->OnInitMenu(menu); | |
| 615 } | |
| 616 | |
| 617 void NativeWidgetWin::OnInitMenuPopup(HMENU menu, | |
| 618 UINT position, | |
| 619 BOOL is_system_menu) { | |
| 620 message_handler_->OnInitMenuPopup(); | |
| 621 } | |
| 622 | |
| 623 void NativeWidgetWin::OnInputLangChange(DWORD character_set, | |
| 624 HKL input_language_id) { | |
| 625 message_handler_->OnInputLangChange(character_set, input_language_id); | |
| 626 } | |
| 627 | |
| 628 LRESULT NativeWidgetWin::OnKeyEvent(UINT message, | |
| 629 WPARAM w_param, | |
| 630 LPARAM l_param) { | |
| 631 return message_handler_->OnKeyEvent(message, w_param, l_param); | |
| 632 } | |
| 633 | |
| 634 void NativeWidgetWin::OnKillFocus(HWND focused_window) { | |
| 635 message_handler_->OnKillFocus(focused_window); | |
| 636 } | |
| 637 | |
| 638 LRESULT NativeWidgetWin::OnMouseActivate(UINT message, | |
| 639 WPARAM w_param, | |
| 640 LPARAM l_param) { | |
| 641 return message_handler_->OnMouseActivate(message, w_param, l_param); | |
| 642 } | |
| 643 | |
| 644 LRESULT NativeWidgetWin::OnMouseRange(UINT message, | |
| 645 WPARAM w_param, | |
| 646 LPARAM l_param) { | |
| 647 return message_handler_->OnMouseRange(message, w_param, l_param); | |
| 648 } | |
| 649 | |
| 650 void NativeWidgetWin::OnMove(const CPoint& point) { | |
| 651 message_handler_->OnMove(point); | |
| 652 } | |
| 653 | |
| 654 void NativeWidgetWin::OnMoving(UINT param, const LPRECT new_bounds) { | |
| 655 message_handler_->OnMoving(param, new_bounds); | |
| 656 } | |
| 657 | |
| 658 LRESULT NativeWidgetWin::OnNCActivate(BOOL active) { | |
| 659 return message_handler_->OnNCActivate(active); | |
| 660 } | |
| 661 | |
| 662 LRESULT NativeWidgetWin::OnNCCalcSize(BOOL mode, LPARAM l_param) { | |
| 663 return message_handler_->OnNCCalcSize(mode, l_param); | |
| 664 } | |
| 665 | |
| 666 LRESULT NativeWidgetWin::OnNCHitTest(const CPoint& point) { | |
| 667 return message_handler_->OnNCHitTest(point); | |
| 668 } | |
| 669 | |
| 670 void NativeWidgetWin::OnNCPaint(HRGN rgn) { | |
| 671 message_handler_->OnNCPaint(rgn); | |
| 672 } | |
| 673 | |
| 674 LRESULT NativeWidgetWin::OnNCUAHDrawCaption(UINT msg, | |
| 675 WPARAM w_param, | |
| 676 LPARAM l_param) { | |
| 677 return message_handler_->OnNCUAHDrawCaption(msg, w_param, l_param); | |
| 678 } | |
| 679 | |
| 680 LRESULT NativeWidgetWin::OnNCUAHDrawFrame(UINT msg, | |
| 681 WPARAM w_param, | |
| 682 LPARAM l_param) { | |
| 683 return message_handler_->OnNCUAHDrawFrame(msg, w_param, l_param); | |
| 684 } | |
| 685 | |
| 686 LRESULT NativeWidgetWin::OnNotify(int w_param, NMHDR* l_param) { | |
| 687 return message_handler_->OnNotify(w_param, l_param); | |
| 688 } | |
| 689 | |
| 690 void NativeWidgetWin::OnPaint(HDC dc) { | |
| 691 message_handler_->OnPaint(dc); | |
| 692 } | |
| 693 | |
| 694 LRESULT NativeWidgetWin::OnPowerBroadcast(DWORD power_event, DWORD data) { | |
| 695 return message_handler_->OnPowerBroadcast(power_event, data); | |
| 696 } | |
| 697 | |
| 698 LRESULT NativeWidgetWin::OnReflectedMessage(UINT msg, | |
| 699 WPARAM w_param, | |
| 700 LPARAM l_param) { | |
| 701 return message_handler_->OnReflectedMessage(msg, w_param, l_param); | |
| 702 } | |
| 703 | |
| 704 LRESULT NativeWidgetWin::OnSetCursor(UINT message, | |
| 705 WPARAM w_param, | |
| 706 LPARAM l_param) { | |
| 707 return message_handler_->OnSetCursor(message, w_param, l_param); | |
| 708 } | |
| 709 | |
| 710 void NativeWidgetWin::OnSetFocus(HWND old_focused_window) { | |
| 711 message_handler_->OnSetFocus(old_focused_window); | |
| 712 } | |
| 713 | |
| 714 LRESULT NativeWidgetWin::OnSetIcon(UINT size_type, HICON new_icon) { | |
| 715 return message_handler_->OnSetIcon(size_type, new_icon); | |
| 716 } | |
| 717 | |
| 718 LRESULT NativeWidgetWin::OnSetText(const wchar_t* text) { | |
| 719 return message_handler_->OnSetText(text); | |
| 720 } | |
| 721 | |
| 722 void NativeWidgetWin::OnSettingChange(UINT flags, const wchar_t* section) { | |
| 723 message_handler_->OnSettingChange(flags, section); | |
| 724 } | |
| 725 | |
| 726 void NativeWidgetWin::OnSize(UINT param, const CSize& size) { | |
| 727 message_handler_->OnSize(param, size); | |
| 728 } | |
| 729 | |
| 730 void NativeWidgetWin::OnSysCommand(UINT notification_code, CPoint click) { | |
| 731 message_handler_->OnSysCommand(notification_code, click); | |
| 732 } | |
| 733 | |
| 734 void NativeWidgetWin::OnThemeChanged() { | |
| 735 message_handler_->OnThemeChanged(); | |
| 736 } | |
| 737 | |
| 738 LRESULT NativeWidgetWin::OnTouchEvent(UINT message, | |
| 739 WPARAM w_param, | |
| 740 LPARAM l_param) { | |
| 741 return message_handler_->OnTouchEvent(message, w_param, l_param); | |
| 742 } | |
| 743 | |
| 744 void NativeWidgetWin::OnVScroll(int scroll_type, | |
| 745 short position, | |
| 746 HWND scrollbar) { | |
| 747 message_handler_->OnVScroll(scroll_type, position, scrollbar); | |
| 748 } | |
| 749 | |
| 750 void NativeWidgetWin::OnWindowPosChanging(WINDOWPOS* window_pos) { | |
| 751 message_handler_->OnWindowPosChanging(window_pos); | |
| 752 } | |
| 753 | |
| 754 void NativeWidgetWin::OnWindowPosChanged(WINDOWPOS* window_pos) { | |
| 755 message_handler_->OnWindowPosChanged(window_pos); | |
| 756 } | |
| 757 | |
| 758 void NativeWidgetWin::OnFinalMessage(HWND window) { | 501 void NativeWidgetWin::OnFinalMessage(HWND window) { |
| 759 // We don't destroy props in WM_DESTROY as we may still get messages after | 502 // We don't destroy props in WM_DESTROY as we may still get messages after |
| 760 // WM_DESTROY that assume the properties are still valid (such as WM_CLOSE). | 503 // WM_DESTROY that assume the properties are still valid (such as WM_CLOSE). |
| 761 props_.clear(); | 504 props_.clear(); |
| 762 delegate_->OnNativeWidgetDestroyed(); | 505 delegate_->OnNativeWidgetDestroyed(); |
| 763 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) | 506 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) |
| 764 delete this; | 507 delete this; |
| 765 } | 508 } |
| 766 | 509 |
| 767 //////////////////////////////////////////////////////////////////////////////// | 510 //////////////////////////////////////////////////////////////////////////////// |
| 768 // NativeWidgetWin, protected: | 511 // NativeWidgetWin, protected: |
| 769 | 512 |
| 770 void NativeWidgetWin::OnScreenReaderDetected() { | 513 void NativeWidgetWin::OnScreenReaderDetected() { |
| 771 screen_reader_active_ = true; | 514 screen_reader_active_ = true; |
| 772 } | 515 } |
| 773 | 516 |
| 517 HWNDMessageHandler* NativeWidgetWin::GetMessageHandler() { |
| 518 return message_handler_.get(); |
| 519 } |
| 520 |
| 774 //////////////////////////////////////////////////////////////////////////////// | 521 //////////////////////////////////////////////////////////////////////////////// |
| 775 // NativeWidgetWin, HWNDMessageHandlerDelegate implementation: | 522 // NativeWidgetWin, HWNDMessageHandlerDelegate implementation: |
| 776 | 523 |
| 777 bool NativeWidgetWin::IsWidgetWindow() const { | 524 bool NativeWidgetWin::IsWidgetWindow() const { |
| 778 // We don't NULL check GetWidget()->non_client_view() here because this | 525 // We don't NULL check GetWidget()->non_client_view() here because this |
| 779 // function can be called before the widget is fully constructed. | 526 // function can be called before the widget is fully constructed. |
| 780 return has_non_client_view_; | 527 return has_non_client_view_; |
| 781 } | 528 } |
| 782 | 529 |
| 783 bool NativeWidgetWin::IsUsingCustomFrame() const { | 530 bool NativeWidgetWin::IsUsingCustomFrame() const { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 } | 672 } |
| 926 | 673 |
| 927 void NativeWidgetWin::HandleAccelerator(const ui::Accelerator& accelerator) { | 674 void NativeWidgetWin::HandleAccelerator(const ui::Accelerator& accelerator) { |
| 928 GetWidget()->GetFocusManager()->ProcessAccelerator(accelerator); | 675 GetWidget()->GetFocusManager()->ProcessAccelerator(accelerator); |
| 929 } | 676 } |
| 930 | 677 |
| 931 void NativeWidgetWin::HandleCreate() { | 678 void NativeWidgetWin::HandleCreate() { |
| 932 // TODO(beng): much of this could/should maybe move to HWNDMessageHandler. | 679 // TODO(beng): much of this could/should maybe move to HWNDMessageHandler. |
| 933 | 680 |
| 934 SetNativeWindowProperty(kNativeWidgetKey, this); | 681 SetNativeWindowProperty(kNativeWidgetKey, this); |
| 935 CHECK_EQ(this, GetNativeWidgetForNativeView(hwnd())); | 682 CHECK_EQ(this, GetNativeWidgetForNativeView(GetNativeView())); |
| 936 | 683 |
| 937 props_.push_back(ui::SetWindowSupportsRerouteMouseWheel(hwnd())); | 684 props_.push_back(ui::SetWindowSupportsRerouteMouseWheel(GetNativeView())); |
| 938 | 685 |
| 939 drop_target_ = new DropTargetWin( | 686 drop_target_ = new DropTargetWin( |
| 940 static_cast<internal::RootView*>(GetWidget()->GetRootView())); | 687 static_cast<internal::RootView*>(GetWidget()->GetRootView())); |
| 941 | 688 |
| 942 // Windows special DWM window frame requires a special tooltip manager so | 689 // Windows special DWM window frame requires a special tooltip manager so |
| 943 // that window controls in Chrome windows don't flicker when you move your | 690 // that window controls in Chrome windows don't flicker when you move your |
| 944 // mouse over them. See comment in aero_tooltip_manager.h. | 691 // mouse over them. See comment in aero_tooltip_manager.h. |
| 945 Widget* widget = GetWidget()->GetTopLevelWidget(); | 692 Widget* widget = GetWidget()->GetTopLevelWidget(); |
| 946 if (widget && widget->ShouldUseNativeFrame()) { | 693 if (widget && widget->ShouldUseNativeFrame()) { |
| 947 tooltip_manager_.reset(new AeroTooltipManager(GetWidget())); | 694 tooltip_manager_.reset(new AeroTooltipManager(GetWidget())); |
| 948 } else { | 695 } else { |
| 949 tooltip_manager_.reset(new TooltipManagerWin(GetWidget())); | 696 tooltip_manager_.reset(new TooltipManagerWin(GetWidget())); |
| 950 } | 697 } |
| 951 if (!tooltip_manager_->Init()) { | 698 if (!tooltip_manager_->Init()) { |
| 952 // There was a problem creating the TooltipManager. Common error is 127. | 699 // There was a problem creating the TooltipManager. Common error is 127. |
| 953 // See 82193 for details. | 700 // See 82193 for details. |
| 954 LOG_GETLASTERROR(WARNING) << "tooltip creation failed, disabling tooltips"; | 701 LOG_GETLASTERROR(WARNING) << "tooltip creation failed, disabling tooltips"; |
| 955 tooltip_manager_.reset(); | 702 tooltip_manager_.reset(); |
| 956 } | 703 } |
| 957 | 704 |
| 958 delegate_->OnNativeWidgetCreated(); | 705 delegate_->OnNativeWidgetCreated(); |
| 959 } | 706 } |
| 960 | 707 |
| 961 void NativeWidgetWin::HandleDestroying() { | 708 void NativeWidgetWin::HandleDestroying() { |
| 962 delegate_->OnNativeWidgetDestroying(); | 709 delegate_->OnNativeWidgetDestroying(); |
| 963 if (drop_target_.get()) { | 710 if (drop_target_.get()) { |
| 964 RevokeDragDrop(hwnd()); | 711 RevokeDragDrop(GetNativeView()); |
| 965 drop_target_ = NULL; | 712 drop_target_ = NULL; |
| 966 } | 713 } |
| 967 } | 714 } |
| 968 | 715 |
| 969 void NativeWidgetWin::HandleDestroyed() { | 716 void NativeWidgetWin::HandleDestroyed() { |
| 970 OnFinalMessage(hwnd()); | 717 OnFinalMessage(GetNativeView()); |
| 971 } | 718 } |
| 972 | 719 |
| 973 bool NativeWidgetWin::HandleInitialFocus() { | 720 bool NativeWidgetWin::HandleInitialFocus() { |
| 974 return GetWidget()->SetInitialFocus(); | 721 return GetWidget()->SetInitialFocus(); |
| 975 } | 722 } |
| 976 | 723 |
| 977 void NativeWidgetWin::HandleDisplayChange() { | 724 void NativeWidgetWin::HandleDisplayChange() { |
| 978 GetWidget()->widget_delegate()->OnDisplayChanged(); | 725 GetWidget()->widget_delegate()->OnDisplayChanged(); |
| 979 } | 726 } |
| 980 | 727 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 LPARAM l_param, | 814 LPARAM l_param, |
| 1068 LRESULT* result) { | 815 LRESULT* result) { |
| 1069 return false; | 816 return false; |
| 1070 } | 817 } |
| 1071 | 818 |
| 1072 void NativeWidgetWin::PostHandleMSG(UINT message, | 819 void NativeWidgetWin::PostHandleMSG(UINT message, |
| 1073 WPARAM w_param, | 820 WPARAM w_param, |
| 1074 LPARAM l_param) { | 821 LPARAM l_param) { |
| 1075 } | 822 } |
| 1076 | 823 |
| 1077 NativeWidgetWin* NativeWidgetWin::AsNativeWidgetWin() { | |
| 1078 return this; | |
| 1079 } | |
| 1080 | |
| 1081 //////////////////////////////////////////////////////////////////////////////// | 824 //////////////////////////////////////////////////////////////////////////////// |
| 1082 // NativeWidgetWin, private: | 825 // NativeWidgetWin, private: |
| 1083 | 826 |
| 1084 void NativeWidgetWin::SetInitParams(const Widget::InitParams& params) { | 827 void NativeWidgetWin::SetInitParams(const Widget::InitParams& params) { |
| 1085 // Set non-style attributes. | 828 // Set non-style attributes. |
| 1086 ownership_ = params.ownership; | 829 ownership_ = params.ownership; |
| 1087 | 830 |
| 1088 DWORD style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS; | 831 DWORD style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS; |
| 1089 DWORD ex_style = 0; | 832 DWORD ex_style = 0; |
| 1090 DWORD class_style = CS_DBLCLKS; | 833 DWORD class_style = CS_DBLCLKS; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 style |= WS_POPUP; | 898 style |= WS_POPUP; |
| 1156 ex_style |= WS_EX_TOOLWINDOW; | 899 ex_style |= WS_EX_TOOLWINDOW; |
| 1157 break; | 900 break; |
| 1158 case Widget::InitParams::TYPE_MENU: | 901 case Widget::InitParams::TYPE_MENU: |
| 1159 style |= WS_POPUP; | 902 style |= WS_POPUP; |
| 1160 break; | 903 break; |
| 1161 default: | 904 default: |
| 1162 NOTREACHED(); | 905 NOTREACHED(); |
| 1163 } | 906 } |
| 1164 | 907 |
| 1165 set_initial_class_style(class_style); | 908 message_handler_->set_initial_class_style(class_style); |
| 1166 set_window_style(window_style() | style); | 909 message_handler_->set_window_style(message_handler_->window_style() | style); |
| 1167 set_window_ex_style(window_ex_style() | ex_style); | 910 message_handler_->set_window_ex_style( |
| 911 message_handler_->window_ex_style() | ex_style); |
| 1168 | 912 |
| 1169 has_non_client_view_ = Widget::RequiresNonClientView(params.type); | 913 has_non_client_view_ = Widget::RequiresNonClientView(params.type); |
| 1170 message_handler_->set_remove_standard_frame(params.remove_standard_frame); | 914 message_handler_->set_remove_standard_frame(params.remove_standard_frame); |
| 1171 } | 915 } |
| 1172 | 916 |
| 1173 //////////////////////////////////////////////////////////////////////////////// | 917 //////////////////////////////////////////////////////////////////////////////// |
| 1174 // Widget, public: | 918 // Widget, public: |
| 1175 | 919 |
| 1176 // static | 920 // static |
| 1177 void Widget::NotifyLocaleChanged() { | 921 void Widget::NotifyLocaleChanged() { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 // static | 1077 // static |
| 1334 bool NativeWidgetPrivate::IsTouchDown() { | 1078 bool NativeWidgetPrivate::IsTouchDown() { |
| 1335 // This currently isn't necessary because we're not generating touch events on | 1079 // This currently isn't necessary because we're not generating touch events on |
| 1336 // windows. When we do, this will need to be updated. | 1080 // windows. When we do, this will need to be updated. |
| 1337 return false; | 1081 return false; |
| 1338 } | 1082 } |
| 1339 | 1083 |
| 1340 } // namespace internal | 1084 } // namespace internal |
| 1341 | 1085 |
| 1342 } // namespace views | 1086 } // namespace views |
| OLD | NEW |