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

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

Issue 2818533003: Make nesting/running states a RunLoop rather than a MessageLoop concept. (Closed)
Patch Set: still need to check MessageLoop::current() in Mojo's RunLoopNestingObserver::GetForThread() Created 3 years, 7 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 "chrome/browser/ui/simple_message_box.h" 5 #include "chrome/browser/ui/simple_message_box.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.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/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 const base::string16& checkbox_text) { 216 const base::string16& checkbox_text) {
217 startup_metric_utils::SetNonBrowserUIDisplayed(); 217 startup_metric_utils::SetNonBrowserUIDisplayed();
218 if (internal::g_should_skip_message_box_for_test) 218 if (internal::g_should_skip_message_box_for_test)
219 return MESSAGE_BOX_RESULT_YES; 219 return MESSAGE_BOX_RESULT_YES;
220 220
221 // Views dialogs cannot be shown outside the UI thread message loop or if the 221 // Views dialogs cannot be shown outside the UI thread message loop or if the
222 // ResourceBundle is not initialized yet. 222 // ResourceBundle is not initialized yet.
223 // Fallback to logging with a default response or a Windows MessageBox. 223 // Fallback to logging with a default response or a Windows MessageBox.
224 #if defined(OS_WIN) 224 #if defined(OS_WIN)
225 if (!base::MessageLoopForUI::IsCurrent() || 225 if (!base::MessageLoopForUI::IsCurrent() ||
226 !base::MessageLoopForUI::current()->is_running() || 226 !base::RunLoop::IsRunningOnCurrentThread() ||
227 !ResourceBundle::HasSharedInstance()) { 227 !ResourceBundle::HasSharedInstance()) {
228 LOG_IF(ERROR, !checkbox_text.empty()) << "Dialog checkbox won't be shown"; 228 LOG_IF(ERROR, !checkbox_text.empty()) << "Dialog checkbox won't be shown";
229 int result = ui::MessageBox(views::HWNDForNativeWindow(parent), message, 229 int result = ui::MessageBox(views::HWNDForNativeWindow(parent), message,
230 title, GetMessageBoxFlagsFromType(type)); 230 title, GetMessageBoxFlagsFromType(type));
231 return (result == IDYES || result == IDOK) ? 231 return (result == IDYES || result == IDOK) ?
232 MESSAGE_BOX_RESULT_YES : MESSAGE_BOX_RESULT_NO; 232 MESSAGE_BOX_RESULT_YES : MESSAGE_BOX_RESULT_NO;
233 } 233 }
234 #else 234 #else
235 if (!base::MessageLoopForUI::IsCurrent() || 235 if (!base::MessageLoopForUI::IsCurrent() ||
236 !ResourceBundle::HasSharedInstance()) { 236 !ResourceBundle::HasSharedInstance()) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 MessageBoxResult ShowMessageBoxWithButtonText(gfx::NativeWindow parent, 290 MessageBoxResult ShowMessageBoxWithButtonText(gfx::NativeWindow parent,
291 const base::string16& title, 291 const base::string16& title,
292 const base::string16& message, 292 const base::string16& message,
293 const base::string16& yes_text, 293 const base::string16& yes_text,
294 const base::string16& no_text) { 294 const base::string16& no_text) {
295 return ShowMessageBoxImpl(parent, title, message, MESSAGE_BOX_TYPE_QUESTION, 295 return ShowMessageBoxImpl(parent, title, message, MESSAGE_BOX_TYPE_QUESTION,
296 yes_text, no_text, base::string16()); 296 yes_text, no_text, base::string16());
297 } 297 }
298 298
299 } // namespace chrome 299 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/metrics/chromeos_metrics_provider_unittest.cc ('k') | chromeos/dbus/services/service_provider_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698