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

Side by Side Diff: ash/common/system/tray/tray_details_view.h

Issue 2289223002: Make TrayDetailsView a ViewClickListener and ButtonListener (Closed)
Patch Set: CreateTitleRow() parameter removed 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ 5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_
6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/common/system/tray/special_popup_row.h" 9 #include "ash/common/system/tray/special_popup_row.h"
10 #include "ash/common/system/tray/view_click_listener.h"
10 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "ui/views/controls/button/button.h"
11 #include "ui/views/view.h" 13 #include "ui/views/view.h"
12 14
13 namespace views { 15 namespace views {
14 class ScrollView; 16 class ScrollView;
15 } 17 } // namespace views
16 18
17 namespace ash { 19 namespace ash {
20 namespace test {
21 class TrayDetailsViewTest;
22 } // namespace test
23
18 class FixedSizedScrollView; 24 class FixedSizedScrollView;
19 class ScrollBorder; 25 class ScrollBorder;
20 class SystemTrayItem; 26 class SystemTrayItem;
21 class ViewClickListener;
22 27
23 class ASH_EXPORT TrayDetailsView : public views::View { 28 class ASH_EXPORT TrayDetailsView : public views::View,
29 public ViewClickListener,
30 public views::ButtonListener {
24 public: 31 public:
25 explicit TrayDetailsView(SystemTrayItem* owner); 32 explicit TrayDetailsView(SystemTrayItem* owner);
26 ~TrayDetailsView() override; 33 ~TrayDetailsView() override;
27 34
28 // Creates a row with special highlighting etc. This is typically the 35 // ViewClickListener:
29 // bottom-most row in the popup. 36 void OnViewClicked(views::View* sender) override;
30 void CreateSpecialRow(int string_id, ViewClickListener* listener); 37
38 // views::ButtonListener:
39 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
40
41 SystemTrayItem* owner() const { return owner_; }
42 SpecialPopupRow* title_row() const { return title_row_; }
43 FixedSizedScrollView* scroller() const { return scroller_; }
44 views::View* scroll_content() const { return scroll_content_; }
oshima 2016/09/01 18:00:58 ash uses the pattern where const method should ret
tdanderson 2016/09/01 19:48:00 Sorry, I don't understand your question - It seems
oshima 2016/09/01 20:23:17 const accessor shouldn't return non const internal
45
46 protected:
47 // views::View:
48 void Layout() override;
49 void OnPaintBorder(gfx::Canvas* canvas) override;
50
51 // Creates the row containing the back button and title. For material design
52 // this appears at the top of the view, for non-material design it appears
53 // at the bottom.
54 void CreateTitleRow(int string_id);
31 55
32 // Creates a scrollable list. The list has a border at the bottom if there is 56 // Creates a scrollable list. The list has a border at the bottom if there is
33 // any other view between the list and the footer row at the bottom. 57 // any other view between the list and the footer row at the bottom.
34 void CreateScrollableList(); 58 void CreateScrollableList();
35 59
36 // Adds a separator in scrollable list. 60 // Adds a separator in scrollable list.
37 void AddScrollSeparator(); 61 void AddScrollSeparator();
38 62
39 // Removes (and destroys) all child views. 63 // Removes (and destroys) all child views.
40 void Reset(); 64 void Reset();
41 65
42 // Transition to default view from details view. If |footer_| has focus before 66 private:
43 // transition, the default view should focus on the owner of this details 67 friend class test::TrayDetailsViewTest;
44 // view. 68
69 // Overridden to handle clicks on subclass-specific views.
70 virtual void HandleViewClicked(views::View* view);
71
72 // Overridden to handle button presses on subclass-specific buttons.
73 virtual void HandleButtonPressed(views::Button* sender,
74 const ui::Event& event);
75
76 // Creates and adds subclass-specific buttons to the title row.
77 virtual void CreateExtraTitleRowButtons();
78
79 // Transition to default view from details view. If |title_row_| has focus
80 // before transition, the default view should focus on the owner of this
81 // details view.
45 void TransitionToDefaultView(); 82 void TransitionToDefaultView();
46 83
47 SystemTrayItem* owner() const { return owner_; }
48 SpecialPopupRow* footer() const { return footer_; }
49 FixedSizedScrollView* scroller() const { return scroller_; }
50 views::View* scroll_content() const { return scroll_content_; }
51
52 protected:
53 // Overridden from views::View.
54 void Layout() override;
55 void OnPaintBorder(gfx::Canvas* canvas) override;
56
57 private:
58 SystemTrayItem* owner_; 84 SystemTrayItem* owner_;
59 SpecialPopupRow* footer_; 85 SpecialPopupRow* title_row_;
60 FixedSizedScrollView* scroller_; 86 FixedSizedScrollView* scroller_;
61 views::View* scroll_content_; 87 views::View* scroll_content_;
62 ScrollBorder* scroll_border_; // Weak reference 88 ScrollBorder* scroll_border_; // Weak reference
63 89
64 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView); 90 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView);
65 }; 91 };
66 92
67 } // namespace ash 93 } // namespace ash
68 94
69 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ 95 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_
OLDNEW
« 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