OLD | NEW |
1 // Copyright (c) 2011 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/singleton.h" | 9 #include "base/singleton.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/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/browser_thread.h" | 14 #include "chrome/browser/browser_thread.h" |
15 #include "chrome/browser/custom_home_pages_table_model.h" | 15 #include "chrome/browser/custom_home_pages_table_model.h" |
16 #include "chrome/browser/dom_ui/options/dom_options_util.h" | 16 #include "chrome/browser/dom_ui/options/dom_options_util.h" |
17 #include "chrome/browser/dom_ui/options/options_managed_banner_handler.h" | 17 #include "chrome/browser/dom_ui/options/options_managed_banner_handler.h" |
18 #include "chrome/browser/dom_ui/web_ui_favicon_source.h" | 18 #include "chrome/browser/dom_ui/web_ui_favicon_source.h" |
19 #include "chrome/browser/instant/instant_confirm_dialog.h" | 19 #include "chrome/browser/instant/instant_confirm_dialog.h" |
20 #include "chrome/browser/metrics/user_metrics.h" | 20 #include "chrome/browser/metrics/user_metrics.h" |
21 #include "chrome/browser/net/url_fixer_upper.h" | 21 #include "chrome/browser/net/url_fixer_upper.h" |
| 22 #include "chrome/browser/prefs/pref_service.h" |
22 #include "chrome/browser/prefs/session_startup_pref.h" | 23 #include "chrome/browser/prefs/session_startup_pref.h" |
23 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/search_engines/template_url.h" | 25 #include "chrome/browser/search_engines/template_url.h" |
25 #include "chrome/browser/search_engines/template_url_model.h" | 26 #include "chrome/browser/search_engines/template_url_model.h" |
26 #include "chrome/browser/ui/options/options_window.h" | 27 #include "chrome/browser/ui/options/options_window.h" |
27 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
28 #include "chrome/installer/util/browser_distribution.h" | 29 #include "chrome/installer/util/browser_distribution.h" |
29 #include "grit/chromium_strings.h" | 30 #include "grit/chromium_strings.h" |
30 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
31 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 return; | 180 return; |
180 | 181 |
181 UserMetricsRecordAction(UserMetricsAction("Options_SetAsDefaultBrowser")); | 182 UserMetricsRecordAction(UserMetricsAction("Options_SetAsDefaultBrowser")); |
182 #if defined(OS_MACOSX) | 183 #if defined(OS_MACOSX) |
183 if (ShellIntegration::SetAsDefaultBrowser()) | 184 if (ShellIntegration::SetAsDefaultBrowser()) |
184 UpdateDefaultBrowserState(); | 185 UpdateDefaultBrowserState(); |
185 #else | 186 #else |
186 default_browser_worker_->StartSetAsDefaultBrowser(); | 187 default_browser_worker_->StartSetAsDefaultBrowser(); |
187 // Callback takes care of updating UI. | 188 // Callback takes care of updating UI. |
188 #endif | 189 #endif |
| 190 |
| 191 // If the user attempted to make Chrome the default browser, then he/she |
| 192 // arguably wants to be notified when that changes. |
| 193 PrefService* prefs = web_ui_->GetProfile()->GetPrefs(); |
| 194 prefs->SetBoolean(prefs::kCheckDefaultBrowser, true); |
189 } | 195 } |
190 | 196 |
191 int BrowserOptionsHandler::StatusStringIdForState( | 197 int BrowserOptionsHandler::StatusStringIdForState( |
192 ShellIntegration::DefaultBrowserState state) { | 198 ShellIntegration::DefaultBrowserState state) { |
193 if (state == ShellIntegration::IS_DEFAULT_BROWSER) | 199 if (state == ShellIntegration::IS_DEFAULT_BROWSER) |
194 return IDS_OPTIONS_DEFAULTBROWSER_DEFAULT; | 200 return IDS_OPTIONS_DEFAULTBROWSER_DEFAULT; |
195 if (state == ShellIntegration::NOT_DEFAULT_BROWSER) | 201 if (state == ShellIntegration::NOT_DEFAULT_BROWSER) |
196 return IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT; | 202 return IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT; |
197 return IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN; | 203 return IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN; |
198 } | 204 } |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } | 406 } |
401 | 407 |
402 void BrowserOptionsHandler::SaveStartupPagesPref() { | 408 void BrowserOptionsHandler::SaveStartupPagesPref() { |
403 PrefService* prefs = web_ui_->GetProfile()->GetPrefs(); | 409 PrefService* prefs = web_ui_->GetProfile()->GetPrefs(); |
404 | 410 |
405 SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs); | 411 SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs); |
406 pref.urls = startup_custom_pages_table_model_->GetURLs(); | 412 pref.urls = startup_custom_pages_table_model_->GetURLs(); |
407 | 413 |
408 SessionStartupPref::SetStartupPref(prefs, pref); | 414 SessionStartupPref::SetStartupPref(prefs, pref); |
409 } | 415 } |
OLD | NEW |