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

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

Issue 1395103003: Don't use base::MessageLoop::{Quit,QuitClosure} in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months 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
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 "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/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 private: 50 private:
51 // TODO(xiyuan): Update this when WidgetDelegate has bounds change hook. 51 // TODO(xiyuan): Update this when WidgetDelegate has bounds change hook.
52 void SaveWindowPlacement(const gfx::Rect& bounds, 52 void SaveWindowPlacement(const gfx::Rect& bounds,
53 ui::WindowShowState show_state) override { 53 ui::WindowShowState show_state) override {
54 if (should_quit_on_size_change_ && last_size_ != bounds.size()) { 54 if (should_quit_on_size_change_ && last_size_ != bounds.size()) {
55 // Schedule message loop quit because we could be called while 55 // Schedule message loop quit because we could be called while
56 // the bounds change call is on the stack and not in the nested message 56 // the bounds change call is on the stack and not in the nested message
57 // loop. 57 // loop.
58 base::MessageLoop::current()->task_runner()->PostTask( 58 base::MessageLoop::current()->task_runner()->PostTask(
59 FROM_HERE, 59 FROM_HERE,
60 base::Bind(&base::MessageLoop::Quit, 60 base::Bind(&base::MessageLoop::QuitWhenIdle,
61 base::Unretained(base::MessageLoop::current()))); 61 base::Unretained(base::MessageLoop::current())));
62 } 62 }
63 63
64 last_size_ = bounds.size(); 64 last_size_ = bounds.size();
65 } 65 }
66 66
67 void OnDialogClosed(const std::string& json_retval) override { 67 void OnDialogClosed(const std::string& json_retval) override {
68 should_quit_on_size_change_ = false; // No quit when we are closing. 68 should_quit_on_size_change_ = false; // No quit when we are closing.
69 views::WebDialogView::OnDialogClosed(json_retval); // Deletes this. 69 views::WebDialogView::OnDialogClosed(json_retval); // Deletes this.
70 } 70 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 view_->GetWidget()->widget_delegate()->GetModalType()); 227 view_->GetWidget()->widget_delegate()->GetModalType());
228 228
229 // Close the parent window. Tear down may happen asynchronously. 229 // Close the parent window. Tear down may happen asynchronously.
230 EXPECT_FALSE(web_dialog_delegate_destroyed_); 230 EXPECT_FALSE(web_dialog_delegate_destroyed_);
231 EXPECT_FALSE(web_dialog_view_destroyed_); 231 EXPECT_FALSE(web_dialog_view_destroyed_);
232 browser()->window()->Close(); 232 browser()->window()->Close();
233 content::RunAllPendingInMessageLoop(); 233 content::RunAllPendingInMessageLoop();
234 EXPECT_TRUE(web_dialog_delegate_destroyed_); 234 EXPECT_TRUE(web_dialog_delegate_destroyed_);
235 EXPECT_TRUE(web_dialog_view_destroyed_); 235 EXPECT_TRUE(web_dialog_view_destroyed_);
236 } 236 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698