Chromium Code Reviews| 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_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 { | |
|
msw
2016/04/29 20:00:00
nit: add a blank line between the namespace and th
ftang
2016/04/29 22:37:00
Done.
| |
| 12 enum TranslateBubbleUiEvent { | |
| 13 // Bubble enters the options state. | |
|
msw
2016/04/29 20:00:00
Give a more descriptive comment, maybe "The bubble
ftang
2016/04/29 22:37:00
Done.
| |
| 14 SET_STATE_OPTIONS = 1, | |
|
msw
2016/04/29 20:00:00
Why do you give explicit values to the enums? Remo
| |
| 15 | |
| 16 // Bubble leaves the options state. | |
| 17 LEAVE_STATE_OPTIONS = 2, | |
| 18 | |
| 19 // User click the advanced link | |
|
msw
2016/04/29 20:00:00
Add trailing periods on this comment and others be
msw
2016/04/29 20:00:00
It'd be nice if you used the same subject and tens
ftang
2016/04/29 22:37:00
Done.
ftang
2016/04/29 22:37:00
Done.
| |
| 20 ADVANCED_LINK_CLICKED = 3, | |
| 21 | |
| 22 // User check the "always translate" checkbox | |
| 23 ALWAYS_TRANSLATE_CHECKED = 4, | |
| 24 | |
| 25 // User uncheck the "always translate" checkbox | |
| 26 ALWAYS_TRANSLATE_UNCHECKED = 5, | |
| 27 | |
| 28 // User select the "Nope" in option menu | |
| 29 NOPE_MENU_CLICKED = 6, | |
| 30 | |
| 31 // User select the "Never translate language" in option menu | |
| 32 NEVER_TRANSLATE_LANGUAGE_MENU_CLICKED = 7, | |
| 33 | |
| 34 // User select the "Never translate this site" in option menu | |
| 35 NEVER_TRANSLATE_SITE_MENU_CLICKED = 8, | |
| 36 | |
| 37 // User click "Translate" button | |
| 38 TRANSLATE_BUTTON_CLICKED = 9, | |
| 39 | |
| 40 // User click the "Done" button | |
| 41 DONE_BUTTON_CLICKED = 10, | |
| 42 | |
| 43 // User click the "Cancel" button | |
| 44 CANCEL_BUTTON_CLICKED = 11, | |
| 45 | |
| 46 // User click the "Closed" [X] button | |
|
msw
2016/04/29 20:00:00
nit: s/Closed/Close/ and s/[X]/(x)/
| |
| 47 CLOSE_BUTTON_CLICKED = 12, | |
| 48 | |
| 49 // User click the "Try Again" button | |
| 50 TRY_AGAIN_BUTTON_CLICKED = 13, | |
| 51 | |
| 52 // User click the "Show Original" button | |
| 53 SHOW_ORIGINAL_BUTTON_CLICKED = 14, | |
| 54 | |
| 55 // User click the "Setting" link | |
| 56 SETTING_LINK_CLICKED = 15, | |
| 57 | |
| 58 // User change the "Source language" | |
| 59 SOURCE_LANGUAGE_MENU_CLICKED = 16, | |
| 60 | |
| 61 // User change the "Target language" | |
| 62 TARGET_LANGUAGE_MENU_CLICKED = 17 , | |
|
msw
2016/04/29 20:00:00
nit: remove the space before the comma.
| |
| 63 | |
| 64 TRANSLATE_BUBBLE_UI_EVENT_MAX | |
| 65 }; | |
| 66 } // namespace translate | |
| 67 | |
| 11 // The class which manages the transition of the view state of the Translate | 68 // The class which manages the transition of the view state of the Translate |
| 12 // bubble. | 69 // bubble. |
| 13 class TranslateBubbleViewStateTransition { | 70 class TranslateBubbleViewStateTransition { |
| 14 public: | 71 public: |
| 15 explicit TranslateBubbleViewStateTransition( | 72 explicit TranslateBubbleViewStateTransition( |
| 16 TranslateBubbleModel::ViewState view_state); | 73 TranslateBubbleModel::ViewState view_state); |
| 17 | 74 |
| 18 TranslateBubbleModel::ViewState view_state() const { return view_state_; } | 75 TranslateBubbleModel::ViewState view_state() const { return view_state_; } |
| 19 | 76 |
| 20 // Transitions the view state. | 77 // Transitions the view state. |
| 21 void SetViewState(TranslateBubbleModel::ViewState view_state); | 78 void SetViewState(TranslateBubbleModel::ViewState view_state); |
| 22 | 79 |
| 23 // Goes back from the 'Advanced' view state. | 80 // Goes back from the 'Advanced' view state. |
| 24 void GoBackFromAdvanced(); | 81 void GoBackFromAdvanced(); |
| 25 | 82 |
| 26 private: | 83 private: |
| 27 // The current view type. | 84 // The current view type. |
| 28 TranslateBubbleModel::ViewState view_state_; | 85 TranslateBubbleModel::ViewState view_state_; |
| 29 | 86 |
| 30 // The view type. When the current view type is not 'Advanced' view, this is | 87 // 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 | 88 // 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 | 89 // before the user opens the 'Advanced' view. This is used to navigate when |
| 33 // pressing 'Cancel' button on the 'Advanced' view. | 90 // pressing 'Cancel' button on the 'Advanced' view. |
| 34 TranslateBubbleModel::ViewState view_state_before_advanced_view_; | 91 TranslateBubbleModel::ViewState view_state_before_advanced_view_; |
| 35 | 92 |
| 36 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleViewStateTransition); | 93 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleViewStateTransition); |
| 37 }; | 94 }; |
| 38 | 95 |
| 39 #endif // CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_VIEW_STATE_TRANSITION_H_ | 96 #endif // CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_VIEW_STATE_TRANSITION_H_ |
| OLD | NEW |