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

Side by Side Diff: ash/wm/gestures/tray_gesture_handler.cc

Issue 11476033: [Launcher per display] Removed Shell::status_area_widget(), system_tray() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix style Created 8 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
« no previous file with comments | « ash/system/tray_update.cc ('k') | ash/wm/shelf_layout_manager_unittest.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/wm/gestures/tray_gesture_handler.h" 5 #include "ash/wm/gestures/tray_gesture_handler.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/tray/system_tray.h" 8 #include "ash/system/tray/system_tray.h"
9 #include "ash/system/tray/system_tray_bubble.h" 9 #include "ash/system/tray/system_tray_bubble.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
11 #include "ui/base/events/event.h" 11 #include "ui/base/events/event.h"
12 #include "ui/compositor/layer.h" 12 #include "ui/compositor/layer.h"
13 #include "ui/gfx/transform.h" 13 #include "ui/gfx/transform.h"
14 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
15 15
16 const int kMinBubbleHeight = 13; 16 const int kMinBubbleHeight = 13;
17 17
18 namespace ash { 18 namespace ash {
19 namespace internal { 19 namespace internal {
20 20
21 TrayGestureHandler::TrayGestureHandler() 21 TrayGestureHandler::TrayGestureHandler()
22 : widget_(NULL), 22 : widget_(NULL),
23 gesture_drag_amount_(0) { 23 gesture_drag_amount_(0) {
24 SystemTray* tray = Shell::GetInstance()->system_tray(); 24 // TODO(oshima): Support multiple display case.
25 SystemTray* tray = Shell::GetInstance()->GetPrimarySystemTray();
25 tray->ShowDefaultView(BUBBLE_CREATE_NEW); 26 tray->ShowDefaultView(BUBBLE_CREATE_NEW);
26 SystemTrayBubble* bubble = tray->GetSystemBubble(); 27 SystemTrayBubble* bubble = tray->GetSystemBubble();
27 if (!bubble) 28 if (!bubble)
28 return; 29 return;
29 bubble->bubble_view()->set_gesture_dragging(true); 30 bubble->bubble_view()->set_gesture_dragging(true);
30 widget_ = bubble->bubble_view()->GetWidget(); 31 widget_ = bubble->bubble_view()->GetWidget();
31 widget_->AddObserver(this); 32 widget_->AddObserver(this);
32 33
33 gfx::Rect bounds = widget_->GetWindowBoundsInScreen(); 34 gfx::Rect bounds = widget_->GetWindowBoundsInScreen();
34 int height_change = bounds.height() - kMinBubbleHeight; 35 int height_change = bounds.height() - kMinBubbleHeight;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 event.details().velocity_y() > -kMinThresholdGestureFling) 87 event.details().velocity_y() > -kMinThresholdGestureFling)
87 should_close = true; 88 should_close = true;
88 } else { 89 } else {
89 NOTREACHED(); 90 NOTREACHED();
90 } 91 }
91 92
92 if (should_close) { 93 if (should_close) {
93 widget_->Close(); 94 widget_->Close();
94 } else { 95 } else {
95 SystemTrayBubble* bubble = 96 SystemTrayBubble* bubble =
96 Shell::GetInstance()->system_tray()->GetSystemBubble(); 97 Shell::GetInstance()->GetPrimarySystemTray()->GetSystemBubble();
97 if (bubble) 98 if (bubble)
98 bubble->bubble_view()->set_gesture_dragging(false); 99 bubble->bubble_view()->set_gesture_dragging(false);
99 } 100 }
100 } 101 }
101 102
102 void TrayGestureHandler::OnWidgetClosing(views::Widget* widget) { 103 void TrayGestureHandler::OnWidgetClosing(views::Widget* widget) {
103 CHECK_EQ(widget_, widget); 104 CHECK_EQ(widget_, widget);
104 widget_ = NULL; 105 widget_ = NULL;
105 } 106 }
106 107
107 } // namespace internal 108 } // namespace internal
108 } // namespace ash 109 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray_update.cc ('k') | ash/wm/shelf_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698