| 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/dom_ui/browser_options_handler.h" | 5 #include "chrome/browser/dom_ui/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/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/custom_home_pages_table_model.h" | 13 #include "chrome/browser/custom_home_pages_table_model.h" |
| 14 #include "chrome/browser/dom_ui/options_managed_banner_handler.h" |
| 14 #include "chrome/browser/net/url_fixer_upper.h" | 15 #include "chrome/browser/net/url_fixer_upper.h" |
| 15 #include "chrome/browser/profile.h" | 16 #include "chrome/browser/profile.h" |
| 17 #include "chrome/browser/options_window.h" |
| 16 #include "chrome/browser/session_startup_pref.h" | 18 #include "chrome/browser/session_startup_pref.h" |
| 17 #include "chrome/installer/util/browser_distribution.h" | 19 #include "chrome/installer/util/browser_distribution.h" |
| 18 #include "grit/chromium_strings.h" | 20 #include "grit/chromium_strings.h" |
| 19 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 20 | 22 |
| 21 BrowserOptionsHandler::BrowserOptionsHandler() | 23 BrowserOptionsHandler::BrowserOptionsHandler() |
| 22 : template_url_model_(NULL), startup_custom_pages_table_model_(NULL) { | 24 : template_url_model_(NULL), startup_custom_pages_table_model_(NULL) { |
| 23 #if !defined(OS_MACOSX) | 25 #if !defined(OS_MACOSX) |
| 24 default_browser_worker_ = new ShellIntegration::DefaultBrowserWorker(this); | 26 default_browser_worker_ = new ShellIntegration::DefaultBrowserWorker(this); |
| 25 #endif | 27 #endif |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 NewCallback(this, &BrowserOptionsHandler::AddStartupPage)); | 88 NewCallback(this, &BrowserOptionsHandler::AddStartupPage)); |
| 87 dom_ui_->RegisterMessageCallback( | 89 dom_ui_->RegisterMessageCallback( |
| 88 "setStartupPagesToCurrentPages", | 90 "setStartupPagesToCurrentPages", |
| 89 NewCallback(this, &BrowserOptionsHandler::SetStartupPagesToCurrentPages)); | 91 NewCallback(this, &BrowserOptionsHandler::SetStartupPagesToCurrentPages)); |
| 90 } | 92 } |
| 91 | 93 |
| 92 void BrowserOptionsHandler::Initialize() { | 94 void BrowserOptionsHandler::Initialize() { |
| 93 UpdateDefaultBrowserState(); | 95 UpdateDefaultBrowserState(); |
| 94 UpdateStartupPages(); | 96 UpdateStartupPages(); |
| 95 UpdateSearchEngines(); | 97 UpdateSearchEngines(); |
| 98 banner_handler_.reset( |
| 99 new OptionsManagedBannerHandler(dom_ui_, |
| 100 ASCIIToUTF16("BrowserOptions"), |
| 101 OPTIONS_PAGE_GENERAL)); |
| 96 } | 102 } |
| 97 | 103 |
| 98 void BrowserOptionsHandler::UpdateDefaultBrowserState() { | 104 void BrowserOptionsHandler::UpdateDefaultBrowserState() { |
| 99 #if defined(OS_WIN) | 105 #if defined(OS_WIN) |
| 100 // Check for side-by-side first. | 106 // Check for side-by-side first. |
| 101 if (!BrowserDistribution::GetDistribution()->CanSetAsDefault()) { | 107 if (!BrowserDistribution::GetDistribution()->CanSetAsDefault()) { |
| 102 SetDefaultBrowserUIString(IDS_OPTIONS_DEFAULTBROWSER_SXS); | 108 SetDefaultBrowserUIString(IDS_OPTIONS_DEFAULTBROWSER_SXS); |
| 103 return; | 109 return; |
| 104 } | 110 } |
| 105 #endif | 111 #endif |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 } | 333 } |
| 328 | 334 |
| 329 void BrowserOptionsHandler::SaveStartupPagesPref() { | 335 void BrowserOptionsHandler::SaveStartupPagesPref() { |
| 330 PrefService* prefs = dom_ui_->GetProfile()->GetPrefs(); | 336 PrefService* prefs = dom_ui_->GetProfile()->GetPrefs(); |
| 331 | 337 |
| 332 SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs); | 338 SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs); |
| 333 pref.urls = startup_custom_pages_table_model_->GetURLs(); | 339 pref.urls = startup_custom_pages_table_model_->GetURLs(); |
| 334 | 340 |
| 335 SessionStartupPref::SetStartupPref(prefs, pref); | 341 SessionStartupPref::SetStartupPref(prefs, pref); |
| 336 } | 342 } |
| OLD | NEW |