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

Side by Side Diff: ash/launcher/launcher_view.cc

Issue 26373009: ash:Shelf - Added UMA stats for ShelfAlignment (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more specific UMA counts Created 7 years, 2 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 | « no previous file | ash/shelf/shelf_alignment_menu.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) 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/launcher/launcher_view.h" 5 #include "ash/launcher/launcher_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_icon_observer.h" 14 #include "ash/launcher/launcher_icon_observer.h"
15 #include "ash/launcher/launcher_item_delegate.h" 15 #include "ash/launcher/launcher_item_delegate.h"
16 #include "ash/launcher/launcher_item_delegate_manager.h" 16 #include "ash/launcher/launcher_item_delegate_manager.h"
17 #include "ash/launcher/launcher_model.h" 17 #include "ash/launcher/launcher_model.h"
18 #include "ash/root_window_controller.h" 18 #include "ash/root_window_controller.h"
19 #include "ash/scoped_target_root_window.h" 19 #include "ash/scoped_target_root_window.h"
20 #include "ash/shelf/alternate_app_list_button.h" 20 #include "ash/shelf/alternate_app_list_button.h"
21 #include "ash/shelf/app_list_button.h" 21 #include "ash/shelf/app_list_button.h"
22 #include "ash/shelf/overflow_bubble.h" 22 #include "ash/shelf/overflow_bubble.h"
23 #include "ash/shelf/overflow_button.h" 23 #include "ash/shelf/overflow_button.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 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 if (index == -1) 1553 if (index == -1)
1548 return; 1554 return;
1549 1555
1550 LauncherItemDelegate* item_delegate = item_manager_->GetLauncherItemDelegate( 1556 LauncherItemDelegate* item_delegate = item_manager_->GetLauncherItemDelegate(
1551 model_->items()[index].id); 1557 model_->items()[index].id);
1552 if (view_model_->view_size() <= 1 || !item_delegate->IsDraggable()) 1558 if (view_model_->view_size() <= 1 || !item_delegate->IsDraggable())
1553 return; // View is being deleted or not draggable, ignore request. 1559 return; // View is being deleted or not draggable, ignore request.
1554 1560
1555 ShelfLayoutManager* shelf = tooltip_->shelf_layout_manager(); 1561 ShelfLayoutManager* shelf = tooltip_->shelf_layout_manager();
1556 1562
1563 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentUsage",
James Cook 2013/10/16 23:35:27 This feels like the wrong way to do this. It will
1564 shelf->SelectValueForShelfAlignment(SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM,
1565 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT,
1566 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT,
1567 -1),
1568 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT);
1569
1557 drag_view_ = view; 1570 drag_view_ = view;
1558 drag_offset_ = shelf->PrimaryAxisValue(event.x(), event.y()); 1571 drag_offset_ = shelf->PrimaryAxisValue(event.x(), event.y());
1559 } 1572 }
1560 1573
1561 void LauncherView::PointerDraggedOnButton(views::View* view, 1574 void LauncherView::PointerDraggedOnButton(views::View* view,
1562 Pointer pointer, 1575 Pointer pointer,
1563 const ui::LocatedEvent& event) { 1576 const ui::LocatedEvent& event) {
1564 ShelfLayoutManager* shelf = tooltip_->shelf_layout_manager(); 1577 ShelfLayoutManager* shelf = tooltip_->shelf_layout_manager();
1565 if (!dragging() && drag_view_ && 1578 if (!dragging() && drag_view_ &&
1566 shelf->PrimaryAxisValue(abs(event.x() - drag_offset_), 1579 shelf->PrimaryAxisValue(abs(event.x() - drag_offset_),
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 break; 1922 break;
1910 case ash::SHELF_ALIGNMENT_TOP: 1923 case ash::SHELF_ALIGNMENT_TOP:
1911 distance = coordinate.y() - bounds.bottom(); 1924 distance = coordinate.y() - bounds.bottom();
1912 break; 1925 break;
1913 } 1926 }
1914 return distance > 0 ? distance : 0; 1927 return distance > 0 ? distance : 0;
1915 } 1928 }
1916 1929
1917 } // namespace internal 1930 } // namespace internal
1918 } // namespace ash 1931 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/shelf/shelf_alignment_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698