| 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 #include <string> | 10 #include <string> |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 BrowserOptionsHandler::BrowserOptionsHandler() | 180 BrowserOptionsHandler::BrowserOptionsHandler() |
| 181 : page_initialized_(false), | 181 : page_initialized_(false), |
| 182 template_url_service_(NULL), | 182 template_url_service_(NULL), |
| 183 cloud_print_mdns_ui_enabled_(false), | 183 cloud_print_mdns_ui_enabled_(false), |
| 184 #if defined(OS_CHROMEOS) | 184 #if defined(OS_CHROMEOS) |
| 185 enable_factory_reset_(false), | 185 enable_factory_reset_(false), |
| 186 #endif // defined(OS_CHROMEOS) | 186 #endif // defined(OS_CHROMEOS) |
| 187 signin_observer_(this), | 187 signin_observer_(this), |
| 188 weak_ptr_factory_(this) { | 188 weak_ptr_factory_(this) { |
| 189 default_browser_worker_ = new ShellIntegration::DefaultBrowserWorker(this); | 189 default_browser_worker_ = new ShellIntegration::DefaultBrowserWorker( |
| 190 this, /*delete_observer=*/false); |
| 190 | 191 |
| 191 #if defined(ENABLE_SERVICE_DISCOVERY) | 192 #if defined(ENABLE_SERVICE_DISCOVERY) |
| 192 cloud_print_mdns_ui_enabled_ = true; | 193 cloud_print_mdns_ui_enabled_ = true; |
| 193 #endif // defined(ENABLE_SERVICE_DISCOVERY) | 194 #endif // defined(ENABLE_SERVICE_DISCOVERY) |
| 194 } | 195 } |
| 195 | 196 |
| 196 BrowserOptionsHandler::~BrowserOptionsHandler() { | 197 BrowserOptionsHandler::~BrowserOptionsHandler() { |
| 197 ProfileSyncService* sync_service(ProfileSyncServiceFactory:: | 198 ProfileSyncService* sync_service(ProfileSyncServiceFactory:: |
| 198 GetInstance()->GetForProfile(Profile::FromWebUI(web_ui()))); | 199 GetInstance()->GetForProfile(Profile::FromWebUI(web_ui()))); |
| 199 if (sync_service) | 200 if (sync_service) |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 } | 1138 } |
| 1138 } else if (state == ShellIntegration::STATE_UNKNOWN) { | 1139 } else if (state == ShellIntegration::STATE_UNKNOWN) { |
| 1139 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN; | 1140 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN; |
| 1140 } else { | 1141 } else { |
| 1141 return; // Still processing. | 1142 return; // Still processing. |
| 1142 } | 1143 } |
| 1143 | 1144 |
| 1144 SetDefaultBrowserUIString(status_string_id); | 1145 SetDefaultBrowserUIString(status_string_id); |
| 1145 } | 1146 } |
| 1146 | 1147 |
| 1147 bool BrowserOptionsHandler::IsInteractiveSetDefaultPermitted() { | |
| 1148 return true; // This is UI so we can allow it. | |
| 1149 } | |
| 1150 | |
| 1151 void BrowserOptionsHandler::SetDefaultBrowserUIString(int status_string_id) { | 1148 void BrowserOptionsHandler::SetDefaultBrowserUIString(int status_string_id) { |
| 1152 base::StringValue status_string( | 1149 base::StringValue status_string( |
| 1153 l10n_util::GetStringFUTF16(status_string_id, | 1150 l10n_util::GetStringFUTF16(status_string_id, |
| 1154 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); | 1151 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); |
| 1155 | 1152 |
| 1156 base::FundamentalValue is_default( | 1153 base::FundamentalValue is_default( |
| 1157 status_string_id == IDS_OPTIONS_DEFAULTBROWSER_DEFAULT); | 1154 status_string_id == IDS_OPTIONS_DEFAULTBROWSER_DEFAULT); |
| 1158 | 1155 |
| 1159 base::FundamentalValue can_be_default( | 1156 base::FundamentalValue can_be_default( |
| 1160 !default_browser_policy_.IsManaged() && | 1157 !default_browser_policy_.IsManaged() && |
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2145 | 2142 |
| 2146 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2143 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
| 2147 #if defined(OS_CHROMEOS) | 2144 #if defined(OS_CHROMEOS) |
| 2148 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2145 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
| 2149 #else | 2146 #else |
| 2150 return true; | 2147 return true; |
| 2151 #endif | 2148 #endif |
| 2152 } | 2149 } |
| 2153 | 2150 |
| 2154 } // namespace options | 2151 } // namespace options |
| OLD | NEW |