OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOSEN_OBJECT_ROW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOSEN_OBJECT_ROW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOSEN_OBJECT_ROW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOSEN_OBJECT_ROW_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/browser/ui/website_settings/website_settings_ui.h" | 9 #include "chrome/browser/ui/website_settings/website_settings_ui.h" |
10 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
11 #include "ui/views/layout/grid_layout.h" | |
11 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
12 | 13 |
13 namespace views { | 14 namespace views { |
14 class ImageButton; | 15 class ImageButton; |
15 class ImageView; | 16 class ImageView; |
16 } | 17 } |
17 | 18 |
18 class ChosenObjectRowObserver; | 19 class ChosenObjectRowObserver; |
19 | 20 |
20 // A ChosenObjectRow is a row in the Page Info bubble that shows an individual | 21 // A ChosenObjectRow is a row in the Page Info bubble that shows an individual |
21 // object (e.g. a Bluetooth device, a USB device) that the current site has | 22 // object (e.g. a Bluetooth device, a USB device) that the current site has |
22 // access to. | 23 // access to. |
23 class ChosenObjectRow : public views::View, public views::ButtonListener { | 24 class ChosenObjectRow : public views::ButtonListener { |
24 public: | 25 public: |
26 // The constructor adds two views to the current row of |layout|: | |
27 // 1. An icon. | |
28 // 2. A label with a delete button. | |
25 explicit ChosenObjectRow( | 29 explicit ChosenObjectRow( |
msw
2016/09/26 20:47:55
nit: remove explicit
lgarron
2016/09/28 21:11:46
Done.
At the risk of asking in the wrong place, w
msw
2016/09/30 00:37:04
The explicit keyword is a guard against implicit c
lgarron
2016/09/30 05:05:55
Ah, that makes sense, thanks.
| |
26 std::unique_ptr<WebsiteSettingsUI::ChosenObjectInfo> info); | 30 std::unique_ptr<WebsiteSettingsUI::ChosenObjectInfo> info, |
31 views::GridLayout* layout); | |
27 | 32 |
28 void AddObserver(ChosenObjectRowObserver* observer); | 33 void AddObserver(ChosenObjectRowObserver* observer); |
29 | 34 |
30 private: | 35 private: |
31 ~ChosenObjectRow() override; | 36 ~ChosenObjectRow() override; |
32 | 37 |
33 // views::ButtonListener implementation. | 38 // views::ButtonListener implementation. |
34 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 39 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
35 | 40 |
36 views::ImageView* icon_; // Owned by the views hierarchy. | 41 views::ImageView* icon_; // Owned by the views hierarchy. |
42 views::View* label_with_delete_; // Owned by the views hierarchy. | |
37 views::ImageButton* delete_button_; // Owned by the views hierarchy. | 43 views::ImageButton* delete_button_; // Owned by the views hierarchy. |
38 | 44 |
39 base::ObserverList<ChosenObjectRowObserver> observer_list_; | 45 base::ObserverList<ChosenObjectRowObserver> observer_list_; |
40 std::unique_ptr<WebsiteSettingsUI::ChosenObjectInfo> info_; | 46 std::unique_ptr<WebsiteSettingsUI::ChosenObjectInfo> info_; |
41 | 47 |
42 DISALLOW_COPY_AND_ASSIGN(ChosenObjectRow); | 48 DISALLOW_COPY_AND_ASSIGN(ChosenObjectRow); |
43 }; | 49 }; |
44 | 50 |
45 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOSEN_OBJECT_ROW_H_ | 51 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_CHOSEN_OBJECT_ROW_H_ |
OLD | NEW |