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 #include "chrome/browser/chromeos/status/accessibility_menu_button.h" | 5 #include "chrome/browser/chromeos/status/accessibility_menu_button.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/chromeos/accessibility_util.h" | 9 #include "chrome/browser/chromeos/accessibility_util.h" |
| 10 #include "chrome/browser/chromeos/view_ids.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
11 #include "chrome/common/chrome_notification_types.h" | 12 #include "chrome/common/chrome_notification_types.h" |
12 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
13 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
14 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
16 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
17 #include "views/controls/menu/menu_item_view.h" | 18 #include "views/controls/menu/menu_item_view.h" |
18 #include "views/controls/menu/menu_runner.h" | 19 #include "views/controls/menu/menu_runner.h" |
19 #include "views/widget/widget.h" | 20 #include "views/widget/widget.h" |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 enum MenuItemID { | 24 enum MenuItemID { |
24 MENU_ITEM_DISABLE_SPOKEN_FEEDBACK, | 25 MENU_ITEM_DISABLE_SPOKEN_FEEDBACK, |
25 }; | 26 }; |
26 | 27 |
27 } // namespace | 28 } // namespace |
28 | 29 |
29 namespace chromeos { | 30 namespace chromeos { |
30 | 31 |
31 //////////////////////////////////////////////////////////////////////////////// | 32 //////////////////////////////////////////////////////////////////////////////// |
32 // AccessibilityMenuButton | 33 // AccessibilityMenuButton |
33 | 34 |
34 AccessibilityMenuButton::AccessibilityMenuButton(StatusAreaHost* host) | 35 AccessibilityMenuButton::AccessibilityMenuButton( |
35 : StatusAreaButton(host, this) { | 36 StatusAreaButton::Delegate* delegate) |
| 37 : StatusAreaButton(delegate, this) { |
| 38 set_id(VIEW_ID_STATUS_BUTTON_ACCESSIBILITY); |
36 accessibility_enabled_.Init(prefs::kAccessibilityEnabled, | 39 accessibility_enabled_.Init(prefs::kAccessibilityEnabled, |
37 g_browser_process->local_state(), this); | 40 g_browser_process->local_state(), this); |
38 SetIcon(*ResourceBundle::GetSharedInstance().GetBitmapNamed( | 41 SetIcon(*ResourceBundle::GetSharedInstance().GetBitmapNamed( |
39 IDR_STATUSBAR_ACCESSIBILITY)); | 42 IDR_STATUSBAR_ACCESSIBILITY)); |
40 Update(); | 43 Update(); |
41 } | 44 } |
42 | 45 |
43 AccessibilityMenuButton::~AccessibilityMenuButton() { | 46 AccessibilityMenuButton::~AccessibilityMenuButton() { |
44 } | 47 } |
45 | 48 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 views::MenuItemView* menu = new views::MenuItemView(this); | 101 views::MenuItemView* menu = new views::MenuItemView(this); |
99 if (accessibility_enabled_.GetValue()) | 102 if (accessibility_enabled_.GetValue()) |
100 menu->AppendMenuItemWithLabel( | 103 menu->AppendMenuItemWithLabel( |
101 MENU_ITEM_DISABLE_SPOKEN_FEEDBACK, | 104 MENU_ITEM_DISABLE_SPOKEN_FEEDBACK, |
102 l10n_util::GetStringUTF16(IDS_STATUSBAR_DISABLE_SPOKEN_FEEDBACK)); | 105 l10n_util::GetStringUTF16(IDS_STATUSBAR_DISABLE_SPOKEN_FEEDBACK)); |
103 // |menu_runner_| takes the ownership of |menu| | 106 // |menu_runner_| takes the ownership of |menu| |
104 menu_runner_.reset(new views::MenuRunner(menu)); | 107 menu_runner_.reset(new views::MenuRunner(menu)); |
105 } | 108 } |
106 | 109 |
107 } // namespace chromeos | 110 } // namespace chromeos |
OLD | NEW |