Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: ash/common/system/tray/tray_popup_header_button.cc

Issue 2734653002: chromeos: Move files in //ash/common to //ash (Closed)
Patch Set: fix a11y tests, fix docs Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/common/system/tray/tray_popup_header_button.cc
diff --git a/ash/common/system/tray/tray_popup_header_button.cc b/ash/common/system/tray/tray_popup_header_button.cc
deleted file mode 100644
index 07334c6cbdcfab93b2a9ffac8d2fd5c2ca2d85a2..0000000000000000000000000000000000000000
--- a/ash/common/system/tray/tray_popup_header_button.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/common/system/tray/tray_popup_header_button.h"
-
-#include "ash/common/ash_constants.h"
-#include "ash/common/system/tray/tray_constants.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/views/background.h"
-#include "ui/views/painter.h"
-
-namespace ash {
-
-namespace {
-
-const gfx::ImageSkia* GetImageForResourceId(int resource_id) {
- ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
- return bundle.GetImageNamed(resource_id).ToImageSkia();
-}
-
-} // namespace
-
-// static
-const char TrayPopupHeaderButton::kViewClassName[] =
- "tray/TrayPopupHeaderButton";
-
-TrayPopupHeaderButton::TrayPopupHeaderButton(views::ButtonListener* listener,
- const gfx::ImageSkia& icon,
- int accessible_name_id)
- : views::ToggleImageButton(listener) {
- Initialize(icon, accessible_name_id);
-}
-
-TrayPopupHeaderButton::TrayPopupHeaderButton(views::ButtonListener* listener,
- int enabled_resource_id,
- int disabled_resource_id,
- int enabled_resource_id_hover,
- int disabled_resource_id_hover,
- int accessible_name_id)
- : views::ToggleImageButton(listener) {
- Initialize(*GetImageForResourceId(enabled_resource_id), accessible_name_id);
- ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
- SetToggledImage(views::Button::STATE_NORMAL,
- bundle.GetImageNamed(disabled_resource_id).ToImageSkia());
- SetImage(views::Button::STATE_HOVERED,
- *bundle.GetImageNamed(enabled_resource_id_hover).ToImageSkia());
- SetToggledImage(
- views::Button::STATE_HOVERED,
- bundle.GetImageNamed(disabled_resource_id_hover).ToImageSkia());
-}
-
-TrayPopupHeaderButton::~TrayPopupHeaderButton() {}
-
-const char* TrayPopupHeaderButton::GetClassName() const {
- return kViewClassName;
-}
-
-gfx::Size TrayPopupHeaderButton::GetPreferredSize() const {
- return gfx::Size(kTrayPopupItemMinHeight, kTrayPopupItemMinHeight);
-}
-
-void TrayPopupHeaderButton::StateChanged(ButtonState old_state) {
- if (state() == STATE_HOVERED || state() == STATE_PRESSED) {
- set_background(views::Background::CreateSolidBackground(
- kTrayPopupHoverBackgroundColor));
- } else {
- set_background(nullptr);
- }
- SchedulePaint();
-}
-
-void TrayPopupHeaderButton::Initialize(const gfx::ImageSkia& icon,
- int accessible_name_id) {
- ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
- SetImage(views::Button::STATE_NORMAL, icon);
- SetImageAlignment(views::ImageButton::ALIGN_CENTER,
- views::ImageButton::ALIGN_MIDDLE);
- SetAccessibleName(bundle.GetLocalizedString(accessible_name_id));
- SetFocusForPlatform();
-
- SetFocusPainter(views::Painter::CreateSolidFocusPainter(
- kFocusBorderColor, gfx::Insets(1, 2, 2, 3)));
-}
-
-} // namespace ash
« no previous file with comments | « ash/common/system/tray/tray_popup_header_button.h ('k') | ash/common/system/tray/tray_popup_ink_drop_style.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698