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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 views::View* child = CreateViewForItem(*i); | 277 views::View* child = CreateViewForItem(*i); |
278 child->SetPaintToLayer(true); | 278 child->SetPaintToLayer(true); |
279 view_model_->Add(child, static_cast<int>(i - items.begin())); | 279 view_model_->Add(child, static_cast<int>(i - items.begin())); |
280 AddChildView(child); | 280 AddChildView(child); |
281 } | 281 } |
282 | 282 |
283 overflow_button_ = new views::ImageButton(this); | 283 overflow_button_ = new views::ImageButton(this); |
284 overflow_button_->set_accessibility_focusable(true); | 284 overflow_button_->set_accessibility_focusable(true); |
285 overflow_button_->SetImage( | 285 overflow_button_->SetImage( |
286 views::CustomButton::BS_NORMAL, | 286 views::CustomButton::BS_NORMAL, |
287 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToSkBitmap()); | 287 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToImageSkia()); |
288 overflow_button_->SetImage( | 288 overflow_button_->SetImage( |
289 views::CustomButton::BS_HOT, | 289 views::CustomButton::BS_HOT, |
290 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_HOT).ToSkBitmap()); | 290 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_HOT).ToImageSkia()); |
291 overflow_button_->SetImage( | 291 overflow_button_->SetImage( |
292 views::CustomButton::BS_PUSHED, | 292 views::CustomButton::BS_PUSHED, |
293 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_PUSHED).ToSkBitmap()); | 293 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_PUSHED).ToImageSkia()); |
294 overflow_button_->SetAccessibleName( | 294 overflow_button_->SetAccessibleName( |
295 l10n_util::GetStringUTF16(IDS_AURA_LAUNCHER_OVERFLOW_NAME)); | 295 l10n_util::GetStringUTF16(IDS_AURA_LAUNCHER_OVERFLOW_NAME)); |
296 overflow_button_->set_context_menu_controller(this); | 296 overflow_button_->set_context_menu_controller(this); |
297 ConfigureChildView(overflow_button_); | 297 ConfigureChildView(overflow_button_); |
298 AddChildView(overflow_button_); | 298 AddChildView(overflow_button_); |
299 | 299 |
300 // We'll layout when our bounds change. | 300 // We'll layout when our bounds change. |
301 } | 301 } |
302 | 302 |
303 void LauncherView::SetAlignment(ShelfAlignment alignment) { | 303 void LauncherView::SetAlignment(ShelfAlignment alignment) { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 view = button; | 467 view = button; |
468 break; | 468 break; |
469 } | 469 } |
470 | 470 |
471 case TYPE_APP_LIST: { | 471 case TYPE_APP_LIST: { |
472 // TODO[dave] turn this into a LauncherButton too. | 472 // TODO[dave] turn this into a LauncherButton too. |
473 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 473 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
474 views::ImageButton* button = new views::ImageButton(this); | 474 views::ImageButton* button = new views::ImageButton(this); |
475 button->SetImage( | 475 button->SetImage( |
476 views::CustomButton::BS_NORMAL, | 476 views::CustomButton::BS_NORMAL, |
477 rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST).ToSkBitmap()); | 477 rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST).ToImageSkia()); |
478 button->SetImage( | 478 button->SetImage( |
479 views::CustomButton::BS_HOT, | 479 views::CustomButton::BS_HOT, |
480 rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_HOT).ToSkBitmap()); | 480 rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_HOT). |
| 481 ToImageSkia()); |
481 button->SetImage( | 482 button->SetImage( |
482 views::CustomButton::BS_PUSHED, | 483 views::CustomButton::BS_PUSHED, |
483 rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_PUSHED).ToSkBitmap()); | 484 rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_PUSHED). |
| 485 ToImageSkia()); |
484 button->SetAccessibleName( | 486 button->SetAccessibleName( |
485 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE)); | 487 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE)); |
486 button->SetTooltipText( | 488 button->SetTooltipText( |
487 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE)); | 489 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE)); |
488 view = button; | 490 view = button; |
489 break; | 491 break; |
490 } | 492 } |
491 | 493 |
492 case TYPE_BROWSER_SHORTCUT: { | 494 case TYPE_BROWSER_SHORTCUT: { |
493 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 495 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
494 LauncherButton* button = LauncherButton::Create(this, this); | 496 LauncherButton* button = LauncherButton::Create(this, this); |
495 int image_id = delegate_ ? | 497 int image_id = delegate_ ? |
496 delegate_->GetBrowserShortcutResourceId() : | 498 delegate_->GetBrowserShortcutResourceId() : |
497 IDR_AURA_LAUNCHER_BROWSER_SHORTCUT; | 499 IDR_AURA_LAUNCHER_BROWSER_SHORTCUT; |
498 button->SetImage(*rb.GetImageNamed(image_id).ToSkBitmap()); | 500 button->SetImage(*rb.GetImageNamed(image_id).ToImageSkia()); |
499 view = button; | 501 view = button; |
500 break; | 502 break; |
501 } | 503 } |
502 | 504 |
503 default: | 505 default: |
504 break; | 506 break; |
505 } | 507 } |
506 view->set_context_menu_controller(this); | 508 view->set_context_menu_controller(this); |
507 | 509 |
508 DCHECK(view); | 510 DCHECK(view); |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 source->GetWidget(), NULL, gfx::Rect(point, gfx::Size()), | 975 source->GetWidget(), NULL, gfx::Rect(point, gfx::Size()), |
974 views::MenuItemView::TOPLEFT, 0) == views::MenuRunner::MENU_DELETED) | 976 views::MenuItemView::TOPLEFT, 0) == views::MenuRunner::MENU_DELETED) |
975 return; | 977 return; |
976 | 978 |
977 Shell::GetInstance()->UpdateShelfVisibility(); | 979 Shell::GetInstance()->UpdateShelfVisibility(); |
978 #endif | 980 #endif |
979 } | 981 } |
980 | 982 |
981 } // namespace internal | 983 } // namespace internal |
982 } // namespace ash | 984 } // namespace ash |
OLD | NEW |