Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" | 5 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | |
| 7 #include "ash/common/shelf/shelf_constants.h" | 8 #include "ash/common/shelf/shelf_constants.h" |
| 8 #include "ash/common/shelf/wm_shelf_util.h" | 9 #include "ash/common/shelf/wm_shelf_util.h" |
| 9 #include "ash/keyboard/keyboard_ui.h" | 10 #include "ash/keyboard/keyboard_ui.h" |
| 10 #include "ash/shelf/shelf.h" | 11 #include "ash/shelf/shelf.h" |
| 11 #include "ash/shelf/shelf_util.h" | 12 #include "ash/shelf/shelf_util.h" |
| 12 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 13 #include "ash/system/status_area_widget.h" | 14 #include "ash/system/status_area_widget.h" |
| 14 #include "ash/system/tray/system_tray_notifier.h" | 15 #include "ash/system/tray/system_tray_notifier.h" |
| 15 #include "ash/system/tray/tray_constants.h" | 16 #include "ash/system/tray/tray_constants.h" |
| 16 #include "ash/system/tray/tray_utils.h" | 17 #include "ash/system/tray/tray_utils.h" |
| 17 #include "grit/ash_resources.h" | 18 #include "grit/ash_resources.h" |
| 18 #include "grit/ash_strings.h" | 19 #include "grit/ash_strings.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
| 21 #include "ui/events/event.h" | 22 #include "ui/events/event.h" |
| 22 #include "ui/gfx/image/image_skia.h" | 23 #include "ui/gfx/image/image_skia.h" |
| 24 #include "ui/gfx/paint_vector_icon.h" | |
| 25 #include "ui/gfx/vector_icons_public.h" | |
| 23 #include "ui/views/controls/button/image_button.h" | 26 #include "ui/views/controls/button/image_button.h" |
| 24 | 27 |
| 25 namespace ash { | 28 namespace ash { |
| 26 | 29 |
| 27 VirtualKeyboardTray::VirtualKeyboardTray(StatusAreaWidget* status_area_widget) | 30 VirtualKeyboardTray::VirtualKeyboardTray(StatusAreaWidget* status_area_widget) |
| 28 : TrayBackgroundView(status_area_widget), | 31 : TrayBackgroundView(status_area_widget), |
| 29 button_(NULL) { | 32 button_(NULL) { |
| 30 button_ = new views::ImageButton(this); | 33 button_ = new views::ImageButton(this); |
| 31 button_->SetImage(views::CustomButton::STATE_NORMAL, | 34 if (MaterialDesignController::IsShelfMaterial()) { |
| 32 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 35 gfx::ImageSkia image_md = |
| 33 IDR_AURA_UBER_TRAY_VIRTUAL_KEYBOARD)); | 36 CreateVectorIcon(gfx::VectorIconId::SHELF_KEYBOARD, kShelfIconColor); |
| 37 button_->SetImage(views::CustomButton::STATE_NORMAL, &image_md); | |
|
James Cook
2016/06/09 23:00:09
see below
tdanderson
2016/06/09 23:51:41
In this case I'm keeping it as-is since ImageButto
James Cook
2016/06/10 00:14:40
That's OK, it's fine as it is. There seems to be a
| |
| 38 } else { | |
| 39 gfx::ImageSkia* image_non_md = | |
| 40 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | |
| 41 IDR_AURA_UBER_TRAY_VIRTUAL_KEYBOARD); | |
| 42 button_->SetImage(views::CustomButton::STATE_NORMAL, image_non_md); | |
| 43 } | |
| 34 button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, | 44 button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, |
| 35 views::ImageButton::ALIGN_MIDDLE); | 45 views::ImageButton::ALIGN_MIDDLE); |
| 36 | 46 |
| 37 tray_container()->AddChildView(button_); | 47 tray_container()->AddChildView(button_); |
| 38 SetContentsBackground(); | 48 SetContentsBackground(); |
| 39 // The Shell may not exist in some unit tests. | 49 // The Shell may not exist in some unit tests. |
| 40 if (Shell::HasInstance()) | 50 if (Shell::HasInstance()) |
| 41 Shell::GetInstance()->keyboard_ui()->AddObserver(this); | 51 Shell::GetInstance()->keyboard_ui()->AddObserver(this); |
| 42 } | 52 } |
| 43 | 53 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 const ui::Event& event) { | 106 const ui::Event& event) { |
| 97 DCHECK_EQ(button_, sender); | 107 DCHECK_EQ(button_, sender); |
| 98 PerformAction(event); | 108 PerformAction(event); |
| 99 } | 109 } |
| 100 | 110 |
| 101 void VirtualKeyboardTray::OnKeyboardEnabledStateChanged(bool new_value) { | 111 void VirtualKeyboardTray::OnKeyboardEnabledStateChanged(bool new_value) { |
| 102 SetVisible(Shell::GetInstance()->keyboard_ui()->IsEnabled()); | 112 SetVisible(Shell::GetInstance()->keyboard_ui()->IsEnabled()); |
| 103 } | 113 } |
| 104 | 114 |
| 105 } // namespace ash | 115 } // namespace ash |
| OLD | NEW |