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

Side by Side Diff: chrome/browser/ui/views/tabs/default_tab_drag_controller.cc

Issue 8919017: Split UserMetrics into API vs. implementation. Move API to content/public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move to content namespace. Update usages. Update extract_actions tool. Created 9 years 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/default_tab_drag_controller.h" 5 #include "chrome/browser/ui/views/tabs/default_tab_drag_controller.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <set> 8 #include <set>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #include "chrome/browser/extensions/extension_function_dispatcher.h" 12 #include "chrome/browser/extensions/extension_function_dispatcher.h"
13 #include "chrome/browser/tabs/tab_strip_model.h" 13 #include "chrome/browser/tabs/tab_strip_model.h"
14 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" 14 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h"
15 #include "chrome/browser/ui/browser_window.h" 15 #include "chrome/browser/ui/browser_window.h"
16 #include "chrome/browser/ui/views/frame/browser_view.h" 16 #include "chrome/browser/ui/views/frame/browser_view.h"
17 #include "chrome/browser/ui/views/tabs/base_tab.h" 17 #include "chrome/browser/ui/views/tabs/base_tab.h"
18 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" 18 #include "chrome/browser/ui/views/tabs/base_tab_strip.h"
19 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" 19 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h"
20 #include "chrome/browser/ui/views/tabs/dragged_tab_view.h" 20 #include "chrome/browser/ui/views/tabs/dragged_tab_view.h"
21 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h" 21 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h"
22 #include "chrome/browser/ui/views/tabs/tab.h" 22 #include "chrome/browser/ui/views/tabs/tab.h"
23 #include "chrome/browser/ui/views/tabs/tab_strip.h" 23 #include "chrome/browser/ui/views/tabs/tab_strip.h"
24 #include "content/browser/tab_contents/tab_contents.h" 24 #include "content/browser/tab_contents/tab_contents.h"
25 #include "content/browser/user_metrics.h"
26 #include "content/public/browser/notification_details.h" 25 #include "content/public/browser/notification_details.h"
27 #include "content/public/browser/notification_source.h" 26 #include "content/public/browser/notification_source.h"
28 #include "content/public/browser/notification_types.h" 27 #include "content/public/browser/notification_types.h"
28 #include "content/public/browser/user_metrics.h"
29 #include "grit/theme_resources.h" 29 #include "grit/theme_resources.h"
30 #include "third_party/skia/include/core/SkBitmap.h" 30 #include "third_party/skia/include/core/SkBitmap.h"
31 #include "ui/base/animation/animation.h" 31 #include "ui/base/animation/animation.h"
32 #include "ui/base/animation/animation_delegate.h" 32 #include "ui/base/animation/animation_delegate.h"
33 #include "ui/base/animation/slide_animation.h" 33 #include "ui/base/animation/slide_animation.h"
34 #include "ui/base/events.h" 34 #include "ui/base/events.h"
35 #include "ui/base/resource/resource_bundle.h" 35 #include "ui/base/resource/resource_bundle.h"
36 #include "ui/gfx/canvas_skia.h" 36 #include "ui/gfx/canvas_skia.h"
37 #include "ui/gfx/screen.h" 37 #include "ui/gfx/screen.h"
38 #include "ui/views/events/event.h" 38 #include "ui/views/events/event.h"
39 #include "ui/views/widget/widget.h" 39 #include "ui/views/widget/widget.h"
40 40
41 #if defined(TOOLKIT_USES_GTK) 41 #if defined(TOOLKIT_USES_GTK)
42 #include <gdk/gdk.h> // NOLINT 42 #include <gdk/gdk.h> // NOLINT
43 #include <gdk/gdkkeysyms.h> // NOLINT 43 #include <gdk/gdkkeysyms.h> // NOLINT
44 #endif 44 #endif
45 45
46 using content::UserMetricsAction;
47
46 static const int kHorizontalMoveThreshold = 16; // Pixels. 48 static const int kHorizontalMoveThreshold = 16; // Pixels.
47 49
48 // If non-null there is a drag underway. 50 // If non-null there is a drag underway.
49 static DefaultTabDragController* instance_ = NULL; 51 static DefaultTabDragController* instance_ = NULL;
50 52
51 namespace { 53 namespace {
52 54
53 // Delay, in ms, during dragging before we bring a window to front. 55 // Delay, in ms, during dragging before we bring a window to front.
54 const int kBringToFrontDelay = 750; 56 const int kBringToFrontDelay = 750;
55 57
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 void DefaultTabDragController::CompleteDrag() { 1172 void DefaultTabDragController::CompleteDrag() {
1171 DCHECK(started_drag_); 1173 DCHECK(started_drag_);
1172 1174
1173 if (attached_tabstrip_) { 1175 if (attached_tabstrip_) {
1174 attached_tabstrip_->StoppedDraggingTabs( 1176 attached_tabstrip_->StoppedDraggingTabs(
1175 GetTabsMatchingDraggedContents(attached_tabstrip_)); 1177 GetTabsMatchingDraggedContents(attached_tabstrip_));
1176 } else { 1178 } else {
1177 if (dock_info_.type() != DockInfo::NONE) { 1179 if (dock_info_.type() != DockInfo::NONE) {
1178 switch (dock_info_.type()) { 1180 switch (dock_info_.type()) {
1179 case DockInfo::LEFT_OF_WINDOW: 1181 case DockInfo::LEFT_OF_WINDOW:
1180 UserMetrics::RecordAction(UserMetricsAction("DockingWindow_Left")); 1182 content::RecordAction(UserMetricsAction("DockingWindow_Left"));
1181 break; 1183 break;
1182 1184
1183 case DockInfo::RIGHT_OF_WINDOW: 1185 case DockInfo::RIGHT_OF_WINDOW:
1184 UserMetrics::RecordAction(UserMetricsAction("DockingWindow_Right")); 1186 content::RecordAction(UserMetricsAction("DockingWindow_Right"));
1185 break; 1187 break;
1186 1188
1187 case DockInfo::BOTTOM_OF_WINDOW: 1189 case DockInfo::BOTTOM_OF_WINDOW:
1188 UserMetrics::RecordAction(UserMetricsAction("DockingWindow_Bottom")); 1190 content::RecordAction(UserMetricsAction("DockingWindow_Bottom"));
1189 break; 1191 break;
1190 1192
1191 case DockInfo::TOP_OF_WINDOW: 1193 case DockInfo::TOP_OF_WINDOW:
1192 UserMetrics::RecordAction(UserMetricsAction("DockingWindow_Top")); 1194 content::RecordAction(UserMetricsAction("DockingWindow_Top"));
1193 break; 1195 break;
1194 1196
1195 case DockInfo::MAXIMIZE: 1197 case DockInfo::MAXIMIZE:
1196 UserMetrics::RecordAction( 1198 content::RecordAction(
1197 UserMetricsAction("DockingWindow_Maximize")); 1199 UserMetricsAction("DockingWindow_Maximize"));
1198 break; 1200 break;
1199 1201
1200 case DockInfo::LEFT_HALF: 1202 case DockInfo::LEFT_HALF:
1201 UserMetrics::RecordAction( 1203 content::RecordAction(
1202 UserMetricsAction("DockingWindow_LeftHalf")); 1204 UserMetricsAction("DockingWindow_LeftHalf"));
1203 break; 1205 break;
1204 1206
1205 case DockInfo::RIGHT_HALF: 1207 case DockInfo::RIGHT_HALF:
1206 UserMetrics::RecordAction( 1208 content::RecordAction(
1207 UserMetricsAction("DockingWindow_RightHalf")); 1209 UserMetricsAction("DockingWindow_RightHalf"));
1208 break; 1210 break;
1209 1211
1210 case DockInfo::BOTTOM_HALF: 1212 case DockInfo::BOTTOM_HALF:
1211 UserMetrics::RecordAction( 1213 content::RecordAction(
1212 UserMetricsAction("DockingWindow_BottomHalf")); 1214 UserMetricsAction("DockingWindow_BottomHalf"));
1213 break; 1215 break;
1214 1216
1215 default: 1217 default:
1216 NOTREACHED(); 1218 NOTREACHED();
1217 break; 1219 break;
1218 } 1220 }
1219 } 1221 }
1220 // Compel the model to construct a new window for the detached TabContents. 1222 // Compel the model to construct a new window for the detached TabContents.
1221 views::Widget* widget = source_tabstrip_->GetWidget(); 1223 views::Widget* widget = source_tabstrip_->GetWidget();
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 controller->Init(source_tabstrip, source_tab, tabs, mouse_offset, 1412 controller->Init(source_tabstrip, source_tab, tabs, mouse_offset,
1411 source_tab_offset, initial_selection_model); 1413 source_tab_offset, initial_selection_model);
1412 return controller; 1414 return controller;
1413 } 1415 }
1414 1416
1415 // static 1417 // static
1416 bool TabDragController::IsAttachedTo(BaseTabStrip* tab_strip) { 1418 bool TabDragController::IsAttachedTo(BaseTabStrip* tab_strip) {
1417 return instance_ && instance_->active()&& 1419 return instance_ && instance_->active()&&
1418 instance_->attached_tabstrip() == tab_strip; 1420 instance_->attached_tabstrip() == tab_strip;
1419 } 1421 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698