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

Unified Diff: ash/common/system/tray/tray_details_view.h

Issue 2289223002: Make TrayDetailsView a ViewClickListener and ButtonListener (Closed)
Patch Set: fix test Created 4 years, 3 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/ime/tray_ime_chromeos.cc ('k') | ash/common/system/tray/tray_details_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/tray/tray_details_view.h
diff --git a/ash/common/system/tray/tray_details_view.h b/ash/common/system/tray/tray_details_view.h
index 1cf8eaaf470df3e6c0d0888bb16dac2196db3fa6..c08382891f1a18dc1682480fd9ad3e5f374e2c5f 100644
--- a/ash/common/system/tray/tray_details_view.h
+++ b/ash/common/system/tray/tray_details_view.h
@@ -7,27 +7,51 @@
#include "ash/ash_export.h"
#include "ash/common/system/tray/special_popup_row.h"
+#include "ash/common/system/tray/view_click_listener.h"
#include "base/macros.h"
+#include "ui/views/controls/button/button.h"
#include "ui/views/view.h"
namespace views {
class ScrollView;
-}
+} // namespace views
namespace ash {
+namespace test {
+class TrayDetailsViewTest;
+} // namespace test
+
class FixedSizedScrollView;
class ScrollBorder;
class SystemTrayItem;
-class ViewClickListener;
-class ASH_EXPORT TrayDetailsView : public views::View {
+class ASH_EXPORT TrayDetailsView : public views::View,
+ public ViewClickListener,
+ public views::ButtonListener {
public:
explicit TrayDetailsView(SystemTrayItem* owner);
~TrayDetailsView() override;
- // Creates a row with special highlighting etc. This is typically the
- // bottom-most row in the popup.
- void CreateSpecialRow(int string_id, ViewClickListener* listener);
+ // ViewClickListener:
+ void OnViewClicked(views::View* sender) override;
+
+ // views::ButtonListener:
+ void ButtonPressed(views::Button* sender, const ui::Event& event) override;
+
+ SystemTrayItem* owner() { return owner_; }
+ SpecialPopupRow* title_row() { return title_row_; }
+ FixedSizedScrollView* scroller() { return scroller_; }
+ views::View* scroll_content() { return scroll_content_; }
+
+ protected:
+ // views::View:
+ void Layout() override;
+ void OnPaintBorder(gfx::Canvas* canvas) override;
+
+ // Creates the row containing the back button and title. For material design
+ // this appears at the top of the view, for non-material design it appears
+ // at the bottom.
+ void CreateTitleRow(int string_id);
// Creates a scrollable list. The list has a border at the bottom if there is
// any other view between the list and the footer row at the bottom.
@@ -39,24 +63,26 @@ class ASH_EXPORT TrayDetailsView : public views::View {
// Removes (and destroys) all child views.
void Reset();
- // Transition to default view from details view. If |footer_| has focus before
- // transition, the default view should focus on the owner of this details
- // view.
- void TransitionToDefaultView();
+ private:
+ friend class test::TrayDetailsViewTest;
- SystemTrayItem* owner() const { return owner_; }
- SpecialPopupRow* footer() const { return footer_; }
- FixedSizedScrollView* scroller() const { return scroller_; }
- views::View* scroll_content() const { return scroll_content_; }
+ // Overridden to handle clicks on subclass-specific views.
+ virtual void HandleViewClicked(views::View* view);
- protected:
- // Overridden from views::View.
- void Layout() override;
- void OnPaintBorder(gfx::Canvas* canvas) override;
+ // Overridden to handle button presses on subclass-specific buttons.
+ virtual void HandleButtonPressed(views::Button* sender,
+ const ui::Event& event);
+
+ // Creates and adds subclass-specific buttons to the title row.
+ virtual void CreateExtraTitleRowButtons();
+
+ // Transition to default view from details view. If |title_row_| has focus
+ // before transition, the default view should focus on the owner of this
+ // details view.
+ void TransitionToDefaultView();
- private:
SystemTrayItem* owner_;
- SpecialPopupRow* footer_;
+ SpecialPopupRow* title_row_;
FixedSizedScrollView* scroller_;
views::View* scroll_content_;
ScrollBorder* scroll_border_; // Weak reference
« no previous file with comments | « ash/common/system/ime/tray_ime_chromeos.cc ('k') | ash/common/system/tray/tray_details_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698