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 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL_H_ |
7 | 7 |
8 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" | 8 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" |
9 | 9 |
10 #include "ash/ime/candidate_window_view.h" | |
11 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
12 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
13 #include "ui/base/ime/chromeos/ime_bridge.h" | 12 #include "ui/base/ime/chromeos/ime_bridge.h" |
14 #include "ui/base/ime/infolist_entry.h" | 13 #include "ui/base/ime/infolist_entry.h" |
| 14 #include "ui/chromeos/ime/candidate_window_view.h" |
15 #include "ui/views/widget/widget_observer.h" | 15 #include "ui/views/widget/widget_observer.h" |
16 | 16 |
17 namespace ash { | 17 namespace ui { |
| 18 class CandidateWindow; |
| 19 |
18 namespace ime { | 20 namespace ime { |
19 class InfolistWindow; | 21 class InfolistWindow; |
20 } // namespace ime | 22 } // namespace ime |
21 } // namespace ash | |
22 | |
23 namespace ui { | |
24 class CandidateWindow; | |
25 } // namespace ui | 23 } // namespace ui |
26 | 24 |
27 namespace views { | 25 namespace views { |
28 class Widget; | 26 class Widget; |
29 } // namespace views | 27 } // namespace views |
30 | 28 |
31 namespace chromeos { | 29 namespace chromeos { |
32 namespace input_method { | 30 namespace input_method { |
33 | 31 |
34 class DelayableWidget; | 32 class DelayableWidget; |
35 class ModeIndicatorController; | 33 class ModeIndicatorController; |
36 | 34 |
37 // The implementation of CandidateWindowController. | 35 // The implementation of CandidateWindowController. |
38 // CandidateWindowController controls the CandidateWindow. | 36 // CandidateWindowController controls the CandidateWindow. |
39 class CandidateWindowControllerImpl | 37 class CandidateWindowControllerImpl |
40 : public CandidateWindowController, | 38 : public CandidateWindowController, |
41 public ash::ime::CandidateWindowView::Observer, | 39 public ui::ime::CandidateWindowView::Observer, |
42 public views::WidgetObserver, | 40 public views::WidgetObserver, |
43 public IMECandidateWindowHandlerInterface { | 41 public IMECandidateWindowHandlerInterface { |
44 public: | 42 public: |
45 CandidateWindowControllerImpl(); | 43 CandidateWindowControllerImpl(); |
46 virtual ~CandidateWindowControllerImpl(); | 44 virtual ~CandidateWindowControllerImpl(); |
47 | 45 |
48 // CandidateWindowController overrides: | 46 // CandidateWindowController overrides: |
49 virtual void AddObserver( | 47 virtual void AddObserver( |
50 CandidateWindowController::Observer* observer) override; | 48 CandidateWindowController::Observer* observer) override; |
51 virtual void RemoveObserver( | 49 virtual void RemoveObserver( |
52 CandidateWindowController::Observer* observer) override; | 50 CandidateWindowController::Observer* observer) override; |
53 virtual void Hide() override; | 51 virtual void Hide() override; |
54 | 52 |
55 protected: | 53 protected: |
56 static void ConvertLookupTableToInfolistEntry( | 54 static void ConvertLookupTableToInfolistEntry( |
57 const ui::CandidateWindow& candidate_window, | 55 const ui::CandidateWindow& candidate_window, |
58 std::vector<ui::InfolistEntry>* infolist_entries, | 56 std::vector<ui::InfolistEntry>* infolist_entries, |
59 bool* has_highlighted); | 57 bool* has_highlighted); |
60 | 58 |
61 private: | 59 private: |
62 // ash::ime::CandidateWindowView::Observer implementation. | 60 // ui::ime::CandidateWindowView::Observer implementation. |
63 virtual void OnCandidateCommitted(int index) override; | 61 virtual void OnCandidateCommitted(int index) override; |
64 | 62 |
65 // views::WidgetObserver implementation. | 63 // views::WidgetObserver implementation. |
66 virtual void OnWidgetClosing(views::Widget* widget) override; | 64 virtual void OnWidgetClosing(views::Widget* widget) override; |
67 | 65 |
68 // IMECandidateWindowHandlerInterface implementation. | 66 // IMECandidateWindowHandlerInterface implementation. |
69 virtual void SetCursorBounds(const gfx::Rect& cursor_bounds, | 67 virtual void SetCursorBounds(const gfx::Rect& cursor_bounds, |
70 const gfx::Rect& composition_head) override; | 68 const gfx::Rect& composition_head) override; |
71 virtual void UpdateLookupTable( | 69 virtual void UpdateLookupTable( |
72 const ui::CandidateWindow& candidate_window, | 70 const ui::CandidateWindow& candidate_window, |
73 bool visible) override; | 71 bool visible) override; |
74 virtual void UpdatePreeditText(const base::string16& text, | 72 virtual void UpdatePreeditText(const base::string16& text, |
75 unsigned int cursor, bool visible) override; | 73 unsigned int cursor, bool visible) override; |
76 virtual void FocusStateChanged(bool is_focused) override; | 74 virtual void FocusStateChanged(bool is_focused) override; |
77 | 75 |
78 void InitCandidateWindowView(); | 76 void InitCandidateWindowView(); |
79 | 77 |
80 // The candidate window view. | 78 // The candidate window view. |
81 ash::ime::CandidateWindowView* candidate_window_view_; | 79 ui::ime::CandidateWindowView* candidate_window_view_; |
82 | 80 |
83 // This is the outer frame of the infolist window view. Owned by the widget. | 81 // This is the outer frame of the infolist window view. Owned by the widget. |
84 ash::ime::InfolistWindow* infolist_window_; | 82 ui::ime::InfolistWindow* infolist_window_; |
85 | 83 |
86 gfx::Rect cursor_bounds_; | 84 gfx::Rect cursor_bounds_; |
87 gfx::Rect composition_head_; | 85 gfx::Rect composition_head_; |
88 | 86 |
89 // This is the controller of the IME mode indicator. | 87 // This is the controller of the IME mode indicator. |
90 scoped_ptr<ModeIndicatorController> mode_indicator_controller_; | 88 scoped_ptr<ModeIndicatorController> mode_indicator_controller_; |
91 | 89 |
92 // The infolist entries and its focused index which currently shown in | 90 // The infolist entries and its focused index which currently shown in |
93 // Infolist window. | 91 // Infolist window. |
94 std::vector<ui::InfolistEntry> latest_infolist_entries_; | 92 std::vector<ui::InfolistEntry> latest_infolist_entries_; |
95 | 93 |
96 ObserverList<CandidateWindowController::Observer> observers_; | 94 ObserverList<CandidateWindowController::Observer> observers_; |
97 | 95 |
98 DISALLOW_COPY_AND_ASSIGN(CandidateWindowControllerImpl); | 96 DISALLOW_COPY_AND_ASSIGN(CandidateWindowControllerImpl); |
99 }; | 97 }; |
100 | 98 |
101 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL
_H_ | 99 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL
_H_ |
102 | 100 |
103 } // namespace input_method | 101 } // namespace input_method |
104 } // namespace chromeos | 102 } // namespace chromeos |
OLD | NEW |