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

Side by Side Diff: chrome/browser/extensions/extension_i18n_api.cc

Issue 7649006: more changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix another typo Created 9 years, 4 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/extensions/extension_i18n_api.h" 5 #include "chrome/browser/extensions/extension_i18n_api.h"
6 6
7 #include "base/string_piece.h" 7 #include "base/string_piece.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 21 matching lines...) Expand all
32 return false; 32 return false;
33 } 33 }
34 size_t begin = 0; 34 size_t begin = 0;
35 size_t end; 35 size_t end;
36 while (1) { 36 while (1) {
37 end = acceptLanguages.find(',', begin); 37 end = acceptLanguages.find(',', begin);
38 if (end > begin) { 38 if (end > begin) {
39 // Guard against a malformed value with multiple "," in a row. 39 // Guard against a malformed value with multiple "," in a row.
40 string16 acceptLang = acceptLanguages.substr(begin, end - begin); 40 string16 acceptLang = acceptLanguages.substr(begin, end - begin);
41 static_cast<ListValue*>(result_.get())-> 41 static_cast<ListValue*>(result_.get())->
42 Append(Value::CreateStringValue(acceptLang)); 42 Append(base::StringValue::New(acceptLang));
43 } 43 }
44 begin = end + 1; 44 begin = end + 1;
45 // 'begin >= acceptLanguages.length()' to guard against a value 45 // 'begin >= acceptLanguages.length()' to guard against a value
46 // ending with ','. 46 // ending with ','.
47 if (end == string16::npos || begin >= acceptLanguages.length()) 47 if (end == string16::npos || begin >= acceptLanguages.length())
48 break; 48 break;
49 } 49 }
50 if (static_cast<ListValue*>(result_.get())->GetSize() == 0) { 50 if (static_cast<ListValue*>(result_.get())->GetSize() == 0) {
51 error_ = kEmptyAcceptLanguagesError; 51 error_ = kEmptyAcceptLanguagesError;
52 return false; 52 return false;
53 } 53 }
54 return true; 54 return true;
55 } 55 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_history_api.cc ('k') | chrome/browser/extensions/extension_idle_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698