| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/options/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 #include "content/public/common/page_zoom.h" | 98 #include "content/public/common/page_zoom.h" |
| 99 #include "extensions/browser/extension_registry.h" | 99 #include "extensions/browser/extension_registry.h" |
| 100 #include "google_apis/gaia/gaia_auth_util.h" | 100 #include "google_apis/gaia/gaia_auth_util.h" |
| 101 #include "google_apis/gaia/google_service_auth_error.h" | 101 #include "google_apis/gaia/google_service_auth_error.h" |
| 102 #include "policy/policy_constants.h" | 102 #include "policy/policy_constants.h" |
| 103 #include "third_party/skia/include/core/SkBitmap.h" | 103 #include "third_party/skia/include/core/SkBitmap.h" |
| 104 #include "ui/base/l10n/l10n_util.h" | 104 #include "ui/base/l10n/l10n_util.h" |
| 105 #include "ui/base/webui/web_ui_util.h" | 105 #include "ui/base/webui/web_ui_util.h" |
| 106 | 106 |
| 107 #if !defined(OS_CHROMEOS) | 107 #if !defined(OS_CHROMEOS) |
| 108 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
| 108 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" | 109 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" |
| 109 #endif | 110 #endif |
| 110 | 111 |
| 111 #if defined(OS_CHROMEOS) | 112 #if defined(OS_CHROMEOS) |
| 112 #include "ash/ash_switches.h" | 113 #include "ash/ash_switches.h" |
| 113 #include "ash/desktop_background/user_wallpaper_delegate.h" | 114 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 114 #include "ash/shell.h" | 115 #include "ash/shell.h" |
| 115 #include "ash/system/chromeos/devicetype_utils.h" | 116 #include "ash/system/chromeos/devicetype_utils.h" |
| 116 #include "chrome/browser/browser_process_platform_part.h" | 117 #include "chrome/browser/browser_process_platform_part.h" |
| 117 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 118 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| (...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1113 return; | 1114 return; |
| 1114 | 1115 |
| 1115 content::RecordAction(UserMetricsAction("Options_SetAsDefaultBrowser")); | 1116 content::RecordAction(UserMetricsAction("Options_SetAsDefaultBrowser")); |
| 1116 UMA_HISTOGRAM_COUNTS("Settings.StartSetAsDefault", true); | 1117 UMA_HISTOGRAM_COUNTS("Settings.StartSetAsDefault", true); |
| 1117 | 1118 |
| 1118 // Callback takes care of updating UI. | 1119 // Callback takes care of updating UI. |
| 1119 default_browser_worker_->StartSetAsDefault(); | 1120 default_browser_worker_->StartSetAsDefault(); |
| 1120 | 1121 |
| 1121 // If the user attempted to make Chrome the default browser, notify | 1122 // If the user attempted to make Chrome the default browser, notify |
| 1122 // them when this changes. | 1123 // them when this changes. |
| 1123 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 1124 chrome::ResetDefaultBrowserPrompt(Profile::FromWebUI(web_ui())); |
| 1124 prefs->SetBoolean(prefs::kCheckDefaultBrowser, true); | |
| 1125 } | 1125 } |
| 1126 | 1126 |
| 1127 void BrowserOptionsHandler::OnDefaultBrowserWorkerFinished( | 1127 void BrowserOptionsHandler::OnDefaultBrowserWorkerFinished( |
| 1128 shell_integration::DefaultWebClientUIState state) { | 1128 shell_integration::DefaultWebClientUIState state) { |
| 1129 int status_string_id; | 1129 int status_string_id; |
| 1130 | 1130 |
| 1131 if (state == shell_integration::STATE_IS_DEFAULT) { | 1131 if (state == shell_integration::STATE_IS_DEFAULT) { |
| 1132 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_DEFAULT; | 1132 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_DEFAULT; |
| 1133 // Notify the user in the future if Chrome ceases to be the user's chosen | 1133 // Notify the user in the future if Chrome ceases to be the user's chosen |
| 1134 // default browser. | 1134 // default browser. |
| 1135 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 1135 chrome::ResetDefaultBrowserPrompt(Profile::FromWebUI(web_ui())); |
| 1136 prefs->SetBoolean(prefs::kCheckDefaultBrowser, true); | |
| 1137 } else if (state == shell_integration::STATE_NOT_DEFAULT) { | 1136 } else if (state == shell_integration::STATE_NOT_DEFAULT) { |
| 1138 if (shell_integration::CanSetAsDefaultBrowser() == | 1137 if (shell_integration::CanSetAsDefaultBrowser() == |
| 1139 shell_integration::SET_DEFAULT_NOT_ALLOWED) { | 1138 shell_integration::SET_DEFAULT_NOT_ALLOWED) { |
| 1140 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_SXS; | 1139 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_SXS; |
| 1141 } else { | 1140 } else { |
| 1142 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT; | 1141 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT; |
| 1143 } | 1142 } |
| 1144 } else if (state == shell_integration::STATE_UNKNOWN) { | 1143 } else if (state == shell_integration::STATE_UNKNOWN) { |
| 1145 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN; | 1144 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN; |
| 1146 } else { | 1145 } else { |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2125 | 2124 |
| 2126 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2125 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
| 2127 #if defined(OS_CHROMEOS) | 2126 #if defined(OS_CHROMEOS) |
| 2128 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2127 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
| 2129 #else | 2128 #else |
| 2130 return true; | 2129 return true; |
| 2131 #endif | 2130 #endif |
| 2132 } | 2131 } |
| 2133 | 2132 |
| 2134 } // namespace options | 2133 } // namespace options |
| OLD | NEW |