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

Side by Side Diff: chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.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/tab_contents/native_tab_contents_view_aura.h" 5 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.h"
6 6
7 // TODO(beng): USE_ASH 7 // TODO(beng): USE_ASH
8 #include "ash/wm/visibility_controller.h" 8 #include "ash/wm/visibility_controller.h"
9 #include "base/event_types.h" 9 #include "base/event_types.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 ui::OSExchangeDataProviderAura* provider = new ui::OSExchangeDataProviderAura; 204 ui::OSExchangeDataProviderAura* provider = new ui::OSExchangeDataProviderAura;
205 PrepareDragData(drop_data, provider); 205 PrepareDragData(drop_data, provider);
206 if (!image.isNull()) 206 if (!image.isNull())
207 provider->set_drag_image(image); 207 provider->set_drag_image(image);
208 ui::OSExchangeData data(provider); // takes ownership of |provider|. 208 ui::OSExchangeData data(provider); // takes ownership of |provider|.
209 209
210 scoped_ptr<WebDragSourceAura> drag_source(new WebDragSourceAura(this)); 210 scoped_ptr<WebDragSourceAura> drag_source(new WebDragSourceAura(this));
211 211
212 // We need to enable recursive tasks on the message loop so we can get 212 // We need to enable recursive tasks on the message loop so we can get
213 // updates while in the system DoDragDrop loop. 213 // updates while in the system DoDragDrop loop.
214 bool old_state = MessageLoop::current()->NestableTasksAllowed(); 214 int result_op = 0;
215 MessageLoop::current()->SetNestableTasksAllowed(true); 215 {
216 int result_op = aura::client::GetDragDropClient()->StartDragAndDrop( 216 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
217 data, ConvertFromWeb(ops)); 217 result_op = aura::client::GetDragDropClient()->StartDragAndDrop(
jar (doing other things) 2012/02/11 03:24:38 nit: Does this actually induce a nested message lo
dhollowa 2012/02/13 17:44:26 sky will be the best person to comment here. But
jar (doing other things) 2012/02/14 01:51:43 Sky@ Do you think this is as close as you can get
sky 2012/02/14 04:45:05 DragDropController::StartDragAndDrop is closer (in
dhollowa 2012/02/14 05:42:20 Shall I move the scoper there then? Or would you
218 MessageLoop::current()->SetNestableTasksAllowed(old_state); 218 data, ConvertFromWeb(ops));
219 }
219 220
220 EndDrag(ConvertToWeb(result_op)); 221 EndDrag(ConvertToWeb(result_op));
221 GetWebContents()->GetRenderViewHost()->DragSourceSystemDragEnded(); 222 GetWebContents()->GetRenderViewHost()->DragSourceSystemDragEnded();
222 } 223 }
223 224
224 void NativeTabContentsViewAura::CancelDrag() { 225 void NativeTabContentsViewAura::CancelDrag() {
225 if (aura::client::GetDragDropClient()) 226 if (aura::client::GetDragDropClient())
226 aura::client::GetDragDropClient()->DragCancel(); 227 aura::client::GetDragDropClient()->DragCancel();
227 } 228 }
228 229
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 316 }
316 317
317 //////////////////////////////////////////////////////////////////////////////// 318 ////////////////////////////////////////////////////////////////////////////////
318 // NativeTabContentsView, public: 319 // NativeTabContentsView, public:
319 320
320 // static 321 // static
321 NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView( 322 NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView(
322 internal::NativeTabContentsViewDelegate* delegate) { 323 internal::NativeTabContentsViewDelegate* delegate) {
323 return new NativeTabContentsViewAura(delegate); 324 return new NativeTabContentsViewAura(delegate);
324 } 325 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698