OLD | NEW |
1 // Copyright (c) 2011 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/dom_ui/options/browser_options_handler.h" | 5 #include "chrome/browser/dom_ui/options/browser_options_handler.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 int default_index = 0; | 223 int default_index = 0; |
224 ListValue search_engines; | 224 ListValue search_engines; |
225 std::vector<const TemplateURL*> model_urls = | 225 std::vector<const TemplateURL*> model_urls = |
226 template_url_model_->GetTemplateURLs(); | 226 template_url_model_->GetTemplateURLs(); |
227 for (size_t i = 0; i < model_urls.size(); ++i) { | 227 for (size_t i = 0; i < model_urls.size(); ++i) { |
228 if (!model_urls[i]->ShowInDefaultList()) | 228 if (!model_urls[i]->ShowInDefaultList()) |
229 continue; | 229 continue; |
230 | 230 |
231 DictionaryValue* entry = new DictionaryValue(); | 231 DictionaryValue* entry = new DictionaryValue(); |
232 entry->SetString("name", model_urls[i]->short_name()); | 232 entry->SetString("name", WideToUTF16Hack(model_urls[i]->short_name())); |
233 entry->SetInteger("index", i); | 233 entry->SetInteger("index", i); |
234 search_engines.Append(entry); | 234 search_engines.Append(entry); |
235 if (model_urls[i] == default_url) | 235 if (model_urls[i] == default_url) |
236 default_index = i; | 236 default_index = i; |
237 } | 237 } |
238 | 238 |
239 scoped_ptr<Value> default_value(Value::CreateIntegerValue(default_index)); | 239 scoped_ptr<Value> default_value(Value::CreateIntegerValue(default_index)); |
240 | 240 |
241 dom_ui_->CallJavascriptFunction(L"BrowserOptions.updateSearchEngines", | 241 dom_ui_->CallJavascriptFunction(L"BrowserOptions.updateSearchEngines", |
242 search_engines, *(default_value.get())); | 242 search_engines, *(default_value.get())); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 } | 377 } |
378 | 378 |
379 void BrowserOptionsHandler::SaveStartupPagesPref() { | 379 void BrowserOptionsHandler::SaveStartupPagesPref() { |
380 PrefService* prefs = dom_ui_->GetProfile()->GetPrefs(); | 380 PrefService* prefs = dom_ui_->GetProfile()->GetPrefs(); |
381 | 381 |
382 SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs); | 382 SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs); |
383 pref.urls = startup_custom_pages_table_model_->GetURLs(); | 383 pref.urls = startup_custom_pages_table_model_->GetURLs(); |
384 | 384 |
385 SessionStartupPref::SetStartupPref(prefs, pref); | 385 SessionStartupPref::SetStartupPref(prefs, pref); |
386 } | 386 } |
OLD | NEW |