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 "ash/common/system/ime/tray_ime_chromeos.h" | 5 #include "ash/common/system/ime/tray_ime_chromeos.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
10 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
11 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h" | 11 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h" |
12 #include "ash/common/system/tray/hover_highlight_view.h" | 12 #include "ash/common/system/tray/hover_highlight_view.h" |
13 #include "ash/common/system/tray/system_tray.h" | 13 #include "ash/common/system/tray/system_tray.h" |
14 #include "ash/common/system/tray/system_tray_delegate.h" | 14 #include "ash/common/system/tray/system_tray_delegate.h" |
15 #include "ash/common/system/tray/system_tray_notifier.h" | 15 #include "ash/common/system/tray/system_tray_notifier.h" |
16 #include "ash/common/system/tray/tray_constants.h" | 16 #include "ash/common/system/tray/tray_constants.h" |
17 #include "ash/common/system/tray/tray_details_view.h" | 17 #include "ash/common/system/tray/tray_details_view.h" |
18 #include "ash/common/system/tray/tray_item_more.h" | 18 #include "ash/common/system/tray/tray_item_more.h" |
19 #include "ash/common/system/tray/tray_item_view.h" | 19 #include "ash/common/system/tray/tray_item_view.h" |
| 20 #include "ash/common/system/tray/tray_popup_item_style.h" |
20 #include "ash/common/system/tray/tray_utils.h" | 21 #include "ash/common/system/tray/tray_utils.h" |
21 #include "ash/common/system/tray_accessibility.h" | 22 #include "ash/common/system/tray_accessibility.h" |
22 #include "ash/common/wm_shell.h" | 23 #include "ash/common/wm_shell.h" |
23 #include "ash/resources/vector_icons/vector_icons.h" | 24 #include "ash/resources/vector_icons/vector_icons.h" |
24 #include "base/logging.h" | 25 #include "base/logging.h" |
25 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
26 #include "grit/ash_resources.h" | 27 #include "grit/ash_resources.h" |
27 #include "grit/ash_strings.h" | 28 #include "grit/ash_strings.h" |
28 #include "ui/accessibility/ax_enums.h" | 29 #include "ui/accessibility/ax_enums.h" |
29 #include "ui/accessibility/ax_view_state.h" | 30 #include "ui/accessibility/ax_view_state.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 UpdateLabel(label); | 82 UpdateLabel(label); |
82 } | 83 } |
83 | 84 |
84 ~IMEDefaultView() override {} | 85 ~IMEDefaultView() override {} |
85 | 86 |
86 void UpdateLabel(const base::string16& label) { | 87 void UpdateLabel(const base::string16& label) { |
87 SetLabel(label); | 88 SetLabel(label); |
88 SetAccessibleName(label); | 89 SetAccessibleName(label); |
89 } | 90 } |
90 | 91 |
| 92 protected: |
| 93 // TrayItemMore: |
| 94 std::unique_ptr<TrayPopupItemStyle> CreateStyle() const override { |
| 95 return base::MakeUnique<TrayPopupItemStyle>( |
| 96 GetNativeTheme(), TrayPopupItemStyle::FontStyle::DEFAULT_VIEW_LABEL); |
| 97 } |
| 98 |
| 99 void UpdateStyle() override { |
| 100 TrayItemMore::UpdateStyle(); |
| 101 |
| 102 if (!MaterialDesignController::IsSystemTrayMenuMaterial()) |
| 103 return; |
| 104 |
| 105 std::unique_ptr<TrayPopupItemStyle> style = CreateStyle(); |
| 106 SetImage(gfx::CreateVectorIcon(kSystemMenuKeyboardIcon, |
| 107 style->GetForegroundColor())); |
| 108 } |
| 109 |
91 private: | 110 private: |
92 DISALLOW_COPY_AND_ASSIGN(IMEDefaultView); | 111 DISALLOW_COPY_AND_ASSIGN(IMEDefaultView); |
93 }; | 112 }; |
94 | 113 |
95 class IMEDetailedView : public ImeListView { | 114 class IMEDetailedView : public ImeListView { |
96 public: | 115 public: |
97 IMEDetailedView(SystemTrayItem* owner, | 116 IMEDetailedView(SystemTrayItem* owner, |
98 LoginStatus login, | 117 LoginStatus login, |
99 bool show_keyboard_toggle) | 118 bool show_keyboard_toggle) |
100 : ImeListView(owner, show_keyboard_toggle, ImeListView::HIDE_SINGLE_IME), | 119 : ImeListView(owner, show_keyboard_toggle, ImeListView::HIDE_SINGLE_IME), |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 else | 317 else |
299 Update(); | 318 Update(); |
300 } | 319 } |
301 | 320 |
302 bool TrayIME::ShouldDefaultViewBeVisible() { | 321 bool TrayIME::ShouldDefaultViewBeVisible() { |
303 return is_visible_ && (ime_list_.size() > 1 || property_list_.size() > 1 || | 322 return is_visible_ && (ime_list_.size() > 1 || property_list_.size() > 1 || |
304 ShouldShowKeyboardToggle()); | 323 ShouldShowKeyboardToggle()); |
305 } | 324 } |
306 | 325 |
307 } // namespace ash | 326 } // namespace ash |
OLD | NEW |