OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_UI_VIEWS_TRANSLATE_TRANSLATE_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_BUBBLE_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_BUBBLE_VIEW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 public views::ComboboxListener, | 38 public views::ComboboxListener, |
39 public views::LinkListener, | 39 public views::LinkListener, |
40 public content::WebContentsObserver { | 40 public content::WebContentsObserver { |
41 public: | 41 public: |
42 virtual ~TranslateBubbleView(); | 42 virtual ~TranslateBubbleView(); |
43 | 43 |
44 // Shows the Translate bubble. | 44 // Shows the Translate bubble. |
45 static void ShowBubble(views::View* anchor_view, | 45 static void ShowBubble(views::View* anchor_view, |
46 content::WebContents* web_contents, | 46 content::WebContents* web_contents, |
47 translate::TranslateStep step, | 47 translate::TranslateStep step, |
48 TranslateErrors::Type error_type); | 48 translate::TranslateErrors::Type error_type); |
49 | 49 |
50 // If true, the Translate bubble is being shown. | 50 // If true, the Translate bubble is being shown. |
51 static bool IsShowing(); | 51 static bool IsShowing(); |
52 | 52 |
53 // Returns the bubble view currently shown. This may return NULL. | 53 // Returns the bubble view currently shown. This may return NULL. |
54 static TranslateBubbleView* GetCurrentBubble(); | 54 static TranslateBubbleView* GetCurrentBubble(); |
55 | 55 |
56 TranslateBubbleModel* model() { return model_.get(); } | 56 TranslateBubbleModel* model() { return model_.get(); } |
57 | 57 |
58 // views::BubbleDelegateView methods. | 58 // views::BubbleDelegateView methods. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, | 113 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, |
114 DoneButtonWithoutTranslating); | 114 DoneButtonWithoutTranslating); |
115 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, | 115 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, |
116 CancelButtonReturningBeforeTranslate); | 116 CancelButtonReturningBeforeTranslate); |
117 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, | 117 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, |
118 CancelButtonReturningAfterTranslate); | 118 CancelButtonReturningAfterTranslate); |
119 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, CancelButtonReturningError); | 119 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, CancelButtonReturningError); |
120 | 120 |
121 TranslateBubbleView(views::View* anchor_view, | 121 TranslateBubbleView(views::View* anchor_view, |
122 scoped_ptr<TranslateBubbleModel> model, | 122 scoped_ptr<TranslateBubbleModel> model, |
123 TranslateErrors::Type error_type, | 123 translate::TranslateErrors::Type error_type, |
124 content::WebContents* web_contents); | 124 content::WebContents* web_contents); |
125 | 125 |
126 // Returns the current child view. | 126 // Returns the current child view. |
127 views::View* GetCurrentView() const; | 127 views::View* GetCurrentView() const; |
128 | 128 |
129 // Handles the event when the user presses a button. | 129 // Handles the event when the user presses a button. |
130 void HandleButtonPressed(ButtonID sender_id); | 130 void HandleButtonPressed(ButtonID sender_id); |
131 | 131 |
132 // Handles the event when the user clicks a link. | 132 // Handles the event when the user clicks a link. |
133 void HandleLinkClicked(LinkID sender_id); | 133 void HandleLinkClicked(LinkID sender_id); |
(...skipping 19 matching lines...) Expand all Loading... |
153 // Creates the 'error' view. Caller takes ownership of the returned view. | 153 // Creates the 'error' view. Caller takes ownership of the returned view. |
154 views::View* CreateViewError(); | 154 views::View* CreateViewError(); |
155 | 155 |
156 // Creates the 'advanced' view. Caller takes ownership of the returned view. | 156 // Creates the 'advanced' view. Caller takes ownership of the returned view. |
157 views::View* CreateViewAdvanced(); | 157 views::View* CreateViewAdvanced(); |
158 | 158 |
159 // Switches the view type. | 159 // Switches the view type. |
160 void SwitchView(TranslateBubbleModel::ViewState view_state); | 160 void SwitchView(TranslateBubbleModel::ViewState view_state); |
161 | 161 |
162 // Switches to the error view. | 162 // Switches to the error view. |
163 void SwitchToErrorView(TranslateErrors::Type error_type); | 163 void SwitchToErrorView(translate::TranslateErrors::Type error_type); |
164 | 164 |
165 // Updates the advanced view. | 165 // Updates the advanced view. |
166 void UpdateAdvancedView(); | 166 void UpdateAdvancedView(); |
167 | 167 |
168 static TranslateBubbleView* translate_bubble_view_; | 168 static TranslateBubbleView* translate_bubble_view_; |
169 | 169 |
170 views::View* before_translate_view_; | 170 views::View* before_translate_view_; |
171 views::View* translating_view_; | 171 views::View* translating_view_; |
172 views::View* after_translate_view_; | 172 views::View* after_translate_view_; |
173 views::View* error_view_; | 173 views::View* error_view_; |
174 views::View* advanced_view_; | 174 views::View* advanced_view_; |
175 | 175 |
176 scoped_ptr<ui::SimpleComboboxModel> denial_combobox_model_; | 176 scoped_ptr<ui::SimpleComboboxModel> denial_combobox_model_; |
177 scoped_ptr<LanguageComboboxModel> source_language_combobox_model_; | 177 scoped_ptr<LanguageComboboxModel> source_language_combobox_model_; |
178 scoped_ptr<LanguageComboboxModel> target_language_combobox_model_; | 178 scoped_ptr<LanguageComboboxModel> target_language_combobox_model_; |
179 | 179 |
180 views::Combobox* denial_combobox_; | 180 views::Combobox* denial_combobox_; |
181 views::Combobox* source_language_combobox_; | 181 views::Combobox* source_language_combobox_; |
182 views::Combobox* target_language_combobox_; | 182 views::Combobox* target_language_combobox_; |
183 | 183 |
184 views::Checkbox* always_translate_checkbox_; | 184 views::Checkbox* always_translate_checkbox_; |
185 | 185 |
186 views::LabelButton* advanced_cancel_button_; | 186 views::LabelButton* advanced_cancel_button_; |
187 views::LabelButton* advanced_done_button_; | 187 views::LabelButton* advanced_done_button_; |
188 | 188 |
189 scoped_ptr<TranslateBubbleModel> model_; | 189 scoped_ptr<TranslateBubbleModel> model_; |
190 | 190 |
191 TranslateErrors::Type error_type_; | 191 translate::TranslateErrors::Type error_type_; |
192 | 192 |
193 // Whether the window is an incognito window. | 193 // Whether the window is an incognito window. |
194 const bool is_in_incognito_window_; | 194 const bool is_in_incognito_window_; |
195 | 195 |
196 // Whether the translation is acutually executed. | 196 // Whether the translation is acutually executed. |
197 bool translate_executed_; | 197 bool translate_executed_; |
198 | 198 |
199 // Whether one of denial buttons is clicked. | 199 // Whether one of denial buttons is clicked. |
200 bool denial_button_clicked_; | 200 bool denial_button_clicked_; |
201 | 201 |
202 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleView); | 202 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleView); |
203 }; | 203 }; |
204 | 204 |
205 #endif // CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_BUBBLE_VIEW_H_ | 205 #endif // CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_BUBBLE_VIEW_H_ |
OLD | NEW |