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/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.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 } | 50 } |
51 | 51 |
52 private: | 52 private: |
53 // TODO(xiyuan): Update this when WidgetDelegate has bounds change hook. | 53 // TODO(xiyuan): Update this when WidgetDelegate has bounds change hook. |
54 virtual void SaveWindowPlacement(const gfx::Rect& bounds, | 54 virtual void SaveWindowPlacement(const gfx::Rect& bounds, |
55 ui::WindowShowState show_state) OVERRIDE { | 55 ui::WindowShowState show_state) OVERRIDE { |
56 if (should_quit_on_size_change_ && last_size_ != bounds.size()) { | 56 if (should_quit_on_size_change_ && last_size_ != bounds.size()) { |
57 // Schedule message loop quit because we could be called while | 57 // Schedule message loop quit because we could be called while |
58 // the bounds change call is on the stack and not in the nested message | 58 // the bounds change call is on the stack and not in the nested message |
59 // loop. | 59 // loop. |
60 MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 60 base::MessageLoop::current()->PostTask( |
61 &MessageLoop::Quit, base::Unretained(MessageLoop::current()))); | 61 FROM_HERE, |
| 62 base::Bind(&base::MessageLoop::Quit, |
| 63 base::Unretained(base::MessageLoop::current()))); |
62 } | 64 } |
63 | 65 |
64 last_size_ = bounds.size(); | 66 last_size_ = bounds.size(); |
65 } | 67 } |
66 | 68 |
67 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE { | 69 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE { |
68 should_quit_on_size_change_ = false; // No quit when we are closing. | 70 should_quit_on_size_change_ = false; // No quit when we are closing. |
69 views::WebDialogView::OnDialogClosed(json_retval); | 71 views::WebDialogView::OnDialogClosed(json_retval); |
70 } | 72 } |
71 | 73 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // Check to make sure we can't get to 0x0 | 171 // Check to make sure we can't get to 0x0 |
170 set_bounds.set_width(0); | 172 set_bounds.set_width(0); |
171 set_bounds.set_height(0); | 173 set_bounds.set_height(0); |
172 | 174 |
173 view->MoveContents(web_contents, set_bounds); | 175 view->MoveContents(web_contents, set_bounds); |
174 content::RunMessageLoop(); // TestWebDialogView will quit. | 176 content::RunMessageLoop(); // TestWebDialogView will quit. |
175 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); | 177 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); |
176 EXPECT_LT(0, actual_bounds.width()); | 178 EXPECT_LT(0, actual_bounds.width()); |
177 EXPECT_LT(0, actual_bounds.height()); | 179 EXPECT_LT(0, actual_bounds.height()); |
178 } | 180 } |
OLD | NEW |