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

Side by Side Diff: athena/home/minimized_home.cc

Issue 404613004: Introduces mouse event handler to the minimized home. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/home/minimized_home.h" 5 #include "athena/home/minimized_home.h"
6 6
7 #include "ui/views/background.h" 7 #include "ui/views/background.h"
8 #include "ui/views/layout/box_layout.h" 8 #include "ui/views/layout/box_layout.h"
9 #include "ui/views/view.h" 9 #include "ui/views/view.h"
10 #include "ui/views/widget/widget.h" 10 #include "ui/views/widget/widget.h"
(...skipping 21 matching lines...) Expand all
32 SchedulePaint(); 32 SchedulePaint();
33 } 33 }
34 34
35 // views::View: 35 // views::View:
36 virtual gfx::Size GetPreferredSize() const OVERRIDE { 36 virtual gfx::Size GetPreferredSize() const OVERRIDE {
37 const int kDragHandleWidth = 80; 37 const int kDragHandleWidth = 80;
38 const int kDragHandleHeight = 4; 38 const int kDragHandleHeight = 4;
39 return gfx::Size(kDragHandleWidth, kDragHandleHeight); 39 return gfx::Size(kDragHandleWidth, kDragHandleHeight);
40 } 40 }
41 41
42 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE {
43 if (event.IsLeftMouseButton() && event.GetClickCount() > 1) {
44 delegate_->OnDragUpCompleted();
45 SetColor(kDragHandleColorNormal);
46 return true;
47 }
48 return false;
49 }
50
51 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE {
52 SetColor(kDragHandleColorHot);
53 }
54
55 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE {
56 SetColor(kDragHandleColorNormal);
57 }
58
42 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { 59 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE {
43 SkColor change_color = SK_ColorTRANSPARENT; 60 SkColor change_color = SK_ColorTRANSPARENT;
44 if (event->type() == ui::ET_GESTURE_BEGIN && 61 if (event->type() == ui::ET_GESTURE_BEGIN &&
45 event->details().touch_points() == 1) { 62 event->details().touch_points() == 1) {
46 change_color = kDragHandleColorHot; 63 change_color = kDragHandleColorHot;
47 } else if (event->type() == ui::ET_GESTURE_END && 64 } else if (event->type() == ui::ET_GESTURE_END &&
48 event->details().touch_points() == 1) { 65 event->details().touch_points() == 1) {
49 change_color = kDragHandleColorNormal; 66 change_color = kDragHandleColorNormal;
50 } 67 }
51 68
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 2, 0); 108 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 2, 0);
92 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); 109 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER);
93 content_view->SetLayoutManager(layout); 110 content_view->SetLayoutManager(layout);
94 111
95 views::View* view = new MinimizedHomeView(delegate); 112 views::View* view = new MinimizedHomeView(delegate);
96 content_view->AddChildView(view); 113 content_view->AddChildView(view);
97 return widget; 114 return widget;
98 } 115 }
99 116
100 } // namespace athena 117 } // namespace athena
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698