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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 private: | 54 private: |
55 // TODO(xiyuan): Update this when WidgetDelegate has bounds change hook. | 55 // TODO(xiyuan): Update this when WidgetDelegate has bounds change hook. |
56 void SaveWindowPlacement(const gfx::Rect& bounds, | 56 void SaveWindowPlacement(const gfx::Rect& bounds, |
57 ui::WindowShowState show_state) override { | 57 ui::WindowShowState show_state) override { |
58 if (should_quit_on_size_change_ && last_size_ != bounds.size()) { | 58 if (should_quit_on_size_change_ && last_size_ != bounds.size()) { |
59 // Schedule message loop quit because we could be called while | 59 // Schedule message loop quit because we could be called while |
60 // the bounds change call is on the stack and not in the nested message | 60 // the bounds change call is on the stack and not in the nested message |
61 // loop. | 61 // loop. |
62 base::ThreadTaskRunnerHandle::Get()->PostTask( | 62 base::ThreadTaskRunnerHandle::Get()->PostTask( |
63 FROM_HERE, | 63 FROM_HERE, |
64 base::Bind(&base::MessageLoop::QuitWhenIdle, | 64 base::BindOnce(&base::MessageLoop::QuitWhenIdle, |
65 base::Unretained(base::MessageLoop::current()))); | 65 base::Unretained(base::MessageLoop::current()))); |
66 } | 66 } |
67 | 67 |
68 last_size_ = bounds.size(); | 68 last_size_ = bounds.size(); |
69 } | 69 } |
70 | 70 |
71 void OnDialogClosed(const std::string& json_retval) override { | 71 void OnDialogClosed(const std::string& json_retval) override { |
72 should_quit_on_size_change_ = false; // No quit when we are closing. | 72 should_quit_on_size_change_ = false; // No quit when we are closing. |
73 views::WebDialogView::OnDialogClosed(json_retval); // Deletes this. | 73 views::WebDialogView::OnDialogClosed(json_retval); // Deletes this. |
74 } | 74 } |
75 | 75 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 view_->GetWidget()->widget_delegate()->GetModalType()); | 231 view_->GetWidget()->widget_delegate()->GetModalType()); |
232 | 232 |
233 // Close the parent window. Tear down may happen asynchronously. | 233 // Close the parent window. Tear down may happen asynchronously. |
234 EXPECT_FALSE(web_dialog_delegate_destroyed_); | 234 EXPECT_FALSE(web_dialog_delegate_destroyed_); |
235 EXPECT_FALSE(web_dialog_view_destroyed_); | 235 EXPECT_FALSE(web_dialog_view_destroyed_); |
236 browser()->window()->Close(); | 236 browser()->window()->Close(); |
237 content::RunAllPendingInMessageLoop(); | 237 content::RunAllPendingInMessageLoop(); |
238 EXPECT_TRUE(web_dialog_delegate_destroyed_); | 238 EXPECT_TRUE(web_dialog_delegate_destroyed_); |
239 EXPECT_TRUE(web_dialog_view_destroyed_); | 239 EXPECT_TRUE(web_dialog_view_destroyed_); |
240 } | 240 } |
OLD | NEW |