OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_service.h" | 5 #include "chrome/browser/search_engines/template_url_service.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.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/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 if (reset_keyword) | 1219 if (reset_keyword) |
1220 keyword = ASCIIToUTF16("dummy"); // Will be replaced below. | 1220 keyword = ASCIIToUTF16("dummy"); // Will be replaced below. |
1221 DCHECK(!keyword.empty()); | 1221 DCHECK(!keyword.empty()); |
1222 data.SetKeyword(keyword); | 1222 data.SetKeyword(keyword); |
1223 data.SetURL(specifics.url()); | 1223 data.SetURL(specifics.url()); |
1224 data.suggestions_url = specifics.suggestions_url(); | 1224 data.suggestions_url = specifics.suggestions_url(); |
1225 data.instant_url = specifics.instant_url(); | 1225 data.instant_url = specifics.instant_url(); |
1226 data.favicon_url = GURL(specifics.favicon_url()); | 1226 data.favicon_url = GURL(specifics.favicon_url()); |
1227 data.show_in_default_list = specifics.show_in_default_list(); | 1227 data.show_in_default_list = specifics.show_in_default_list(); |
1228 data.safe_for_autoreplace = specifics.safe_for_autoreplace(); | 1228 data.safe_for_autoreplace = specifics.safe_for_autoreplace(); |
| 1229 data.input_encodings.clear(); |
1229 base::SplitString(specifics.input_encodings(), ';', &data.input_encodings); | 1230 base::SplitString(specifics.input_encodings(), ';', &data.input_encodings); |
1230 data.date_created = base::Time::FromInternalValue(specifics.date_created()); | 1231 data.date_created = base::Time::FromInternalValue(specifics.date_created()); |
1231 data.last_modified = base::Time::FromInternalValue(specifics.last_modified()); | 1232 data.last_modified = base::Time::FromInternalValue(specifics.last_modified()); |
1232 data.prepopulate_id = specifics.prepopulate_id(); | 1233 data.prepopulate_id = specifics.prepopulate_id(); |
1233 data.sync_guid = specifics.sync_guid(); | 1234 data.sync_guid = specifics.sync_guid(); |
1234 | 1235 |
1235 TemplateURL* turl = new TemplateURL(profile, data); | 1236 TemplateURL* turl = new TemplateURL(profile, data); |
1236 DCHECK(!turl->IsExtensionKeyword()); | 1237 DCHECK(!turl->IsExtensionKeyword()); |
1237 if (reset_keyword) { | 1238 if (reset_keyword) { |
1238 turl->ResetKeywordIfNecessary(true); | 1239 turl->ResetKeywordIfNecessary(true); |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 // TODO(mpcomplete): If we allow editing extension keywords, then those | 2357 // TODO(mpcomplete): If we allow editing extension keywords, then those |
2357 // should be persisted to disk and synced. | 2358 // should be persisted to disk and synced. |
2358 if (template_url->sync_guid().empty() && | 2359 if (template_url->sync_guid().empty() && |
2359 !template_url->IsExtensionKeyword()) { | 2360 !template_url->IsExtensionKeyword()) { |
2360 template_url->data_.sync_guid = guid::GenerateGUID(); | 2361 template_url->data_.sync_guid = guid::GenerateGUID(); |
2361 if (service_.get()) | 2362 if (service_.get()) |
2362 service_->UpdateKeyword(template_url->data()); | 2363 service_->UpdateKeyword(template_url->data()); |
2363 } | 2364 } |
2364 } | 2365 } |
2365 } | 2366 } |
OLD | NEW |