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

Side by Side Diff: chrome/browser/ui/views/tabs/tab_strip.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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tabs/tab_strip.h" 5 #include "chrome/browser/ui/views/tabs/tab_strip.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/drag_drop_types.h"
10 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
11 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
12 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
13 #include "base/stl_util-inl.h" 12 #include "base/stl_util-inl.h"
14 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/defaults.h" 14 #include "chrome/browser/defaults.h"
16 #include "chrome/browser/themes/browser_theme_provider.h" 15 #include "chrome/browser/themes/browser_theme_provider.h"
17 #include "chrome/browser/ui/view_ids.h" 16 #include "chrome/browser/ui/view_ids.h"
18 #include "chrome/browser/ui/views/tabs/tab.h" 17 #include "chrome/browser/ui/views/tabs/tab.h"
19 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" 18 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h"
20 #include "gfx/canvas_skia.h" 19 #include "gfx/canvas_skia.h"
21 #include "gfx/path.h" 20 #include "gfx/path.h"
22 #include "gfx/size.h" 21 #include "gfx/size.h"
23 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
24 #include "grit/theme_resources.h" 23 #include "grit/theme_resources.h"
25 #include "ui/base/animation/animation_container.h" 24 #include "ui/base/animation/animation_container.h"
25 #include "ui/base/dragdrop/drag_drop_types.h"
26 #include "views/controls/image_view.h" 26 #include "views/controls/image_view.h"
27 #include "views/widget/default_theme_provider.h" 27 #include "views/widget/default_theme_provider.h"
28 #include "views/window/non_client_view.h" 28 #include "views/window/non_client_view.h"
29 #include "views/window/window.h" 29 #include "views/window/window.h"
30 30
31 #if defined(OS_WIN) 31 #if defined(OS_WIN)
32 #include "app/win/win_util.h" 32 #include "app/win/win_util.h"
33 #include "views/widget/widget_win.h" 33 #include "views/widget/widget_win.h"
34 #elif defined(OS_LINUX) 34 #elif defined(OS_LINUX)
35 #include "views/widget/widget_gtk.h" 35 #include "views/widget/widget_gtk.h"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 UpdateDropIndex(event); 342 UpdateDropIndex(event);
343 return GetDropEffect(event); 343 return GetDropEffect(event);
344 } 344 }
345 345
346 void TabStrip::OnDragExited() { 346 void TabStrip::OnDragExited() {
347 SetDropIndex(-1, false); 347 SetDropIndex(-1, false);
348 } 348 }
349 349
350 int TabStrip::OnPerformDrop(const DropTargetEvent& event) { 350 int TabStrip::OnPerformDrop(const DropTargetEvent& event) {
351 if (!drop_info_.get()) 351 if (!drop_info_.get())
352 return DragDropTypes::DRAG_NONE; 352 return ui::DragDropTypes::DRAG_NONE;
353 353
354 const int drop_index = drop_info_->drop_index; 354 const int drop_index = drop_info_->drop_index;
355 const bool drop_before = drop_info_->drop_before; 355 const bool drop_before = drop_info_->drop_before;
356 356
357 // Hide the drop indicator. 357 // Hide the drop indicator.
358 SetDropIndex(-1, false); 358 SetDropIndex(-1, false);
359 359
360 GURL url; 360 GURL url;
361 std::wstring title; 361 std::wstring title;
362 if (!event.GetData().GetURLAndTitle(&url, &title) || !url.is_valid()) 362 if (!event.GetData().GetURLAndTitle(&url, &title) || !url.is_valid())
363 return DragDropTypes::DRAG_NONE; 363 return ui::DragDropTypes::DRAG_NONE;
364 364
365 controller()->PerformDrop(drop_before, drop_index, url); 365 controller()->PerformDrop(drop_before, drop_index, url);
366 366
367 return GetDropEffect(event); 367 return GetDropEffect(event);
368 } 368 }
369 369
370 AccessibilityTypes::Role TabStrip::GetAccessibleRole() { 370 AccessibilityTypes::Role TabStrip::GetAccessibleRole() {
371 return AccessibilityTypes::ROLE_PAGETABLIST; 371 return AccessibilityTypes::ROLE_PAGETABLIST;
372 } 372 }
373 373
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 HWND_TOPMOST, drop_bounds.x(), drop_bounds.y(), drop_bounds.width(), 763 HWND_TOPMOST, drop_bounds.x(), drop_bounds.y(), drop_bounds.width(),
764 drop_bounds.height(), SWP_NOACTIVATE | SWP_SHOWWINDOW); 764 drop_bounds.height(), SWP_NOACTIVATE | SWP_SHOWWINDOW);
765 #else 765 #else
766 drop_info_->arrow_window->SetBounds(drop_bounds); 766 drop_info_->arrow_window->SetBounds(drop_bounds);
767 drop_info_->arrow_window->Show(); 767 drop_info_->arrow_window->Show();
768 #endif 768 #endif
769 } 769 }
770 770
771 int TabStrip::GetDropEffect(const views::DropTargetEvent& event) { 771 int TabStrip::GetDropEffect(const views::DropTargetEvent& event) {
772 const int source_ops = event.GetSourceOperations(); 772 const int source_ops = event.GetSourceOperations();
773 if (source_ops & DragDropTypes::DRAG_COPY) 773 if (source_ops & ui::DragDropTypes::DRAG_COPY)
774 return DragDropTypes::DRAG_COPY; 774 return ui::DragDropTypes::DRAG_COPY;
775 if (source_ops & DragDropTypes::DRAG_LINK) 775 if (source_ops & ui::DragDropTypes::DRAG_LINK)
776 return DragDropTypes::DRAG_LINK; 776 return ui::DragDropTypes::DRAG_LINK;
777 return DragDropTypes::DRAG_MOVE; 777 return ui::DragDropTypes::DRAG_MOVE;
778 } 778 }
779 779
780 // static 780 // static
781 SkBitmap* TabStrip::GetDropArrowImage(bool is_down) { 781 SkBitmap* TabStrip::GetDropArrowImage(bool is_down) {
782 return ResourceBundle::GetSharedInstance().GetBitmapNamed( 782 return ResourceBundle::GetSharedInstance().GetBitmapNamed(
783 is_down ? IDR_TAB_DROP_DOWN : IDR_TAB_DROP_UP); 783 is_down ? IDR_TAB_DROP_DOWN : IDR_TAB_DROP_UP);
784 } 784 }
785 785
786 // TabStrip::DropInfo ---------------------------------------------------------- 786 // TabStrip::DropInfo ----------------------------------------------------------
787 787
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 int TabStrip::GetAvailableWidthForTabs(Tab* last_tab) const { 968 int TabStrip::GetAvailableWidthForTabs(Tab* last_tab) const {
969 return last_tab->x() + last_tab->width(); 969 return last_tab->x() + last_tab->width();
970 } 970 }
971 971
972 bool TabStrip::IsPointInTab(Tab* tab, 972 bool TabStrip::IsPointInTab(Tab* tab,
973 const gfx::Point& point_in_tabstrip_coords) { 973 const gfx::Point& point_in_tabstrip_coords) {
974 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); 974 gfx::Point point_in_tab_coords(point_in_tabstrip_coords);
975 View::ConvertPointToView(this, tab, &point_in_tab_coords); 975 View::ConvertPointToView(this, tab, &point_in_tab_coords);
976 return tab->HitTest(point_in_tab_coords); 976 return tab->HitTest(point_in_tab_coords);
977 } 977 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.cc ('k') | ui/base/dragdrop/download_file_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698