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 "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // Draw the default indicator "US". The default indicator "US" is used when | 50 // Draw the default indicator "US". The default indicator "US" is used when |
51 // |pref_service| is not available (for example, unit tests) or |pref_service| | 51 // |pref_service| is not available (for example, unit tests) or |pref_service| |
52 // is available, but Chrome preferences are not available (for example, | 52 // is available, but Chrome preferences are not available (for example, |
53 // initial OS boot). | 53 // initial OS boot). |
54 InputMethodMenuButton::UpdateUI(L"US", L""); | 54 InputMethodMenuButton::UpdateUI(L"US", L""); |
55 } | 55 } |
56 | 56 |
57 //////////////////////////////////////////////////////////////////////////////// | 57 //////////////////////////////////////////////////////////////////////////////// |
58 // views::View implementation: | 58 // views::View implementation: |
59 | 59 |
| 60 gfx::Size InputMethodMenuButton::GetPreferredSize() { |
| 61 // If not enabled, then hide this button. |
| 62 if (!IsEnabled()) { |
| 63 return gfx::Size(0, 0); |
| 64 } |
| 65 return StatusAreaButton::GetPreferredSize(); |
| 66 } |
| 67 |
60 void InputMethodMenuButton::OnLocaleChanged() { | 68 void InputMethodMenuButton::OnLocaleChanged() { |
61 input_method::OnLocaleChanged(); | 69 input_method::OnLocaleChanged(); |
62 const InputMethodDescriptor& input_method = | 70 const InputMethodDescriptor& input_method = |
63 CrosLibrary::Get()->GetInputMethodLibrary()->current_input_method(); | 71 CrosLibrary::Get()->GetInputMethodLibrary()->current_input_method(); |
64 UpdateUIFromInputMethod(input_method); | 72 UpdateUIFromInputMethod(input_method); |
65 Layout(); | 73 Layout(); |
66 SchedulePaint(); | 74 SchedulePaint(); |
67 } | 75 } |
68 | 76 |
69 //////////////////////////////////////////////////////////////////////////////// | 77 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 24 matching lines...) Expand all Loading... |
94 | 102 |
95 void InputMethodMenuButton::OpenConfigUI() { | 103 void InputMethodMenuButton::OpenConfigUI() { |
96 host_->OpenButtonOptions(this); // ask browser to open the DOMUI page. | 104 host_->OpenButtonOptions(this); // ask browser to open the DOMUI page. |
97 } | 105 } |
98 | 106 |
99 bool InputMethodMenuButton::ShouldSupportConfigUI() { | 107 bool InputMethodMenuButton::ShouldSupportConfigUI() { |
100 return host_->ShouldOpenButtonOptions(this); | 108 return host_->ShouldOpenButtonOptions(this); |
101 } | 109 } |
102 | 110 |
103 } // namespace chromeos | 111 } // namespace chromeos |
OLD | NEW |