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_thread.h" | 13 #include "chrome/browser/browser_thread.h" |
14 #include "chrome/browser/custom_home_pages_table_model.h" | 14 #include "chrome/browser/custom_home_pages_table_model.h" |
15 #include "chrome/browser/dom_ui/dom_ui_favicon_source.h" | 15 #include "chrome/browser/dom_ui/dom_ui_favicon_source.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/instant/instant_confirm_dialog.h" | 18 #include "chrome/browser/instant/instant_confirm_dialog.h" |
19 #include "chrome/browser/metrics/user_metrics.h" | 19 #include "chrome/browser/metrics/user_metrics.h" |
20 #include "chrome/browser/net/url_fixer_upper.h" | 20 #include "chrome/browser/net/url_fixer_upper.h" |
| 21 #include "chrome/browser/prefs/pref_service.h" |
21 #include "chrome/browser/prefs/session_startup_pref.h" | 22 #include "chrome/browser/prefs/session_startup_pref.h" |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/search_engines/template_url.h" | 24 #include "chrome/browser/search_engines/template_url.h" |
24 #include "chrome/browser/search_engines/template_url_model.h" | 25 #include "chrome/browser/search_engines/template_url_model.h" |
25 #include "chrome/browser/ui/options/options_window.h" | 26 #include "chrome/browser/ui/options/options_window.h" |
26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
27 #include "chrome/installer/util/browser_distribution.h" | 28 #include "chrome/installer/util/browser_distribution.h" |
28 #include "grit/chromium_strings.h" | 29 #include "grit/chromium_strings.h" |
29 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
30 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
(...skipping 157 matching lines...) Loading... |
188 | 189 |
189 void BrowserOptionsHandler::BecomeDefaultBrowser(const ListValue* args) { | 190 void BrowserOptionsHandler::BecomeDefaultBrowser(const ListValue* args) { |
190 UserMetricsRecordAction(UserMetricsAction("Options_SetAsDefaultBrowser")); | 191 UserMetricsRecordAction(UserMetricsAction("Options_SetAsDefaultBrowser")); |
191 #if defined(OS_MACOSX) | 192 #if defined(OS_MACOSX) |
192 if (ShellIntegration::SetAsDefaultBrowser()) | 193 if (ShellIntegration::SetAsDefaultBrowser()) |
193 UpdateDefaultBrowserState(); | 194 UpdateDefaultBrowserState(); |
194 #else | 195 #else |
195 default_browser_worker_->StartSetAsDefaultBrowser(); | 196 default_browser_worker_->StartSetAsDefaultBrowser(); |
196 // Callback takes care of updating UI. | 197 // Callback takes care of updating UI. |
197 #endif | 198 #endif |
| 199 |
| 200 // If the user attempted to make Chrome the default browser, then he/she |
| 201 // arguably wants to be notified when that changes. |
| 202 PrefService* prefs = web_ui_->GetProfile()->GetPrefs(); |
| 203 prefs->SetBoolean(prefs::kCheckDefaultBrowser, true); |
198 } | 204 } |
199 | 205 |
200 int BrowserOptionsHandler::StatusStringIdForState( | 206 int BrowserOptionsHandler::StatusStringIdForState( |
201 ShellIntegration::DefaultBrowserState state) { | 207 ShellIntegration::DefaultBrowserState state) { |
202 if (state == ShellIntegration::IS_DEFAULT_BROWSER) | 208 if (state == ShellIntegration::IS_DEFAULT_BROWSER) |
203 return IDS_OPTIONS_DEFAULTBROWSER_DEFAULT; | 209 return IDS_OPTIONS_DEFAULTBROWSER_DEFAULT; |
204 if (state == ShellIntegration::NOT_DEFAULT_BROWSER) | 210 if (state == ShellIntegration::NOT_DEFAULT_BROWSER) |
205 return IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT; | 211 return IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT; |
206 return IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN; | 212 return IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN; |
207 } | 213 } |
(...skipping 194 matching lines...) Loading... |
402 } | 408 } |
403 | 409 |
404 void BrowserOptionsHandler::SaveStartupPagesPref() { | 410 void BrowserOptionsHandler::SaveStartupPagesPref() { |
405 PrefService* prefs = dom_ui_->GetProfile()->GetPrefs(); | 411 PrefService* prefs = dom_ui_->GetProfile()->GetPrefs(); |
406 | 412 |
407 SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs); | 413 SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs); |
408 pref.urls = startup_custom_pages_table_model_->GetURLs(); | 414 pref.urls = startup_custom_pages_table_model_->GetURLs(); |
409 | 415 |
410 SessionStartupPref::SetStartupPref(prefs, pref); | 416 SessionStartupPref::SetStartupPref(prefs, pref); |
411 } | 417 } |
OLD | NEW |