| 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 "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 "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "ui/views/window/non_client_view.h" | 50 #include "ui/views/window/non_client_view.h" |
| 51 #include "ui/views/window/window_resources.h" | 51 #include "ui/views/window/window_resources.h" |
| 52 #include "ui/views/window/window_shape.h" | 52 #include "ui/views/window/window_shape.h" |
| 53 | 53 |
| 54 #if defined(OS_WIN) && !defined(USE_AURA) | 54 #if defined(OS_WIN) && !defined(USE_AURA) |
| 55 #include "ui/base/win/shell.h" | 55 #include "ui/base/win/shell.h" |
| 56 #include "ui/views/widget/native_widget_win.h" | 56 #include "ui/views/widget/native_widget_win.h" |
| 57 #endif | 57 #endif |
| 58 | 58 |
| 59 #if defined(USE_AURA) | 59 #if defined(USE_AURA) |
| 60 #include "ui/aura/window.h" |
| 60 #include "ui/views/corewm/visibility_controller.h" | 61 #include "ui/views/corewm/visibility_controller.h" |
| 61 #include "ui/views/corewm/window_animations.h" | 62 #include "ui/views/corewm/window_animations.h" |
| 63 #include "ui/views/corewm/window_modality_controller.h" |
| 62 #endif | 64 #endif |
| 63 | 65 |
| 64 #if defined(USE_ASH) | 66 #if defined(USE_ASH) |
| 65 #include "ash/ash_constants.h" | 67 #include "ash/ash_constants.h" |
| 66 #include "ash/ash_switches.h" | 68 #include "ash/ash_switches.h" |
| 67 #include "ash/shell.h" | 69 #include "ash/shell.h" |
| 68 #include "ash/wm/custom_frame_view_ash.h" | 70 #include "ash/wm/custom_frame_view_ash.h" |
| 69 #include "ash/wm/window_modality_controller.h" | |
| 70 #include "ui/aura/window.h" | |
| 71 #endif | 71 #endif |
| 72 | 72 |
| 73 using base::TimeDelta; | 73 using base::TimeDelta; |
| 74 | 74 |
| 75 namespace views { | 75 namespace views { |
| 76 class ClientView; | 76 class ClientView; |
| 77 } | 77 } |
| 78 | 78 |
| 79 // An enumeration of image resources used by this window. | 79 // An enumeration of image resources used by this window. |
| 80 enum { | 80 enum { |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 registrar_.Add(this, | 625 registrar_.Add(this, |
| 626 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, | 626 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, |
| 627 content::Source<content::WebContents>(web_contents)); | 627 content::Source<content::WebContents>(web_contents)); |
| 628 } | 628 } |
| 629 | 629 |
| 630 ConstrainedWindowTabHelper* constrained_window_tab_helper = | 630 ConstrainedWindowTabHelper* constrained_window_tab_helper = |
| 631 ConstrainedWindowTabHelper::FromWebContents(web_contents_); | 631 ConstrainedWindowTabHelper::FromWebContents(web_contents_); |
| 632 constrained_window_tab_helper->AddConstrainedDialog(this); | 632 constrained_window_tab_helper->AddConstrainedDialog(this); |
| 633 #if defined(USE_ASH) | 633 #if defined(USE_ASH) |
| 634 GetNativeWindow()->SetProperty(ash::kConstrainedWindowKey, true); | 634 GetNativeWindow()->SetProperty(ash::kConstrainedWindowKey, true); |
| 635 ash::SetModalParent(GetNativeWindow(), | 635 views::corewm::SetModalParent(GetNativeWindow(), |
| 636 web_contents_->GetView()->GetNativeView()); | 636 web_contents_->GetView()->GetNativeView()); |
| 637 #endif | 637 #endif |
| 638 } | 638 } |
| 639 | 639 |
| 640 ConstrainedWindowViews::~ConstrainedWindowViews() { | 640 ConstrainedWindowViews::~ConstrainedWindowViews() { |
| 641 } | 641 } |
| 642 | 642 |
| 643 void ConstrainedWindowViews::ShowConstrainedWindow() { | 643 void ConstrainedWindowViews::ShowConstrainedWindow() { |
| 644 #if defined(USE_AURA) | 644 #if defined(USE_AURA) |
| 645 if (enable_chrome_style_) { | 645 if (enable_chrome_style_) { |
| 646 views::corewm::SetWindowVisibilityAnimationType( | 646 views::corewm::SetWindowVisibilityAnimationType( |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 return; | 764 return; |
| 765 } | 765 } |
| 766 #if defined(USE_ASH) | 766 #if defined(USE_ASH) |
| 767 if (is_top_level()) { | 767 if (is_top_level()) { |
| 768 point += web_contents_->GetNativeView()->parent()->bounds().origin(). | 768 point += web_contents_->GetNativeView()->parent()->bounds().origin(). |
| 769 OffsetFromOrigin(); | 769 OffsetFromOrigin(); |
| 770 } | 770 } |
| 771 #endif | 771 #endif |
| 772 SetBounds(gfx::Rect(point - gfx::Vector2d(size.width() / 2, 0), size)); | 772 SetBounds(gfx::Rect(point - gfx::Vector2d(size.width() / 2, 0), size)); |
| 773 } | 773 } |
| OLD | NEW |