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

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

Issue 11316245: Move VisibilityController to corewm. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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
OLDNEW
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
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/views/corewm/visibility_controller.h"
60 #include "ui/views/corewm/window_animations.h" 61 #include "ui/views/corewm/window_animations.h"
61 #endif 62 #endif
62 63
63 #if defined(USE_ASH) 64 #if defined(USE_ASH)
64 #include "ash/ash_constants.h" 65 #include "ash/ash_constants.h"
65 #include "ash/ash_switches.h" 66 #include "ash/ash_switches.h"
66 #include "ash/shell.h" 67 #include "ash/shell.h"
67 #include "ash/wm/custom_frame_view_ash.h" 68 #include "ash/wm/custom_frame_view_ash.h"
68 #include "ash/wm/visibility_controller.h"
69 #include "ash/wm/window_modality_controller.h" 69 #include "ash/wm/window_modality_controller.h"
70 #include "ui/aura/window.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
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 params.parent = web_contents_->GetNativeView(); 587 params.parent = web_contents_->GetNativeView();
588 } 588 }
589 589
590 #if defined(USE_ASH) 590 #if defined(USE_ASH)
591 if (enable_chrome_style_) { 591 if (enable_chrome_style_) {
592 params.child = false; 592 params.child = false;
593 DCHECK_EQ(widget_delegate->GetModalType(), ui::MODAL_TYPE_CHILD); 593 DCHECK_EQ(widget_delegate->GetModalType(), ui::MODAL_TYPE_CHILD);
594 } 594 }
595 // Ash window headers can be transparent. 595 // Ash window headers can be transparent.
596 params.transparent = true; 596 params.transparent = true;
597 ash::SetChildWindowVisibilityChangesAnimated(params.GetParent()); 597 views::corewm::SetChildWindowVisibilityChangesAnimated(params.GetParent());
598 // No animations should get performed on the window since that will re-order 598 // No animations should get performed on the window since that will re-order
599 // the window stack which will then cause many problems. 599 // the window stack which will then cause many problems.
600 if (params.parent && params.parent->parent()) { 600 if (params.parent && params.parent->parent()) {
601 params.parent->parent()->SetProperty(aura::client::kAnimationsDisabledKey, 601 params.parent->parent()->SetProperty(aura::client::kAnimationsDisabledKey,
602 true); 602 true);
603 } 603 }
604 #endif 604 #endif
605 Init(params); 605 Init(params);
606 606
607 if (enable_chrome_style_) { 607 if (enable_chrome_style_) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 web_contents_ = NULL; 736 web_contents_ = NULL;
737 } 737 }
738 738
739 void ConstrainedWindowViews::Observe( 739 void ConstrainedWindowViews::Observe(
740 int type, 740 int type,
741 const content::NotificationSource& source, 741 const content::NotificationSource& source,
742 const content::NotificationDetails& details) { 742 const content::NotificationDetails& details) {
743 DCHECK(enable_chrome_style_); 743 DCHECK(enable_chrome_style_);
744 DCHECK_EQ(type, content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED); 744 DCHECK_EQ(type, content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED);
745 #if defined(USE_ASH) 745 #if defined(USE_ASH)
746 ash::SuspendChildWindowVisibilityAnimations 746 views::corewm::SuspendChildWindowVisibilityAnimations
747 suspend(GetNativeWindow()->parent()); 747 suspend(GetNativeWindow()->parent());
748 #endif 748 #endif
749 if (*content::Details<bool>(details).ptr()) { 749 if (*content::Details<bool>(details).ptr()) {
750 Show(); 750 Show();
751 } else { 751 } else {
752 Hide(); 752 Hide();
753 } 753 }
754 } 754 }
755 755
756 void ConstrainedWindowViews::PositionChromeStyleWindow(const gfx::Size& size) { 756 void ConstrainedWindowViews::PositionChromeStyleWindow(const gfx::Size& size) {
757 DCHECK(enable_chrome_style_); 757 DCHECK(enable_chrome_style_);
758 ConstrainedWindowTabHelperDelegate* tab_helper_delegate = 758 ConstrainedWindowTabHelperDelegate* tab_helper_delegate =
759 ConstrainedWindowTabHelper::FromWebContents(web_contents_)->delegate(); 759 ConstrainedWindowTabHelper::FromWebContents(web_contents_)->delegate();
760 gfx::Point point; 760 gfx::Point point;
761 if (!tab_helper_delegate || 761 if (!tab_helper_delegate ||
762 !tab_helper_delegate->GetConstrainedWindowTopCenter(&point)) { 762 !tab_helper_delegate->GetConstrainedWindowTopCenter(&point)) {
763 Widget::CenterWindow(size); 763 Widget::CenterWindow(size);
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 }
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace.cc ('k') | chrome/browser/ui/views/frame/desktop_browser_frame_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698