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

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

Issue 490523004: [Mac] Do not show the 'Make X the default browser' button on Canary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "apps/app_window.h" 10 #include "apps/app_window.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } // namespace 162 } // namespace
163 163
164 namespace options { 164 namespace options {
165 165
166 BrowserOptionsHandler::BrowserOptionsHandler() 166 BrowserOptionsHandler::BrowserOptionsHandler()
167 : page_initialized_(false), 167 : page_initialized_(false),
168 template_url_service_(NULL), 168 template_url_service_(NULL),
169 cloud_print_mdns_ui_enabled_(false), 169 cloud_print_mdns_ui_enabled_(false),
170 signin_observer_(this), 170 signin_observer_(this),
171 weak_ptr_factory_(this) { 171 weak_ptr_factory_(this) {
172 #if !defined(OS_MACOSX)
173 default_browser_worker_ = new ShellIntegration::DefaultBrowserWorker(this); 172 default_browser_worker_ = new ShellIntegration::DefaultBrowserWorker(this);
174 #endif
175 173
176 #if defined(ENABLE_SERVICE_DISCOVERY) 174 #if defined(ENABLE_SERVICE_DISCOVERY)
177 cloud_print_mdns_ui_enabled_ = true; 175 cloud_print_mdns_ui_enabled_ = true;
178 #endif // defined(ENABLE_SERVICE_DISCOVERY) 176 #endif // defined(ENABLE_SERVICE_DISCOVERY)
179 } 177 }
180 178
181 BrowserOptionsHandler::~BrowserOptionsHandler() { 179 BrowserOptionsHandler::~BrowserOptionsHandler() {
182 ProfileSyncService* sync_service(ProfileSyncServiceFactory:: 180 ProfileSyncService* sync_service(ProfileSyncServiceFactory::
183 GetInstance()->GetForProfile(Profile::FromWebUI(web_ui()))); 181 GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
184 if (sync_service) 182 if (sync_service)
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 bool BrowserOptionsHandler::ShouldAllowAdvancedSettings() { 1026 bool BrowserOptionsHandler::ShouldAllowAdvancedSettings() {
1029 #if defined(OS_CHROMEOS) 1027 #if defined(OS_CHROMEOS)
1030 // ChromeOS handles guest-mode restrictions in a different manner. 1028 // ChromeOS handles guest-mode restrictions in a different manner.
1031 return true; 1029 return true;
1032 #else 1030 #else
1033 return !Profile::FromWebUI(web_ui())->IsGuestSession(); 1031 return !Profile::FromWebUI(web_ui())->IsGuestSession();
1034 #endif 1032 #endif
1035 } 1033 }
1036 1034
1037 void BrowserOptionsHandler::UpdateDefaultBrowserState() { 1035 void BrowserOptionsHandler::UpdateDefaultBrowserState() {
1038 #if defined(OS_MACOSX)
1039 ShellIntegration::DefaultWebClientState state =
1040 ShellIntegration::GetDefaultBrowser();
1041 int status_string_id;
1042 if (state == ShellIntegration::IS_DEFAULT)
1043 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_DEFAULT;
1044 else if (state == ShellIntegration::NOT_DEFAULT)
1045 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT;
1046 else
1047 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN;
1048
1049 SetDefaultBrowserUIString(status_string_id);
1050 #else
1051 default_browser_worker_->StartCheckIsDefault(); 1036 default_browser_worker_->StartCheckIsDefault();
1052 #endif
1053 } 1037 }
1054 1038
1055 void BrowserOptionsHandler::BecomeDefaultBrowser(const base::ListValue* args) { 1039 void BrowserOptionsHandler::BecomeDefaultBrowser(const base::ListValue* args) {
1056 // If the default browser setting is managed then we should not be able to 1040 // If the default browser setting is managed then we should not be able to
1057 // call this function. 1041 // call this function.
1058 if (default_browser_policy_.IsManaged()) 1042 if (default_browser_policy_.IsManaged())
1059 return; 1043 return;
1060 1044
1061 content::RecordAction(UserMetricsAction("Options_SetAsDefaultBrowser")); 1045 content::RecordAction(UserMetricsAction("Options_SetAsDefaultBrowser"));
1062 #if defined(OS_MACOSX)
1063 if (ShellIntegration::SetAsDefaultBrowser())
1064 UpdateDefaultBrowserState();
1065 #else
1066 default_browser_worker_->StartSetAsDefault(); 1046 default_browser_worker_->StartSetAsDefault();
1067 // Callback takes care of updating UI. 1047 // Callback takes care of updating UI.
1068 #endif
1069 1048
1070 // If the user attempted to make Chrome the default browser, then he/she 1049 // If the user attempted to make Chrome the default browser, then he/she
1071 // arguably wants to be notified when that changes. 1050 // arguably wants to be notified when that changes.
1072 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); 1051 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
1073 prefs->SetBoolean(prefs::kCheckDefaultBrowser, true); 1052 prefs->SetBoolean(prefs::kCheckDefaultBrowser, true);
1074 } 1053 }
1075 1054
1076 int BrowserOptionsHandler::StatusStringIdForState( 1055 int BrowserOptionsHandler::StatusStringIdForState(
1077 ShellIntegration::DefaultWebClientState state) { 1056 ShellIntegration::DefaultWebClientState state) {
1078 if (state == ShellIntegration::IS_DEFAULT) 1057 if (state == ShellIntegration::IS_DEFAULT)
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 extension = extensions::GetExtensionOverridingProxy( 1862 extension = extensions::GetExtensionOverridingProxy(
1884 Profile::FromWebUI(web_ui())); 1863 Profile::FromWebUI(web_ui()));
1885 AppendExtensionData("proxy", extension, &extension_controlled); 1864 AppendExtensionData("proxy", extension, &extension_controlled);
1886 1865
1887 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", 1866 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators",
1888 extension_controlled); 1867 extension_controlled);
1889 #endif // defined(OS_WIN) 1868 #endif // defined(OS_WIN)
1890 } 1869 }
1891 1870
1892 } // namespace options 1871 } // namespace options
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698