diff options
Diffstat (limited to 'chrome/browser/ui')
5 files changed, 19 insertions, 18 deletions
diff --git a/chrome/browser/ui/views/simple_message_box_views.cc b/chrome/browser/ui/views/simple_message_box_views.cc index c644a4e..596b7d9 100644 --- a/chrome/browser/ui/views/simple_message_box_views.cc +++ b/chrome/browser/ui/views/simple_message_box_views.cc @@ -63,10 +63,10 @@ bool SimpleMessageBoxViews::ShowYesNoBox(gfx::NativeWindow parent_window, aura::client::GetDispatcherClient()->RunWithDispatcher(dialog, parent_window, true); #else - bool old_state = MessageLoopForUI::current()->NestableTasksAllowed(); - MessageLoopForUI::current()->SetNestableTasksAllowed(true); - MessageLoopForUI::current()->RunWithDispatcher(dialog); - MessageLoopForUI::current()->SetNestableTasksAllowed(old_state); + { + MessageLoop::ScopedNestableTaskAllower allow(MessageLoopForUI::current()); + MessageLoopForUI::current()->RunWithDispatcher(dialog); + } #endif g_browser_process->ReleaseModule(); diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc index 795b967..ab1a843 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc @@ -211,11 +211,12 @@ void NativeTabContentsViewAura::StartDragging(const WebDropData& drop_data, // We need to enable recursive tasks on the message loop so we can get // updates while in the system DoDragDrop loop. - bool old_state = MessageLoop::current()->NestableTasksAllowed(); - MessageLoop::current()->SetNestableTasksAllowed(true); - int result_op = aura::client::GetDragDropClient()->StartDragAndDrop( - data, ConvertFromWeb(ops)); - MessageLoop::current()->SetNestableTasksAllowed(old_state); + int result_op = 0; + { + MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); + result_op = aura::client::GetDragDropClient()->StartDragAndDrop( + data, ConvertFromWeb(ops)); + } EndDrag(ConvertToWeb(result_op)); GetWebContents()->GetRenderViewHost()->DragSourceSystemDragEnded(); diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc b/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc index 2c289cb..58955a2 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc +++ b/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc @@ -312,12 +312,14 @@ void TabContentsDragWin::DoDragging(const WebDropData& drop_data, // We need to enable recursive tasks on the message loop so we can get // updates while in the system DoDragDrop loop. - bool old_state = MessageLoop::current()->NestableTasksAllowed(); - MessageLoop::current()->SetNestableTasksAllowed(true); DWORD effect; - DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), drag_source_, - web_drag_utils_win::WebDragOpMaskToWinDragOpMask(ops), &effect); - MessageLoop::current()->SetNestableTasksAllowed(old_state); + { + MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); + DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), + drag_source_, + web_drag_utils_win::WebDragOpMaskToWinDragOpMask(ops), + &effect); + } // This works because WebDragSource::OnDragSourceDrop uses PostTask to // dispatch the actual event. diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc b/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc index 4325e40..45dde04 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc +++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc @@ -362,10 +362,8 @@ void TabContentsViewViews::ShowContextMenu( // Enable recursive tasks on the message loop so we can get updates while // the context menu is being displayed. - bool old_state = MessageLoop::current()->NestableTasksAllowed(); - MessageLoop::current()->SetNestableTasksAllowed(true); + MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); context_menu_->RunMenuAt(screen_point.x(), screen_point.y()); - MessageLoop::current()->SetNestableTasksAllowed(old_state); } void TabContentsViewViews::ShowPopupMenu(const gfx::Rect& bounds, diff --git a/chrome/browser/ui/webui/downloads_dom_handler.cc b/chrome/browser/ui/webui/downloads_dom_handler.cc index 92ae005..7fbe6ac 100644 --- a/chrome/browser/ui/webui/downloads_dom_handler.cc +++ b/chrome/browser/ui/webui/downloads_dom_handler.cc @@ -268,7 +268,7 @@ void DownloadsDOMHandler::HandleDrag(const ListValue* args) { gfx::NativeView view = web_ui()->GetWebContents()->GetNativeView(); { // Enable nested tasks during DnD, while |DragDownload()| blocks. - MessageLoop::ScopedNestableTaskAllower allower(MessageLoop::current()); + MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); download_util::DragDownload(file, icon, view); } } |