OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/input_method/mode_indicator_controller.h" | 5 #include "chrome/browser/chromeos/input_method/mode_indicator_controller.h" |
6 | 6 |
7 #include "ash/ime/mode_indicator_view.h" | 7 #include "ash/ime/mode_indicator_view.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 ModeIndicatorObserver() | 24 ModeIndicatorObserver() |
25 : active_widget_(NULL) {} | 25 : active_widget_(NULL) {} |
26 | 26 |
27 virtual ~ModeIndicatorObserver() { | 27 virtual ~ModeIndicatorObserver() { |
28 if (active_widget_) | 28 if (active_widget_) |
29 active_widget_->RemoveObserver(this); | 29 active_widget_->RemoveObserver(this); |
30 } | 30 } |
31 | 31 |
32 // If other active mode indicator widget is shown, close it immedicately | 32 // If other active mode indicator widget is shown, close it immedicately |
33 // without fading animation. Then store this widget as the active widget. | 33 // without fading animation. Then store this widget as the active widget. |
34 virtual void AddModeIndicatorWidget(views::Widget* widget) OVERRIDE { | 34 virtual void AddModeIndicatorWidget(views::Widget* widget) override { |
35 DCHECK(widget); | 35 DCHECK(widget); |
36 if (active_widget_) | 36 if (active_widget_) |
37 active_widget_->Close(); | 37 active_widget_->Close(); |
38 active_widget_ = widget; | 38 active_widget_ = widget; |
39 widget->AddObserver(this); | 39 widget->AddObserver(this); |
40 } | 40 } |
41 | 41 |
42 // views::WidgetObserver override: | 42 // views::WidgetObserver override: |
43 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE { | 43 virtual void OnWidgetDestroying(views::Widget* widget) override { |
44 if (widget == active_widget_) | 44 if (widget == active_widget_) |
45 active_widget_ = NULL; | 45 active_widget_ = NULL; |
46 } | 46 } |
47 | 47 |
48 private: | 48 private: |
49 views::Widget* active_widget_; | 49 views::Widget* active_widget_; |
50 }; | 50 }; |
51 | 51 |
52 | 52 |
53 ModeIndicatorController::ModeIndicatorController(InputMethodManager* imm) | 53 ModeIndicatorController::ModeIndicatorController(InputMethodManager* imm) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 views::Widget* mi_widget = mi_view->GetWidget(); | 115 views::Widget* mi_widget = mi_view->GetWidget(); |
116 if (GetModeIndicatorObserverForTesting()) | 116 if (GetModeIndicatorObserverForTesting()) |
117 GetModeIndicatorObserverForTesting()->AddModeIndicatorWidget(mi_widget); | 117 GetModeIndicatorObserverForTesting()->AddModeIndicatorWidget(mi_widget); |
118 | 118 |
119 mi_observer_->AddModeIndicatorWidget(mi_widget); | 119 mi_observer_->AddModeIndicatorWidget(mi_widget); |
120 mi_view->ShowAndFadeOut(); | 120 mi_view->ShowAndFadeOut(); |
121 } | 121 } |
122 | 122 |
123 } // namespace input_method | 123 } // namespace input_method |
124 } // namespace chromeos | 124 } // namespace chromeos |
OLD | NEW |