OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/input_method_menu_button.h" | 5 #include "chrome/browser/chromeos/status/input_method_menu_button.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 } // namespace | 35 } // namespace |
36 | 36 |
37 namespace chromeos { | 37 namespace chromeos { |
38 | 38 |
39 //////////////////////////////////////////////////////////////////////////////// | 39 //////////////////////////////////////////////////////////////////////////////// |
40 // InputMethodMenuButton | 40 // InputMethodMenuButton |
41 | 41 |
42 InputMethodMenuButton::InputMethodMenuButton(StatusAreaHost* host) | 42 InputMethodMenuButton::InputMethodMenuButton(StatusAreaHost* host) |
43 : StatusAreaButton(this), | 43 : StatusAreaButton(this), |
44 InputMethodMenu(GetPrefService(host), | 44 InputMethodMenu(GetPrefService(host), |
45 host->IsBrowserMode(), | 45 host->GetScreenMode(), |
46 host->IsScreenLockerMode(), | 46 false /* for_out_of_box_experience_dialog */), |
47 false /* is_out_of_box_experience_mode */), | |
48 host_(host) { | 47 host_(host) { |
49 set_border(NULL); | 48 set_border(NULL); |
50 set_use_menu_button_paint(true); | 49 set_use_menu_button_paint(true); |
51 SetFont(ResourceBundle::GetSharedInstance().GetFont( | 50 SetFont(ResourceBundle::GetSharedInstance().GetFont( |
52 ResourceBundle::BaseFont).DeriveFont(kFontSizeDelta)); | 51 ResourceBundle::BaseFont).DeriveFont(kFontSizeDelta)); |
53 SetEnabledColor(0xB3FFFFFF); // White with 70% Alpha | 52 SetEnabledColor(0xB3FFFFFF); // White with 70% Alpha |
54 SetDisabledColor(0x00FFFFFF); // White with 00% Alpha (invisible) | 53 SetDisabledColor(0x00FFFFFF); // White with 00% Alpha (invisible) |
55 SetShowMultipleIconStates(false); | 54 SetShowMultipleIconStates(false); |
56 set_alignment(TextButton::ALIGN_CENTER); | 55 set_alignment(TextButton::ALIGN_CENTER); |
57 | 56 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 void InputMethodMenuButton::UpdateUI(const std::string& input_method_id, | 104 void InputMethodMenuButton::UpdateUI(const std::string& input_method_id, |
106 const std::wstring& name, | 105 const std::wstring& name, |
107 const std::wstring& tooltip, | 106 const std::wstring& tooltip, |
108 size_t num_active_input_methods) { | 107 size_t num_active_input_methods) { |
109 // Hide the button only if there is only one input method, and the input | 108 // Hide the button only if there is only one input method, and the input |
110 // method is a XKB keyboard layout. We don't hide the button for other | 109 // method is a XKB keyboard layout. We don't hide the button for other |
111 // types of input methods as these might have intra input method modes, | 110 // types of input methods as these might have intra input method modes, |
112 // like Hiragana and Katakana modes in Japanese input methods. | 111 // like Hiragana and Katakana modes in Japanese input methods. |
113 if (num_active_input_methods == 1 && | 112 if (num_active_input_methods == 1 && |
114 input_method::IsKeyboardLayout(input_method_id) && | 113 input_method::IsKeyboardLayout(input_method_id) && |
115 host_->IsBrowserMode()) { | 114 host_->GetScreenMode() == StatusAreaHost::kBrowserMode) { |
116 // As the disabled color is set to invisible, disabling makes the | 115 // As the disabled color is set to invisible, disabling makes the |
117 // button disappear. | 116 // button disappear. |
118 SetEnabled(false); | 117 SetEnabled(false); |
119 SetTooltipText(L""); // remove tooltip | 118 SetTooltipText(L""); // remove tooltip |
120 } else { | 119 } else { |
121 SetEnabled(true); | 120 SetEnabled(true); |
122 SetTooltipText(tooltip); | 121 SetTooltipText(tooltip); |
123 } | 122 } |
124 SetText(name); | 123 SetText(name); |
125 SchedulePaint(); | 124 SchedulePaint(); |
126 } | 125 } |
127 | 126 |
128 void InputMethodMenuButton::OpenConfigUI() { | 127 void InputMethodMenuButton::OpenConfigUI() { |
129 host_->OpenButtonOptions(this); // ask browser to open the DOMUI page. | 128 host_->OpenButtonOptions(this); // ask browser to open the DOMUI page. |
130 } | 129 } |
131 | 130 |
132 bool InputMethodMenuButton::ShouldSupportConfigUI() { | 131 bool InputMethodMenuButton::ShouldSupportConfigUI() { |
133 return host_->ShouldOpenButtonOptions(this); | 132 return host_->ShouldOpenButtonOptions(this); |
134 } | 133 } |
135 | 134 |
136 } // namespace chromeos | 135 } // namespace chromeos |
OLD | NEW |