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

Side by Side Diff: ui/views/view.cc

Issue 22934007: linux_aura: Fix crash on drags from the omnibox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
« no previous file with comments | « ui/views/view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include "ui/views/view.h" 7 #include "ui/views/view.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 paint_to_layer_(false), 178 paint_to_layer_(false),
179 accelerator_registration_delayed_(false), 179 accelerator_registration_delayed_(false),
180 accelerator_focus_manager_(NULL), 180 accelerator_focus_manager_(NULL),
181 registered_accelerator_count_(0), 181 registered_accelerator_count_(0),
182 next_focusable_view_(NULL), 182 next_focusable_view_(NULL),
183 previous_focusable_view_(NULL), 183 previous_focusable_view_(NULL),
184 focusable_(false), 184 focusable_(false),
185 accessibility_focusable_(false), 185 accessibility_focusable_(false),
186 context_menu_controller_(NULL), 186 context_menu_controller_(NULL),
187 drag_controller_(NULL), 187 drag_controller_(NULL),
188 currently_dragging_(false),
188 post_dispatch_handler_(new internal::PostEventDispatchHandler(this)), 189 post_dispatch_handler_(new internal::PostEventDispatchHandler(this)),
189 native_view_accessibility_(NULL) { 190 native_view_accessibility_(NULL) {
190 AddPostTargetHandler(post_dispatch_handler_.get()); 191 AddPostTargetHandler(post_dispatch_handler_.get());
191 } 192 }
192 193
193 View::~View() { 194 View::~View() {
194 if (parent_) 195 if (parent_)
195 parent_->RemoveChildView(this); 196 parent_->RemoveChildView(this);
196 197
197 for (Views::const_iterator i(children_.begin()); i != children_.end(); ++i) { 198 for (Views::const_iterator i(children_.begin()); i != children_.end(); ++i) {
(...skipping 2113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2311 if (widget && widget->native_widget_private()->GetTooltipManager()) 2312 if (widget && widget->native_widget_private()->GetTooltipManager())
2312 widget->native_widget_private()->GetTooltipManager()->UpdateTooltip(); 2313 widget->native_widget_private()->GetTooltipManager()->UpdateTooltip();
2313 } 2314 }
2314 2315
2315 // Drag and drop --------------------------------------------------------------- 2316 // Drag and drop ---------------------------------------------------------------
2316 2317
2317 bool View::DoDrag(const ui::LocatedEvent& event, 2318 bool View::DoDrag(const ui::LocatedEvent& event,
2318 const gfx::Point& press_pt, 2319 const gfx::Point& press_pt,
2319 ui::DragDropTypes::DragEventSource source) { 2320 ui::DragDropTypes::DragEventSource source) {
2320 #if !defined(OS_MACOSX) 2321 #if !defined(OS_MACOSX)
2322 if (currently_dragging_)
2323 return false;
2324
2321 int drag_operations = GetDragOperations(press_pt); 2325 int drag_operations = GetDragOperations(press_pt);
2322 if (drag_operations == ui::DragDropTypes::DRAG_NONE) 2326 if (drag_operations == ui::DragDropTypes::DRAG_NONE)
2323 return false; 2327 return false;
2324 2328
2329 currently_dragging_ = true;
Elliot Glaysher 2013/08/14 21:15:55 I vaguely remember us having some sort of scoped b
sadrul 2013/08/14 21:33:52 I think you mean base::AutoReset.
2330
2325 OSExchangeData data; 2331 OSExchangeData data;
2326 WriteDragData(press_pt, &data); 2332 WriteDragData(press_pt, &data);
2327 2333
2328 // Message the RootView to do the drag and drop. That way if we're removed 2334 // Message the RootView to do the drag and drop. That way if we're removed
2329 // the RootView can detect it and avoid calling us back. 2335 // the RootView can detect it and avoid calling us back.
2330 gfx::Point widget_location(event.location()); 2336 gfx::Point widget_location(event.location());
2331 ConvertPointToWidget(this, &widget_location); 2337 ConvertPointToWidget(this, &widget_location);
2332 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations, 2338 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations,
2333 source); 2339 source);
2340
2341 currently_dragging_ = false;
2342
2334 return true; 2343 return true;
2335 #else 2344 #else
2336 return false; 2345 return false;
2337 #endif // !defined(OS_MACOSX) 2346 #endif // !defined(OS_MACOSX)
2338 } 2347 }
2339 2348
2340 } // namespace views 2349 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698