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 21 matching lines...) Expand all Loading... |
32 namespace ui { | 32 namespace ui { |
33 class SimpleComboboxModel; | 33 class SimpleComboboxModel; |
34 } | 34 } |
35 | 35 |
36 class TranslateBubbleView : public views::BubbleDelegateView, | 36 class TranslateBubbleView : public views::BubbleDelegateView, |
37 public views::ButtonListener, | 37 public views::ButtonListener, |
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 ~TranslateBubbleView() override; |
43 | 43 |
44 // Shows the Translate bubble. | 44 // Shows the Translate bubble. |
45 // | 45 // |
46 // |is_user_gesture| is true when the bubble is shown on the user's delibarate | 46 // |is_user_gesture| is true when the bubble is shown on the user's delibarate |
47 // action. | 47 // action. |
48 static void ShowBubble(views::View* anchor_view, | 48 static void ShowBubble(views::View* anchor_view, |
49 content::WebContents* web_contents, | 49 content::WebContents* web_contents, |
50 translate::TranslateStep step, | 50 translate::TranslateStep step, |
51 translate::TranslateErrors::Type error_type, | 51 translate::TranslateErrors::Type error_type, |
52 bool is_user_gesture); | 52 bool is_user_gesture); |
53 | 53 |
54 // Closes the current bubble if existing. | 54 // Closes the current bubble if existing. |
55 static void CloseBubble(); | 55 static void CloseBubble(); |
56 | 56 |
57 // If true, the Translate bubble is being shown. | 57 // If true, the Translate bubble is being shown. |
58 static bool IsShowing(); | 58 static bool IsShowing(); |
59 | 59 |
60 // Returns the bubble view currently shown. This may return NULL. | 60 // Returns the bubble view currently shown. This may return NULL. |
61 static TranslateBubbleView* GetCurrentBubble(); | 61 static TranslateBubbleView* GetCurrentBubble(); |
62 | 62 |
63 TranslateBubbleModel* model() { return model_.get(); } | 63 TranslateBubbleModel* model() { return model_.get(); } |
64 | 64 |
65 // views::BubbleDelegateView methods. | 65 // views::BubbleDelegateView methods. |
66 virtual void Init() override; | 66 void Init() override; |
67 virtual void ButtonPressed(views::Button* sender, | 67 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
68 const ui::Event& event) override; | |
69 | 68 |
70 // views::WidgetDelegate method. | 69 // views::WidgetDelegate method. |
71 virtual void WindowClosing() override; | 70 void WindowClosing() override; |
72 | 71 |
73 // views::View methods. | 72 // views::View methods. |
74 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 73 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
75 virtual gfx::Size GetPreferredSize() const override; | 74 gfx::Size GetPreferredSize() const override; |
76 | 75 |
77 // views::CombboxListener methods. | 76 // views::CombboxListener methods. |
78 virtual void OnPerformAction(views::Combobox* combobox) override; | 77 void OnPerformAction(views::Combobox* combobox) override; |
79 | 78 |
80 // views::LinkListener method. | 79 // views::LinkListener method. |
81 virtual void LinkClicked(views::Link* source, int event_flags) override; | 80 void LinkClicked(views::Link* source, int event_flags) override; |
82 | 81 |
83 // content::WebContentsObserver method. | 82 // content::WebContentsObserver method. |
84 virtual void WebContentsDestroyed() override; | 83 void WebContentsDestroyed() override; |
85 | 84 |
86 // Returns the current view state. | 85 // Returns the current view state. |
87 TranslateBubbleModel::ViewState GetViewState() const; | 86 TranslateBubbleModel::ViewState GetViewState() const; |
88 | 87 |
89 private: | 88 private: |
90 enum LinkID { | 89 enum LinkID { |
91 LINK_ID_ADVANCED, | 90 LINK_ID_ADVANCED, |
92 LINK_ID_LANGUAGE_SETTINGS, | 91 LINK_ID_LANGUAGE_SETTINGS, |
93 }; | 92 }; |
94 | 93 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // Whether the translation is acutually executed. | 202 // Whether the translation is acutually executed. |
204 bool translate_executed_; | 203 bool translate_executed_; |
205 | 204 |
206 // Whether one of denial buttons is clicked. | 205 // Whether one of denial buttons is clicked. |
207 bool denial_button_clicked_; | 206 bool denial_button_clicked_; |
208 | 207 |
209 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleView); | 208 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleView); |
210 }; | 209 }; |
211 | 210 |
212 #endif // CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_BUBBLE_VIEW_H_ | 211 #endif // CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_BUBBLE_VIEW_H_ |
OLD | NEW |