OLD | NEW |
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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 default_provider->reset(new TemplateURL()); | 837 default_provider->reset(new TemplateURL()); |
838 (*default_provider)->set_short_name(name); | 838 (*default_provider)->set_short_name(name); |
839 (*default_provider)->SetURL(search_url, 0, 0); | 839 (*default_provider)->SetURL(search_url, 0, 0); |
840 (*default_provider)->SetSuggestionsURL(suggest_url, 0, 0); | 840 (*default_provider)->SetSuggestionsURL(suggest_url, 0, 0); |
841 (*default_provider)->SetInstantURL(instant_url, 0, 0); | 841 (*default_provider)->SetInstantURL(instant_url, 0, 0); |
842 (*default_provider)->set_keyword(keyword); | 842 (*default_provider)->set_keyword(keyword); |
843 (*default_provider)->SetFavIconURL(GURL(icon_url)); | 843 (*default_provider)->SetFavIconURL(GURL(icon_url)); |
844 std::vector<std::string> encodings_vector; | 844 std::vector<std::string> encodings_vector; |
845 base::SplitString(encodings, ';', &encodings_vector); | 845 base::SplitString(encodings, ';', &encodings_vector); |
846 (*default_provider)->set_input_encodings(encodings_vector); | 846 (*default_provider)->set_input_encodings(encodings_vector); |
847 if (!id_string.empty()) { | 847 if (!id_string.empty() && !*is_managed) { |
848 int64 value; | 848 int64 value; |
849 base::StringToInt64(id_string, &value); | 849 base::StringToInt64(id_string, &value); |
850 (*default_provider)->set_id(value); | 850 (*default_provider)->set_id(value); |
851 } | 851 } |
852 if (!prepopulate_id.empty()) { | 852 if (!prepopulate_id.empty() && !*is_managed) { |
853 int value; | 853 int value; |
854 base::StringToInt(prepopulate_id, &value); | 854 base::StringToInt(prepopulate_id, &value); |
855 (*default_provider)->set_prepopulate_id(value); | 855 (*default_provider)->set_prepopulate_id(value); |
856 } | 856 } |
857 (*default_provider)->set_show_in_default_list(true); | 857 (*default_provider)->set_show_in_default_list(true); |
858 return true; | 858 return true; |
859 } | 859 } |
860 | 860 |
861 static bool TemplateURLsHaveSamePrefs(const TemplateURL* url1, | 861 static bool TemplateURLsHaveSamePrefs(const TemplateURL* url1, |
862 const TemplateURL* url2) { | 862 const TemplateURL* url2) { |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 delete template_url; | 1251 delete template_url; |
1252 } | 1252 } |
1253 | 1253 |
1254 void TemplateURLModel::NotifyObservers() { | 1254 void TemplateURLModel::NotifyObservers() { |
1255 if (!loaded_) | 1255 if (!loaded_) |
1256 return; | 1256 return; |
1257 | 1257 |
1258 FOR_EACH_OBSERVER(TemplateURLModelObserver, model_observers_, | 1258 FOR_EACH_OBSERVER(TemplateURLModelObserver, model_observers_, |
1259 OnTemplateURLModelChanged()); | 1259 OnTemplateURLModelChanged()); |
1260 } | 1260 } |
1261 | |
OLD | NEW |