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 #include "chrome/browser/ui/views/website_settings/permission_selector_view.h" | 5 #include "chrome/browser/ui/views/website_settings/permission_selector_view.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/ui/website_settings/permission_menu_model.h" | 8 #include "chrome/browser/ui/website_settings/permission_menu_model.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 "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 public views::MenuButtonListener { | 36 public views::MenuButtonListener { |
37 public: | 37 public: |
38 // Creates a new |PermissionMenuButton| with the passed |text|. The ownership | 38 // Creates a new |PermissionMenuButton| with the passed |text|. The ownership |
39 // of the |model| remains with the caller and is not transfered to the | 39 // of the |model| remains with the caller and is not transfered to the |
40 // |PermissionMenuButton|. If the |show_menu_marker| flag is true, then a | 40 // |PermissionMenuButton|. If the |show_menu_marker| flag is true, then a |
41 // small icon is be displayed next to the button |text|, indicating that the | 41 // small icon is be displayed next to the button |text|, indicating that the |
42 // button opens a drop down menu. | 42 // button opens a drop down menu. |
43 PermissionMenuButton(const base::string16& text, | 43 PermissionMenuButton(const base::string16& text, |
44 PermissionMenuModel* model, | 44 PermissionMenuModel* model, |
45 bool show_menu_marker); | 45 bool show_menu_marker); |
46 virtual ~PermissionMenuButton(); | 46 ~PermissionMenuButton() override; |
47 | 47 |
48 // Overridden from views::LabelButton. | 48 // Overridden from views::LabelButton. |
49 virtual void SetText(const base::string16& text) override; | 49 void SetText(const base::string16& text) override; |
50 | 50 |
51 // Overridden from views::View. | 51 // Overridden from views::View. |
52 virtual void GetAccessibleState(ui::AXViewState* state) override; | 52 void GetAccessibleState(ui::AXViewState* state) override; |
53 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 53 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
54 | 54 |
55 private: | 55 private: |
56 // Overridden from views::MenuButtonListener. | 56 // Overridden from views::MenuButtonListener. |
57 virtual void OnMenuButtonClicked(View* source, | 57 void OnMenuButtonClicked(View* source, const gfx::Point& point) override; |
58 const gfx::Point& point) override; | |
59 | 58 |
60 PermissionMenuModel* menu_model_; // Owned by |PermissionSelectorView|. | 59 PermissionMenuModel* menu_model_; // Owned by |PermissionSelectorView|. |
61 scoped_ptr<views::MenuRunner> menu_runner_; | 60 scoped_ptr<views::MenuRunner> menu_runner_; |
62 | 61 |
63 DISALLOW_COPY_AND_ASSIGN(PermissionMenuButton); | 62 DISALLOW_COPY_AND_ASSIGN(PermissionMenuButton); |
64 }; | 63 }; |
65 | 64 |
66 /////////////////////////////////////////////////////////////////////////////// | 65 /////////////////////////////////////////////////////////////////////////////// |
67 // PermissionMenuButton | 66 // PermissionMenuButton |
68 /////////////////////////////////////////////////////////////////////////////// | 67 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // Update the menu button text to reflect the new setting. | 212 // Update the menu button text to reflect the new setting. |
214 menu_button_->SetText(WebsiteSettingsUI::PermissionActionToUIString( | 213 menu_button_->SetText(WebsiteSettingsUI::PermissionActionToUIString( |
215 permission.setting, | 214 permission.setting, |
216 permission.default_setting, | 215 permission.default_setting, |
217 content_settings::SETTING_SOURCE_USER)); | 216 content_settings::SETTING_SOURCE_USER)); |
218 | 217 |
219 FOR_EACH_OBSERVER(PermissionSelectorViewObserver, | 218 FOR_EACH_OBSERVER(PermissionSelectorViewObserver, |
220 observer_list_, | 219 observer_list_, |
221 OnPermissionChanged(permission)); | 220 OnPermissionChanged(permission)); |
222 } | 221 } |
OLD | NEW |