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

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

Issue 15470004: Translate: display alpha language name with (alpha) suffix (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update resource description Created 7 years, 6 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 | Annotate | Revision Log
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_TRANSLATE_TRANSLATE_LANGUAGE_LIST_H_ 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_LANGUAGE_LIST_H_
6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_LANGUAGE_LIST_H_ 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_LANGUAGE_LIST_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 20 matching lines...) Expand all
31 // translate to and from. 31 // translate to and from.
32 void GetSupportedLanguages(std::vector<std::string>* languages); 32 void GetSupportedLanguages(std::vector<std::string>* languages);
33 33
34 // Returns the language code that can be used with the Translate method for a 34 // Returns the language code that can be used with the Translate method for a
35 // specified |chrome_locale|. 35 // specified |chrome_locale|.
36 std::string GetLanguageCode(const std::string& chrome_locale); 36 std::string GetLanguageCode(const std::string& chrome_locale);
37 37
38 // Returns true if |language| is supported by the translation server. 38 // Returns true if |language| is supported by the translation server.
39 bool IsSupportedLanguage(const std::string& language); 39 bool IsSupportedLanguage(const std::string& language);
40 40
41 // TODO(toyoshim): Add IsSupportedAlphaLanguage() here. 41 // Returns true if |language| is supported by the translation server as a
42 // alpha language.
43 bool IsAlphaLanguage(const std::string& language);
42 44
43 // Fetches the language list from the translate server. It will not retry 45 // Fetches the language list from the translate server. It will not retry
44 // more than kMaxRetryLanguageListFetch times. 46 // more than kMaxRetryLanguageListFetch times.
45 void RequestLanguageList(); 47 void RequestLanguageList();
46 48
47 // static const values shared with our browser tests. 49 // static const values shared with our browser tests.
48 static const char kLanguageListCallbackName[]; 50 static const char kLanguageListCallbackName[];
49 static const char kTargetLanguagesKey[]; 51 static const char kTargetLanguagesKey[];
50 52
51 private: 53 private:
52 // Parses |language_list| and fills |supported_languages_| with the list of 54 // Parses |language_list| and fills |supported_languages_| with the list of
53 // languages that the translate server can translate to and from. 55 // languages that the translate server can translate to and from.
54 void SetSupportedLanguages(const std::string& language_list); 56 void SetSupportedLanguages(const std::string& language_list);
55 57
58 // Fetches the language list. If |alpha| is set, it requests a language list
59 // including alpha languages.
60 void FetchLanguageList(bool alpha);
61
56 // The languages supported by the translation server. 62 // The languages supported by the translation server.
57 std::set<std::string> supported_languages_; 63 std::set<std::string> supported_languages_;
58 64
65 // The alpha languages supported by the translation server.
66 std::set<std::string> supported_alpha_languages_;
67
59 // An URLFetcher instance to fetch a server providing supported language list. 68 // An URLFetcher instance to fetch a server providing supported language list.
60 scoped_ptr<net::URLFetcher> url_fetcher_; 69 scoped_ptr<net::URLFetcher> url_fetcher_;
61 70
71 // Flag if |ufl_fetcher_| is requesting a language list including alpha
MAD 2013/05/29 14:09:32 I usually try to avoid such flags, it's a bit risk
Takashi Toyoshima 2013/05/30 06:25:31 Done.
72 // languages.
73 bool requesting_alpha_;
74
62 DISALLOW_COPY_AND_ASSIGN(TranslateLanguageList); 75 DISALLOW_COPY_AND_ASSIGN(TranslateLanguageList);
63 }; 76 };
64 77
65 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_LANGUAGE_LIST_H_ 78 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_LANGUAGE_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698