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

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: Rename back to "allow". 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(
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
« no previous file with comments | « chrome/browser/ui/views/simple_message_box_views.cc ('k') | chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698