OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/system/ime/tray_ime.h" | 5 #include "ash/system/ime/tray_ime.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
11 #include "ash/system/tray/system_tray_delegate.h" | 11 #include "ash/system/tray/system_tray_delegate.h" |
12 #include "ash/system/tray/tray_constants.h" | 12 #include "ash/system/tray/tray_constants.h" |
13 #include "ash/system/tray/tray_details_view.h" | 13 #include "ash/system/tray/tray_details_view.h" |
14 #include "ash/system/tray/tray_item_more.h" | 14 #include "ash/system/tray/tray_item_more.h" |
15 #include "ash/system/tray/tray_item_view.h" | 15 #include "ash/system/tray/tray_item_view.h" |
| 16 #include "ash/system/tray/tray_notification_view.h" |
16 #include "ash/system/tray/tray_views.h" | 17 #include "ash/system/tray/tray_views.h" |
17 #include "base/logging.h" | 18 #include "base/logging.h" |
18 #include "base/timer.h" | 19 #include "base/timer.h" |
19 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
20 #include "grit/ash_strings.h" | 21 #include "grit/ash_strings.h" |
21 #include "grit/ui_resources_standard.h" | 22 #include "grit/ui_resources_standard.h" |
22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
23 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
24 #include "ui/gfx/font.h" | 25 #include "ui/gfx/font.h" |
25 #include "ui/gfx/image/image.h" | 26 #include "ui/gfx/image/image.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 std::map<views::View*, std::string> ime_map_; | 163 std::map<views::View*, std::string> ime_map_; |
163 std::map<views::View*, std::string> property_map_; | 164 std::map<views::View*, std::string> property_map_; |
164 views::View* settings_; | 165 views::View* settings_; |
165 | 166 |
166 DISALLOW_COPY_AND_ASSIGN(IMEDetailedView); | 167 DISALLOW_COPY_AND_ASSIGN(IMEDetailedView); |
167 }; | 168 }; |
168 | 169 |
169 class IMENotificationView : public TrayNotificationView { | 170 class IMENotificationView : public TrayNotificationView { |
170 public: | 171 public: |
171 explicit IMENotificationView(TrayIME* tray) | 172 explicit IMENotificationView(TrayIME* tray) |
172 : TrayNotificationView(IDR_AURA_UBER_TRAY_IME), | 173 : TrayNotificationView(tray, IDR_AURA_UBER_TRAY_IME) { |
173 tray_(tray) { | |
174 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); | 174 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); |
175 IMEInfo current; | 175 IMEInfo current; |
176 delegate->GetCurrentIME(¤t); | 176 delegate->GetCurrentIME(¤t); |
177 | 177 |
178 // TODO(zork): Use IDS_ASH_STATUS_TRAY_THIRD_PARTY_IME_TURNED_ON_BUBBLE for | 178 // TODO(zork): Use IDS_ASH_STATUS_TRAY_THIRD_PARTY_IME_TURNED_ON_BUBBLE for |
179 // third party IMEs | 179 // third party IMEs |
180 InitView(new views::Label( | 180 InitView(new views::Label( |
181 l10n_util::GetStringFUTF16( | 181 l10n_util::GetStringFUTF16( |
182 IDS_ASH_STATUS_TRAY_IME_TURNED_ON_BUBBLE, | 182 IDS_ASH_STATUS_TRAY_IME_TURNED_ON_BUBBLE, |
183 current.short_name))); | 183 current.short_name))); |
(...skipping 11 matching lines...) Expand all Loading... |
195 | 195 |
196 void StopAutoCloseTimer() { | 196 void StopAutoCloseTimer() { |
197 autoclose_.Stop(); | 197 autoclose_.Stop(); |
198 } | 198 } |
199 | 199 |
200 void RestartAutoCloseTimer() { | 200 void RestartAutoCloseTimer() { |
201 if (autoclose_delay_) | 201 if (autoclose_delay_) |
202 StartAutoCloseTimer(autoclose_delay_); | 202 StartAutoCloseTimer(autoclose_delay_); |
203 } | 203 } |
204 | 204 |
205 // Overridden from TrayNotificationView: | 205 // Overridden from TrayNotificationView. |
206 virtual void OnClose() OVERRIDE { | 206 virtual void OnClickAction() OVERRIDE { |
207 Close(); | 207 tray()->PopupDetailedView(0, true); |
208 } | 208 } |
209 | 209 |
210 private: | 210 private: |
211 void Close() { | 211 void Close() { |
212 tray_->HideNotificationView(); | 212 tray()->HideNotificationView(); |
213 } | 213 } |
214 | 214 |
215 TrayIME* tray_; | |
216 | |
217 int autoclose_delay_; | 215 int autoclose_delay_; |
218 base::OneShotTimer<IMENotificationView> autoclose_; | 216 base::OneShotTimer<IMENotificationView> autoclose_; |
219 | 217 |
220 DISALLOW_COPY_AND_ASSIGN(IMENotificationView); | 218 DISALLOW_COPY_AND_ASSIGN(IMENotificationView); |
221 }; | 219 }; |
222 | 220 |
223 | 221 |
224 } // namespace tray | 222 } // namespace tray |
225 | 223 |
226 TrayIME::TrayIME() | 224 TrayIME::TrayIME() |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 if (list.size() > 1 && show_message && !message_shown_) { | 317 if (list.size() > 1 && show_message && !message_shown_) { |
320 if (!notification_) { | 318 if (!notification_) { |
321 ShowNotificationView(); | 319 ShowNotificationView(); |
322 message_shown_ = true; | 320 message_shown_ = true; |
323 } | 321 } |
324 } | 322 } |
325 } | 323 } |
326 | 324 |
327 } // namespace internal | 325 } // namespace internal |
328 } // namespace ash | 326 } // namespace ash |
OLD | NEW |