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" |
11 #include "chrome/browser/chromeos/cros/keyboard_library.h" | 11 #include "chrome/browser/chromeos/cros/keyboard_library.h" |
12 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 12 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
13 #include "chrome/browser/chromeos/status/status_area_host.h" | 13 #include "chrome/browser/chromeos/status/status_area_host.h" |
14 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
15 #include "chrome/browser/profile.h" | 15 #include "chrome/browser/profile.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // Returns PrefService object associated with |host|. Returns NULL if we are NOT | 19 // Returns PrefService object associated with |host|. Returns NULL if we are NOT |
20 // within a browser. | 20 // within a browser. |
21 PrefService* GetPrefService(chromeos::StatusAreaHost* host) { | 21 PrefService* GetPrefService(chromeos::StatusAreaHost* host) { |
22 if (host->GetProfile()) { | 22 if (host->GetProfile()) { |
23 return host->GetProfile()->GetPrefs(); | 23 return host->GetProfile()->GetPrefs(); |
24 } | 24 } |
25 return NULL; | 25 return NULL; |
26 } | 26 } |
27 | 27 |
| 28 #if defined(CROS_FONTS_USING_BCI) |
| 29 const int kFontSizeDelta = 0; |
| 30 #else |
| 31 const int kFontSizeDelta = 1; |
| 32 #endif |
| 33 |
28 } // namespace | 34 } // namespace |
29 | 35 |
30 namespace chromeos { | 36 namespace chromeos { |
31 | 37 |
32 //////////////////////////////////////////////////////////////////////////////// | 38 //////////////////////////////////////////////////////////////////////////////// |
33 // InputMethodMenuButton | 39 // InputMethodMenuButton |
34 | 40 |
35 InputMethodMenuButton::InputMethodMenuButton(StatusAreaHost* host) | 41 InputMethodMenuButton::InputMethodMenuButton(StatusAreaHost* host) |
36 : StatusAreaButton(this), | 42 : StatusAreaButton(this), |
37 InputMethodMenu(GetPrefService(host), | 43 InputMethodMenu(GetPrefService(host), |
38 host->IsBrowserMode(), | 44 host->IsBrowserMode(), |
39 host->IsScreenLockerMode(), | 45 host->IsScreenLockerMode(), |
40 false /* is_out_of_box_experience_mode */), | 46 false /* is_out_of_box_experience_mode */), |
41 host_(host) { | 47 host_(host) { |
42 set_border(NULL); | 48 set_border(NULL); |
43 set_use_menu_button_paint(true); | 49 set_use_menu_button_paint(true); |
44 SetFont(ResourceBundle::GetSharedInstance().GetFont( | 50 SetFont(ResourceBundle::GetSharedInstance().GetFont( |
45 ResourceBundle::BaseFont).DeriveFont(1)); | 51 ResourceBundle::BaseFont).DeriveFont(kFontSizeDelta)); |
46 SetEnabledColor(0xB3FFFFFF); // White with 70% Alpha | 52 SetEnabledColor(0xB3FFFFFF); // White with 70% Alpha |
47 SetDisabledColor(0x00FFFFFF); // White with 00% Alpha (invisible) | 53 SetDisabledColor(0x00FFFFFF); // White with 00% Alpha (invisible) |
48 SetShowMultipleIconStates(false); | 54 SetShowMultipleIconStates(false); |
49 set_alignment(TextButton::ALIGN_CENTER); | 55 set_alignment(TextButton::ALIGN_CENTER); |
50 | 56 |
51 // Draw the default indicator "US". The default indicator "US" is used when | 57 // Draw the default indicator "US". The default indicator "US" is used when |
52 // |pref_service| is not available (for example, unit tests) or |pref_service| | 58 // |pref_service| is not available (for example, unit tests) or |pref_service| |
53 // is available, but Chrome preferences are not available (for example, | 59 // is available, but Chrome preferences are not available (for example, |
54 // initial OS boot). | 60 // initial OS boot). |
55 InputMethodMenuButton::UpdateUI(L"US", L""); | 61 InputMethodMenuButton::UpdateUI(L"US", L""); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 109 |
104 void InputMethodMenuButton::OpenConfigUI() { | 110 void InputMethodMenuButton::OpenConfigUI() { |
105 host_->OpenButtonOptions(this); // ask browser to open the DOMUI page. | 111 host_->OpenButtonOptions(this); // ask browser to open the DOMUI page. |
106 } | 112 } |
107 | 113 |
108 bool InputMethodMenuButton::ShouldSupportConfigUI() { | 114 bool InputMethodMenuButton::ShouldSupportConfigUI() { |
109 return host_->ShouldOpenButtonOptions(this); | 115 return host_->ShouldOpenButtonOptions(this); |
110 } | 116 } |
111 | 117 |
112 } // namespace chromeos | 118 } // namespace chromeos |
OLD | NEW |