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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "chrome/browser/ui/translate/language_combobox_model.h" | 12 #include "chrome/browser/ui/translate/language_combobox_model.h" |
13 #include "chrome/browser/ui/translate/translate_bubble_model.h" | 13 #include "chrome/browser/ui/translate/translate_bubble_model.h" |
14 #include "chrome/common/translate/translate_errors.h" | 14 #include "chrome/common/translate/translate_errors.h" |
15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
16 #include "ui/views/bubble/bubble_delegate.h" | 16 #include "ui/views/bubble/bubble_delegate.h" |
17 #include "ui/views/controls/button/button.h" | 17 #include "ui/views/controls/button/button.h" |
18 #include "ui/views/controls/combobox/combobox_listener.h" | 18 #include "ui/views/controls/combobox/combobox_listener.h" |
19 #include "ui/views/controls/link_listener.h" | 19 #include "ui/views/controls/link_listener.h" |
20 | 20 |
21 class Browser; | 21 class Browser; |
sky
2013/12/19 16:45:21
I think you can nuke this too.
hajimehoshi
2013/12/20 03:25:45
Done.
| |
22 class PrefService; | 22 class PrefService; |
23 class TranslateBubbleModel; | 23 class TranslateBubbleModel; |
24 | 24 |
25 namespace views { | 25 namespace views { |
26 class Checkbox; | 26 class Checkbox; |
27 class GridLayout; | 27 class GridLayout; |
28 class LabelButton; | 28 class LabelButton; |
29 class Link; | 29 class Link; |
30 class View; | 30 class View; |
31 } | 31 } |
32 | 32 |
33 class TranslateBubbleView : public views::BubbleDelegateView, | 33 class TranslateBubbleView : public views::BubbleDelegateView, |
34 public views::ButtonListener, | 34 public views::ButtonListener, |
35 public views::ComboboxListener, | 35 public views::ComboboxListener, |
36 public views::LinkListener, | 36 public views::LinkListener, |
37 public content::WebContentsObserver { | 37 public content::WebContentsObserver { |
38 public: | 38 public: |
39 virtual ~TranslateBubbleView(); | 39 virtual ~TranslateBubbleView(); |
40 | 40 |
41 // Shows the Translate bubble. | 41 // Shows the Translate bubble. |
42 static void ShowBubble(views::View* anchor_view, | 42 static void ShowBubble(views::View* anchor_view, |
43 content::WebContents* web_contents, | 43 content::WebContents* web_contents, |
44 TranslateBubbleModel::ViewState type, | 44 TranslateBubbleModel::ViewState type, |
45 TranslateErrors::Type error_type, | 45 TranslateErrors::Type error_type); |
46 Browser* browser); | |
47 | 46 |
48 // If true, the Translate bubble is being shown. | 47 // If true, the Translate bubble is being shown. |
49 static bool IsShowing(); | 48 static bool IsShowing(); |
50 | 49 |
51 // Returns the bubble view currently shown. This may return NULL. | 50 // Returns the bubble view currently shown. This may return NULL. |
52 static TranslateBubbleView* GetCurrentBubble(); | 51 static TranslateBubbleView* GetCurrentBubble(); |
53 | 52 |
54 TranslateBubbleModel* model() { return model_.get(); } | 53 TranslateBubbleModel* model() { return model_.get(); } |
55 | 54 |
56 // views::BubbleDelegateView methods. | 55 // views::BubbleDelegateView methods. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 DoneButtonWithoutTranslating); | 113 DoneButtonWithoutTranslating); |
115 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, | 114 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, |
116 CancelButtonReturningBeforeTranslate); | 115 CancelButtonReturningBeforeTranslate); |
117 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, | 116 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, |
118 CancelButtonReturningAfterTranslate); | 117 CancelButtonReturningAfterTranslate); |
119 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, CancelButtonReturningError); | 118 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, CancelButtonReturningError); |
120 | 119 |
121 TranslateBubbleView(views::View* anchor_view, | 120 TranslateBubbleView(views::View* anchor_view, |
122 scoped_ptr<TranslateBubbleModel> model, | 121 scoped_ptr<TranslateBubbleModel> model, |
123 TranslateErrors::Type error_type, | 122 TranslateErrors::Type error_type, |
124 Browser* browser, | |
125 content::WebContents* web_contents); | 123 content::WebContents* web_contents); |
126 | 124 |
127 // Returns the current child view. | 125 // Returns the current child view. |
128 views::View* GetCurrentView(); | 126 views::View* GetCurrentView(); |
129 | 127 |
130 // Handles the event when the user presses a button. | 128 // Handles the event when the user presses a button. |
131 void HandleButtonPressed(ButtonID sender_id); | 129 void HandleButtonPressed(ButtonID sender_id); |
132 | 130 |
133 // Handles the event when the user clicks a link. | 131 // Handles the event when the user clicks a link. |
134 void HandleLinkClicked(LinkID sender_id); | 132 void HandleLinkClicked(LinkID sender_id); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 views::LabelButton* advanced_cancel_button_; | 184 views::LabelButton* advanced_cancel_button_; |
187 views::LabelButton* advanced_done_button_; | 185 views::LabelButton* advanced_done_button_; |
188 | 186 |
189 scoped_ptr<TranslateBubbleModel> model_; | 187 scoped_ptr<TranslateBubbleModel> model_; |
190 | 188 |
191 TranslateErrors::Type error_type_; | 189 TranslateErrors::Type error_type_; |
192 | 190 |
193 // Whether the window is an incognito window. | 191 // Whether the window is an incognito window. |
194 const bool is_in_incognito_window_; | 192 const bool is_in_incognito_window_; |
195 | 193 |
196 // The browser to open the help URL into a new tab. | |
197 Browser* browser_; | |
198 | |
199 // Whether the translation is acutually executed. | 194 // Whether the translation is acutually executed. |
200 bool translate_executed_; | 195 bool translate_executed_; |
201 | 196 |
202 // Whether one of denial buttons is clicked. | 197 // Whether one of denial buttons is clicked. |
203 bool denial_button_clicked_; | 198 bool denial_button_clicked_; |
204 | 199 |
205 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleView); | 200 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleView); |
206 }; | 201 }; |
207 | 202 |
208 #endif // CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_BUBBLE_VIEW_H_ | 203 #endif // CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_BUBBLE_VIEW_H_ |
OLD | NEW |