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

Side by Side Diff: chrome/browser/search_engines/template_url_model.cc

Issue 3056029: Move the number conversions from string_util to a new file.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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/search_engines/template_url_model.h" 5 #include "chrome/browser/search_engines/template_url_model.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/stl_util-inl.h" 8 #include "base/stl_util-inl.h"
9 #include "base/string_number_conversions.h"
9 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/extensions/extensions_service.h" 11 #include "chrome/browser/extensions/extensions_service.h"
11 #include "chrome/browser/google_url_tracker.h" 12 #include "chrome/browser/google_url_tracker.h"
12 #include "chrome/browser/history/history.h" 13 #include "chrome/browser/history/history.h"
13 #include "chrome/browser/history/history_notifications.h" 14 #include "chrome/browser/history/history_notifications.h"
14 #include "chrome/browser/net/url_fixer_upper.h" 15 #include "chrome/browser/net/url_fixer_upper.h"
15 #include "chrome/browser/pref_service.h" 16 #include "chrome/browser/pref_service.h"
16 #include "chrome/browser/profile.h" 17 #include "chrome/browser/profile.h"
17 #include "chrome/browser/rlz/rlz.h" 18 #include "chrome/browser/rlz/rlz.h"
18 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" 19 #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 const std::string suggest_url = 812 const std::string suggest_url =
812 (t_url && t_url->suggestions_url()) ? t_url->suggestions_url()->url() : 813 (t_url && t_url->suggestions_url()) ? t_url->suggestions_url()->url() :
813 std::string(); 814 std::string();
814 prefs->SetString(prefs::kDefaultSearchProviderSuggestURL, suggest_url); 815 prefs->SetString(prefs::kDefaultSearchProviderSuggestURL, suggest_url);
815 816
816 const std::string name = 817 const std::string name =
817 t_url ? WideToUTF8(t_url->short_name()) : std::string(); 818 t_url ? WideToUTF8(t_url->short_name()) : std::string();
818 prefs->SetString(prefs::kDefaultSearchProviderName, name); 819 prefs->SetString(prefs::kDefaultSearchProviderName, name);
819 820
820 const std::string id_string = 821 const std::string id_string =
821 t_url ? Int64ToString(t_url->id()) : std::string(); 822 t_url ? base::Int64ToString(t_url->id()) : std::string();
822 prefs->SetString(prefs::kDefaultSearchProviderID, id_string); 823 prefs->SetString(prefs::kDefaultSearchProviderID, id_string);
823 824
824 const std::string prepopulate_id = 825 const std::string prepopulate_id =
825 t_url ? Int64ToString(t_url->prepopulate_id()) : std::string(); 826 t_url ? base::Int64ToString(t_url->prepopulate_id()) : std::string();
826 prefs->SetString(prefs::kDefaultSearchProviderPrepopulateID, prepopulate_id); 827 prefs->SetString(prefs::kDefaultSearchProviderPrepopulateID, prepopulate_id);
827 828
828 prefs->ScheduleSavePersistentPrefs(); 829 prefs->ScheduleSavePersistentPrefs();
829 } 830 }
830 831
831 bool TemplateURLModel::LoadDefaultSearchProviderFromPrefs( 832 bool TemplateURLModel::LoadDefaultSearchProviderFromPrefs(
832 TemplateURL** default_provider) { 833 TemplateURL** default_provider) {
833 PrefService* prefs = GetPrefs(); 834 PrefService* prefs = GetPrefs();
834 if (!prefs || !prefs->HasPrefPath(prefs::kDefaultSearchProviderSearchURL) || 835 if (!prefs || !prefs->HasPrefPath(prefs::kDefaultSearchProviderSearchURL) ||
835 !prefs->HasPrefPath(prefs::kDefaultSearchProviderSuggestURL) || 836 !prefs->HasPrefPath(prefs::kDefaultSearchProviderSuggestURL) ||
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 const TemplateURL* TemplateURLModel::GetTemplateURLForExtension( 1100 const TemplateURL* TemplateURLModel::GetTemplateURLForExtension(
1100 Extension* extension) const { 1101 Extension* extension) const {
1101 for (TemplateURLVector::const_iterator i = template_urls_.begin(); 1102 for (TemplateURLVector::const_iterator i = template_urls_.begin();
1102 i != template_urls_.end(); ++i) { 1103 i != template_urls_.end(); ++i) {
1103 if ((*i)->IsExtensionKeyword() && (*i)->url()->GetHost() == extension->id()) 1104 if ((*i)->IsExtensionKeyword() && (*i)->url()->GetHost() == extension->id())
1104 return *i; 1105 return *i;
1105 } 1106 }
1106 1107
1107 return NULL; 1108 return NULL;
1108 } 1109 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url.cc ('k') | chrome/browser/sessions/session_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698