OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chromeos/ime_menu/ime_menu_tray.h" | 5 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" |
6 | 6 |
7 #include "ash/common/accessibility_delegate.h" | 7 #include "ash/common/accessibility_delegate.h" |
8 #include "ash/common/ash_constants.h" | 8 #include "ash/common/ash_constants.h" |
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" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 return button; | 137 return button; |
138 } | 138 } |
139 | 139 |
140 // The view that contains IME menu title in the material design. | 140 // The view that contains IME menu title in the material design. |
141 class ImeTitleView : public views::View, public views::ButtonListener { | 141 class ImeTitleView : public views::View, public views::ButtonListener { |
142 public: | 142 public: |
143 explicit ImeTitleView(bool show_settings_button) : settings_button_(nullptr) { | 143 explicit ImeTitleView(bool show_settings_button) : settings_button_(nullptr) { |
144 SetBorder(views::CreatePaddedBorder( | 144 SetBorder(views::CreatePaddedBorder( |
145 views::CreateSolidSidedBorder(0, 0, kSeparatorWidth, 0, | 145 views::CreateSolidSidedBorder(0, 0, kSeparatorWidth, 0, |
146 kHorizontalSeparatorColor), | 146 kMenuSeparatorColor), |
147 gfx::Insets(kMenuSeparatorVerticalPadding - kSeparatorWidth, 0))); | 147 gfx::Insets(kMenuSeparatorVerticalPadding - kSeparatorWidth, 0))); |
148 auto* box_layout = | 148 auto* box_layout = |
149 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); | 149 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); |
150 box_layout->set_minimum_cross_axis_size( | 150 box_layout->set_minimum_cross_axis_size( |
151 GetTrayConstant(TRAY_POPUP_ITEM_MIN_HEIGHT)); | 151 GetTrayConstant(TRAY_POPUP_ITEM_MIN_HEIGHT)); |
152 SetLayoutManager(box_layout); | 152 SetLayoutManager(box_layout); |
153 title_label_ = | 153 title_label_ = |
154 new views::Label(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_IME)); | 154 new views::Label(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_IME)); |
155 title_label_->SetBorder(views::CreateEmptyBorder( | 155 title_label_->SetBorder(views::CreateEmptyBorder( |
156 0, kMenuEdgeEffectivePadding, kTrayMenuBottomRowPadding, 0)); | 156 0, kMenuEdgeEffectivePadding, kTrayMenuBottomRowPadding, 0)); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 bool show_voice_button, | 290 bool show_voice_button, |
291 bool show_settings_button) { | 291 bool show_settings_button) { |
292 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { | 292 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
293 auto* box_layout = | 293 auto* box_layout = |
294 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); | 294 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); |
295 box_layout->set_minimum_cross_axis_size( | 295 box_layout->set_minimum_cross_axis_size( |
296 GetTrayConstant(TRAY_POPUP_ITEM_MIN_HEIGHT)); | 296 GetTrayConstant(TRAY_POPUP_ITEM_MIN_HEIGHT)); |
297 SetLayoutManager(box_layout); | 297 SetLayoutManager(box_layout); |
298 SetBorder(views::CreatePaddedBorder( | 298 SetBorder(views::CreatePaddedBorder( |
299 views::CreateSolidSidedBorder(kSeparatorWidth, 0, 0, 0, | 299 views::CreateSolidSidedBorder(kSeparatorWidth, 0, 0, 0, |
300 kHorizontalSeparatorColor), | 300 kMenuSeparatorColor), |
301 gfx::Insets(kMenuSeparatorVerticalPadding - kSeparatorWidth, | 301 gfx::Insets(kMenuSeparatorVerticalPadding - kSeparatorWidth, |
302 GetTrayConstant(TRAY_POPUP_ITEM_LEFT_INSET)))); | 302 GetTrayConstant(TRAY_POPUP_ITEM_LEFT_INSET)))); |
303 } else { | 303 } else { |
304 auto* box_layout = | 304 auto* box_layout = |
305 new views::BoxLayout(views::BoxLayout::kHorizontal, 4, 4, 0); | 305 new views::BoxLayout(views::BoxLayout::kHorizontal, 4, 4, 0); |
306 set_background( | 306 set_background( |
307 views::Background::CreateSolidBackground(kHeaderBackgroundColor)); | 307 views::Background::CreateSolidBackground(kHeaderBackgroundColor)); |
308 box_layout->SetDefaultFlex(1); | 308 box_layout->SetDefaultFlex(1); |
309 SetLayoutManager(box_layout); | 309 SetLayoutManager(box_layout); |
310 } | 310 } |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 WmShell::Get()->system_tray_delegate()->GetCurrentIME(¤t_ime_); | 677 WmShell::Get()->system_tray_delegate()->GetCurrentIME(¤t_ime_); |
678 | 678 |
679 // Updates the tray label based on the current input method. | 679 // Updates the tray label based on the current input method. |
680 if (current_ime_.third_party) | 680 if (current_ime_.third_party) |
681 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); | 681 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); |
682 else | 682 else |
683 label_->SetText(current_ime_.short_name); | 683 label_->SetText(current_ime_.short_name); |
684 } | 684 } |
685 | 685 |
686 } // namespace ash | 686 } // namespace ash |
OLD | NEW |