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

Unified Diff: ash/common/system/user/button_from_view.cc

Issue 2678353005: Remove pre-MD code related to tray/menu user profiles. (Closed)
Patch Set: back out a11y changes and rebase 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
« no previous file with comments | « ash/common/system/user/button_from_view.h ('k') | ash/common/system/user/rounded_image_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/user/button_from_view.cc
diff --git a/ash/common/system/user/button_from_view.cc b/ash/common/system/user/button_from_view.cc
index fd249d60a395eb4f52ab35c4dc1923f145ea07e4..69f352c145fc53b9af411a912556b3e4175c8a68 100644
--- a/ash/common/system/user/button_from_view.cc
+++ b/ash/common/system/user/button_from_view.cc
@@ -7,7 +7,6 @@
#include "ash/common/system/user/button_from_view.h"
#include "ash/common/ash_constants.h"
-#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/system/tray/tray_constants.h"
#include "ash/common/system/tray/tray_popup_utils.h"
#include "ash/common/system/tray/tray_utils.h"
@@ -20,47 +19,26 @@
#include "ui/views/animation/ink_drop_highlight.h"
#include "ui/views/animation/ink_drop_impl.h"
#include "ui/views/animation/ink_drop_mask.h"
-#include "ui/views/background.h"
-#include "ui/views/border.h"
-#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
namespace ash {
namespace tray {
-namespace {
-
-// The border color of the user button.
-const SkColor kBorderColor = 0xffdcdcdc;
-
-} // namespace
-
ButtonFromView::ButtonFromView(views::View* content,
views::ButtonListener* listener,
- TrayPopupInkDropStyle ink_drop_style,
- bool highlight_on_hover,
- const gfx::Insets& tab_frame_inset)
+ TrayPopupInkDropStyle ink_drop_style)
: CustomButton(listener),
content_(content),
ink_drop_style_(ink_drop_style),
- highlight_on_hover_(highlight_on_hover),
button_hovered_(false),
- show_border_(false),
- tab_frame_inset_(tab_frame_inset),
ink_drop_container_(nullptr) {
set_has_ink_drop_action_on_click(true);
set_notify_enter_exit_on_child(true);
- if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
- ink_drop_container_ = new views::InkDropContainerView();
- AddChildView(ink_drop_container_);
- SetLayoutManager(new views::FillLayout());
- SetInkDropMode(InkDropHostView::InkDropMode::ON);
- } else {
- SetLayoutManager(
- new views::BoxLayout(views::BoxLayout::kHorizontal, 1, 1, 0));
- }
+ ink_drop_container_ = new views::InkDropContainerView();
+ AddChildView(ink_drop_container_);
+ SetLayoutManager(new views::FillLayout());
+ SetInkDropMode(InkDropHostView::InkDropMode::ON);
AddChildView(content_);
- ShowActive();
// Only make it focusable when we are active/interested in clicks.
if (listener)
SetFocusForPlatform();
@@ -68,32 +46,19 @@ ButtonFromView::ButtonFromView(views::View* content,
ButtonFromView::~ButtonFromView() {}
-void ButtonFromView::ForceBorderVisible(bool show) {
- if (MaterialDesignController::IsSystemTrayMenuMaterial())
- return;
- show_border_ = show;
- ShowActive();
-}
-
void ButtonFromView::OnMouseEntered(const ui::MouseEvent& event) {
button_hovered_ = true;
- ShowActive();
}
void ButtonFromView::OnMouseExited(const ui::MouseEvent& event) {
button_hovered_ = false;
- ShowActive();
}
void ButtonFromView::OnPaint(gfx::Canvas* canvas) {
View::OnPaint(canvas);
if (HasFocus()) {
gfx::RectF rect(GetLocalBounds());
- bool use_md = MaterialDesignController::IsSystemTrayMenuMaterial();
- if (!use_md)
- rect.Inset(gfx::InsetsF(tab_frame_inset_));
- canvas->DrawSolidFocusRect(rect, kFocusBorderColor,
- use_md ? kFocusBorderThickness : 1);
+ canvas->DrawSolidFocusRect(rect, kFocusBorderColor, kFocusBorderThickness);
}
}
@@ -162,22 +127,5 @@ std::unique_ptr<views::InkDropMask> ButtonFromView::CreateInkDropMask() const {
return TrayPopupUtils::CreateInkDropMask(ink_drop_style_, this);
}
-void ButtonFromView::ShowActive() {
- if (MaterialDesignController::IsSystemTrayMenuMaterial())
- return;
- bool border_visible =
- (button_hovered_ && highlight_on_hover_) || show_border_;
- SkColor border_color = border_visible ? kBorderColor : SK_ColorTRANSPARENT;
- SetBorder(views::CreateSolidBorder(1, border_color));
- if (highlight_on_hover_) {
- SkColor background_color =
- button_hovered_ ? kHoverBackgroundColor : kBackgroundColor;
- content_->set_background(
- views::Background::CreateSolidBackground(background_color));
- set_background(views::Background::CreateSolidBackground(background_color));
- }
- SchedulePaint();
-}
-
} // namespace tray
} // namespace ash
« no previous file with comments | « ash/common/system/user/button_from_view.h ('k') | ash/common/system/user/rounded_image_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698