OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ASH_IME_CANDIDATE_WINDOW_VIEW_H_ | 5 #ifndef ASH_IME_CANDIDATE_WINDOW_VIEW_H_ |
6 #define ASH_IME_CANDIDATE_WINDOW_VIEW_H_ | 6 #define ASH_IME_CANDIDATE_WINDOW_VIEW_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ui/base/ime/candidate_window.h" | 9 #include "ui/base/ime/candidate_window.h" |
10 #include "ui/views/bubble/bubble_delegate.h" | 10 #include "ui/views/bubble/bubble_delegate.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 public: | 22 public: |
23 // The object can be monitored by the observer. | 23 // The object can be monitored by the observer. |
24 class Observer { | 24 class Observer { |
25 public: | 25 public: |
26 virtual ~Observer() {} | 26 virtual ~Observer() {} |
27 // The function is called when a candidate is committed. | 27 // The function is called when a candidate is committed. |
28 virtual void OnCandidateCommitted(int index) = 0; | 28 virtual void OnCandidateCommitted(int index) = 0; |
29 }; | 29 }; |
30 | 30 |
31 explicit CandidateWindowView(gfx::NativeView parent); | 31 explicit CandidateWindowView(gfx::NativeView parent); |
32 virtual ~CandidateWindowView(); | 32 ~CandidateWindowView() override; |
33 views::Widget* InitWidget(); | 33 views::Widget* InitWidget(); |
34 | 34 |
35 // Adds the given observer. The ownership is not transferred. | 35 // Adds the given observer. The ownership is not transferred. |
36 void AddObserver(Observer* observer) { | 36 void AddObserver(Observer* observer) { |
37 observers_.AddObserver(observer); | 37 observers_.AddObserver(observer); |
38 } | 38 } |
39 | 39 |
40 // Removes the given observer. | 40 // Removes the given observer. |
41 void RemoveObserver(Observer* observer) { | 41 void RemoveObserver(Observer* observer) { |
42 observers_.RemoveObserver(observer); | 42 observers_.RemoveObserver(observer); |
(...skipping 24 matching lines...) Expand all Loading... |
67 // Candidates are arranged per |orientation|. | 67 // Candidates are arranged per |orientation|. |
68 void UpdateCandidates(const ui::CandidateWindow& candidate_window); | 68 void UpdateCandidates(const ui::CandidateWindow& candidate_window); |
69 | 69 |
70 void SetCursorBounds(const gfx::Rect& cursor_bounds, | 70 void SetCursorBounds(const gfx::Rect& cursor_bounds, |
71 const gfx::Rect& composition_head); | 71 const gfx::Rect& composition_head); |
72 | 72 |
73 private: | 73 private: |
74 friend class CandidateWindowViewTest; | 74 friend class CandidateWindowViewTest; |
75 | 75 |
76 // Overridden from views::ButtonListener: | 76 // Overridden from views::ButtonListener: |
77 virtual void ButtonPressed(views::Button* sender, | 77 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
78 const ui::Event& event) override; | |
79 | 78 |
80 void SelectCandidateAt(int index_in_page); | 79 void SelectCandidateAt(int index_in_page); |
81 void UpdateVisibility(); | 80 void UpdateVisibility(); |
82 | 81 |
83 // Initializes the candidate views if needed. | 82 // Initializes the candidate views if needed. |
84 void MaybeInitializeCandidateViews( | 83 void MaybeInitializeCandidateViews( |
85 const ui::CandidateWindow& candidate_window); | 84 const ui::CandidateWindow& candidate_window); |
86 | 85 |
87 // The candidate window data model. | 86 // The candidate window data model. |
88 ui::CandidateWindow candidate_window_; | 87 ui::CandidateWindow candidate_window_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // send OnCandidateWindowOpened and OnCandidateWindowClosed events. | 124 // send OnCandidateWindowOpened and OnCandidateWindowClosed events. |
126 bool was_candidate_window_open_; | 125 bool was_candidate_window_open_; |
127 | 126 |
128 DISALLOW_COPY_AND_ASSIGN(CandidateWindowView); | 127 DISALLOW_COPY_AND_ASSIGN(CandidateWindowView); |
129 }; | 128 }; |
130 | 129 |
131 } // namespace ime | 130 } // namespace ime |
132 } // namespace ash | 131 } // namespace ash |
133 | 132 |
134 #endif // ASH_IME_CANDIDATE_WINDOW_VIEW_H_ | 133 #endif // ASH_IME_CANDIDATE_WINDOW_VIEW_H_ |
OLD | NEW |