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

Side by Side Diff: chrome/browser/translate/translate_infobar_delegate.h

Issue 25531002: Move language detection to a component (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Run translate unittests on iOS Created 7 years, 2 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_ 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "chrome/browser/infobars/infobar_delegate.h" 14 #include "chrome/browser/infobars/infobar_delegate.h"
15 #include "chrome/browser/translate/translate_prefs.h" 15 #include "chrome/browser/translate/translate_prefs.h"
16 #include "chrome/common/chrome_constants.h"
17 #include "chrome/common/translate/translate_errors.h" 16 #include "chrome/common/translate/translate_errors.h"
17 #include "components/translate/common/translate_constants.h"
18 18
19 class PrefService; 19 class PrefService;
20 20
21 // The defaults after which extra shortcuts for options 21 // The defaults after which extra shortcuts for options
22 // can be shown. 22 // can be shown.
23 struct ShortcutConfiguration { 23 struct ShortcutConfiguration {
24 int always_translate_min_count; 24 int always_translate_min_count;
25 int never_translate_min_count; 25 int never_translate_min_count;
26 }; 26 };
27 27
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 96 }
97 size_t target_language_index() const { return target_language_index_; } 97 size_t target_language_index() const { return target_language_index_; }
98 void set_target_language_index(size_t language_index) { 98 void set_target_language_index(size_t language_index) {
99 DCHECK_LT(language_index, num_languages()); 99 DCHECK_LT(language_index, num_languages());
100 target_language_index_ = language_index; 100 target_language_index_ = language_index;
101 } 101 }
102 102
103 // Convenience methods. 103 // Convenience methods.
104 std::string original_language_code() const { 104 std::string original_language_code() const {
105 return (original_language_index() == kNoIndex) ? 105 return (original_language_index() == kNoIndex) ?
106 chrome::kUnknownLanguageCode : 106 translate::kUnknownLanguageCode :
107 language_code_at(original_language_index()); 107 language_code_at(original_language_index());
108 } 108 }
109 std::string target_language_code() const { 109 std::string target_language_code() const {
110 return language_code_at(target_language_index()); 110 return language_code_at(target_language_index());
111 } 111 }
112 112
113 // Returns true if the current infobar indicates an error (in which case it 113 // Returns true if the current infobar indicates an error (in which case it
114 // should get a yellow background instead of a blue one). 114 // should get a yellow background instead of a blue one).
115 bool is_error() const { return infobar_type_ == TRANSLATION_ERROR; } 115 bool is_error() const { return infobar_type_ == TRANSLATION_ERROR; }
116 116
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 // The translation related preferences. 234 // The translation related preferences.
235 TranslatePrefs prefs_; 235 TranslatePrefs prefs_;
236 236
237 // Translation shortcut configuration 237 // Translation shortcut configuration
238 ShortcutConfiguration shortcut_config_; 238 ShortcutConfiguration shortcut_config_;
239 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); 239 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate);
240 }; 240 };
241 241
242 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_ 242 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_browsertest.cc ('k') | chrome/browser/translate/translate_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698