| 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_views.h" | 5 #include "chrome/browser/ui/views/constrained_window_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 // We marked the view as hidden during construction. Mark it as | 588 // We marked the view as hidden during construction. Mark it as |
| 589 // visible now so FocusManager will let us receive focus. | 589 // visible now so FocusManager will let us receive focus. |
| 590 non_client_view()->SetVisible(true); | 590 non_client_view()->SetVisible(true); |
| 591 if (owner_->delegate()) | 591 if (owner_->delegate()) |
| 592 owner_->delegate()->WillShowConstrainedWindow(owner_); | 592 owner_->delegate()->WillShowConstrainedWindow(owner_); |
| 593 Activate(); | 593 Activate(); |
| 594 FocusConstrainedWindow(); | 594 FocusConstrainedWindow(); |
| 595 } | 595 } |
| 596 | 596 |
| 597 void ConstrainedWindowViews::CloseConstrainedWindow() { | 597 void ConstrainedWindowViews::CloseConstrainedWindow() { |
| 598 // Broadcast to all observers of NOTIFY_CWINDOW_CLOSED. | |
| 599 // One example of such an observer is AutomationCWindowTracker in the | |
| 600 // automation component. | |
| 601 NotificationService::current()->Notify(chrome::NOTIFICATION_CWINDOW_CLOSED, | |
| 602 Source<ConstrainedWindow>(this), | |
| 603 NotificationService::NoDetails()); | |
| 604 Close(); | 598 Close(); |
| 605 } | 599 } |
| 606 | 600 |
| 607 void ConstrainedWindowViews::FocusConstrainedWindow() { | 601 void ConstrainedWindowViews::FocusConstrainedWindow() { |
| 608 if ((!owner_->delegate() || | 602 if ((!owner_->delegate() || |
| 609 owner_->delegate()->ShouldFocusConstrainedWindow()) && | 603 owner_->delegate()->ShouldFocusConstrainedWindow()) && |
| 610 widget_delegate() && | 604 widget_delegate() && |
| 611 widget_delegate()->GetInitiallyFocusedView()) { | 605 widget_delegate()->GetInitiallyFocusedView()) { |
| 612 widget_delegate()->GetInitiallyFocusedView()->RequestFocus(); | 606 widget_delegate()->GetInitiallyFocusedView()->RequestFocus(); |
| 613 } | 607 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 641 | 635 |
| 642 //////////////////////////////////////////////////////////////////////////////// | 636 //////////////////////////////////////////////////////////////////////////////// |
| 643 // ConstrainedWindow, public: | 637 // ConstrainedWindow, public: |
| 644 | 638 |
| 645 // static | 639 // static |
| 646 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog( | 640 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog( |
| 647 TabContents* parent, | 641 TabContents* parent, |
| 648 views::WidgetDelegate* widget_delegate) { | 642 views::WidgetDelegate* widget_delegate) { |
| 649 return new ConstrainedWindowViews(parent, widget_delegate); | 643 return new ConstrainedWindowViews(parent, widget_delegate); |
| 650 } | 644 } |
| OLD | NEW |