| 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 // TrayPopupHeaderButton | 324 // TrayPopupHeaderButton |
| 325 | 325 |
| 326 TrayPopupHeaderButton::TrayPopupHeaderButton(views::ButtonListener* listener, | 326 TrayPopupHeaderButton::TrayPopupHeaderButton(views::ButtonListener* listener, |
| 327 int enabled_resource_id, | 327 int enabled_resource_id, |
| 328 int disabled_resource_id, | 328 int disabled_resource_id, |
| 329 int enabled_resource_id_hover, | 329 int enabled_resource_id_hover, |
| 330 int disabled_resource_id_hover) | 330 int disabled_resource_id_hover) |
| 331 : views::ToggleImageButton(listener) { | 331 : views::ToggleImageButton(listener) { |
| 332 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 332 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 333 SetImage(views::CustomButton::BS_NORMAL, | 333 SetImage(views::CustomButton::BS_NORMAL, |
| 334 bundle.GetImageNamed(enabled_resource_id).ToSkBitmap()); | 334 bundle.GetImageNamed(enabled_resource_id).ToImageSkia()); |
| 335 SetToggledImage(views::CustomButton::BS_NORMAL, | 335 SetToggledImage(views::CustomButton::BS_NORMAL, |
| 336 bundle.GetImageNamed(disabled_resource_id).ToSkBitmap()); | 336 bundle.GetImageNamed(disabled_resource_id).ToImageSkia()); |
| 337 SetImage(views::CustomButton::BS_HOT, | 337 SetImage(views::CustomButton::BS_HOT, |
| 338 bundle.GetImageNamed(enabled_resource_id_hover).ToSkBitmap()); | 338 bundle.GetImageNamed(enabled_resource_id_hover).ToImageSkia()); |
| 339 SetToggledImage(views::CustomButton::BS_HOT, | 339 SetToggledImage(views::CustomButton::BS_HOT, |
| 340 bundle.GetImageNamed(disabled_resource_id_hover).ToSkBitmap()); | 340 bundle.GetImageNamed(disabled_resource_id_hover).ToImageSkia()); |
| 341 SetImageAlignment(views::ImageButton::ALIGN_CENTER, | 341 SetImageAlignment(views::ImageButton::ALIGN_CENTER, |
| 342 views::ImageButton::ALIGN_MIDDLE); | 342 views::ImageButton::ALIGN_MIDDLE); |
| 343 set_focusable(true); | 343 set_focusable(true); |
| 344 | 344 |
| 345 // TODO(sad): Turn animation back on once there are proper assets. | 345 // TODO(sad): Turn animation back on once there are proper assets. |
| 346 // http://crbug.com/119832 | 346 // http://crbug.com/119832 |
| 347 set_animate_on_state_change(false); | 347 set_animate_on_state_change(false); |
| 348 } | 348 } |
| 349 | 349 |
| 350 TrayPopupHeaderButton::~TrayPopupHeaderButton() {} | 350 TrayPopupHeaderButton::~TrayPopupHeaderButton() {} |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 } | 464 } |
| 465 | 465 |
| 466 void TrayNotificationView::InitView(views::View* contents) { | 466 void TrayNotificationView::InitView(views::View* contents) { |
| 467 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); | 467 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); |
| 468 | 468 |
| 469 views::GridLayout* layout = new views::GridLayout(this); | 469 views::GridLayout* layout = new views::GridLayout(this); |
| 470 SetLayoutManager(layout); | 470 SetLayoutManager(layout); |
| 471 | 471 |
| 472 views::ImageButton* close_button = new views::ImageButton(this); | 472 views::ImageButton* close_button = new views::ImageButton(this); |
| 473 close_button->SetImage(views::CustomButton::BS_NORMAL, | 473 close_button->SetImage(views::CustomButton::BS_NORMAL, |
| 474 ResourceBundle::GetSharedInstance().GetBitmapNamed( | 474 ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 475 IDR_AURA_WINDOW_CLOSE)); | 475 IDR_AURA_WINDOW_CLOSE)); |
| 476 | 476 |
| 477 int contents_width = kTrayPopupWidth - kNotificationCloseButtonWidth; | 477 int contents_width = kTrayPopupWidth - kNotificationCloseButtonWidth; |
| 478 views::ColumnSet* columns = layout->AddColumnSet(0); | 478 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 479 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::FILL, | 479 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::FILL, |
| 480 0, /* resize percent */ | 480 0, /* resize percent */ |
| 481 views::GridLayout::FIXED, | 481 views::GridLayout::FIXED, |
| 482 contents_width, | 482 contents_width, |
| 483 contents_width); | 483 contents_width); |
| 484 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, | 484 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 495 TrayNotificationView::~TrayNotificationView() { | 495 TrayNotificationView::~TrayNotificationView() { |
| 496 } | 496 } |
| 497 | 497 |
| 498 void TrayNotificationView::ButtonPressed(views::Button* sender, | 498 void TrayNotificationView::ButtonPressed(views::Button* sender, |
| 499 const views::Event& event) { | 499 const views::Event& event) { |
| 500 OnClose(); | 500 OnClose(); |
| 501 } | 501 } |
| 502 | 502 |
| 503 } // namespace internal | 503 } // namespace internal |
| 504 } // namespace ash | 504 } // namespace ash |
| OLD | NEW |