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

Side by Side Diff: ash/shelf/shelf_view.cc

Issue 26373009: ash:Shelf - Added UMA stats for ShelfAlignment (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « ash/shelf/shelf_view.h ('k') | ash/shell.h » ('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) 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 "ash/shelf/shelf_view.h" 5 #include "ash/shelf/shelf_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
11 #include "ash/drag_drop/drag_image_view.h" 11 #include "ash/drag_drop/drag_image_view.h"
12 #include "ash/launcher/launcher_button.h" 12 #include "ash/launcher/launcher_button.h"
13 #include "ash/launcher/launcher_delegate.h" 13 #include "ash/launcher/launcher_delegate.h"
14 #include "ash/launcher/launcher_item_delegate.h" 14 #include "ash/launcher/launcher_item_delegate.h"
15 #include "ash/launcher/launcher_item_delegate_manager.h" 15 #include "ash/launcher/launcher_item_delegate_manager.h"
16 #include "ash/launcher/launcher_model.h" 16 #include "ash/launcher/launcher_model.h"
17 #include "ash/root_window_controller.h" 17 #include "ash/root_window_controller.h"
18 #include "ash/scoped_target_root_window.h" 18 #include "ash/scoped_target_root_window.h"
19 #include "ash/shelf/alternate_app_list_button.h" 19 #include "ash/shelf/alternate_app_list_button.h"
20 #include "ash/shelf/app_list_button.h" 20 #include "ash/shelf/app_list_button.h"
21 #include "ash/shelf/overflow_bubble.h" 21 #include "ash/shelf/overflow_bubble.h"
22 #include "ash/shelf/overflow_button.h" 22 #include "ash/shelf/overflow_button.h"
23 #include "ash/shelf/shelf_icon_observer.h" 23 #include "ash/shelf/shelf_icon_observer.h"
24 #include "ash/shelf/shelf_layout_manager.h" 24 #include "ash/shelf/shelf_layout_manager.h"
25 #include "ash/shelf/shelf_tooltip_manager.h" 25 #include "ash/shelf/shelf_tooltip_manager.h"
26 #include "ash/shelf/shelf_widget.h" 26 #include "ash/shelf/shelf_widget.h"
27 #include "ash/shell_delegate.h" 27 #include "ash/shell_delegate.h"
28 #include "base/auto_reset.h" 28 #include "base/auto_reset.h"
29 #include "base/memory/scoped_ptr.h" 29 #include "base/memory/scoped_ptr.h"
30 #include "base/metrics/histogram.h"
30 #include "grit/ash_resources.h" 31 #include "grit/ash_resources.h"
31 #include "grit/ash_strings.h" 32 #include "grit/ash_strings.h"
32 #include "ui/aura/client/screen_position_client.h" 33 #include "ui/aura/client/screen_position_client.h"
33 #include "ui/aura/root_window.h" 34 #include "ui/aura/root_window.h"
34 #include "ui/aura/window.h" 35 #include "ui/aura/window.h"
35 #include "ui/base/accessibility/accessible_view_state.h" 36 #include "ui/base/accessibility/accessible_view_state.h"
36 #include "ui/base/l10n/l10n_util.h" 37 #include "ui/base/l10n/l10n_util.h"
37 #include "ui/base/models/simple_menu_model.h" 38 #include "ui/base/models/simple_menu_model.h"
38 #include "ui/base/resource/resource_bundle.h" 39 #include "ui/base/resource/resource_bundle.h"
39 #include "ui/compositor/layer.h" 40 #include "ui/compositor/layer.h"
(...skipping 11 matching lines...) Expand all
51 #include "ui/views/view_model.h" 52 #include "ui/views/view_model.h"
52 #include "ui/views/view_model_utils.h" 53 #include "ui/views/view_model_utils.h"
53 #include "ui/views/widget/widget.h" 54 #include "ui/views/widget/widget.h"
54 55
55 using gfx::Animation; 56 using gfx::Animation;
56 using views::View; 57 using views::View;
57 58
58 namespace ash { 59 namespace ash {
59 namespace internal { 60 namespace internal {
60 61
62 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM = 0;
63 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT = 1;
64 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT = 2;
65 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT = 3;
66
61 // Default amount content is inset on the left edge. 67 // Default amount content is inset on the left edge.
62 const int kDefaultLeadingInset = 8; 68 const int kDefaultLeadingInset = 8;
63 69
64 // Minimum distance before drag starts. 70 // Minimum distance before drag starts.
65 const int kMinimumDragDistance = 8; 71 const int kMinimumDragDistance = 8;
66 72
67 // Size between the buttons. 73 // Size between the buttons.
68 const int kButtonSpacing = 4; 74 const int kButtonSpacing = 4;
69 const int kAlternateButtonSpacing = 10; 75 const int kAlternateButtonSpacing = 10;
70 76
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 if (index == -1) 1548 if (index == -1)
1543 return; 1549 return;
1544 1550
1545 LauncherItemDelegate* item_delegate = item_manager_->GetLauncherItemDelegate( 1551 LauncherItemDelegate* item_delegate = item_manager_->GetLauncherItemDelegate(
1546 model_->items()[index].id); 1552 model_->items()[index].id);
1547 if (view_model_->view_size() <= 1 || !item_delegate->IsDraggable()) 1553 if (view_model_->view_size() <= 1 || !item_delegate->IsDraggable())
1548 return; // View is being deleted or not draggable, ignore request. 1554 return; // View is being deleted or not draggable, ignore request.
1549 1555
1550 drag_view_ = view; 1556 drag_view_ = view;
1551 drag_offset_ = layout_manager_->PrimaryAxisValue(event.x(), event.y()); 1557 drag_offset_ = layout_manager_->PrimaryAxisValue(event.x(), event.y());
1558 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentUsage",
1559 layout_manager_->SelectValueForShelfAlignment(
1560 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM,
1561 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT,
1562 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT,
1563 -1),
1564 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT);
1552 } 1565 }
1553 1566
1554 void ShelfView::PointerDraggedOnButton(views::View* view, 1567 void ShelfView::PointerDraggedOnButton(views::View* view,
1555 Pointer pointer, 1568 Pointer pointer,
1556 const ui::LocatedEvent& event) { 1569 const ui::LocatedEvent& event) {
1557 // To prepare all drag types (moving an item in the shelf and dragging off), 1570 // To prepare all drag types (moving an item in the shelf and dragging off),
1558 // we should check the x-axis and y-axis offset. 1571 // we should check the x-axis and y-axis offset.
1559 if (!dragging() && drag_view_ && 1572 if (!dragging() && drag_view_ &&
1560 ((abs(event.x() - drag_offset_) >= kMinimumDragDistance) || 1573 ((abs(event.x() - drag_offset_) >= kMinimumDragDistance) ||
1561 (abs(event.y() - drag_offset_) >= kMinimumDragDistance))) { 1574 (abs(event.y() - drag_offset_) >= kMinimumDragDistance))) {
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 break; 1913 break;
1901 case ash::SHELF_ALIGNMENT_TOP: 1914 case ash::SHELF_ALIGNMENT_TOP:
1902 distance = coordinate.y() - bounds.bottom(); 1915 distance = coordinate.y() - bounds.bottom();
1903 break; 1916 break;
1904 } 1917 }
1905 return distance > 0 ? distance : 0; 1918 return distance > 0 ? distance : 0;
1906 } 1919 }
1907 1920
1908 } // namespace internal 1921 } // namespace internal
1909 } // namespace ash 1922 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view.h ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698