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

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

Issue 11962021: Revert 177182 - ViewTest.ChangeNativeViewHierarchyFindRoots failure (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
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 "chrome/browser/ui/simple_message_box.h" 5 #include "chrome/browser/ui/simple_message_box.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 } // namespace 161 } // namespace
162 162
163 MessageBoxResult ShowMessageBox(gfx::NativeWindow parent, 163 MessageBoxResult ShowMessageBox(gfx::NativeWindow parent,
164 const string16& title, 164 const string16& title,
165 const string16& message, 165 const string16& message,
166 MessageBoxType type) { 166 MessageBoxType type) {
167 scoped_refptr<SimpleMessageBoxViews> dialog( 167 scoped_refptr<SimpleMessageBoxViews> dialog(
168 new SimpleMessageBoxViews(title, message, type)); 168 new SimpleMessageBoxViews(title, message, type));
169 169
170 if (parent) 170 views::Widget::CreateWindowWithParent(dialog, parent)->Show();
171 views::Widget::CreateWindowWithParent(dialog, parent)->Show();
172 else
173 views::Widget::CreateWindow(dialog)->Show();
174 171
175 #if defined(USE_AURA) 172 #if defined(USE_AURA)
176 // Use the widget's window itself so that the message loop 173 // Use the widget's window itself so that the message loop
177 // exists when the dialog is closed by some other means than 174 // exists when the dialog is closed by some other means than
178 // |Cancel| or |Accept|. 175 // |Cancel| or |Accept|.
179 aura::Window* anchor = parent ? 176 aura::Window* anchor = parent ?
180 parent : dialog->GetWidget()->GetNativeWindow(); 177 parent : dialog->GetWidget()->GetNativeWindow();
181 aura::client::GetDispatcherClient(anchor->GetRootWindow())-> 178 aura::client::GetDispatcherClient(anchor->GetRootWindow())->
182 RunWithDispatcher(dialog, anchor, true); 179 RunWithDispatcher(dialog, anchor, true);
183 #else 180 #else
184 { 181 {
185 MessageLoop::ScopedNestableTaskAllower allow(MessageLoopForUI::current()); 182 MessageLoop::ScopedNestableTaskAllower allow(MessageLoopForUI::current());
186 base::RunLoop run_loop(dialog); 183 base::RunLoop run_loop(dialog);
187 run_loop.Run(); 184 run_loop.Run();
188 } 185 }
189 #endif 186 #endif
190 return dialog->result(); 187 return dialog->result();
191 } 188 }
192 189
193 } // namespace chrome 190 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/javascript_app_modal_dialog_views.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698