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 auto title_label = | 153 auto 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( | 155 title_label->SetBorder( |
156 views::CreateEmptyBorder(0, kMenuEdgeEffectivePadding, 1, 0)); | 156 views::CreateEmptyBorder(0, kMenuEdgeEffectivePadding, 1, 0)); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 bool show_voice_button, | 275 bool show_voice_button, |
276 bool show_settings_button) { | 276 bool show_settings_button) { |
277 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { | 277 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
278 auto* box_layout = | 278 auto* box_layout = |
279 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); | 279 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); |
280 box_layout->set_minimum_cross_axis_size( | 280 box_layout->set_minimum_cross_axis_size( |
281 GetTrayConstant(TRAY_POPUP_ITEM_MIN_HEIGHT)); | 281 GetTrayConstant(TRAY_POPUP_ITEM_MIN_HEIGHT)); |
282 SetLayoutManager(box_layout); | 282 SetLayoutManager(box_layout); |
283 SetBorder(views::CreatePaddedBorder( | 283 SetBorder(views::CreatePaddedBorder( |
284 views::CreateSolidSidedBorder(kSeparatorWidth, 0, 0, 0, | 284 views::CreateSolidSidedBorder(kSeparatorWidth, 0, 0, 0, |
285 kHorizontalSeparatorColor), | 285 kMenuSeparatorColor), |
286 gfx::Insets(kMenuSeparatorVerticalPadding - kSeparatorWidth, | 286 gfx::Insets(kMenuSeparatorVerticalPadding - kSeparatorWidth, |
287 GetTrayConstant(TRAY_POPUP_ITEM_LEFT_INSET)))); | 287 GetTrayConstant(TRAY_POPUP_ITEM_LEFT_INSET)))); |
288 } else { | 288 } else { |
289 auto* box_layout = | 289 auto* box_layout = |
290 new views::BoxLayout(views::BoxLayout::kHorizontal, 4, 4, 0); | 290 new views::BoxLayout(views::BoxLayout::kHorizontal, 4, 4, 0); |
291 set_background( | 291 set_background( |
292 views::Background::CreateSolidBackground(kHeaderBackgroundColor)); | 292 views::Background::CreateSolidBackground(kHeaderBackgroundColor)); |
293 box_layout->SetDefaultFlex(1); | 293 box_layout->SetDefaultFlex(1); |
294 SetLayoutManager(box_layout); | 294 SetLayoutManager(box_layout); |
295 } | 295 } |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 WmShell::Get()->system_tray_delegate()->GetCurrentIME(¤t_ime_); | 648 WmShell::Get()->system_tray_delegate()->GetCurrentIME(¤t_ime_); |
649 | 649 |
650 // Updates the tray label based on the current input method. | 650 // Updates the tray label based on the current input method. |
651 if (current_ime_.third_party) | 651 if (current_ime_.third_party) |
652 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); | 652 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); |
653 else | 653 else |
654 label_->SetText(current_ime_.short_name); | 654 label_->SetText(current_ime_.short_name); |
655 } | 655 } |
656 | 656 |
657 } // namespace ash | 657 } // namespace ash |
OLD | NEW |