| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_TRANSLATE_CORE_BROWSER_LANGUAGE_STATE_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_LANGUAGE_STATE_H_ |
| 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_LANGUAGE_STATE_H_ | 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_LANGUAGE_STATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 void SetCurrentLanguage(const std::string& language); | 53 void SetCurrentLanguage(const std::string& language); |
| 54 const std::string& current_language() const { return current_lang_; } | 54 const std::string& current_language() const { return current_lang_; } |
| 55 | 55 |
| 56 bool page_needs_translation() const { return page_needs_translation_; } | 56 bool page_needs_translation() const { return page_needs_translation_; } |
| 57 | 57 |
| 58 // Whether the page is currently in the process of being translated. | 58 // Whether the page is currently in the process of being translated. |
| 59 bool translation_pending() const { return translation_pending_; } | 59 bool translation_pending() const { return translation_pending_; } |
| 60 void set_translation_pending(bool value) { translation_pending_ = value; } | 60 void set_translation_pending(bool value) { translation_pending_ = value; } |
| 61 | 61 |
| 62 // Whether an error occured during translation. |
| 63 bool translation_error() const { return translation_error_; } |
| 64 void set_translation_error(bool value) { translation_error_ = value; } |
| 65 |
| 62 // Whether the user has already declined to translate the page. | 66 // Whether the user has already declined to translate the page. |
| 63 bool translation_declined() const { return translation_declined_; } | 67 bool translation_declined() const { return translation_declined_; } |
| 64 void set_translation_declined(bool value) { translation_declined_ = value; } | 68 void set_translation_declined(bool value) { translation_declined_ = value; } |
| 65 | 69 |
| 66 // Whether the current page was navigated through an in-page (fragment) | 70 // Whether the current page was navigated through an in-page (fragment) |
| 67 // navigation. | 71 // navigation. |
| 68 bool in_page_navigation() const { return in_page_navigation_; } | 72 bool in_page_navigation() const { return in_page_navigation_; } |
| 69 | 73 |
| 70 // Whether the translate is enabled. | 74 // Whether the translate is enabled. |
| 71 bool translate_enabled() const { return translate_enabled_; } | 75 bool translate_enabled() const { return translate_enabled_; } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 102 bool page_needs_translation_; | 106 bool page_needs_translation_; |
| 103 | 107 |
| 104 // Whether a translation is currently pending. | 108 // Whether a translation is currently pending. |
| 105 // This is needed to avoid sending duplicate translate requests to a page. | 109 // This is needed to avoid sending duplicate translate requests to a page. |
| 106 // Translations may be initiated every time the load stops for the main frame, | 110 // Translations may be initiated every time the load stops for the main frame, |
| 107 // which may happen several times. | 111 // which may happen several times. |
| 108 // TODO(jcampan): make the client send the language just once per navigation | 112 // TODO(jcampan): make the client send the language just once per navigation |
| 109 // then we can get rid of that state. | 113 // then we can get rid of that state. |
| 110 bool translation_pending_; | 114 bool translation_pending_; |
| 111 | 115 |
| 116 // Whether an error occured during translation. |
| 117 bool translation_error_; |
| 118 |
| 112 // Whether the user has declined to translate the page (by closing the infobar | 119 // Whether the user has declined to translate the page (by closing the infobar |
| 113 // for example). This is necessary as a new infobar could be shown if a new | 120 // for example). This is necessary as a new infobar could be shown if a new |
| 114 // load happens in the page after the user closed the infobar. | 121 // load happens in the page after the user closed the infobar. |
| 115 bool translation_declined_; | 122 bool translation_declined_; |
| 116 | 123 |
| 117 // Whether the current navigation is a fragment navigation (in page). | 124 // Whether the current navigation is a fragment navigation (in page). |
| 118 bool in_page_navigation_; | 125 bool in_page_navigation_; |
| 119 | 126 |
| 120 // Whether the Translate is enabled. | 127 // Whether the Translate is enabled. |
| 121 bool translate_enabled_; | 128 bool translate_enabled_; |
| 122 | 129 |
| 123 DISALLOW_COPY_AND_ASSIGN(LanguageState); | 130 DISALLOW_COPY_AND_ASSIGN(LanguageState); |
| 124 }; | 131 }; |
| 125 | 132 |
| 126 } // namespace translate | 133 } // namespace translate |
| 127 | 134 |
| 128 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_LANGUAGE_STATE_H_ | 135 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_LANGUAGE_STATE_H_ |
| OLD | NEW |