Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 1657933003: Fixes the interactive default browser UX for policy setting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix merge issue Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 shell_integration::DefaultBrowserWorker(this); 189 // The worker pointer is reference counted. While it is running, the
190 // message loops of the FILE and UI thread will hold references to it
191 // and it will be automatically freed once all its tasks have finished.
192 default_browser_worker_ = new shell_integration::DefaultBrowserWorker(
193 this, /*delete_observer=*/false);
190 194
191 #if defined(ENABLE_SERVICE_DISCOVERY) 195 #if defined(ENABLE_SERVICE_DISCOVERY)
192 cloud_print_mdns_ui_enabled_ = true; 196 cloud_print_mdns_ui_enabled_ = true;
193 #endif // defined(ENABLE_SERVICE_DISCOVERY) 197 #endif // defined(ENABLE_SERVICE_DISCOVERY)
194 } 198 }
195 199
196 BrowserOptionsHandler::~BrowserOptionsHandler() { 200 BrowserOptionsHandler::~BrowserOptionsHandler() {
197 ProfileSyncService* sync_service(ProfileSyncServiceFactory:: 201 ProfileSyncService* sync_service(ProfileSyncServiceFactory::
198 GetInstance()->GetForProfile(Profile::FromWebUI(web_ui()))); 202 GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
199 if (sync_service) 203 if (sync_service)
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 } 1141 }
1138 } else if (state == shell_integration::STATE_UNKNOWN) { 1142 } else if (state == shell_integration::STATE_UNKNOWN) {
1139 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN; 1143 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN;
1140 } else { 1144 } else {
1141 return; // Still processing. 1145 return; // Still processing.
1142 } 1146 }
1143 1147
1144 SetDefaultBrowserUIString(status_string_id); 1148 SetDefaultBrowserUIString(status_string_id);
1145 } 1149 }
1146 1150
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) { 1151 void BrowserOptionsHandler::SetDefaultBrowserUIString(int status_string_id) {
1152 base::StringValue status_string( 1152 base::StringValue status_string(
1153 l10n_util::GetStringFUTF16(status_string_id, 1153 l10n_util::GetStringFUTF16(status_string_id,
1154 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); 1154 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
1155 1155
1156 base::FundamentalValue is_default( 1156 base::FundamentalValue is_default(
1157 status_string_id == IDS_OPTIONS_DEFAULTBROWSER_DEFAULT); 1157 status_string_id == IDS_OPTIONS_DEFAULTBROWSER_DEFAULT);
1158 1158
1159 base::FundamentalValue can_be_default( 1159 base::FundamentalValue can_be_default(
1160 !default_browser_policy_.IsManaged() && 1160 !default_browser_policy_.IsManaged() &&
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
2145 2145
2146 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { 2146 bool BrowserOptionsHandler::IsDeviceOwnerProfile() {
2147 #if defined(OS_CHROMEOS) 2147 #if defined(OS_CHROMEOS)
2148 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); 2148 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui()));
2149 #else 2149 #else
2150 return true; 2150 return true;
2151 #endif 2151 #endif
2152 } 2152 }
2153 2153
2154 } // namespace options 2154 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/browser_options_handler.h ('k') | chrome/browser/ui/webui/set_as_default_browser_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698