Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: chrome/browser/ui/views/translate/translate_bubble_view.h

Issue 1923143003: Implement the 2016Q2 Translate UI designe spec out in (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test breakage Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/controls/styled_label_listener.h"
23 24
24 class Browser; 25 class Browser;
25 class PrefService; 26 class PrefService;
26 27
28 namespace gfx {
29 class Range;
30 }
31
27 namespace views { 32 namespace views {
28 class Checkbox; 33 class Checkbox;
29 class GridLayout; 34 class GridLayout;
30 class LabelButton; 35 class LabelButton;
31 class Link; 36 class Link;
32 class View; 37 class View;
38 class StyledLabel;
33 } 39 }
34 40
35 namespace ui { 41 namespace ui {
36 class SimpleComboboxModel; 42 class SimpleComboboxModel;
37 } 43 }
38 44
39 class TranslateBubbleView : public LocationBarBubbleDelegateView, 45 class TranslateBubbleView : public LocationBarBubbleDelegateView,
40 public views::ButtonListener, 46 public views::ButtonListener,
41 public views::ComboboxListener, 47 public views::ComboboxListener,
42 public views::LinkListener, 48 public views::LinkListener,
49 public views::StyledLabelListener,
43 public content::WebContentsObserver { 50 public content::WebContentsObserver {
44 public: 51 public:
45 // Commands shown in the action-style combobox. The value corresponds to the 52 // Commands shown in the action-style combobox. The value corresponds to the
46 // position in the combobox menu. Gaps will become separators. 53 // position in the combobox menu. Gaps will become separators.
47 enum class DenialComboboxIndex { 54 enum class DenialComboboxIndex {
48 DONT_TRANSLATE = 0, 55 DONT_TRANSLATE = 0,
49 NEVER_TRANSLATE_LANGUAGE = 1, 56 NEVER_TRANSLATE_LANGUAGE = 1,
50 NEVER_TRANSLATE_SITE = 3, 57 NEVER_TRANSLATE_SITE = 3,
51 MENU_SIZE = 4, 58 MENU_SIZE = 4,
52 }; 59 };
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 96
90 // views::LinkListener method. 97 // views::LinkListener method.
91 void LinkClicked(views::Link* source, int event_flags) override; 98 void LinkClicked(views::Link* source, int event_flags) override;
92 99
93 // content::WebContentsObserver method. 100 // content::WebContentsObserver method.
94 void WebContentsDestroyed() override; 101 void WebContentsDestroyed() override;
95 102
96 // Returns the current view state. 103 // Returns the current view state.
97 TranslateBubbleModel::ViewState GetViewState() const; 104 TranslateBubbleModel::ViewState GetViewState() const;
98 105
106 bool ShouldShowCloseButton() const override;
107
108 // views::StyledLabelListener method.
109 void StyledLabelLinkClicked(views::StyledLabel* label,
110 const gfx::Range& range,
111 int event_flags) override;
99 private: 112 private:
100 enum LinkID { 113 enum LinkID {
101 LINK_ID_ADVANCED, 114 LINK_ID_ADVANCED,
102 LINK_ID_LANGUAGE_SETTINGS, 115 LINK_ID_LANGUAGE_SETTINGS,
103 }; 116 };
104 117
105 enum ButtonID { 118 enum ButtonID {
106 BUTTON_ID_TRANSLATE, 119 BUTTON_ID_TRANSLATE,
107 BUTTON_ID_DONE, 120 BUTTON_ID_DONE,
108 BUTTON_ID_CANCEL, 121 BUTTON_ID_CANCEL,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 views::LabelButton* advanced_cancel_button_; 217 views::LabelButton* advanced_cancel_button_;
205 views::LabelButton* advanced_done_button_; 218 views::LabelButton* advanced_done_button_;
206 219
207 std::unique_ptr<TranslateBubbleModel> model_; 220 std::unique_ptr<TranslateBubbleModel> model_;
208 221
209 translate::TranslateErrors::Type error_type_; 222 translate::TranslateErrors::Type error_type_;
210 223
211 // Whether the window is an incognito window. 224 // Whether the window is an incognito window.
212 const bool is_in_incognito_window_; 225 const bool is_in_incognito_window_;
213 226
214 // Whether the translation is acutually executed. 227 // Whether one of denial buttons is clicked.
215 bool translate_executed_; 228 bool denial_button_clicked_;
229
230 // Use 2016 Q2 Translate UI
231 bool use_2016_q2_ui_;
232
233 // Show icon inside dialogbox or not
234 bool show_icon_;
235
236 // Show Always translate checkbox inside dialogbox or not
237 bool show_always_checkbox_;
238
239 // Use Blue button or not
240 bool use_blue_button_;
216 241
217 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleView); 242 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleView);
218 }; 243 };
219 244
220 #endif // CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_BUBBLE_VIEW_H_ 245 #endif // CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698