| 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/system/tray/tray_views.h" | 5 #include "ash/system/tray/tray_views.h" |
| 6 | 6 |
| 7 #include "ash/system/tray/tray_constants.h" | 7 #include "ash/system/tray/tray_constants.h" |
| 8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
| 9 #include "grit/ash_strings.h" | 9 #include "grit/ash_strings.h" |
| 10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 // TrayPopupHeaderButton | 319 // TrayPopupHeaderButton |
| 320 | 320 |
| 321 TrayPopupHeaderButton::TrayPopupHeaderButton(views::ButtonListener* listener, | 321 TrayPopupHeaderButton::TrayPopupHeaderButton(views::ButtonListener* listener, |
| 322 int enabled_resource_id, | 322 int enabled_resource_id, |
| 323 int disabled_resource_id, | 323 int disabled_resource_id, |
| 324 int enabled_resource_id_hover, | 324 int enabled_resource_id_hover, |
| 325 int disabled_resource_id_hover) | 325 int disabled_resource_id_hover) |
| 326 : views::ToggleImageButton(listener) { | 326 : views::ToggleImageButton(listener) { |
| 327 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 327 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 328 SetImage(views::CustomButton::BS_NORMAL, | 328 SetImage(views::CustomButton::BS_NORMAL, |
| 329 bundle.GetImageNamed(enabled_resource_id).ToSkBitmap()); | 329 bundle.GetImageNamed(enabled_resource_id).ToImageSkia()); |
| 330 SetToggledImage(views::CustomButton::BS_NORMAL, | 330 SetToggledImage(views::CustomButton::BS_NORMAL, |
| 331 bundle.GetImageNamed(disabled_resource_id).ToSkBitmap()); | 331 bundle.GetImageNamed(disabled_resource_id).ToImageSkia()); |
| 332 SetImage(views::CustomButton::BS_HOT, | 332 SetImage(views::CustomButton::BS_HOT, |
| 333 bundle.GetImageNamed(enabled_resource_id_hover).ToSkBitmap()); | 333 bundle.GetImageNamed(enabled_resource_id_hover).ToImageSkia()); |
| 334 SetToggledImage(views::CustomButton::BS_HOT, | 334 SetToggledImage(views::CustomButton::BS_HOT, |
| 335 bundle.GetImageNamed(disabled_resource_id_hover).ToSkBitmap()); | 335 bundle.GetImageNamed(disabled_resource_id_hover).ToImageSkia()); |
| 336 SetImageAlignment(views::ImageButton::ALIGN_CENTER, | 336 SetImageAlignment(views::ImageButton::ALIGN_CENTER, |
| 337 views::ImageButton::ALIGN_MIDDLE); | 337 views::ImageButton::ALIGN_MIDDLE); |
| 338 set_focusable(true); | 338 set_focusable(true); |
| 339 | 339 |
| 340 // TODO(sad): Turn animation back on once there are proper assets. | 340 // TODO(sad): Turn animation back on once there are proper assets. |
| 341 // http://crbug.com/119832 | 341 // http://crbug.com/119832 |
| 342 set_animate_on_state_change(false); | 342 set_animate_on_state_change(false); |
| 343 } | 343 } |
| 344 | 344 |
| 345 TrayPopupHeaderButton::~TrayPopupHeaderButton() {} | 345 TrayPopupHeaderButton::~TrayPopupHeaderButton() {} |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 void TrayNotificationView::InitView(views::View* contents) { | 461 void TrayNotificationView::InitView(views::View* contents) { |
| 462 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); | 462 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); |
| 463 | 463 |
| 464 views::GridLayout* layout = new views::GridLayout(this); | 464 views::GridLayout* layout = new views::GridLayout(this); |
| 465 SetLayoutManager(layout); | 465 SetLayoutManager(layout); |
| 466 | 466 |
| 467 AddChildView(contents); | 467 AddChildView(contents); |
| 468 | 468 |
| 469 views::ImageButton* close_button = new views::ImageButton(this); | 469 views::ImageButton* close_button = new views::ImageButton(this); |
| 470 close_button->SetImage(views::CustomButton::BS_NORMAL, | 470 close_button->SetImage(views::CustomButton::BS_NORMAL, |
| 471 ResourceBundle::GetSharedInstance().GetBitmapNamed( | 471 ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 472 IDR_AURA_WINDOW_CLOSE)); | 472 IDR_AURA_WINDOW_CLOSE)); |
| 473 AddChildView(close_button); | 473 AddChildView(close_button); |
| 474 | 474 |
| 475 int contents_width = kTrayPopupWidth - kNotificationCloseButtonWidth; | 475 int contents_width = kTrayPopupWidth - kNotificationCloseButtonWidth; |
| 476 views::ColumnSet* columns = layout->AddColumnSet(0); | 476 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 477 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::FILL, | 477 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::FILL, |
| 478 0, /* resize percent */ | 478 0, /* resize percent */ |
| 479 views::GridLayout::FIXED, | 479 views::GridLayout::FIXED, |
| 480 contents_width, | 480 contents_width, |
| 481 contents_width); | 481 contents_width); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 493 TrayNotificationView::~TrayNotificationView() { | 493 TrayNotificationView::~TrayNotificationView() { |
| 494 } | 494 } |
| 495 | 495 |
| 496 void TrayNotificationView::ButtonPressed(views::Button* sender, | 496 void TrayNotificationView::ButtonPressed(views::Button* sender, |
| 497 const views::Event& event) { | 497 const views::Event& event) { |
| 498 OnClose(); | 498 OnClose(); |
| 499 } | 499 } |
| 500 | 500 |
| 501 } // namespace internal | 501 } // namespace internal |
| 502 } // namespace ash | 502 } // namespace ash |
| OLD | NEW |