| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 219 |
| 220 int default_index = 0; | 220 int default_index = 0; |
| 221 ListValue search_engines; | 221 ListValue search_engines; |
| 222 std::vector<const TemplateURL*> model_urls = | 222 std::vector<const TemplateURL*> model_urls = |
| 223 template_url_model_->GetTemplateURLs(); | 223 template_url_model_->GetTemplateURLs(); |
| 224 for (size_t i = 0; i < model_urls.size(); ++i) { | 224 for (size_t i = 0; i < model_urls.size(); ++i) { |
| 225 if (!model_urls[i]->ShowInDefaultList()) | 225 if (!model_urls[i]->ShowInDefaultList()) |
| 226 continue; | 226 continue; |
| 227 | 227 |
| 228 DictionaryValue* entry = new DictionaryValue(); | 228 DictionaryValue* entry = new DictionaryValue(); |
| 229 entry->SetString("name", WideToUTF16Hack(model_urls[i]->short_name())); | 229 entry->SetString("name", model_urls[i]->short_name()); |
| 230 entry->SetInteger("index", i); | 230 entry->SetInteger("index", i); |
| 231 search_engines.Append(entry); | 231 search_engines.Append(entry); |
| 232 if (model_urls[i] == default_url) | 232 if (model_urls[i] == default_url) |
| 233 default_index = i; | 233 default_index = i; |
| 234 } | 234 } |
| 235 | 235 |
| 236 scoped_ptr<Value> default_value(Value::CreateIntegerValue(default_index)); | 236 scoped_ptr<Value> default_value(Value::CreateIntegerValue(default_index)); |
| 237 | 237 |
| 238 dom_ui_->CallJavascriptFunction(L"BrowserOptions.updateSearchEngines", | 238 dom_ui_->CallJavascriptFunction(L"BrowserOptions.updateSearchEngines", |
| 239 search_engines, *(default_value.get())); | 239 search_engines, *(default_value.get())); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 } | 354 } |
| 355 | 355 |
| 356 void BrowserOptionsHandler::SaveStartupPagesPref() { | 356 void BrowserOptionsHandler::SaveStartupPagesPref() { |
| 357 PrefService* prefs = dom_ui_->GetProfile()->GetPrefs(); | 357 PrefService* prefs = dom_ui_->GetProfile()->GetPrefs(); |
| 358 | 358 |
| 359 SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs); | 359 SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs); |
| 360 pref.urls = startup_custom_pages_table_model_->GetURLs(); | 360 pref.urls = startup_custom_pages_table_model_->GetURLs(); |
| 361 | 361 |
| 362 SessionStartupPref::SetStartupPref(prefs, pref); | 362 SessionStartupPref::SetStartupPref(prefs, pref); |
| 363 } | 363 } |
| OLD | NEW |