Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: chrome/browser/chromeos/status/accessibility_menu_button.cc

Issue 8585031: [cros, Aura] Make screen_mode static variable in StatusAreaViewChromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/accessibility_util.h" 9 #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
10 #include "chrome/browser/chromeos/status/status_area_bubble.h" 10 #include "chrome/browser/chromeos/status/status_area_bubble.h"
11 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
11 #include "chrome/browser/chromeos/view_ids.h" 12 #include "chrome/browser/chromeos/view_ids.h"
12 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
14 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
15 #include "content/public/browser/notification_details.h" 16 #include "content/public/browser/notification_details.h"
16 #include "grit/generated_resources.h" 17 #include "grit/generated_resources.h"
17 #include "grit/theme_resources.h" 18 #include "grit/theme_resources.h"
18 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
21 #include "ui/views/widget/widget.h" 22 #include "ui/views/widget/widget.h"
22 #include "views/controls/image_view.h" 23 #include "views/controls/image_view.h"
23 #include "views/controls/menu/menu_item_view.h" 24 #include "views/controls/menu/menu_item_view.h"
24 #include "views/controls/menu/menu_runner.h" 25 #include "views/controls/menu/menu_runner.h"
25 26
26 namespace { 27 namespace {
27 28
28 enum MenuItemID { 29 enum MenuItemID {
29 MENU_ITEM_DISABLE_SPOKEN_FEEDBACK, 30 MENU_ITEM_DISABLE_SPOKEN_FEEDBACK,
30 }; 31 };
31 32
32 } // namespace 33 } // namespace
33 34
34 namespace chromeos { 35 namespace chromeos {
35 36
36 //////////////////////////////////////////////////////////////////////////////// 37 ////////////////////////////////////////////////////////////////////////////////
37 // AccessibilityMenuButton 38 // AccessibilityMenuButton
38 39
39 AccessibilityMenuButton::AccessibilityMenuButton( 40 AccessibilityMenuButton::AccessibilityMenuButton(
40 StatusAreaButton::Delegate* delegate, 41 StatusAreaButton::Delegate* delegate)
41 StatusAreaViewChromeos::ScreenMode screen_mode) 42 : StatusAreaButton(delegate, this) {
42 : StatusAreaButton(delegate, this),
43 screen_mode_(screen_mode) {
44 set_id(VIEW_ID_STATUS_BUTTON_ACCESSIBILITY); 43 set_id(VIEW_ID_STATUS_BUTTON_ACCESSIBILITY);
45 accessibility_enabled_.Init(prefs::kAccessibilityEnabled, 44 accessibility_enabled_.Init(prefs::kAccessibilityEnabled,
46 g_browser_process->local_state(), this); 45 g_browser_process->local_state(), this);
47 SetIcon(*ResourceBundle::GetSharedInstance().GetBitmapNamed( 46 SetIcon(*ResourceBundle::GetSharedInstance().GetBitmapNamed(
48 IDR_STATUSBAR_ACCESSIBILITY)); 47 IDR_STATUSBAR_ACCESSIBILITY));
49 Update(); 48 Update();
50 } 49 }
51 50
52 AccessibilityMenuButton::~AccessibilityMenuButton() { 51 AccessibilityMenuButton::~AccessibilityMenuButton() {
53 } 52 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 int type, 87 int type,
89 const content::NotificationSource& source, 88 const content::NotificationSource& source,
90 const content::NotificationDetails& details) { 89 const content::NotificationDetails& details) {
91 if (type == chrome::NOTIFICATION_PREF_CHANGED) { 90 if (type == chrome::NOTIFICATION_PREF_CHANGED) {
92 Update(); 91 Update();
93 const std::string path = 92 const std::string path =
94 *static_cast<content::Details<std::string> >(details).ptr(); 93 *static_cast<content::Details<std::string> >(details).ptr();
95 // Show a bubble when accessibility is turned on at the login screen. 94 // Show a bubble when accessibility is turned on at the login screen.
96 if (path == prefs::kAccessibilityEnabled) { 95 if (path == prefs::kAccessibilityEnabled) {
97 if (accessibility_enabled_.GetValue() && 96 if (accessibility_enabled_.GetValue() &&
98 screen_mode_ == StatusAreaViewChromeos::LOGIN_MODE_WEBUI) { 97 StatusAreaViewChromeos::IsLoginMode()) {
99 views::ImageView* icon_view = new views::ImageView; 98 views::ImageView* icon_view = new views::ImageView;
100 const gfx::Image& image = ResourceBundle::GetSharedInstance(). 99 const gfx::Image& image = ResourceBundle::GetSharedInstance().
101 GetImageNamed(IDR_ACCESSIBILITY_ICON); 100 GetImageNamed(IDR_ACCESSIBILITY_ICON);
102 icon_view->SetImage(image.ToSkBitmap()); 101 icon_view->SetImage(image.ToSkBitmap());
103 bubble_controller_.reset( 102 bubble_controller_.reset(
104 StatusAreaBubbleController::ShowBubbleUnderViewForAWhile( 103 StatusAreaBubbleController::ShowBubbleUnderViewForAWhile(
105 this, new StatusAreaBubbleContentView( 104 this, new StatusAreaBubbleContentView(
106 icon_view, 105 icon_view,
107 l10n_util::GetStringUTF16( 106 l10n_util::GetStringUTF16(
108 IDS_STATUSBAR_ACCESSIBILITY_TURNED_ON_BUBBLE)))); 107 IDS_STATUSBAR_ACCESSIBILITY_TURNED_ON_BUBBLE))));
(...skipping 19 matching lines...) Expand all
128 views::MenuItemView* menu = new views::MenuItemView(this); 127 views::MenuItemView* menu = new views::MenuItemView(this);
129 if (accessibility_enabled_.GetValue()) 128 if (accessibility_enabled_.GetValue())
130 menu->AppendMenuItemWithLabel( 129 menu->AppendMenuItemWithLabel(
131 MENU_ITEM_DISABLE_SPOKEN_FEEDBACK, 130 MENU_ITEM_DISABLE_SPOKEN_FEEDBACK,
132 l10n_util::GetStringUTF16(IDS_STATUSBAR_DISABLE_SPOKEN_FEEDBACK)); 131 l10n_util::GetStringUTF16(IDS_STATUSBAR_DISABLE_SPOKEN_FEEDBACK));
133 // |menu_runner_| takes the ownership of |menu| 132 // |menu_runner_| takes the ownership of |menu|
134 menu_runner_.reset(new views::MenuRunner(menu)); 133 menu_runner_.reset(new views::MenuRunner(menu));
135 } 134 }
136 135
137 } // namespace chromeos 136 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/accessibility_menu_button.h ('k') | chrome/browser/chromeos/status/input_method_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698