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

Side by Side Diff: chrome/browser/translate/translate_manager.cc

Issue 3750001: base: Move SplitString functions into the base namespace and update the callers. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: brett review, reverted changes in o3d due to it's using an old base revision Created 10 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
« no previous file with comments | « chrome/browser/spellcheck_host.cc ('k') | chrome/browser/views/shell_dialogs_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/translate/translate_manager.h" 5 #include "chrome/browser/translate/translate_manager.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/histogram.h" 10 #include "base/histogram.h"
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 } 540 }
541 541
542 return iter->second.count(language) != 0; 542 return iter->second.count(language) != 0;
543 } 543 }
544 544
545 void TranslateManager::InitAcceptLanguages(PrefService* prefs) { 545 void TranslateManager::InitAcceptLanguages(PrefService* prefs) {
546 // We have been asked for this profile, build the languages. 546 // We have been asked for this profile, build the languages.
547 std::string accept_langs_str = prefs->GetString(prefs::kAcceptLanguages); 547 std::string accept_langs_str = prefs->GetString(prefs::kAcceptLanguages);
548 std::vector<std::string> accept_langs_list; 548 std::vector<std::string> accept_langs_list;
549 LanguageSet accept_langs_set; 549 LanguageSet accept_langs_set;
550 SplitString(accept_langs_str, ',', &accept_langs_list); 550 base::SplitString(accept_langs_str, ',', &accept_langs_list);
551 std::vector<std::string>::const_iterator iter; 551 std::vector<std::string>::const_iterator iter;
552 std::string ui_lang = 552 std::string ui_lang =
553 GetLanguageCode(g_browser_process->GetApplicationLocale()); 553 GetLanguageCode(g_browser_process->GetApplicationLocale());
554 bool is_ui_english = StartsWithASCII(ui_lang, "en-", false); 554 bool is_ui_english = StartsWithASCII(ui_lang, "en-", false);
555 for (iter = accept_langs_list.begin(); 555 for (iter = accept_langs_list.begin();
556 iter != accept_langs_list.end(); ++iter) { 556 iter != accept_langs_list.end(); ++iter) {
557 // Get rid of the locale extension if any (ex: en-US -> en), but for Chinese 557 // Get rid of the locale extension if any (ex: en-US -> en), but for Chinese
558 // for which the CLD reports zh-CN and zh-TW. 558 // for which the CLD reports zh-CN and zh-TW.
559 std::string accept_lang(*iter); 559 std::string accept_lang(*iter);
560 size_t index = iter->find("-"); 560 size_t index = iter->find("-");
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 TranslateInfoBarDelegate* TranslateManager::GetTranslateInfoBarDelegate( 610 TranslateInfoBarDelegate* TranslateManager::GetTranslateInfoBarDelegate(
611 TabContents* tab) { 611 TabContents* tab) {
612 for (int i = 0; i < tab->infobar_delegate_count(); ++i) { 612 for (int i = 0; i < tab->infobar_delegate_count(); ++i) {
613 TranslateInfoBarDelegate* delegate = 613 TranslateInfoBarDelegate* delegate =
614 tab->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); 614 tab->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate();
615 if (delegate) 615 if (delegate)
616 return delegate; 616 return delegate;
617 } 617 }
618 return NULL; 618 return NULL;
619 } 619 }
OLDNEW
« no previous file with comments | « chrome/browser/spellcheck_host.cc ('k') | chrome/browser/views/shell_dialogs_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698