Chromium Code Reviews
[email protected] (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

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

Issue 9384024: Prefer ScopedNestableTaskAllower over manual save/restore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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/views/simple_message_box_views.h" 5 #include "chrome/browser/ui/views/simple_message_box_views.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/simple_message_box.h" 9 #include "chrome/browser/simple_message_box.h"
10 #include "chrome/browser/ui/dialog_style.h" 10 #include "chrome/browser/ui/dialog_style.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // until we retrieve the user response.. 55 // until we retrieve the user response..
56 scoped_refptr<SimpleMessageBoxViews> dialog = 56 scoped_refptr<SimpleMessageBoxViews> dialog =
57 new SimpleMessageBoxViews(parent_window, DIALOG_YES_NO, title, message); 57 new SimpleMessageBoxViews(parent_window, DIALOG_YES_NO, title, message);
58 58
59 // Make sure Chrome doesn't attempt to shut down with the dialog up. 59 // Make sure Chrome doesn't attempt to shut down with the dialog up.
60 g_browser_process->AddRefModule(); 60 g_browser_process->AddRefModule();
61 61
62 #if defined(USE_AURA) 62 #if defined(USE_AURA)
63 aura::client::GetDispatcherClient()->RunWithDispatcher(dialog, true); 63 aura::client::GetDispatcherClient()->RunWithDispatcher(dialog, true);
64 #else 64 #else
65 bool old_state = MessageLoopForUI::current()->NestableTasksAllowed(); 65 {
66 MessageLoopForUI::current()->SetNestableTasksAllowed(true); 66 MessageLoop::ScopedNestableTaskAllower allow(MessageLoopForUI::current());
67 MessageLoopForUI::current()->RunWithDispatcher(dialog); 67 MessageLoopForUI::current()->RunWithDispatcher(dialog);
68 MessageLoopForUI::current()->SetNestableTasksAllowed(old_state); 68 }
69 #endif 69 #endif
70 70
71 g_browser_process->ReleaseModule(); 71 g_browser_process->ReleaseModule();
jar (doing other things) 2012/02/11 03:24:38 nit/curious question: What are the potential side
dhollowa 2012/02/13 17:44:26 This is meant to match the |AddRefModule| at line
72 72
73 return dialog->Accepted(); 73 return dialog->Accepted();
74 } 74 }
75 75
76 bool SimpleMessageBoxViews::Cancel() { 76 bool SimpleMessageBoxViews::Cancel() {
77 disposition_ = DISPOSITION_CANCEL; 77 disposition_ = DISPOSITION_CANCEL;
78 return true; 78 return true;
79 } 79 }
80 80
81 bool SimpleMessageBoxViews::Accept() { 81 bool SimpleMessageBoxViews::Accept() {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (disposition_ == DISPOSITION_UNKNOWN) 161 if (disposition_ == DISPOSITION_UNKNOWN)
162 return base::MessagePumpDispatcher::EVENT_PROCESSED; 162 return base::MessagePumpDispatcher::EVENT_PROCESSED;
163 return base::MessagePumpDispatcher::EVENT_QUIT; 163 return base::MessagePumpDispatcher::EVENT_QUIT;
164 } 164 }
165 #else 165 #else
166 bool SimpleMessageBoxViews::Dispatch(GdkEvent* event) { 166 bool SimpleMessageBoxViews::Dispatch(GdkEvent* event) {
167 gtk_main_do_event(event); 167 gtk_main_do_event(event);
168 return disposition_ == DISPOSITION_UNKNOWN; 168 return disposition_ == DISPOSITION_UNKNOWN;
169 } 169 }
170 #endif 170 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698