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

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

Issue 11829040: Fix the content_browsertests everywhere maybe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And fix the final ExtensionApiTest.AlertBasic case. 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 views::Widget::CreateWindowWithParent(dialog, parent)->Show(); 170 if (parent)
171 views::Widget::CreateWindowWithParent(dialog, parent)->Show();
172 else
173 views::Widget::CreateWindow(dialog)->Show();
171 174
172 #if defined(USE_AURA) 175 #if defined(USE_AURA)
173 // Use the widget's window itself so that the message loop 176 // Use the widget's window itself so that the message loop
174 // exists when the dialog is closed by some other means than 177 // exists when the dialog is closed by some other means than
175 // |Cancel| or |Accept|. 178 // |Cancel| or |Accept|.
176 aura::Window* anchor = parent ? 179 aura::Window* anchor = parent ?
177 parent : dialog->GetWidget()->GetNativeWindow(); 180 parent : dialog->GetWidget()->GetNativeWindow();
178 aura::client::GetDispatcherClient(anchor->GetRootWindow())-> 181 aura::client::GetDispatcherClient(anchor->GetRootWindow())->
179 RunWithDispatcher(dialog, anchor, true); 182 RunWithDispatcher(dialog, anchor, true);
180 #else 183 #else
181 { 184 {
182 MessageLoop::ScopedNestableTaskAllower allow(MessageLoopForUI::current()); 185 MessageLoop::ScopedNestableTaskAllower allow(MessageLoopForUI::current());
183 base::RunLoop run_loop(dialog); 186 base::RunLoop run_loop(dialog);
184 run_loop.Run(); 187 run_loop.Run();
185 } 188 }
186 #endif 189 #endif
187 return dialog->result(); 190 return dialog->result();
188 } 191 }
189 192
190 } // namespace chrome 193 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698