Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: chrome/browser/ui/views/constrained_window_win.cc

Issue 6261015: Keep visibility state in sync between the native window and view (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/win_util.h" 10 #include "app/win/win_util.h"
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // We marked the view as hidden during construction. Mark it as
575 // visible now so FocusManager will let us receive focus.
576 GetNonClientView()->SetVisible(true);
574 if (owner_->delegate()) 577 if (owner_->delegate())
575 owner_->delegate()->WillShowConstrainedWindow(owner_); 578 owner_->delegate()->WillShowConstrainedWindow(owner_);
576 ActivateConstrainedWindow(); 579 ActivateConstrainedWindow();
577 FocusConstrainedWindow(); 580 FocusConstrainedWindow();
578 } 581 }
579 582
580 void ConstrainedWindowWin::CloseConstrainedWindow() { 583 void ConstrainedWindowWin::CloseConstrainedWindow() {
581 // Broadcast to all observers of NOTIFY_CWINDOW_CLOSED. 584 // Broadcast to all observers of NOTIFY_CWINDOW_CLOSED.
582 // One example of such an observer is AutomationCWindowTracker in the 585 // One example of such an observer is AutomationCWindowTracker in the
583 // automation component. 586 // automation component.
(...skipping 23 matching lines...) Expand all
607 ConstrainedWindowWin::ConstrainedWindowWin( 610 ConstrainedWindowWin::ConstrainedWindowWin(
608 TabContents* owner, 611 TabContents* owner,
609 views::WindowDelegate* window_delegate) 612 views::WindowDelegate* window_delegate)
610 : WindowWin(window_delegate), 613 : WindowWin(window_delegate),
611 owner_(owner) { 614 owner_(owner) {
612 GetNonClientView()->SetFrameView(CreateFrameViewForWindow()); 615 GetNonClientView()->SetFrameView(CreateFrameViewForWindow());
613 616
614 set_window_style(WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | 617 set_window_style(WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION |
615 WS_THICKFRAME | WS_SYSMENU); 618 WS_THICKFRAME | WS_SYSMENU);
616 set_focus_on_creation(false); 619 set_focus_on_creation(false);
620 // Views default to visible. Since we are creating a window that is
621 // not visible (no WS_VISIBLE), mark our View as hidden so that
622 // FocusManager can deal with it properly.
623 GetNonClientView()->SetVisible(false);
617 624
618 WindowWin::Init(owner_->GetNativeView(), gfx::Rect()); 625 WindowWin::Init(owner_->GetNativeView(), gfx::Rect());
619 } 626 }
620 627
621 void ConstrainedWindowWin::ActivateConstrainedWindow() { 628 void ConstrainedWindowWin::ActivateConstrainedWindow() {
622 // Other pop-ups are simply moved to the front of the z-order. 629 // 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); 630 SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
624 } 631 }
625 632
626 //////////////////////////////////////////////////////////////////////////////// 633 ////////////////////////////////////////////////////////////////////////////////
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 671
665 672
666 // static 673 // static
667 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog( 674 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog(
668 TabContents* parent, 675 TabContents* parent,
669 views::WindowDelegate* window_delegate) { 676 views::WindowDelegate* window_delegate) {
670 ConstrainedWindowWin* window = new ConstrainedWindowWin(parent, 677 ConstrainedWindowWin* window = new ConstrainedWindowWin(parent,
671 window_delegate); 678 window_delegate);
672 return window; 679 return window;
673 } 680 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698