| 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_view.h" | 5 #include "ash/launcher/launcher_view.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher_button.h" | 7 #include "ash/launcher/launcher_button.h" |
| 8 #include "ash/launcher/launcher_delegate.h" | 8 #include "ash/launcher/launcher_delegate.h" |
| 9 #include "ash/launcher/launcher_icon_observer.h" | 9 #include "ash/launcher/launcher_icon_observer.h" |
| 10 #include "ash/launcher/launcher_model.h" | 10 #include "ash/launcher/launcher_model.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 views::View* child = CreateViewForItem(*i); | 269 views::View* child = CreateViewForItem(*i); |
| 270 child->SetPaintToLayer(true); | 270 child->SetPaintToLayer(true); |
| 271 view_model_->Add(child, static_cast<int>(i - items.begin())); | 271 view_model_->Add(child, static_cast<int>(i - items.begin())); |
| 272 AddChildView(child); | 272 AddChildView(child); |
| 273 } | 273 } |
| 274 | 274 |
| 275 overflow_button_ = new views::ImageButton(this); | 275 overflow_button_ = new views::ImageButton(this); |
| 276 overflow_button_->set_accessibility_focusable(true); | 276 overflow_button_->set_accessibility_focusable(true); |
| 277 overflow_button_->SetImage( | 277 overflow_button_->SetImage( |
| 278 views::CustomButton::BS_NORMAL, | 278 views::CustomButton::BS_NORMAL, |
| 279 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToSkBitmap()); | 279 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToImageSkia()); |
| 280 overflow_button_->SetImage( | 280 overflow_button_->SetImage( |
| 281 views::CustomButton::BS_HOT, | 281 views::CustomButton::BS_HOT, |
| 282 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_HOT).ToSkBitmap()); | 282 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_HOT).ToImageSkia()); |
| 283 overflow_button_->SetImage( | 283 overflow_button_->SetImage( |
| 284 views::CustomButton::BS_PUSHED, | 284 views::CustomButton::BS_PUSHED, |
| 285 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_PUSHED).ToSkBitmap()); | 285 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_PUSHED).ToImageSkia()); |
| 286 overflow_button_->SetAccessibleName( | 286 overflow_button_->SetAccessibleName( |
| 287 l10n_util::GetStringUTF16(IDS_AURA_LAUNCHER_OVERFLOW_NAME)); | 287 l10n_util::GetStringUTF16(IDS_AURA_LAUNCHER_OVERFLOW_NAME)); |
| 288 overflow_button_->set_context_menu_controller(this); | 288 overflow_button_->set_context_menu_controller(this); |
| 289 ConfigureChildView(overflow_button_); | 289 ConfigureChildView(overflow_button_); |
| 290 AddChildView(overflow_button_); | 290 AddChildView(overflow_button_); |
| 291 | 291 |
| 292 // We'll layout when our bounds change. | 292 // We'll layout when our bounds change. |
| 293 } | 293 } |
| 294 | 294 |
| 295 void LauncherView::SetAlignment(ShelfAlignment alignment) { | 295 void LauncherView::SetAlignment(ShelfAlignment alignment) { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 view = button; | 459 view = button; |
| 460 break; | 460 break; |
| 461 } | 461 } |
| 462 | 462 |
| 463 case TYPE_APP_LIST: { | 463 case TYPE_APP_LIST: { |
| 464 // TODO[dave] turn this into a LauncherButton too. | 464 // TODO[dave] turn this into a LauncherButton too. |
| 465 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 465 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 466 views::ImageButton* button = new views::ImageButton(this); | 466 views::ImageButton* button = new views::ImageButton(this); |
| 467 button->SetImage( | 467 button->SetImage( |
| 468 views::CustomButton::BS_NORMAL, | 468 views::CustomButton::BS_NORMAL, |
| 469 rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST).ToSkBitmap()); | 469 rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST).ToImageSkia()); |
| 470 button->SetImage( | 470 button->SetImage( |
| 471 views::CustomButton::BS_HOT, | 471 views::CustomButton::BS_HOT, |
| 472 rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_HOT).ToSkBitmap()); | 472 rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_HOT). |
| 473 ToImageSkia()); |
| 473 button->SetImage( | 474 button->SetImage( |
| 474 views::CustomButton::BS_PUSHED, | 475 views::CustomButton::BS_PUSHED, |
| 475 rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_PUSHED).ToSkBitmap()); | 476 rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_PUSHED). |
| 477 ToImageSkia()); |
| 476 button->SetAccessibleName( | 478 button->SetAccessibleName( |
| 477 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE)); | 479 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE)); |
| 478 button->SetTooltipText( | 480 button->SetTooltipText( |
| 479 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE)); | 481 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE)); |
| 480 view = button; | 482 view = button; |
| 481 break; | 483 break; |
| 482 } | 484 } |
| 483 | 485 |
| 484 case TYPE_BROWSER_SHORTCUT: { | 486 case TYPE_BROWSER_SHORTCUT: { |
| 485 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 487 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 486 LauncherButton* button = LauncherButton::Create(this, this); | 488 LauncherButton* button = LauncherButton::Create(this, this); |
| 487 int image_id = delegate_ ? | 489 int image_id = delegate_ ? |
| 488 delegate_->GetBrowserShortcutResourceId() : | 490 delegate_->GetBrowserShortcutResourceId() : |
| 489 IDR_AURA_LAUNCHER_BROWSER_SHORTCUT; | 491 IDR_AURA_LAUNCHER_BROWSER_SHORTCUT; |
| 490 button->SetImage(*rb.GetImageNamed(image_id).ToSkBitmap()); | 492 button->SetImage(*rb.GetImageNamed(image_id).ToImageSkia()); |
| 491 view = button; | 493 view = button; |
| 492 break; | 494 break; |
| 493 } | 495 } |
| 494 | 496 |
| 495 default: | 497 default: |
| 496 break; | 498 break; |
| 497 } | 499 } |
| 498 view->set_context_menu_controller(this); | 500 view->set_context_menu_controller(this); |
| 499 | 501 |
| 500 DCHECK(view); | 502 DCHECK(view); |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 source->GetWidget(), NULL, gfx::Rect(point, gfx::Size()), | 972 source->GetWidget(), NULL, gfx::Rect(point, gfx::Size()), |
| 971 views::MenuItemView::TOPLEFT, 0) == views::MenuRunner::MENU_DELETED) | 973 views::MenuItemView::TOPLEFT, 0) == views::MenuRunner::MENU_DELETED) |
| 972 return; | 974 return; |
| 973 | 975 |
| 974 Shell::GetInstance()->UpdateShelfVisibility(); | 976 Shell::GetInstance()->UpdateShelfVisibility(); |
| 975 #endif | 977 #endif |
| 976 } | 978 } |
| 977 | 979 |
| 978 } // namespace internal | 980 } // namespace internal |
| 979 } // namespace ash | 981 } // namespace ash |
| OLD | NEW |