Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSION_SELECTOR_ROW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSION_SELECTOR_ROW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSION_SELECTOR_ROW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSION_SELECTOR_ROW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "chrome/browser/ui/views/website_settings/permission_selector_row_obser ver.h" | 14 #include "chrome/browser/ui/views/website_settings/permission_selector_row_obser ver.h" |
| 15 #include "chrome/browser/ui/website_settings/permission_menu_model.h" | 15 #include "chrome/browser/ui/website_settings/permission_menu_model.h" |
| 16 #include "chrome/browser/ui/website_settings/website_settings_ui.h" | 16 #include "chrome/browser/ui/website_settings/website_settings_ui.h" |
| 17 #include "components/content_settings/core/common/content_settings.h" | 17 #include "components/content_settings/core/common/content_settings.h" |
| 18 #include "components/content_settings/core/common/content_settings_types.h" | 18 #include "components/content_settings/core/common/content_settings_types.h" |
| 19 #include "ui/views/controls/button/menu_button_listener.h" | 19 #include "ui/views/controls/button/menu_button_listener.h" |
| 20 #include "ui/views/view.h" | 20 #include "ui/views/view.h" |
| 21 | 21 |
| 22 class Profile; | 22 class Profile; |
| 23 | 23 |
| 24 namespace internal { | 24 namespace internal { |
| 25 class ComboboxModelAdapter; | 25 class ComboboxModelAdapter; |
| 26 class PermissionCombobox; | 26 class PermissionCombobox; |
| 27 class PermissionMenuButton; | 27 class PermissionMenuButton; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace test { | |
| 31 class WebsiteSettingsPopupViewTestApi; | |
| 32 } | |
| 33 | |
| 30 namespace views { | 34 namespace views { |
| 31 class GridLayout; | 35 class GridLayout; |
| 32 class ImageView; | 36 class ImageView; |
| 37 class Label; | |
| 33 } | 38 } |
| 34 | 39 |
| 35 // A PermissionSelectorRow is a row in the Page Info bubble that shows a | 40 // A PermissionSelectorRow is a row in the Page Info bubble that shows a |
| 36 // permission that a site can have ambient access to, and allows the user to | 41 // permission that a site can have ambient access to, and allows the user to |
| 37 // control whether that access is granted. | 42 // control whether that access is granted. A PermissionSelectorRow is not itself |
| 38 class PermissionSelectorRow : public views::View { | 43 // a View, but creates some Views, which end up owned by the View hierarchy. |
| 44 class PermissionSelectorRow { | |
| 39 public: | 45 public: |
| 46 // The PermissionSelectorRow's constituent views are added to |container|. | |
| 40 PermissionSelectorRow(Profile* profile, | 47 PermissionSelectorRow(Profile* profile, |
| 41 const GURL& url, | 48 const GURL& url, |
| 42 const WebsiteSettingsUI::PermissionInfo& permission); | 49 const WebsiteSettingsUI::PermissionInfo& permission, |
| 50 views::GridLayout* container); | |
|
sky
2017/03/02 20:05:41
The name container implies a view, where as |conta
Elly Fong-Jones
2017/03/06 17:17:10
Done.
| |
| 51 virtual ~PermissionSelectorRow(); | |
| 43 | 52 |
| 44 void AddObserver(PermissionSelectorRowObserver* observer); | 53 void AddObserver(PermissionSelectorRowObserver* observer); |
| 45 | 54 |
| 46 void PermissionChanged(const WebsiteSettingsUI::PermissionInfo& permission); | 55 void PermissionChanged(const WebsiteSettingsUI::PermissionInfo& permission); |
| 47 | 56 |
| 48 protected: | |
| 49 // Overridden from views::View. | |
| 50 void ChildPreferredSizeChanged(View* child) override; | |
| 51 | |
| 52 private: | 57 private: |
| 53 ~PermissionSelectorRow() override; | 58 friend class test::WebsiteSettingsPopupViewTestApi; |
| 54 | 59 |
| 55 void InitializeMenuButtonView( | 60 void InitializeMenuButtonView( |
| 56 views::GridLayout* layout, | 61 views::GridLayout* layout, |
| 57 const WebsiteSettingsUI::PermissionInfo& permission); | 62 const WebsiteSettingsUI::PermissionInfo& permission); |
| 58 void InitializeComboboxView( | 63 void InitializeComboboxView( |
| 59 views::GridLayout* layout, | 64 views::GridLayout* layout, |
| 60 const WebsiteSettingsUI::PermissionInfo& permission); | 65 const WebsiteSettingsUI::PermissionInfo& permission); |
| 61 | 66 |
| 67 views::View* button(); | |
|
sky
2017/03/02 20:05:41
Add description of this, it isn't at all obvious t
Elly Fong-Jones
2017/03/06 17:17:10
Done.
| |
| 68 | |
| 62 Profile* profile_; | 69 Profile* profile_; |
| 63 | 70 |
| 64 // Model for the permission's menu. | 71 // Model for the permission's menu. |
| 65 std::unique_ptr<PermissionMenuModel> menu_model_; | 72 std::unique_ptr<PermissionMenuModel> menu_model_; |
| 66 std::unique_ptr<internal::ComboboxModelAdapter> combobox_model_adapter_; | 73 std::unique_ptr<internal::ComboboxModelAdapter> combobox_model_adapter_; |
| 67 | 74 |
| 68 views::ImageView* icon_; // Owned by the views hierachy. | 75 // These are all owned by the views hierarchy: |
| 69 internal::PermissionMenuButton* menu_button_; // Owned by the views hierachy. | 76 views::ImageView* icon_; |
| 70 internal::PermissionCombobox* combobox_; // Owned by the views hierarchy. | 77 views::Label* label_; |
| 78 internal::PermissionMenuButton* menu_button_; | |
| 79 internal::PermissionCombobox* combobox_; | |
| 71 | 80 |
| 72 base::ObserverList<PermissionSelectorRowObserver, false> observer_list_; | 81 base::ObserverList<PermissionSelectorRowObserver, false> observer_list_; |
| 73 | 82 |
| 74 DISALLOW_COPY_AND_ASSIGN(PermissionSelectorRow); | 83 DISALLOW_COPY_AND_ASSIGN(PermissionSelectorRow); |
| 75 }; | 84 }; |
| 76 | 85 |
| 77 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSION_SELECTOR_ROW_H_ | 86 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSION_SELECTOR_ROW_H_ |
| OLD | NEW |