Commit f87b6bda authored by Jazz Xu's avatar Jazz Xu Committed by Commit Bot

CrOS GMC: Remove media controls chip view.

Remove media controls chip view since they're implemented in
ash/system/media/.

Change-Id: I3b91ca767f5cbae1e14937a0c6a7f327b1ff6aa1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2466351Reviewed-by: default avatarTim Song <tengs@chromium.org>
Commit-Queue: Jazz Xu <jazzhsu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816706}
parent cf64cb34
......@@ -1327,8 +1327,6 @@ component("ash") {
"system/unified/ime_mode_view.h",
"system/unified/managed_device_tray_item_view.cc",
"system/unified/managed_device_tray_item_view.h",
"system/unified/media_controls_chip_view.cc",
"system/unified/media_controls_chip_view.h",
"system/unified/notification_counter_view.cc",
"system/unified/notification_counter_view.h",
"system/unified/notification_hidden_view.cc",
......
// Copyright 2020 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/system/unified/media_controls_chip_view.h"
#include "ash/style/ash_color_provider.h"
#include "ui/gfx/canvas.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h"
namespace ash {
namespace {
constexpr int kMediaControlsChipContainerRadius = 8;
constexpr gfx::Insets kMediaControlsChipViewPadding(8, 16, 11, 16);
constexpr gfx::Insets kMediaControlsChipContainerPadding(8);
constexpr int kMediaControlsChipSpacing = 16;
} // namespace
MediaControlsChipView::MediaControlsChipView()
: artwork_view_(new views::ImageView),
title_artist_view_(new views::View),
title_label_(new views::Label),
artist_label_(new views::Label) {
auto* container = SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kHorizontal,
kMediaControlsChipViewPadding + kMediaControlsChipContainerPadding,
kMediaControlsChipSpacing));
container->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::kCenter);
AddChildView(artwork_view_);
auto* title_artist_container =
title_artist_view_->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical, gfx::Insets(), 0));
title_artist_container->set_main_axis_alignment(
views::BoxLayout::MainAxisAlignment::kCenter);
title_artist_container->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::kStart);
title_label_->SetAutoColorReadabilityEnabled(false);
title_label_->SetSubpixelRenderingEnabled(false);
title_label_->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorPrimary));
title_artist_view_->AddChildView(title_label_);
artist_label_->SetAutoColorReadabilityEnabled(false);
artist_label_->SetSubpixelRenderingEnabled(false);
artist_label_->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorSecondary));
title_artist_view_->AddChildView(artist_label_);
AddChildView(title_artist_view_);
}
MediaControlsChipView::~MediaControlsChipView() {}
void MediaControlsChipView::OnPaintBackground(gfx::Canvas* canvas) {
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setColor(AshColorProvider::Get()->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive));
gfx::Rect bounds = GetContentsBounds();
bounds.Inset(kMediaControlsChipViewPadding);
canvas->DrawRoundRect(bounds, kMediaControlsChipContainerRadius, flags);
views::View::OnPaintBackground(canvas);
}
void MediaControlsChipView::SetExpandedAmount(double expanded_amount) {
DCHECK(0.0 <= expanded_amount && expanded_amount <= 1.0);
SetVisible(expanded_amount > 0.0);
InvalidateLayout();
// TODO(leandre): add animation and opacity when collapsing/expanding the
// tray.
}
const char* MediaControlsChipView::GetClassName() const {
return "MediaControlsChipView";
}
} // namespace ash
// Copyright 2020 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.
#ifndef ASH_SYSTEM_UNIFIED_MEDIA_CONTROLS_CHIP_VIEW_H_
#define ASH_SYSTEM_UNIFIED_MEDIA_CONTROLS_CHIP_VIEW_H_
#include "ash/ash_export.h"
#include "services/media_session/public/mojom/media_session.mojom.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/view.h"
namespace views {
class Label;
class ImageView;
} // namespace views
namespace ash {
// A media controls chip in UnifiedSystemTray bubble. It shows
// information and basic controls of the media currently playing.
class ASH_EXPORT MediaControlsChipView : public views::View {
public:
MediaControlsChipView();
~MediaControlsChipView() override;
MediaControlsChipView(MediaControlsChipView&) = delete;
MediaControlsChipView operator=(MediaControlsChipView&) = delete;
// views::View:
void OnPaintBackground(gfx::Canvas* canvas) override;
// Change the expanded state. 0.0 if collapsed, and 1.0 if expanded.
// Otherwise, it shows intermediate state. If collapsed, the media controls
// are hidden.
void SetExpandedAmount(double expanded_amount);
const char* GetClassName() const override;
private:
views::ImageView* artwork_view_ = nullptr;
views::View* title_artist_view_ = nullptr;
views::Label* title_label_ = nullptr;
views::Label* artist_label_ = nullptr;
};
} // namespace ash
#endif // ASH_SYSTEM_UNIFIED_MEDIA_CONTROLS_CHIP_VIEW_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment