| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CONTENT_SETTING_BUBBLE_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "components/content_settings/core/common/content_settings_types.h" | 13 #include "components/content_settings/core/common/content_settings_types.h" |
| 14 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
| 15 #include "content/public/common/media_stream_request.h" | 15 #include "content/public/common/media_stream_request.h" |
| 16 #include "ui/base/models/combobox_model.h" | 16 #include "ui/base/models/combobox_model.h" |
| 17 #include "ui/views/bubble/bubble_dialog_delegate.h" | 17 #include "ui/views/bubble/bubble_dialog_delegate.h" |
| 18 #include "ui/views/controls/button/button.h" | 18 #include "ui/views/controls/button/button.h" |
| 19 #include "ui/views/controls/combobox/combobox_listener.h" | 19 #include "ui/views/controls/combobox/combobox_listener.h" |
| 20 #include "ui/views/controls/link_listener.h" | 20 #include "ui/views/controls/link_listener.h" |
| 21 | 21 |
| 22 class ContentSettingBubbleModel; | 22 class ContentSettingBubbleModel; |
| 23 class Profile; | 23 class Profile; |
| 24 | 24 |
| 25 namespace chrome { | 25 namespace chrome { |
| 26 class ContentSettingBubbleViewsBridge; | 26 class ContentSettingBubbleViewsBridge; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace views { | 29 namespace views { |
| 30 class LabelButton; | |
| 31 class RadioButton; | 30 class RadioButton; |
| 32 } | 31 } |
| 33 | 32 |
| 34 // ContentSettingBubbleContents is used when the user turns on different kinds | 33 // ContentSettingBubbleContents is used when the user turns on different kinds |
| 35 // of content blocking (e.g. "block images"). When viewing a page with blocked | 34 // of content blocking (e.g. "block images"). When viewing a page with blocked |
| 36 // content, icons appear in the omnibox corresponding to the content types that | 35 // content, icons appear in the omnibox corresponding to the content types that |
| 37 // were blocked, and the user can click one to get a bubble hosting a few | 36 // were blocked, and the user can click one to get a bubble hosting a few |
| 38 // controls. This class provides the content of that bubble. In general, | 37 // controls. This class provides the content of that bubble. In general, |
| 39 // these bubbles typically have a title, a pair of radio buttons for toggling | 38 // these bubbles typically have a title, a pair of radio buttons for toggling |
| 40 // the blocking settings for the current site, a close button, and a link to | 39 // the blocking settings for the current site, a close button, and a link to |
| (...skipping 11 matching lines...) Expand all Loading... |
| 52 views::View* anchor_view, | 51 views::View* anchor_view, |
| 53 views::BubbleBorder::Arrow arrow); | 52 views::BubbleBorder::Arrow arrow); |
| 54 ~ContentSettingBubbleContents() override; | 53 ~ContentSettingBubbleContents() override; |
| 55 | 54 |
| 56 gfx::Size GetPreferredSize() const override; | 55 gfx::Size GetPreferredSize() const override; |
| 57 | 56 |
| 58 protected: | 57 protected: |
| 59 // views::BubbleDialogDelegateView: | 58 // views::BubbleDialogDelegateView: |
| 60 void Init() override; | 59 void Init() override; |
| 61 View* CreateExtraView() override; | 60 View* CreateExtraView() override; |
| 61 bool Accept() override; |
| 62 bool Close() override; |
| 62 int GetDialogButtons() const override; | 63 int GetDialogButtons() const override; |
| 63 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 64 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 64 | 65 |
| 65 private: | 66 private: |
| 66 // A combobox model that builds the contents of the media capture devices menu | 67 // A combobox model that builds the contents of the media capture devices menu |
| 67 // in the content setting bubble. | 68 // in the content setting bubble. |
| 68 class MediaComboboxModel : public ui::ComboboxModel { | 69 class MediaComboboxModel : public ui::ComboboxModel { |
| 69 public: | 70 public: |
| 70 explicit MediaComboboxModel(content::MediaStreamType type); | 71 explicit MediaComboboxModel(content::MediaStreamType type); |
| 71 ~MediaComboboxModel() override; | 72 ~MediaComboboxModel() override; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model_; | 110 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model_; |
| 110 | 111 |
| 111 // Some of our controls, so we can tell what's been clicked when we get a | 112 // Some of our controls, so we can tell what's been clicked when we get a |
| 112 // message. | 113 // message. |
| 113 ListItemLinks list_item_links_; | 114 ListItemLinks list_item_links_; |
| 114 typedef std::vector<views::RadioButton*> RadioGroup; | 115 typedef std::vector<views::RadioButton*> RadioGroup; |
| 115 RadioGroup radio_group_; | 116 RadioGroup radio_group_; |
| 116 views::Link* custom_link_; | 117 views::Link* custom_link_; |
| 117 views::Link* manage_link_; | 118 views::Link* manage_link_; |
| 118 views::Link* learn_more_link_; | 119 views::Link* learn_more_link_; |
| 119 views::LabelButton* close_button_; | |
| 120 | 120 |
| 121 // Combobox models the bubble owns. | 121 // Combobox models the bubble owns. |
| 122 std::list<MediaComboboxModel> combobox_models_; | 122 std::list<MediaComboboxModel> combobox_models_; |
| 123 | 123 |
| 124 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingBubbleContents); | 124 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingBubbleContents); |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 #endif // CHROME_BROWSER_UI_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_ | 127 #endif // CHROME_BROWSER_UI_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_ |
| OLD | NEW |