OLD | NEW |
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/launcher/launcher_button_host.h" | 9 #include "ash/launcher/launcher_button_host.h" |
10 #include "grit/ash_resources.h" | 10 #include "grit/ash_resources.h" |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 return host_->GetShelfAlignment() == SHELF_ALIGNMENT_BOTTOM; | 347 return host_->GetShelfAlignment() == SHELF_ALIGNMENT_BOTTOM; |
348 } | 348 } |
349 | 349 |
350 void LauncherButton::UpdateState() { | 350 void LauncherButton::UpdateState() { |
351 if (state_ == STATE_NORMAL) { | 351 if (state_ == STATE_NORMAL) { |
352 bar_->SetVisible(false); | 352 bar_->SetVisible(false); |
353 } else { | 353 } else { |
354 int bar_id; | 354 int bar_id; |
355 if (IsShelfHorizontal()) { | 355 if (IsShelfHorizontal()) { |
356 if (state_ & STATE_ACTIVE) | 356 if (state_ & STATE_ACTIVE) |
357 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_ACTIVE; | 357 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_BOTTOM_ACTIVE; |
358 else if (state_ & (STATE_HOVERED | STATE_FOCUSED | STATE_ATTENTION)) | 358 else if (state_ & (STATE_HOVERED | STATE_FOCUSED | STATE_ATTENTION)) |
359 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_HOVER; | 359 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_BOTTOM_HOVER; |
360 else | 360 else |
361 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_RUNNING; | 361 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_BOTTOM_RUNNING; |
362 } else { | 362 } else { |
363 if (state_ & STATE_ACTIVE) | 363 if (state_ & STATE_ACTIVE) |
364 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_VERTICAL_ACTIVE; | 364 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_LEFT_ACTIVE; |
365 else if (state_ & (STATE_HOVERED | STATE_FOCUSED | STATE_ATTENTION)) | 365 else if (state_ & (STATE_HOVERED | STATE_FOCUSED | STATE_ATTENTION)) |
366 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_VERTICAL_HOVER; | 366 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_LEFT_HOVER; |
367 else | 367 else |
368 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_VERTICAL_RUNNING; | 368 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_LEFT_RUNNING; |
369 } | 369 } |
370 | 370 |
371 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 371 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
372 bar_->SetImage(rb.GetImageNamed(bar_id).ToImageSkia()); | 372 bar_->SetImage(rb.GetImageNamed(bar_id).ToImageSkia()); |
373 bar_->SetVisible(true); | 373 bar_->SetVisible(true); |
374 } | 374 } |
375 | 375 |
376 switch (host_->GetShelfAlignment()) { | 376 switch (host_->GetShelfAlignment()) { |
377 case SHELF_ALIGNMENT_BOTTOM: | 377 case SHELF_ALIGNMENT_BOTTOM: |
378 bar_->SetHorizontalAlignment(views::ImageView::CENTER); | 378 bar_->SetHorizontalAlignment(views::ImageView::CENTER); |
(...skipping 12 matching lines...) Expand all Loading... |
391 bar_->SetVerticalAlignment(views::ImageView::CENTER); | 391 bar_->SetVerticalAlignment(views::ImageView::CENTER); |
392 break; | 392 break; |
393 } | 393 } |
394 | 394 |
395 Layout(); | 395 Layout(); |
396 SchedulePaint(); | 396 SchedulePaint(); |
397 } | 397 } |
398 | 398 |
399 } // namespace internal | 399 } // namespace internal |
400 } // namespace ash | 400 } // namespace ash |
OLD | NEW |