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 "ash/test/child_modal_window.h" | 5 #include "ash/test/child_modal_window.h" |
6 | 6 |
7 #include "ash/wm/window_modality_controller.h" | 7 #include "ash/wm/window_modality_controller.h" |
8 #include "base/utf_string_conversions.h" // ASCIIToUTF16 | 8 #include "base/utf_string_conversions.h" // ASCIIToUTF16 |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 gfx::NativeWindow ChildModalParent::GetChild() const { | 141 gfx::NativeWindow ChildModalParent::GetChild() const { |
142 if (child_) | 142 if (child_) |
143 return child_->GetNativeView(); | 143 return child_->GetNativeView(); |
144 return NULL; | 144 return NULL; |
145 } | 145 } |
146 | 146 |
147 views::Widget* ChildModalParent::CreateChild() { | 147 views::Widget* ChildModalParent::CreateChild() { |
148 views::Widget* child = views::Widget::CreateWindowWithParent( | 148 views::Widget* child = views::Widget::CreateWindowWithParent( |
149 new ChildModalWindow, GetWidget()->GetNativeView()); | 149 new ChildModalWindow, GetWidget()->GetNativeView()); |
150 ash::wm::SetModalParent(child->GetNativeView(), GetModalParent()); | 150 ash::SetModalParent(child->GetNativeView(), GetModalParent()); |
151 child->AddObserver(this); | 151 child->AddObserver(this); |
152 child->GetNativeView()->SetName("ChildModalWindow"); | 152 child->GetNativeView()->SetName("ChildModalWindow"); |
153 return child; | 153 return child; |
154 } | 154 } |
155 | 155 |
156 views::View* ChildModalParent::GetContentsView() { | 156 views::View* ChildModalParent::GetContentsView() { |
157 return this; | 157 return this; |
158 } | 158 } |
159 | 159 |
160 string16 ChildModalParent::GetWindowTitle() const { | 160 string16 ChildModalParent::GetWindowTitle() const { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 void ChildModalParent::OnWidgetClosing(views::Widget* widget) { | 206 void ChildModalParent::OnWidgetClosing(views::Widget* widget) { |
207 if (child_) { | 207 if (child_) { |
208 DCHECK_EQ(child_, widget); | 208 DCHECK_EQ(child_, widget); |
209 child_ = NULL; | 209 child_ = NULL; |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 } // namespace test | 213 } // namespace test |
214 } // namespace ash | 214 } // namespace ash |
OLD | NEW |