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 "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "chrome/browser/chromeos/input_method/candidate_window_view.h" | 12 #include "chrome/browser/chromeos/input_method/candidate_window_view.h" |
13 #include "chrome/browser/chromeos/input_method/infolist_window.h" | 13 #include "chrome/browser/chromeos/input_method/infolist_window.h" |
14 #include "ui/base/ime/chromeos/ibus_bridge.h" | 14 #include "ui/base/ime/chromeos/ibus_bridge.h" |
15 #include "ui/views/widget/widget_observer.h" | 15 #include "ui/views/widget/widget_observer.h" |
16 | 16 |
17 namespace views { | 17 namespace views { |
18 class Widget; | 18 class Widget; |
19 } // namespace views | 19 } // namespace views |
20 | 20 |
| 21 namespace ui { |
| 22 class CandidateWindow; |
| 23 } // namespace ui |
| 24 |
21 namespace chromeos { | 25 namespace chromeos { |
22 namespace input_method { | 26 namespace input_method { |
23 | 27 |
24 class CandidateWindow; | |
25 class DelayableWidget; | 28 class DelayableWidget; |
26 class ModeIndicatorController; | 29 class ModeIndicatorController; |
27 | 30 |
28 // The implementation of CandidateWindowController. | 31 // The implementation of CandidateWindowController. |
29 // CandidateWindowController controls the CandidateWindow. | 32 // CandidateWindowController controls the CandidateWindow. |
30 class CandidateWindowControllerImpl | 33 class CandidateWindowControllerImpl |
31 : public CandidateWindowController, | 34 : public CandidateWindowController, |
32 public CandidateWindowView::Observer, | 35 public CandidateWindowView::Observer, |
33 public views::WidgetObserver, | 36 public views::WidgetObserver, |
34 public IBusPanelCandidateWindowHandlerInterface { | 37 public IBusPanelCandidateWindowHandlerInterface { |
35 public: | 38 public: |
36 CandidateWindowControllerImpl(); | 39 CandidateWindowControllerImpl(); |
37 virtual ~CandidateWindowControllerImpl(); | 40 virtual ~CandidateWindowControllerImpl(); |
38 | 41 |
39 // CandidateWindowController overrides: | 42 // CandidateWindowController overrides: |
40 virtual void AddObserver( | 43 virtual void AddObserver( |
41 CandidateWindowController::Observer* observer) OVERRIDE; | 44 CandidateWindowController::Observer* observer) OVERRIDE; |
42 virtual void RemoveObserver( | 45 virtual void RemoveObserver( |
43 CandidateWindowController::Observer* observer) OVERRIDE; | 46 CandidateWindowController::Observer* observer) OVERRIDE; |
44 virtual void Hide() OVERRIDE; | 47 virtual void Hide() OVERRIDE; |
45 | 48 |
46 protected: | 49 protected: |
47 // Converts |candidate_window| to infolist entry models. Sets | 50 // Converts |candidate_window| to infolist entry models. Sets |
48 // |has_highlighted| to true if infolist_entries contains highlighted entry. | 51 // |has_highlighted| to true if infolist_entries contains highlighted entry. |
49 // TODO(mukai): move this method (and tests) to the new InfolistEntry model. | 52 // TODO(mukai): move this method (and tests) to the new InfolistEntry model. |
50 static void ConvertLookupTableToInfolistEntry( | 53 static void ConvertLookupTableToInfolistEntry( |
51 const CandidateWindow& candidate_window, | 54 const ui::CandidateWindow& candidate_window, |
52 std::vector<InfolistEntry>* infolist_entries, | 55 std::vector<InfolistEntry>* infolist_entries, |
53 bool* has_highlighted); | 56 bool* has_highlighted); |
54 | 57 |
55 private: | 58 private: |
56 // CandidateWindowView::Observer implementation. | 59 // CandidateWindowView::Observer implementation. |
57 virtual void OnCandidateCommitted(int index) OVERRIDE; | 60 virtual void OnCandidateCommitted(int index) OVERRIDE; |
58 | 61 |
59 // views::WidgetObserver implementation. | 62 // views::WidgetObserver implementation. |
60 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; | 63 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
61 | 64 |
62 // IBusPanelCandidateWindowHandlerInterface implementation. | 65 // IBusPanelCandidateWindowHandlerInterface implementation. |
63 virtual void SetCursorBounds(const gfx::Rect& cursor_bounds, | 66 virtual void SetCursorBounds(const gfx::Rect& cursor_bounds, |
64 const gfx::Rect& composition_head) OVERRIDE; | 67 const gfx::Rect& composition_head) OVERRIDE; |
65 virtual void UpdateLookupTable(const CandidateWindow& candidate_window, | 68 virtual void UpdateLookupTable( |
66 bool visible) OVERRIDE; | 69 const ui::CandidateWindow& candidate_window, |
| 70 bool visible) OVERRIDE; |
67 virtual void UpdatePreeditText(const std::string& utf8_text, | 71 virtual void UpdatePreeditText(const std::string& utf8_text, |
68 unsigned int cursor, bool visible) OVERRIDE; | 72 unsigned int cursor, bool visible) OVERRIDE; |
69 virtual void FocusStateChanged(bool is_focused) OVERRIDE; | 73 virtual void FocusStateChanged(bool is_focused) OVERRIDE; |
70 | 74 |
71 void InitCandidateWindowView(); | 75 void InitCandidateWindowView(); |
72 | 76 |
73 // The candidate window view. | 77 // The candidate window view. |
74 CandidateWindowView* candidate_window_view_; | 78 CandidateWindowView* candidate_window_view_; |
75 | 79 |
76 // This is the outer frame of the infolist window view. Owned by the widget. | 80 // This is the outer frame of the infolist window view. Owned by the widget. |
(...skipping 11 matching lines...) Expand all Loading... |
88 | 92 |
89 ObserverList<CandidateWindowController::Observer> observers_; | 93 ObserverList<CandidateWindowController::Observer> observers_; |
90 | 94 |
91 DISALLOW_COPY_AND_ASSIGN(CandidateWindowControllerImpl); | 95 DISALLOW_COPY_AND_ASSIGN(CandidateWindowControllerImpl); |
92 }; | 96 }; |
93 | 97 |
94 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL
_H_ | 98 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL
_H_ |
95 | 99 |
96 } // namespace input_method | 100 } // namespace input_method |
97 } // namespace chromeos | 101 } // namespace chromeos |
OLD | NEW |