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

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

Issue 1860423003: Add a simple API around the pref controlling the default browser prompt. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/settings_utils.h" 109 #include "chrome/browser/ui/webui/settings_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 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 return; 1137 return;
1137 1138
1138 content::RecordAction(UserMetricsAction("Options_SetAsDefaultBrowser")); 1139 content::RecordAction(UserMetricsAction("Options_SetAsDefaultBrowser"));
1139 UMA_HISTOGRAM_COUNTS("Settings.StartSetAsDefault", true); 1140 UMA_HISTOGRAM_COUNTS("Settings.StartSetAsDefault", true);
1140 1141
1141 // Callback takes care of updating UI. 1142 // Callback takes care of updating UI.
1142 default_browser_worker_->StartSetAsDefault(); 1143 default_browser_worker_->StartSetAsDefault();
1143 1144
1144 // If the user attempted to make Chrome the default browser, notify 1145 // If the user attempted to make Chrome the default browser, notify
1145 // them when this changes. 1146 // them when this changes.
1146 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); 1147 chrome::ResetDefaultBrowserPrompt(Profile::FromWebUI(web_ui()));
1147 prefs->SetBoolean(prefs::kCheckDefaultBrowser, true);
1148 } 1148 }
1149 1149
1150 void BrowserOptionsHandler::OnDefaultBrowserWorkerFinished( 1150 void BrowserOptionsHandler::OnDefaultBrowserWorkerFinished(
1151 shell_integration::DefaultWebClientState state) { 1151 shell_integration::DefaultWebClientState state) {
1152 int status_string_id; 1152 int status_string_id;
1153 1153
1154 if (state == shell_integration::IS_DEFAULT) { 1154 if (state == shell_integration::IS_DEFAULT) {
1155 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_DEFAULT; 1155 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_DEFAULT;
1156 // Notify the user in the future if Chrome ceases to be the user's chosen 1156 // Notify the user in the future if Chrome ceases to be the user's chosen
1157 // default browser. 1157 // default browser.
1158 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); 1158 chrome::ResetDefaultBrowserPrompt(Profile::FromWebUI(web_ui()));
1159 prefs->SetBoolean(prefs::kCheckDefaultBrowser, true);
1160 } else if (state == shell_integration::NOT_DEFAULT) { 1159 } else if (state == shell_integration::NOT_DEFAULT) {
1161 if (shell_integration::CanSetAsDefaultBrowser() == 1160 if (shell_integration::CanSetAsDefaultBrowser() ==
1162 shell_integration::SET_DEFAULT_NOT_ALLOWED) { 1161 shell_integration::SET_DEFAULT_NOT_ALLOWED) {
1163 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_SXS; 1162 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_SXS;
1164 } else { 1163 } else {
1165 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT; 1164 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT;
1166 } 1165 }
1167 } else if (state == shell_integration::UNKNOWN_DEFAULT) { 1166 } else if (state == shell_integration::UNKNOWN_DEFAULT) {
1168 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN; 1167 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN;
1169 } else { 1168 } else {
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
2166 2165
2167 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { 2166 bool BrowserOptionsHandler::IsDeviceOwnerProfile() {
2168 #if defined(OS_CHROMEOS) 2167 #if defined(OS_CHROMEOS)
2169 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); 2168 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui()));
2170 #else 2169 #else
2171 return true; 2170 return true;
2172 #endif 2171 #endif
2173 } 2172 }
2174 2173
2175 } // namespace options 2174 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698