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

Side by Side Diff: chrome/browser/ui/translate/translate_bubble_view_state_transition.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: minor changes in comments 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_TRANSLATE_TRANSLATE_BUBBLE_VIEW_STATE_TRANSITION_H_ 5 #ifndef CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_VIEW_STATE_TRANSITION_H_
6 #define CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_VIEW_STATE_TRANSITION_H_ 6 #define CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_VIEW_STATE_TRANSITION_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/ui/translate/translate_bubble_model.h" 9 #include "chrome/browser/ui/translate/translate_bubble_model.h"
10 10
11 namespace translate {
12
13 enum TranslateBubbleUiEvent {
14 // The user clicked the advanced option.
15 SET_STATE_OPTIONS,
16
17 // The user clicked "Done" and went back from the advanced option.
18 LEAVE_STATE_OPTIONS,
19
20 // The user clicked the advanced link.
21 ADVANCED_LINK_CLICKED,
22
23 // The user checked the "always translate" checkbox.
24 ALWAYS_TRANSLATE_CHECKED,
25
26 // The user unchecked the "always translate" checkbox.
27 ALWAYS_TRANSLATE_UNCHECKED,
28
29 // The user selected "Nope" in the "Options" menu.
30 NOPE_MENU_CLICKED,
31
32 // The user selected "Never translate language" in the "Options" menu.
33 NEVER_TRANSLATE_LANGUAGE_MENU_CLICKED,
34
35 // The user selected "Never translate this site" in the "Options" menu.
36 NEVER_TRANSLATE_SITE_MENU_CLICKED,
37
38 // The user clicked the "Translate" button.
39 TRANSLATE_BUTTON_CLICKED,
40
41 // The user clicked the "Done" button.
42 DONE_BUTTON_CLICKED,
43
44 // The user clicked the "Cancel" button.
45 CANCEL_BUTTON_CLICKED,
46
47 // The user clicked the "Closed" [X] button.
48 CLOSE_BUTTON_CLICKED,
49
50 // The user clicked the "Try Again" button.
51 TRY_AGAIN_BUTTON_CLICKED,
52
53 // The user clicked the "Show Original" button.
54 SHOW_ORIGINAL_BUTTON_CLICKED,
55
56 // The user clicked the "Settings" link.
57 SETTINGS_LINK_CLICKED,
58
59 // The user changed the "Source language".
60 SOURCE_LANGUAGE_MENU_CLICKED,
61
62 // The user changed the "Target language".
63 TARGET_LANGUAGE_MENU_CLICKED,
64
65 TRANSLATE_BUBBLE_UI_EVENT_MAX
66 };
67
68 } // namespace translate
69
11 // The class which manages the transition of the view state of the Translate 70 // The class which manages the transition of the view state of the Translate
12 // bubble. 71 // bubble.
13 class TranslateBubbleViewStateTransition { 72 class TranslateBubbleViewStateTransition {
14 public: 73 public:
15 explicit TranslateBubbleViewStateTransition( 74 explicit TranslateBubbleViewStateTransition(
16 TranslateBubbleModel::ViewState view_state); 75 TranslateBubbleModel::ViewState view_state);
17 76
18 TranslateBubbleModel::ViewState view_state() const { return view_state_; } 77 TranslateBubbleModel::ViewState view_state() const { return view_state_; }
19 78
20 // Transitions the view state. 79 // Transitions the view state.
21 void SetViewState(TranslateBubbleModel::ViewState view_state); 80 void SetViewState(TranslateBubbleModel::ViewState view_state);
22 81
23 // Goes back from the 'Advanced' view state. 82 // Goes back from the 'Advanced' view state.
24 void GoBackFromAdvanced(); 83 void GoBackFromAdvanced();
25 84
26 private: 85 private:
27 // The current view type. 86 // The current view type.
28 TranslateBubbleModel::ViewState view_state_; 87 TranslateBubbleModel::ViewState view_state_;
29 88
30 // The view type. When the current view type is not 'Advanced' view, this is 89 // The view type. When the current view type is not 'Advanced' view, this is
31 // equivalent to |view_state_|. Otherwise, this is the previous view type 90 // equivalent to |view_state_|. Otherwise, this is the previous view type
32 // before the user opens the 'Advanced' view. This is used to navigate when 91 // before the user opens the 'Advanced' view. This is used to navigate when
33 // pressing 'Cancel' button on the 'Advanced' view. 92 // pressing 'Cancel' button on the 'Advanced' view.
34 TranslateBubbleModel::ViewState view_state_before_advanced_view_; 93 TranslateBubbleModel::ViewState view_state_before_advanced_view_;
35 94
36 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleViewStateTransition); 95 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleViewStateTransition);
37 }; 96 };
38 97
39 #endif // CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_VIEW_STATE_TRANSITION_H_ 98 #endif // CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_VIEW_STATE_TRANSITION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698