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

Side by Side Diff: views/view.cc

Issue 6250014: Move more dnd related files to ui/base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | « views/event.h ('k') | views/view_win.cc » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "views/view.h" 5 #include "views/view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #ifndef NDEBUG 8 #ifndef NDEBUG
9 #include <iostream> 9 #include <iostream>
10 #endif 10 #endif
11 11
12 #include "app/drag_drop_types.h"
13 #include "base/logging.h" 12 #include "base/logging.h"
14 #include "base/message_loop.h" 13 #include "base/message_loop.h"
15 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
16 #include "gfx/canvas_skia.h" 15 #include "gfx/canvas_skia.h"
17 #include "gfx/path.h" 16 #include "gfx/path.h"
18 #include "third_party/skia/include/core/SkShader.h" 17 #include "third_party/skia/include/core/SkShader.h"
18 #include "ui/base/dragdrop/drag_drop_types.h"
19 #include "views/background.h" 19 #include "views/background.h"
20 #include "views/layout_manager.h" 20 #include "views/layout_manager.h"
21 #include "views/views_delegate.h" 21 #include "views/views_delegate.h"
22 #include "views/widget/root_view.h" 22 #include "views/widget/root_view.h"
23 #include "views/widget/tooltip_manager.h" 23 #include "views/widget/tooltip_manager.h"
24 #include "views/widget/widget.h" 24 #include "views/widget/widget.h"
25 #include "views/window/window.h" 25 #include "views/window/window.h"
26 26
27 #if defined(OS_WIN) 27 #if defined(OS_WIN)
28 #include "base/win/scoped_gdi_object.h" 28 #include "base/win/scoped_gdi_object.h"
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 GetDragOperations(e.location()) : 0; 490 GetDragOperations(e.location()) : 0;
491 ContextMenuController* context_menu_controller = e.IsRightMouseButton() ? 491 ContextMenuController* context_menu_controller = e.IsRightMouseButton() ?
492 context_menu_controller_ : 0; 492 context_menu_controller_ : 0;
493 493
494 const bool result = OnMousePressed(e); 494 const bool result = OnMousePressed(e);
495 // WARNING: we may have been deleted, don't use any View variables; 495 // WARNING: we may have been deleted, don't use any View variables;
496 496
497 if (!enabled) 497 if (!enabled)
498 return result; 498 return result;
499 499
500 if (drag_operations != DragDropTypes::DRAG_NONE) { 500 if (drag_operations != ui::DragDropTypes::DRAG_NONE) {
501 drag_info->PossibleDrag(e.location()); 501 drag_info->PossibleDrag(e.location());
502 return true; 502 return true;
503 } 503 }
504 return !!context_menu_controller || result; 504 return !!context_menu_controller || result;
505 } 505 }
506 506
507 bool View::ProcessMouseDragged(const MouseEvent& e, DragInfo* drag_info) { 507 bool View::ProcessMouseDragged(const MouseEvent& e, DragInfo* drag_info) {
508 // Copy the field, that way if we're deleted after drag and drop no harm is 508 // Copy the field, that way if we're deleted after drag and drop no harm is
509 // done. 509 // done.
510 ContextMenuController* context_menu_controller = context_menu_controller_; 510 ContextMenuController* context_menu_controller = context_menu_controller_;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 void View::RemoveAllChildViews(bool delete_views) { 599 void View::RemoveAllChildViews(bool delete_views) {
600 ViewList::iterator iter; 600 ViewList::iterator iter;
601 while ((iter = child_views_.begin()) != child_views_.end()) { 601 while ((iter = child_views_.begin()) != child_views_.end()) {
602 DoRemoveChildView(*iter, false, false, delete_views); 602 DoRemoveChildView(*iter, false, false, delete_views);
603 } 603 }
604 UpdateTooltip(); 604 UpdateTooltip();
605 } 605 }
606 606
607 void View::DoDrag(const MouseEvent& e, const gfx::Point& press_pt) { 607 void View::DoDrag(const MouseEvent& e, const gfx::Point& press_pt) {
608 int drag_operations = GetDragOperations(press_pt); 608 int drag_operations = GetDragOperations(press_pt);
609 if (drag_operations == DragDropTypes::DRAG_NONE) 609 if (drag_operations == ui::DragDropTypes::DRAG_NONE)
610 return; 610 return;
611 611
612 OSExchangeData data; 612 OSExchangeData data;
613 WriteDragData(press_pt, &data); 613 WriteDragData(press_pt, &data);
614 614
615 // Message the RootView to do the drag and drop. That way if we're removed 615 // Message the RootView to do the drag and drop. That way if we're removed
616 // the RootView can detect it and avoid calling us back. 616 // the RootView can detect it and avoid calling us back.
617 RootView* root_view = GetRootView(); 617 RootView* root_view = GetRootView();
618 root_view->StartDragForViewFromMouseEvent(this, data, drag_operations); 618 root_view->StartDragForViewFromMouseEvent(this, data, drag_operations);
619 } 619 }
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 accelerators_->clear(); 1136 accelerators_->clear();
1137 accelerators_.reset(); 1137 accelerators_.reset();
1138 } 1138 }
1139 registered_accelerator_count_ = 0; 1139 registered_accelerator_count_ = 0;
1140 } 1140 }
1141 } 1141 }
1142 1142
1143 int View::GetDragOperations(const gfx::Point& press_pt) { 1143 int View::GetDragOperations(const gfx::Point& press_pt) {
1144 return drag_controller_ ? 1144 return drag_controller_ ?
1145 drag_controller_->GetDragOperations(this, press_pt) : 1145 drag_controller_->GetDragOperations(this, press_pt) :
1146 DragDropTypes::DRAG_NONE; 1146 ui::DragDropTypes::DRAG_NONE;
1147 } 1147 }
1148 1148
1149 void View::WriteDragData(const gfx::Point& press_pt, OSExchangeData* data) { 1149 void View::WriteDragData(const gfx::Point& press_pt, OSExchangeData* data) {
1150 DCHECK(drag_controller_); 1150 DCHECK(drag_controller_);
1151 drag_controller_->WriteDragData(this, press_pt, data); 1151 drag_controller_->WriteDragData(this, press_pt, data);
1152 } 1152 }
1153 1153
1154 void View::OnDragDone() { 1154 void View::OnDragDone() {
1155 } 1155 }
1156 1156
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 1384
1385 bool View::CanDrop(const OSExchangeData& data) { 1385 bool View::CanDrop(const OSExchangeData& data) {
1386 // TODO(sky): when I finish up migration, this should default to true. 1386 // TODO(sky): when I finish up migration, this should default to true.
1387 return false; 1387 return false;
1388 } 1388 }
1389 1389
1390 void View::OnDragEntered(const DropTargetEvent& event) { 1390 void View::OnDragEntered(const DropTargetEvent& event) {
1391 } 1391 }
1392 1392
1393 int View::OnDragUpdated(const DropTargetEvent& event) { 1393 int View::OnDragUpdated(const DropTargetEvent& event) {
1394 return DragDropTypes::DRAG_NONE; 1394 return ui::DragDropTypes::DRAG_NONE;
1395 } 1395 }
1396 1396
1397 void View::OnDragExited() { 1397 void View::OnDragExited() {
1398 } 1398 }
1399 1399
1400 int View::OnPerformDrop(const DropTargetEvent& event) { 1400 int View::OnPerformDrop(const DropTargetEvent& event) {
1401 return DragDropTypes::DRAG_NONE; 1401 return ui::DragDropTypes::DRAG_NONE;
1402 } 1402 }
1403 1403
1404 // static 1404 // static
1405 bool View::ExceededDragThreshold(int delta_x, int delta_y) { 1405 bool View::ExceededDragThreshold(int delta_x, int delta_y) {
1406 return (abs(delta_x) > GetHorizontalDragThreshold() || 1406 return (abs(delta_x) > GetHorizontalDragThreshold() ||
1407 abs(delta_y) > GetVerticalDragThreshold()); 1407 abs(delta_y) > GetVerticalDragThreshold());
1408 } 1408 }
1409 1409
1410 // Tooltips ----------------------------------------------------------------- 1410 // Tooltips -----------------------------------------------------------------
1411 bool View::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { 1411 bool View::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 possible_drag = false; 1530 possible_drag = false;
1531 start_pt = gfx::Point(); 1531 start_pt = gfx::Point();
1532 } 1532 }
1533 1533
1534 void View::DragInfo::PossibleDrag(const gfx::Point& p) { 1534 void View::DragInfo::PossibleDrag(const gfx::Point& p) {
1535 possible_drag = true; 1535 possible_drag = true;
1536 start_pt = p; 1536 start_pt = p;
1537 } 1537 }
1538 1538
1539 } // namespace 1539 } // namespace
OLDNEW
« no previous file with comments | « views/event.h ('k') | views/view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698