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