Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(843)

Side by Side Diff: chrome/browser/chromeos/input_method/candidate_window_controller_impl.h

Issue 24946003: Rename IBusLookupTable to CandidateWindow, and move it to chromeos/ime. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_view.h" 13 #include "chrome/browser/chromeos/input_method/infolist_window_view.h"
14 #include "chromeos/ime/ibus_bridge.h" 14 #include "chromeos/ime/ibus_bridge.h"
15 #include "chromeos/ime/ibus_daemon_controller.h" 15 #include "chromeos/ime/ibus_daemon_controller.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 chromeos { 21 namespace chromeos {
22 class IBusLookupTable;
23
24 namespace input_method { 22 namespace input_method {
25 23
24 class CandidateWindow;
26 class DelayableWidget; 25 class DelayableWidget;
27 26
28 // The implementation of CandidateWindowController. 27 // The implementation of CandidateWindowController.
29 // CandidateWindowController controls the CandidateWindow. 28 // CandidateWindowController controls the CandidateWindow.
30 class CandidateWindowControllerImpl 29 class CandidateWindowControllerImpl
31 : public CandidateWindowController, 30 : public CandidateWindowController,
32 public CandidateWindowView::Observer, 31 public CandidateWindowView::Observer,
33 public IBusPanelCandidateWindowHandlerInterface { 32 public IBusPanelCandidateWindowHandlerInterface {
34 public: 33 public:
35 CandidateWindowControllerImpl(); 34 CandidateWindowControllerImpl();
(...skipping 13 matching lines...) Expand all
49 // candidate window, but the position should be changed based on position 48 // candidate window, but the position should be changed based on position
50 // overflow. If right of infolist window is out of screen, infolist window is 49 // overflow. If right of infolist window is out of screen, infolist window is
51 // shown left-top of candidate window. If bottom of infolist window is out of 50 // shown left-top of candidate window. If bottom of infolist window is out of
52 // screen, infolist window is shown with clipping to bottom of screen. 51 // screen, infolist window is shown with clipping to bottom of screen.
53 // Infolist window does not overflow top and left direction. 52 // Infolist window does not overflow top and left direction.
54 static gfx::Point GetInfolistWindowPosition( 53 static gfx::Point GetInfolistWindowPosition(
55 const gfx::Rect& candidate_window_rect, 54 const gfx::Rect& candidate_window_rect,
56 const gfx::Rect& screen_rect, 55 const gfx::Rect& screen_rect,
57 const gfx::Size& infolist_winodw_size); 56 const gfx::Size& infolist_winodw_size);
58 57
59 // Converts |lookup_table| to infolist entries. |focused_index| become 58 // Converts |candidate_window| to infolist entries. |focused_index| become
60 // InfolistWindowView::InvalidFocusIndex if there is no selected entries. 59 // InfolistWindowView::InvalidFocusIndex if there is no selected entries.
61 static void ConvertLookupTableToInfolistEntry( 60 static void ConvertLookupTableToInfolistEntry(
62 const IBusLookupTable& lookup_table, 61 const CandidateWindow& candidate_window,
63 std::vector<InfolistWindowView::Entry>* infolist_entries, 62 std::vector<InfolistWindowView::Entry>* infolist_entries,
64 size_t* focused_index); 63 size_t* focused_index);
65 64
66 // Returns true if given |new_entries| is different from |old_entries| and 65 // Returns true if given |new_entries| is different from |old_entries| and
67 // should update current window. 66 // should update current window.
68 static bool ShouldUpdateInfolist( 67 static bool ShouldUpdateInfolist(
69 const std::vector<InfolistWindowView::Entry>& old_entries, 68 const std::vector<InfolistWindowView::Entry>& old_entries,
70 size_t old_focused_index, 69 size_t old_focused_index,
71 const std::vector<InfolistWindowView::Entry>& new_entries, 70 const std::vector<InfolistWindowView::Entry>& new_entries,
72 size_t new_focused_index); 71 size_t new_focused_index);
73 72
74 private: 73 private:
75 // CandidateWindowView::Observer implementation. 74 // CandidateWindowView::Observer implementation.
76 virtual void OnCandidateCommitted(int index, int button, int flags) OVERRIDE; 75 virtual void OnCandidateCommitted(int index, int button, int flags) OVERRIDE;
77 virtual void OnCandidateWindowOpened() OVERRIDE; 76 virtual void OnCandidateWindowOpened() OVERRIDE;
78 virtual void OnCandidateWindowClosed() OVERRIDE; 77 virtual void OnCandidateWindowClosed() OVERRIDE;
79 78
80 // Creates the candidate window view. 79 // Creates the candidate window view.
81 void CreateView(); 80 void CreateView();
82 81
83 // IBusPanelCandidateWindowHandlerInterface overrides. 82 // IBusPanelCandidateWindowHandlerInterface overrides.
84 virtual void HideAuxiliaryText() OVERRIDE; 83 virtual void HideAuxiliaryText() OVERRIDE;
85 virtual void HideLookupTable() OVERRIDE; 84 virtual void HideLookupTable() OVERRIDE;
86 virtual void HidePreeditText() OVERRIDE; 85 virtual void HidePreeditText() OVERRIDE;
87 virtual void SetCursorLocation(const ibus::Rect& cursor_position, 86 virtual void SetCursorLocation(const ibus::Rect& cursor_position,
88 const ibus::Rect& composition_head) OVERRIDE; 87 const ibus::Rect& composition_head) OVERRIDE;
89 virtual void UpdateAuxiliaryText(const std::string& utf8_text, 88 virtual void UpdateAuxiliaryText(const std::string& utf8_text,
90 bool visible) OVERRIDE; 89 bool visible) OVERRIDE;
91 virtual void UpdateLookupTable(const IBusLookupTable& lookup_table, 90 virtual void UpdateLookupTable(const CandidateWindow& candidate_window,
92 bool visible) OVERRIDE; 91 bool visible) OVERRIDE;
93 virtual void UpdatePreeditText(const std::string& utf8_text, 92 virtual void UpdatePreeditText(const std::string& utf8_text,
94 unsigned int cursor, bool visible) OVERRIDE; 93 unsigned int cursor, bool visible) OVERRIDE;
95 94
96 // Updates infolist bounds, if current bounds is up-to-date, this function 95 // Updates infolist bounds, if current bounds is up-to-date, this function
97 // does nothing. 96 // does nothing.
98 void UpdateInfolistBounds(); 97 void UpdateInfolistBounds();
99 98
100 // The candidate window view. 99 // The candidate window view.
101 CandidateWindowView* candidate_window_; 100 CandidateWindowView* candidate_window_view_;
102 101
103 // This is the outer frame of the candidate window view. The frame will 102 // This is the outer frame of the candidate window view. The frame will
104 // own |candidate_window_|. 103 // own |candidate_window_|.
105 scoped_ptr<views::Widget> frame_; 104 scoped_ptr<views::Widget> frame_;
106 105
107 // This is the outer frame of the infolist window view. The frame will 106 // This is the outer frame of the infolist window view. The frame will
108 // own |infolist_window_|. 107 // own |infolist_window_|.
109 scoped_ptr<DelayableWidget> infolist_window_; 108 scoped_ptr<DelayableWidget> infolist_window_;
110 109
111 // The infolist entries and its focused index which currently shown in 110 // The infolist entries and its focused index which currently shown in
112 // Infolist window. 111 // Infolist window.
113 std::vector<InfolistWindowView::Entry> latest_infolist_entries_; 112 std::vector<InfolistWindowView::Entry> latest_infolist_entries_;
114 size_t latest_infolist_focused_index_; 113 size_t latest_infolist_focused_index_;
115 114
116 ObserverList<CandidateWindowController::Observer> observers_; 115 ObserverList<CandidateWindowController::Observer> observers_;
117 116
118 DISALLOW_COPY_AND_ASSIGN(CandidateWindowControllerImpl); 117 DISALLOW_COPY_AND_ASSIGN(CandidateWindowControllerImpl);
119 }; 118 };
120 119
121 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL _H_ 120 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL _H_
122 121
123 } // namespace input_method 122 } // namespace input_method
124 } // namespace chromeos 123 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698