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

Side by Side Diff: ash/common/shelf/app_list_button.cc

Issue 2750483005: Moves app_list() and related functions from Shell to WmShell (Closed)
Patch Set: dont explicitly delete Created 3 years, 9 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
« no previous file with comments | « ash/common/mojo_interface_factory.cc ('k') | ash/common/shelf/app_list_shelf_item_delegate.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 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 "ash/common/shelf/app_list_button.h" 5 #include "ash/common/shelf/app_list_button.h"
6 6
7 #include "ash/common/shelf/ink_drop_button_listener.h" 7 #include "ash/common/shelf/ink_drop_button_listener.h"
8 #include "ash/common/shelf/shelf_constants.h" 8 #include "ash/common/shelf/shelf_constants.h"
9 #include "ash/common/shelf/shelf_view.h" 9 #include "ash/common/shelf/shelf_view.h"
10 #include "ash/common/shelf/wm_shelf.h" 10 #include "ash/common/shelf/wm_shelf.h"
11 #include "ash/common/system/tray/tray_popup_utils.h" 11 #include "ash/common/system/tray/tray_popup_utils.h"
12 #include "ash/common/wm_shell.h"
13 #include "ash/public/cpp/shelf_types.h" 12 #include "ash/public/cpp/shelf_types.h"
13 #include "ash/shell.h"
14 #include "ash/strings/grit/ash_strings.h" 14 #include "ash/strings/grit/ash_strings.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "ui/accessibility/ax_node_data.h" 16 #include "ui/accessibility/ax_node_data.h"
17 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/gfx/canvas.h" 18 #include "ui/gfx/canvas.h"
19 #include "ui/gfx/scoped_canvas.h" 19 #include "ui/gfx/scoped_canvas.h"
20 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" 20 #include "ui/views/animation/flood_fill_ink_drop_ripple.h"
21 #include "ui/views/animation/ink_drop_impl.h" 21 #include "ui/views/animation/ink_drop_impl.h"
22 #include "ui/views/animation/ink_drop_mask.h" 22 #include "ui/views/animation/ink_drop_mask.h"
23 #include "ui/views/painter.h" 23 #include "ui/views/painter.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 case ui::ET_GESTURE_SCROLL_UPDATE: 99 case ui::ET_GESTURE_SCROLL_UPDATE:
100 shelf_view_->PointerDraggedOnButton(this, ShelfView::TOUCH, *event); 100 shelf_view_->PointerDraggedOnButton(this, ShelfView::TOUCH, *event);
101 event->SetHandled(); 101 event->SetHandled();
102 return; 102 return;
103 case ui::ET_GESTURE_SCROLL_END: 103 case ui::ET_GESTURE_SCROLL_END:
104 case ui::ET_SCROLL_FLING_START: 104 case ui::ET_SCROLL_FLING_START:
105 shelf_view_->PointerReleasedOnButton(this, ShelfView::TOUCH, false); 105 shelf_view_->PointerReleasedOnButton(this, ShelfView::TOUCH, false);
106 event->SetHandled(); 106 event->SetHandled();
107 return; 107 return;
108 case ui::ET_GESTURE_TAP_DOWN: 108 case ui::ET_GESTURE_TAP_DOWN:
109 if (!WmShell::Get()->IsApplistVisible()) 109 if (!Shell::Get()->IsAppListVisible())
110 AnimateInkDrop(views::InkDropState::ACTION_PENDING, event); 110 AnimateInkDrop(views::InkDropState::ACTION_PENDING, event);
111 ImageButton::OnGestureEvent(event); 111 ImageButton::OnGestureEvent(event);
112 break; 112 break;
113 default: 113 default:
114 ImageButton::OnGestureEvent(event); 114 ImageButton::OnGestureEvent(event);
115 return; 115 return;
116 } 116 }
117 } 117 }
118 118
119 void AppListButton::OnPaint(gfx::Canvas* canvas) { 119 void AppListButton::OnPaint(gfx::Canvas* canvas) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 void AppListButton::NotifyClick(const ui::Event& event) { 173 void AppListButton::NotifyClick(const ui::Event& event) {
174 ImageButton::NotifyClick(event); 174 ImageButton::NotifyClick(event);
175 if (listener_) 175 if (listener_)
176 listener_->ButtonPressed(this, event, GetInkDrop()); 176 listener_->ButtonPressed(this, event, GetInkDrop());
177 } 177 }
178 178
179 bool AppListButton::ShouldEnterPushedState(const ui::Event& event) { 179 bool AppListButton::ShouldEnterPushedState(const ui::Event& event) {
180 if (!shelf_view_->ShouldEventActivateButton(this, event)) 180 if (!shelf_view_->ShouldEventActivateButton(this, event))
181 return false; 181 return false;
182 if (WmShell::Get()->IsApplistVisible()) 182 if (Shell::Get()->IsAppListVisible())
183 return false; 183 return false;
184 return views::ImageButton::ShouldEnterPushedState(event); 184 return views::ImageButton::ShouldEnterPushedState(event);
185 } 185 }
186 186
187 std::unique_ptr<views::InkDrop> AppListButton::CreateInkDrop() { 187 std::unique_ptr<views::InkDrop> AppListButton::CreateInkDrop() {
188 std::unique_ptr<views::InkDropImpl> ink_drop = 188 std::unique_ptr<views::InkDropImpl> ink_drop =
189 CustomButton::CreateDefaultInkDropImpl(); 189 CustomButton::CreateDefaultInkDropImpl();
190 ink_drop->SetShowHighlightOnHover(false); 190 ink_drop->SetShowHighlightOnHover(false);
191 return std::move(ink_drop); 191 return std::move(ink_drop);
192 } 192 }
(...skipping 17 matching lines...) Expand all
210 return gfx::Point(x_mid, x_mid); 210 return gfx::Point(x_mid, x_mid);
211 } else if (alignment == SHELF_ALIGNMENT_RIGHT) { 211 } else if (alignment == SHELF_ALIGNMENT_RIGHT) {
212 return gfx::Point(y_mid, y_mid); 212 return gfx::Point(y_mid, y_mid);
213 } else { 213 } else {
214 DCHECK_EQ(alignment, SHELF_ALIGNMENT_LEFT); 214 DCHECK_EQ(alignment, SHELF_ALIGNMENT_LEFT);
215 return gfx::Point(width() - y_mid, y_mid); 215 return gfx::Point(width() - y_mid, y_mid);
216 } 216 }
217 } 217 }
218 218
219 } // namespace ash 219 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/mojo_interface_factory.cc ('k') | ash/common/shelf/app_list_shelf_item_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698