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

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

Issue 57453002: ash: Rename LauncherButtonHost to ShelfButtonHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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/launcher/launcher_button.h ('k') | ash/launcher/launcher_button_host.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/launcher/launcher_button.h" 5 #include "ash/launcher/launcher_button.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/launcher/launcher_button_host.h" 10 #include "ash/shelf/shelf_button_host.h"
11 #include "ash/shelf/shelf_layout_manager.h" 11 #include "ash/shelf/shelf_layout_manager.h"
12 #include "grit/ash_resources.h" 12 #include "grit/ash_resources.h"
13 #include "skia/ext/image_operations.h" 13 #include "skia/ext/image_operations.h"
14 #include "ui/base/accessibility/accessible_view_state.h" 14 #include "ui/base/accessibility/accessible_view_state.h"
15 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/compositor/layer.h" 16 #include "ui/compositor/layer.h"
17 #include "ui/compositor/scoped_layer_animation_settings.h" 17 #include "ui/compositor/scoped_layer_animation_settings.h"
18 #include "ui/events/event_constants.h" 18 #include "ui/events/event_constants.h"
19 #include "ui/gfx/animation/animation_delegate.h" 19 #include "ui/gfx/animation/animation_delegate.h"
20 #include "ui/gfx/animation/throb_animation.h" 20 #include "ui/gfx/animation/throb_animation.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 bool LauncherButton::IconView::HitTestRect(const gfx::Rect& rect) const { 214 bool LauncherButton::IconView::HitTestRect(const gfx::Rect& rect) const {
215 // Return false so that LauncherButton gets all the mouse events. 215 // Return false so that LauncherButton gets all the mouse events.
216 return false; 216 return false;
217 } 217 }
218 218
219 //////////////////////////////////////////////////////////////////////////////// 219 ////////////////////////////////////////////////////////////////////////////////
220 // LauncherButton 220 // LauncherButton
221 221
222 LauncherButton* LauncherButton::Create( 222 LauncherButton* LauncherButton::Create(
223 views::ButtonListener* listener, 223 views::ButtonListener* listener,
224 LauncherButtonHost* host, 224 ShelfButtonHost* host,
225 ShelfLayoutManager* shelf_layout_manager) { 225 ShelfLayoutManager* shelf_layout_manager) {
226 LauncherButton* button = 226 LauncherButton* button =
227 new LauncherButton(listener, host, shelf_layout_manager); 227 new LauncherButton(listener, host, shelf_layout_manager);
228 button->Init(); 228 button->Init();
229 return button; 229 return button;
230 } 230 }
231 231
232 LauncherButton::LauncherButton(views::ButtonListener* listener, 232 LauncherButton::LauncherButton(views::ButtonListener* listener,
233 LauncherButtonHost* host, 233 ShelfButtonHost* host,
234 ShelfLayoutManager* shelf_layout_manager) 234 ShelfLayoutManager* shelf_layout_manager)
235 : CustomButton(listener), 235 : CustomButton(listener),
236 host_(host), 236 host_(host),
237 icon_view_(NULL), 237 icon_view_(NULL),
238 bar_(new BarView(this)), 238 bar_(new BarView(this)),
239 state_(STATE_NORMAL), 239 state_(STATE_NORMAL),
240 shelf_layout_manager_(shelf_layout_manager), 240 shelf_layout_manager_(shelf_layout_manager),
241 destroyed_flag_(NULL) { 241 destroyed_flag_(NULL) {
242 set_accessibility_focusable(true); 242 set_accessibility_focusable(true);
243 243
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 destroyed_flag_ = NULL; 348 destroyed_flag_ = NULL;
349 // The menu will not propagate mouse events while its shown. To address, 349 // The menu will not propagate mouse events while its shown. To address,
350 // the hover state gets cleared once the menu was shown (and this was not 350 // the hover state gets cleared once the menu was shown (and this was not
351 // destroyed). 351 // destroyed).
352 ClearState(STATE_HOVERED); 352 ClearState(STATE_HOVERED);
353 } 353 }
354 } 354 }
355 355
356 bool LauncherButton::OnMousePressed(const ui::MouseEvent& event) { 356 bool LauncherButton::OnMousePressed(const ui::MouseEvent& event) {
357 CustomButton::OnMousePressed(event); 357 CustomButton::OnMousePressed(event);
358 host_->PointerPressedOnButton(this, LauncherButtonHost::MOUSE, event); 358 host_->PointerPressedOnButton(this, ShelfButtonHost::MOUSE, event);
359 return true; 359 return true;
360 } 360 }
361 361
362 void LauncherButton::OnMouseReleased(const ui::MouseEvent& event) { 362 void LauncherButton::OnMouseReleased(const ui::MouseEvent& event) {
363 CustomButton::OnMouseReleased(event); 363 CustomButton::OnMouseReleased(event);
364 host_->PointerReleasedOnButton(this, LauncherButtonHost::MOUSE, false); 364 host_->PointerReleasedOnButton(this, ShelfButtonHost::MOUSE, false);
365 } 365 }
366 366
367 void LauncherButton::OnMouseCaptureLost() { 367 void LauncherButton::OnMouseCaptureLost() {
368 ClearState(STATE_HOVERED); 368 ClearState(STATE_HOVERED);
369 host_->PointerReleasedOnButton(this, LauncherButtonHost::MOUSE, true); 369 host_->PointerReleasedOnButton(this, ShelfButtonHost::MOUSE, true);
370 CustomButton::OnMouseCaptureLost(); 370 CustomButton::OnMouseCaptureLost();
371 } 371 }
372 372
373 bool LauncherButton::OnMouseDragged(const ui::MouseEvent& event) { 373 bool LauncherButton::OnMouseDragged(const ui::MouseEvent& event) {
374 CustomButton::OnMouseDragged(event); 374 CustomButton::OnMouseDragged(event);
375 host_->PointerDraggedOnButton(this, LauncherButtonHost::MOUSE, event); 375 host_->PointerDraggedOnButton(this, ShelfButtonHost::MOUSE, event);
376 return true; 376 return true;
377 } 377 }
378 378
379 void LauncherButton::OnMouseMoved(const ui::MouseEvent& event) { 379 void LauncherButton::OnMouseMoved(const ui::MouseEvent& event) {
380 CustomButton::OnMouseMoved(event); 380 CustomButton::OnMouseMoved(event);
381 host_->MouseMovedOverButton(this); 381 host_->MouseMovedOverButton(this);
382 } 382 }
383 383
384 void LauncherButton::OnMouseEntered(const ui::MouseEvent& event) { 384 void LauncherButton::OnMouseEntered(const ui::MouseEvent& event) {
385 AddState(STATE_HOVERED); 385 AddState(STATE_HOVERED);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 474
475 void LauncherButton::OnGestureEvent(ui::GestureEvent* event) { 475 void LauncherButton::OnGestureEvent(ui::GestureEvent* event) {
476 switch (event->type()) { 476 switch (event->type()) {
477 case ui::ET_GESTURE_TAP_DOWN: 477 case ui::ET_GESTURE_TAP_DOWN:
478 AddState(STATE_HOVERED); 478 AddState(STATE_HOVERED);
479 return CustomButton::OnGestureEvent(event); 479 return CustomButton::OnGestureEvent(event);
480 case ui::ET_GESTURE_END: 480 case ui::ET_GESTURE_END:
481 ClearState(STATE_HOVERED); 481 ClearState(STATE_HOVERED);
482 return CustomButton::OnGestureEvent(event); 482 return CustomButton::OnGestureEvent(event);
483 case ui::ET_GESTURE_SCROLL_BEGIN: 483 case ui::ET_GESTURE_SCROLL_BEGIN:
484 host_->PointerPressedOnButton(this, LauncherButtonHost::TOUCH, *event); 484 host_->PointerPressedOnButton(this, ShelfButtonHost::TOUCH, *event);
485 event->SetHandled(); 485 event->SetHandled();
486 return; 486 return;
487 case ui::ET_GESTURE_SCROLL_UPDATE: 487 case ui::ET_GESTURE_SCROLL_UPDATE:
488 host_->PointerDraggedOnButton(this, LauncherButtonHost::TOUCH, *event); 488 host_->PointerDraggedOnButton(this, ShelfButtonHost::TOUCH, *event);
489 event->SetHandled(); 489 event->SetHandled();
490 return; 490 return;
491 case ui::ET_GESTURE_SCROLL_END: 491 case ui::ET_GESTURE_SCROLL_END:
492 case ui::ET_SCROLL_FLING_START: 492 case ui::ET_SCROLL_FLING_START:
493 host_->PointerReleasedOnButton(this, LauncherButtonHost::TOUCH, false); 493 host_->PointerReleasedOnButton(this, ShelfButtonHost::TOUCH, false);
494 event->SetHandled(); 494 event->SetHandled();
495 return; 495 return;
496 default: 496 default:
497 return CustomButton::OnGestureEvent(event); 497 return CustomButton::OnGestureEvent(event);
498 } 498 }
499 } 499 }
500 500
501 void LauncherButton::Init() { 501 void LauncherButton::Init() {
502 icon_view_ = CreateIconView(); 502 icon_view_ = CreateIconView();
503 503
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 views::ImageView::CENTER, 577 views::ImageView::CENTER,
578 views::ImageView::LEADING)); 578 views::ImageView::LEADING));
579 bar_->SchedulePaint(); 579 bar_->SchedulePaint();
580 } 580 }
581 581
582 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); 582 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL);
583 } 583 }
584 584
585 } // namespace internal 585 } // namespace internal
586 } // namespace ash 586 } // namespace ash
OLDNEW
« no previous file with comments | « ash/launcher/launcher_button.h ('k') | ash/launcher/launcher_button_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698