| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/confirm_bubble_views.h" | 5 #include "chrome/browser/ui/views/confirm_bubble_views.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/confirm_bubble.h" | 7 #include "chrome/browser/ui/confirm_bubble.h" |
| 8 #include "chrome/browser/ui/test/test_confirm_bubble_model.h" | 8 #include "chrome/browser/ui/test/test_confirm_bubble_model.h" |
| 9 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" | 9 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" |
| 10 #include "components/constrained_window/constrained_window_views.h" | 10 #include "components/constrained_window/constrained_window_views.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 // Create parent widget, as confirm bubble must have an owner. | 22 // Create parent widget, as confirm bubble must have an owner. |
| 23 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); | 23 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); |
| 24 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 24 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 25 scoped_ptr<views::Widget> parent_widget(new Widget); | 25 scoped_ptr<views::Widget> parent_widget(new Widget); |
| 26 parent_widget->Init(params); | 26 parent_widget->Init(params); |
| 27 parent_widget->Show(); | 27 parent_widget->Show(); |
| 28 | 28 |
| 29 // Bubble owns the model. | 29 // Bubble owns the model. |
| 30 bool model_deleted = false; | 30 bool model_deleted = false; |
| 31 TestConfirmBubbleModel* model = | 31 scoped_ptr<TestConfirmBubbleModel> model( |
| 32 new TestConfirmBubbleModel(&model_deleted, NULL, NULL, NULL); | 32 new TestConfirmBubbleModel(&model_deleted, NULL, NULL, NULL)); |
| 33 ConfirmBubbleViews* bubble = new ConfirmBubbleViews(model); | 33 ConfirmBubbleViews* bubble = new ConfirmBubbleViews(model.Pass()); |
| 34 gfx::NativeWindow parent = parent_widget->GetNativeWindow(); | 34 gfx::NativeWindow parent = parent_widget->GetNativeWindow(); |
| 35 constrained_window::CreateBrowserModalDialogViews(bubble, parent)->Show(); | 35 constrained_window::CreateBrowserModalDialogViews(bubble, parent)->Show(); |
| 36 | 36 |
| 37 // Clean up. | 37 // Clean up. |
| 38 bubble->GetWidget()->CloseNow(); | 38 bubble->GetWidget()->CloseNow(); |
| 39 parent_widget->CloseNow(); | 39 parent_widget->CloseNow(); |
| 40 EXPECT_TRUE(model_deleted); | 40 EXPECT_TRUE(model_deleted); |
| 41 | 41 |
| 42 constrained_window::SetConstrainedWindowViewsClient(nullptr); | 42 constrained_window::SetConstrainedWindowViewsClient(nullptr); |
| 43 } | 43 } |
| OLD | NEW |