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

Side by Side Diff: components/translate/core/browser/translate_prefs.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: add 200 icon png. remove unnecessary include in .cc file, remove unnecessary reset and remove expli… 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 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_TRANSLATE_PREFS_H_ 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_PREFS_H_
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_PREFS_H_ 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_PREFS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/feature_list.h"
13 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/time/time.h" 16 #include "base/time/time.h"
16 #include "build/build_config.h" 17 #include "build/build_config.h"
17 #include "components/prefs/scoped_user_pref_update.h" 18 #include "components/prefs/scoped_user_pref_update.h"
18 #include "url/gurl.h" 19 #include "url/gurl.h"
19 20
20 class PrefService; 21 class PrefService;
21 class Profile; 22 class Profile;
22 23
23 namespace base { 24 namespace base {
24 class DictionaryValue; 25 class DictionaryValue;
25 class ListValue; 26 class ListValue;
26 } 27 }
27 28
28 namespace user_prefs { 29 namespace user_prefs {
29 class PrefRegistrySyncable; 30 class PrefRegistrySyncable;
30 } 31 }
31 32
32 namespace translate { 33 namespace translate {
33 34
35 // Feature flag for "Translate UI 2016 Q2" project.
36 extern const base::Feature kTranslateUI2016Q2;
msw 2016/05/03 22:33:35 Does this belong in chrome/common/chrome_features.
ftang 2016/05/03 23:55:42 this is not really a feature flag, but a short ter
msw 2016/05/04 00:19:20 Acknowledged.
37
34 class TranslateAcceptLanguages; 38 class TranslateAcceptLanguages;
35 39
36 // Allows updating denial times for a specific language while maintaining the 40 // Allows updating denial times for a specific language while maintaining the
37 // maximum list size and ensuring PrefObservers are notified of change values. 41 // maximum list size and ensuring PrefObservers are notified of change values.
38 class DenialTimeUpdate { 42 class DenialTimeUpdate {
39 public: 43 public:
40 DenialTimeUpdate(PrefService* prefs, 44 DenialTimeUpdate(PrefService* prefs,
41 const std::string& language, 45 const std::string& language,
42 size_t max_denial_count); 46 size_t max_denial_count);
43 ~DenialTimeUpdate(); 47 ~DenialTimeUpdate();
(...skipping 19 matching lines...) Expand all
63 }; 67 };
64 68
65 // The wrapper of PrefService object for Translate. 69 // The wrapper of PrefService object for Translate.
66 // 70 //
67 // It is assumed that |prefs_| is alive while this instance is alive. 71 // It is assumed that |prefs_| is alive while this instance is alive.
68 class TranslatePrefs { 72 class TranslatePrefs {
69 public: 73 public:
70 static const char kPrefTranslateSiteBlacklist[]; 74 static const char kPrefTranslateSiteBlacklist[];
71 static const char kPrefTranslateWhitelists[]; 75 static const char kPrefTranslateWhitelists[];
72 static const char kPrefTranslateDeniedCount[]; 76 static const char kPrefTranslateDeniedCount[];
77 static const char kPrefTranslateIgnoredCount[];
73 static const char kPrefTranslateAcceptedCount[]; 78 static const char kPrefTranslateAcceptedCount[];
74 static const char kPrefTranslateBlockedLanguages[]; 79 static const char kPrefTranslateBlockedLanguages[];
75 static const char kPrefTranslateLastDeniedTimeForLanguage[]; 80 static const char kPrefTranslateLastDeniedTimeForLanguage[];
76 static const char kPrefTranslateTooOftenDeniedForLanguage[]; 81 static const char kPrefTranslateTooOftenDeniedForLanguage[];
77 82
78 // |preferred_languages_pref| is only used on Chrome OS, other platforms must 83 // |preferred_languages_pref| is only used on Chrome OS, other platforms must
79 // pass NULL. 84 // pass NULL.
80 TranslatePrefs(PrefService* user_prefs, 85 TranslatePrefs(PrefService* user_prefs,
81 const char* accept_languages_pref, 86 const char* accept_languages_pref,
82 const char* preferred_languages_pref); 87 const char* preferred_languages_pref);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // Will return true if at least one site has been blacklisted. 122 // Will return true if at least one site has been blacklisted.
118 bool HasBlacklistedSites() const; 123 bool HasBlacklistedSites() const;
119 124
120 // These methods are used to track how many times the user has denied the 125 // These methods are used to track how many times the user has denied the
121 // translation for a specific language. (So we can present a UI to black-list 126 // translation for a specific language. (So we can present a UI to black-list
122 // that language if the user keeps denying translations). 127 // that language if the user keeps denying translations).
123 int GetTranslationDeniedCount(const std::string& language) const; 128 int GetTranslationDeniedCount(const std::string& language) const;
124 void IncrementTranslationDeniedCount(const std::string& language); 129 void IncrementTranslationDeniedCount(const std::string& language);
125 void ResetTranslationDeniedCount(const std::string& language); 130 void ResetTranslationDeniedCount(const std::string& language);
126 131
132 // These methods are used to track how many times the user has ignored the
133 // translation bubble for a specific language.
134 int GetTranslationIgnoredCount(const std::string& language) const;
135 void IncrementTranslationIgnoredCount(const std::string& language);
136 void ResetTranslationIgnoredCount(const std::string& language);
137
127 // These methods are used to track how many times the user has accepted the 138 // These methods are used to track how many times the user has accepted the
128 // translation for a specific language. (So we can present a UI to white-list 139 // translation for a specific language. (So we can present a UI to white-list
129 // that language if the user keeps accepting translations). 140 // that language if the user keeps accepting translations).
130 int GetTranslationAcceptedCount(const std::string& language); 141 int GetTranslationAcceptedCount(const std::string& language);
131 void IncrementTranslationAcceptedCount(const std::string& language); 142 void IncrementTranslationAcceptedCount(const std::string& language);
132 void ResetTranslationAcceptedCount(const std::string& language); 143 void ResetTranslationAcceptedCount(const std::string& language);
133 144
134 // Update the last time on closing the Translate UI without translation. 145 // Update the last time on closing the Translate UI without translation.
135 void UpdateLastDeniedTime(const std::string& language); 146 void UpdateLastDeniedTime(const std::string& language);
136 147
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 PrefService* prefs_; // Weak. 207 PrefService* prefs_; // Weak.
197 208
198 std::string country_; // The country the app runs in. 209 std::string country_; // The country the app runs in.
199 210
200 DISALLOW_COPY_AND_ASSIGN(TranslatePrefs); 211 DISALLOW_COPY_AND_ASSIGN(TranslatePrefs);
201 }; 212 };
202 213
203 } // namespace translate 214 } // namespace translate
204 215
205 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_PREFS_H_ 216 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_PREFS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698