OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/constrained_window_win.h" | 5 #include "chrome/browser/ui/views/constrained_window_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "app/win/hwnd_util.h" | 10 #include "app/win/hwnd_util.h" |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
564 | 564 |
565 void ConstrainedWindowWin::FocusConstrainedWindow() { | 565 void ConstrainedWindowWin::FocusConstrainedWindow() { |
566 if ((!owner_->delegate() || | 566 if ((!owner_->delegate() || |
567 owner_->delegate()->ShouldFocusConstrainedWindow()) && | 567 owner_->delegate()->ShouldFocusConstrainedWindow()) && |
568 GetDelegate() && GetDelegate()->GetInitiallyFocusedView()) { | 568 GetDelegate() && GetDelegate()->GetInitiallyFocusedView()) { |
569 GetDelegate()->GetInitiallyFocusedView()->RequestFocus(); | 569 GetDelegate()->GetInitiallyFocusedView()->RequestFocus(); |
570 } | 570 } |
571 } | 571 } |
572 | 572 |
573 void ConstrainedWindowWin::ShowConstrainedWindow() { | 573 void ConstrainedWindowWin::ShowConstrainedWindow() { |
574 GetNonClientView()->SetVisible(true); | |
sky
2011/01/19 21:36:51
Add a comment as to why this is necessary.
asanka (google)
2011/01/20 14:49:18
Done.
| |
574 if (owner_->delegate()) | 575 if (owner_->delegate()) |
575 owner_->delegate()->WillShowConstrainedWindow(owner_); | 576 owner_->delegate()->WillShowConstrainedWindow(owner_); |
576 ActivateConstrainedWindow(); | 577 ActivateConstrainedWindow(); |
577 FocusConstrainedWindow(); | 578 FocusConstrainedWindow(); |
578 } | 579 } |
579 | 580 |
580 void ConstrainedWindowWin::CloseConstrainedWindow() { | 581 void ConstrainedWindowWin::CloseConstrainedWindow() { |
581 // Broadcast to all observers of NOTIFY_CWINDOW_CLOSED. | 582 // Broadcast to all observers of NOTIFY_CWINDOW_CLOSED. |
582 // One example of such an observer is AutomationCWindowTracker in the | 583 // One example of such an observer is AutomationCWindowTracker in the |
583 // automation component. | 584 // automation component. |
(...skipping 23 matching lines...) Expand all Loading... | |
607 ConstrainedWindowWin::ConstrainedWindowWin( | 608 ConstrainedWindowWin::ConstrainedWindowWin( |
608 TabContents* owner, | 609 TabContents* owner, |
609 views::WindowDelegate* window_delegate) | 610 views::WindowDelegate* window_delegate) |
610 : WindowWin(window_delegate), | 611 : WindowWin(window_delegate), |
611 owner_(owner) { | 612 owner_(owner) { |
612 GetNonClientView()->SetFrameView(CreateFrameViewForWindow()); | 613 GetNonClientView()->SetFrameView(CreateFrameViewForWindow()); |
613 | 614 |
614 set_window_style(WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | | 615 set_window_style(WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | |
615 WS_THICKFRAME | WS_SYSMENU); | 616 WS_THICKFRAME | WS_SYSMENU); |
616 set_focus_on_creation(false); | 617 set_focus_on_creation(false); |
618 GetNonClientView()->SetVisible(false); | |
sky
2011/01/19 21:36:51
Add a comment as to why this is necessary.
asanka (google)
2011/01/20 14:49:18
Done.
| |
617 | 619 |
618 WindowWin::Init(owner_->GetNativeView(), gfx::Rect()); | 620 WindowWin::Init(owner_->GetNativeView(), gfx::Rect()); |
619 } | 621 } |
620 | 622 |
621 void ConstrainedWindowWin::ActivateConstrainedWindow() { | 623 void ConstrainedWindowWin::ActivateConstrainedWindow() { |
622 // Other pop-ups are simply moved to the front of the z-order. | 624 // Other pop-ups are simply moved to the front of the z-order. |
623 SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); | 625 SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); |
624 } | 626 } |
625 | 627 |
626 //////////////////////////////////////////////////////////////////////////////// | 628 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
664 | 666 |
665 | 667 |
666 // static | 668 // static |
667 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog( | 669 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog( |
668 TabContents* parent, | 670 TabContents* parent, |
669 views::WindowDelegate* window_delegate) { | 671 views::WindowDelegate* window_delegate) { |
670 ConstrainedWindowWin* window = new ConstrainedWindowWin(parent, | 672 ConstrainedWindowWin* window = new ConstrainedWindowWin(parent, |
671 window_delegate); | 673 window_delegate); |
672 return window; | 674 return window; |
673 } | 675 } |
OLD | NEW |