| 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/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chrome/browser/translate/chrome_translate_client.h" | 13 #include "chrome/browser/translate/chrome_translate_client.h" |
| 14 #include "chrome/browser/ui/translate/language_combobox_model.h" | 14 #include "chrome/browser/ui/translate/language_combobox_model.h" |
| 15 #include "chrome/browser/ui/translate/translate_bubble_model.h" | 15 #include "chrome/browser/ui/translate/translate_bubble_model.h" |
| 16 #include "chrome/browser/ui/translate/translate_bubble_test_utils.h" | 16 #include "chrome/browser/ui/translate/translate_bubble_test_utils.h" |
| 17 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view
.h" | 17 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view
.h" |
| 18 #include "components/translate/core/common/translate_errors.h" | 18 #include "components/translate/core/common/translate_errors.h" |
| 19 #include "content/public/browser/web_contents_observer.h" | 19 #include "content/public/browser/web_contents_observer.h" |
| 20 #include "ui/views/controls/button/button.h" | 20 #include "ui/views/controls/button/button.h" |
| 21 #include "ui/views/controls/combobox/combobox_listener.h" | 21 #include "ui/views/controls/combobox/combobox_listener.h" |
| 22 #include "ui/views/controls/link_listener.h" | 22 #include "ui/views/controls/link_listener.h" |
| 23 #include "ui/views/widget/widget_observer_view.h" |
| 23 | 24 |
| 24 class Browser; | 25 class Browser; |
| 25 class PrefService; | 26 class PrefService; |
| 26 | 27 |
| 27 namespace views { | 28 namespace views { |
| 28 class Checkbox; | 29 class Checkbox; |
| 29 class GridLayout; | 30 class GridLayout; |
| 30 class LabelButton; | 31 class LabelButton; |
| 31 class Link; | 32 class Link; |
| 32 class View; | 33 class View; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 50 NEVER_TRANSLATE_SITE = 3, | 51 NEVER_TRANSLATE_SITE = 3, |
| 51 MENU_SIZE = 4, | 52 MENU_SIZE = 4, |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 ~TranslateBubbleView() override; | 55 ~TranslateBubbleView() override; |
| 55 | 56 |
| 56 // Shows the Translate bubble. | 57 // Shows the Translate bubble. |
| 57 // | 58 // |
| 58 // |is_user_gesture| is true when the bubble is shown on the user's delibarate | 59 // |is_user_gesture| is true when the bubble is shown on the user's delibarate |
| 59 // action. | 60 // action. |
| 60 static void ShowBubble(views::View* anchor_view, | 61 static void ShowBubble(views::WidgetObserverView* anchor_view, |
| 61 content::WebContents* web_contents, | 62 content::WebContents* web_contents, |
| 62 translate::TranslateStep step, | 63 translate::TranslateStep step, |
| 63 translate::TranslateErrors::Type error_type, | 64 translate::TranslateErrors::Type error_type, |
| 64 DisplayReason reason); | 65 DisplayReason reason); |
| 65 | 66 |
| 66 // Closes the current bubble if existing. | 67 // Closes the current bubble if existing. |
| 67 static void CloseBubble(); | 68 static void CloseBubble(); |
| 68 | 69 |
| 69 // Returns the bubble view currently shown. This may return NULL. | 70 // Returns the bubble view currently shown. This may return NULL. |
| 70 static TranslateBubbleView* GetCurrentBubble(); | 71 static TranslateBubbleView* GetCurrentBubble(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 AlwaysTranslateCheckboxAndDoneButton); | 128 AlwaysTranslateCheckboxAndDoneButton); |
| 128 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, DoneButton); | 129 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, DoneButton); |
| 129 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, | 130 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, |
| 130 DoneButtonWithoutTranslating); | 131 DoneButtonWithoutTranslating); |
| 131 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, | 132 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, |
| 132 CancelButtonReturningBeforeTranslate); | 133 CancelButtonReturningBeforeTranslate); |
| 133 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, | 134 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, |
| 134 CancelButtonReturningAfterTranslate); | 135 CancelButtonReturningAfterTranslate); |
| 135 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, CancelButtonReturningError); | 136 FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, CancelButtonReturningError); |
| 136 | 137 |
| 137 TranslateBubbleView(views::View* anchor_view, | 138 TranslateBubbleView(views::WidgetObserverView* anchor_view, |
| 138 scoped_ptr<TranslateBubbleModel> model, | 139 scoped_ptr<TranslateBubbleModel> model, |
| 139 translate::TranslateErrors::Type error_type, | 140 translate::TranslateErrors::Type error_type, |
| 140 content::WebContents* web_contents); | 141 content::WebContents* web_contents); |
| 141 | 142 |
| 142 // Returns the current child view. | 143 // Returns the current child view. |
| 143 views::View* GetCurrentView() const; | 144 views::View* GetCurrentView() const; |
| 144 | 145 |
| 145 // Handles the event when the user presses a button. | 146 // Handles the event when the user presses a button. |
| 146 void HandleButtonPressed(ButtonID sender_id); | 147 void HandleButtonPressed(ButtonID sender_id); |
| 147 | 148 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // Whether the translation is acutually executed. | 213 // Whether the translation is acutually executed. |
| 213 bool translate_executed_; | 214 bool translate_executed_; |
| 214 | 215 |
| 215 // Whether one of denial buttons is clicked. | 216 // Whether one of denial buttons is clicked. |
| 216 bool denial_button_clicked_; | 217 bool denial_button_clicked_; |
| 217 | 218 |
| 218 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleView); | 219 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleView); |
| 219 }; | 220 }; |
| 220 | 221 |
| 221 #endif // CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_BUBBLE_VIEW_H_ | 222 #endif // CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_BUBBLE_VIEW_H_ |
| OLD | NEW |