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" |
11 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 11 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
12 #include "chrome/browser/ui/views/frame/browser_view.h" | 12 #include "chrome/browser/ui/views/frame/browser_view.h" |
13 #include "chrome/browser/ui/window_sizer.h" | 13 #include "chrome/browser/ui/window_sizer.h" |
14 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
| 15 #include "chrome/common/chrome_notification_types.h" |
15 #include "content/browser/tab_contents/tab_contents.h" | 16 #include "content/browser/tab_contents/tab_contents.h" |
16 #include "content/browser/tab_contents/tab_contents_view.h" | 17 #include "content/browser/tab_contents/tab_contents_view.h" |
17 #include "content/common/notification_service.h" | 18 #include "content/common/notification_service.h" |
18 #include "grit/chromium_strings.h" | 19 #include "grit/chromium_strings.h" |
19 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
20 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
21 #include "grit/theme_resources_standard.h" | 22 #include "grit/theme_resources_standard.h" |
22 #include "grit/ui_resources.h" | 23 #include "grit/ui_resources.h" |
23 #include "net/base/net_util.h" | 24 #include "net/base/net_util.h" |
24 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 if (owner_->delegate()) | 591 if (owner_->delegate()) |
591 owner_->delegate()->WillShowConstrainedWindow(owner_); | 592 owner_->delegate()->WillShowConstrainedWindow(owner_); |
592 Activate(); | 593 Activate(); |
593 FocusConstrainedWindow(); | 594 FocusConstrainedWindow(); |
594 } | 595 } |
595 | 596 |
596 void ConstrainedWindowViews::CloseConstrainedWindow() { | 597 void ConstrainedWindowViews::CloseConstrainedWindow() { |
597 // Broadcast to all observers of NOTIFY_CWINDOW_CLOSED. | 598 // Broadcast to all observers of NOTIFY_CWINDOW_CLOSED. |
598 // One example of such an observer is AutomationCWindowTracker in the | 599 // One example of such an observer is AutomationCWindowTracker in the |
599 // automation component. | 600 // automation component. |
600 NotificationService::current()->Notify(NotificationType::CWINDOW_CLOSED, | 601 NotificationService::current()->Notify(chrome::NOTIFICATION_CWINDOW_CLOSED, |
601 Source<ConstrainedWindow>(this), | 602 Source<ConstrainedWindow>(this), |
602 NotificationService::NoDetails()); | 603 NotificationService::NoDetails()); |
603 Close(); | 604 Close(); |
604 } | 605 } |
605 | 606 |
606 void ConstrainedWindowViews::FocusConstrainedWindow() { | 607 void ConstrainedWindowViews::FocusConstrainedWindow() { |
607 if ((!owner_->delegate() || | 608 if ((!owner_->delegate() || |
608 owner_->delegate()->ShouldFocusConstrainedWindow()) && | 609 owner_->delegate()->ShouldFocusConstrainedWindow()) && |
609 widget_delegate() && | 610 widget_delegate() && |
610 widget_delegate()->GetInitiallyFocusedView()) { | 611 widget_delegate()->GetInitiallyFocusedView()) { |
(...skipping 29 matching lines...) Expand all Loading... |
640 | 641 |
641 //////////////////////////////////////////////////////////////////////////////// | 642 //////////////////////////////////////////////////////////////////////////////// |
642 // ConstrainedWindow, public: | 643 // ConstrainedWindow, public: |
643 | 644 |
644 // static | 645 // static |
645 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog( | 646 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog( |
646 TabContents* parent, | 647 TabContents* parent, |
647 views::WidgetDelegate* widget_delegate) { | 648 views::WidgetDelegate* widget_delegate) { |
648 return new ConstrainedWindowViews(parent, widget_delegate); | 649 return new ConstrainedWindowViews(parent, widget_delegate); |
649 } | 650 } |
OLD | NEW |