OLD | NEW |
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 #include "chrome/browser/translate/translate_prefs.h" | 5 #include "chrome/browser/translate/translate_prefs.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
9 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 9 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
10 | 10 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 const std::string& value) { | 248 const std::string& value) { |
249 bool schedule_save = false; | 249 bool schedule_save = false; |
250 { | 250 { |
251 ListPrefUpdate update(prefs_, pref_id); | 251 ListPrefUpdate update(prefs_, pref_id); |
252 ListValue* blacklist = update.Get(); | 252 ListValue* blacklist = update.Get(); |
253 if (!blacklist) { | 253 if (!blacklist) { |
254 NOTREACHED() << "Unregistered translate blacklist pref"; | 254 NOTREACHED() << "Unregistered translate blacklist pref"; |
255 return; | 255 return; |
256 } | 256 } |
257 StringValue string_value(value); | 257 StringValue string_value(value); |
258 schedule_save = blacklist->Remove(string_value) != -1; | 258 schedule_save = blacklist->Remove(string_value, NULL); |
259 } | 259 } |
260 if (schedule_save) | 260 if (schedule_save) |
261 prefs_->ScheduleSavePersistentPrefs(); | 261 prefs_->ScheduleSavePersistentPrefs(); |
262 } | 262 } |
263 | 263 |
264 bool TranslatePrefs::IsLanguageWhitelisted( | 264 bool TranslatePrefs::IsLanguageWhitelisted( |
265 const std::string& original_language, std::string* target_language) { | 265 const std::string& original_language, std::string* target_language) { |
266 const DictionaryValue* dict = prefs_->GetDictionary(kPrefTranslateWhitelists); | 266 const DictionaryValue* dict = prefs_->GetDictionary(kPrefTranslateWhitelists); |
267 if (dict && dict->GetString(original_language, target_language)) { | 267 if (dict && dict->GetString(original_language, target_language)) { |
268 DCHECK(!target_language->empty()); | 268 DCHECK(!target_language->empty()); |
269 return !target_language->empty(); | 269 return !target_language->empty(); |
270 } | 270 } |
271 return false; | 271 return false; |
272 } | 272 } |
OLD | NEW |