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

Unified Diff: ash/system/tray/tray_popup_label_button_border.cc

Issue 2066583004: mash: Move most files in //ash/system/tray to //ash/common/system/tray (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@trayupdatemove
Patch Set: rebase Created 4 years, 6 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/system/tray/tray_popup_label_button_border.h ('k') | ash/system/tray/view_click_listener.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/tray_popup_label_button_border.cc
diff --git a/ash/system/tray/tray_popup_label_button_border.cc b/ash/system/tray/tray_popup_label_button_border.cc
deleted file mode 100644
index 90c94018f008a0419fccde5dbcfeef310c73e2a4..0000000000000000000000000000000000000000
--- a/ash/system/tray/tray_popup_label_button_border.cc
+++ /dev/null
@@ -1,99 +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/system/tray/tray_popup_label_button_border.h"
-
-#include "base/i18n/rtl.h"
-#include "grit/ash_resources.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/geometry/vector2d.h"
-#include "ui/native_theme/native_theme.h"
-#include "ui/views/controls/button/label_button.h"
-#include "ui/views/native_theme_delegate.h"
-
-namespace ash {
-
-TrayPopupLabelButtonBorder::TrayPopupLabelButtonBorder()
- : LabelButtonAssetBorder(views::Button::STYLE_TEXTBUTTON) {
- const int kTrayPopupLabelButtonBorderImagesNormal[] = {
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_BORDER,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_BORDER,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_BORDER,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_NORMAL_BACKGROUND,
- };
- SetPainter(false, views::Button::STATE_NORMAL,
- views::Painter::CreateImageGridPainter(
- kTrayPopupLabelButtonBorderImagesNormal));
- SetPainter(false, views::Button::STATE_DISABLED,
- views::Painter::CreateImageGridPainter(
- kTrayPopupLabelButtonBorderImagesNormal));
-
- const int kTrayPopupLabelButtonBorderImagesHovered[] = {
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_BORDER,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_BORDER,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_BORDER,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_BORDER,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_HOVER_BACKGROUND,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_BORDER,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_BORDER,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_BORDER,
- IDR_AURA_TRAY_POPUP_LABEL_BUTTON_BORDER,
- };
- SetPainter(false, views::Button::STATE_HOVERED,
- views::Painter::CreateImageGridPainter(
- kTrayPopupLabelButtonBorderImagesHovered));
- SetPainter(false, views::Button::STATE_PRESSED,
- views::Painter::CreateImageGridPainter(
- kTrayPopupLabelButtonBorderImagesHovered));
-
- const int kTrayPopupLabelButtonPaddingHorizontal = 16;
- const int kTrayPopupLabelButtonPaddingVertical = 8;
- set_insets(gfx::Insets(kTrayPopupLabelButtonPaddingVertical,
- kTrayPopupLabelButtonPaddingHorizontal,
- kTrayPopupLabelButtonPaddingVertical,
- kTrayPopupLabelButtonPaddingHorizontal));
-}
-
-TrayPopupLabelButtonBorder::~TrayPopupLabelButtonBorder() {}
-
-void TrayPopupLabelButtonBorder::Paint(const views::View& view,
- gfx::Canvas* canvas) {
- const views::NativeThemeDelegate* native_theme_delegate =
- static_cast<const views::LabelButton*>(&view);
- ui::NativeTheme::ExtraParams extra;
- const ui::NativeTheme::State state =
- native_theme_delegate->GetThemeState(&extra);
- if (state == ui::NativeTheme::kNormal ||
- state == ui::NativeTheme::kDisabled) {
- // In normal and disabled state, the border is a vertical bar separating the
- // button from the preceding sibling. If this button is its parent's first
- // visible child, the separator bar should be omitted.
- const views::View* first_visible_child = NULL;
- for (int i = 0; i < view.parent()->child_count(); ++i) {
- const views::View* child = view.parent()->child_at(i);
- if (child->visible()) {
- first_visible_child = child;
- break;
- }
- }
- if (first_visible_child == &view)
- return;
- }
- if (base::i18n::IsRTL()) {
- canvas->Save();
- canvas->Translate(gfx::Vector2d(view.width(), 0));
- canvas->Scale(-1, 1);
- LabelButtonAssetBorder::Paint(view, canvas);
- canvas->Restore();
- } else {
- LabelButtonAssetBorder::Paint(view, canvas);
- }
-}
-
-} // namespace ash
« no previous file with comments | « ash/system/tray/tray_popup_label_button_border.h ('k') | ash/system/tray/view_click_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698