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/options2/browser_options_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/browser_options_handler2.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
672 | 672 |
673 base::FundamentalValue enabled(will_launch_at_login); | 673 base::FundamentalValue enabled(will_launch_at_login); |
674 web_ui()->CallJavascriptFunction("BrowserOptions.updateAutoLaunchState", | 674 web_ui()->CallJavascriptFunction("BrowserOptions.updateAutoLaunchState", |
675 enabled); | 675 enabled); |
676 } | 676 } |
677 #endif | 677 #endif |
678 } | 678 } |
679 | 679 |
680 void BrowserOptionsHandler::UpdateDefaultBrowserState() { | 680 void BrowserOptionsHandler::UpdateDefaultBrowserState() { |
681 // Check for side-by-side first. | 681 // Check for side-by-side first. |
682 if (!ShellIntegration::CanSetAsDefaultBrowser()) { | 682 if (ShellIntegration::CanSetAsDefaultBrowser() == |
683 ShellIntegration::CHANGE_DEFAULT_NOT_ALLOWED) { | |
683 SetDefaultBrowserUIString(IDS_OPTIONS_DEFAULTBROWSER_SXS); | 684 SetDefaultBrowserUIString(IDS_OPTIONS_DEFAULTBROWSER_SXS); |
684 return; | 685 return; |
685 } | 686 } |
686 | 687 |
687 #if defined(OS_MACOSX) | 688 #if defined(OS_MACOSX) |
688 ShellIntegration::DefaultWebClientState state = | 689 ShellIntegration::DefaultWebClientState state = |
689 ShellIntegration::IsDefaultBrowser(); | 690 ShellIntegration::IsDefaultBrowser(); |
690 int status_string_id; | 691 int status_string_id; |
691 if (state == ShellIntegration::IS_DEFAULT_WEB_CLIENT) | 692 if (state == ShellIntegration::IS_DEFAULT_WEB_CLIENT) |
692 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_DEFAULT; | 693 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_DEFAULT; |
693 else if (state == ShellIntegration::NOT_DEFAULT_WEB_CLIENT) | 694 else if (state == ShellIntegration::NOT_DEFAULT_WEB_CLIENT) |
694 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT; | 695 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT; |
695 else | 696 else |
696 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN; | 697 status_string_id = IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN; |
697 | 698 |
698 SetDefaultBrowserUIString(status_string_id); | 699 SetDefaultBrowserUIString(status_string_id); |
699 #else | 700 #else |
700 default_browser_worker_->StartCheckIsDefault(); | 701 default_browser_worker_->StartCheckIsDefault(); |
701 #endif | 702 #endif |
702 } | 703 } |
703 | 704 |
704 void BrowserOptionsHandler::BecomeDefaultBrowser(const ListValue* args) { | 705 void BrowserOptionsHandler::BecomeDefaultBrowser(const ListValue* args) { |
705 // If the default browser setting is managed then we should not be able to | 706 // If the default browser setting is managed then we should not be able to |
706 // call this function. | 707 // call this function. |
707 if (default_browser_policy_.IsManaged()) | 708 if (default_browser_policy_.IsManaged()) |
708 return; | 709 return; |
709 | 710 |
710 content::RecordAction(UserMetricsAction("Options_SetAsDefaultBrowser")); | 711 if (ShellIntegration::CanSetAsDefaultBrowser() == |
712 ShellIntegration::CHANGE_DEFAULT_INTERACTIVE) { | |
713 // Interactive operation (a dialog has to be shown). | |
714 content::RecordAction( | |
715 UserMetricsAction("Options_ShowSetAsDefaultBrowser")); | |
grt (UTC plus 2)
2012/05/28 20:47:02
i don't know how these UserMetrics stuff work. do
motek.
2012/05/31 21:59:04
Ack. This is gone. Do you think I should somehow s
| |
716 if (!ShellIntegration::StartSetAsDefaultBrowserInteractive()) { | |
717 content::RecordAction( | |
718 UserMetricsAction("Options_SetAsDefaultBrowserCancelled")); | |
grt (UTC plus 2)
2012/05/28 20:47:02
the comment for StartSetAsDefaultBrowserInteractiv
motek.
2012/05/31 21:59:04
The comment in the other place was indeed incorrec
| |
719 return; // No updates needed. | |
720 } | |
721 UpdateDefaultBrowserState(); | |
grt (UTC plus 2)
2012/05/28 20:47:02
hmm, this makes me think that StartSetAsDefaultBro
motek.
2012/05/31 21:59:04
You are correct. But there was another problem her
| |
722 } else { | |
723 content::RecordAction(UserMetricsAction("Options_SetAsDefaultBrowser")); | |
711 #if defined(OS_MACOSX) | 724 #if defined(OS_MACOSX) |
712 if (ShellIntegration::SetAsDefaultBrowser()) | 725 if (ShellIntegration::SetAsDefaultBrowser()) |
713 UpdateDefaultBrowserState(); | 726 UpdateDefaultBrowserState(); |
714 #else | 727 #else |
715 default_browser_worker_->StartSetAsDefault(); | 728 default_browser_worker_->StartSetAsDefault(); |
716 // Callback takes care of updating UI. | 729 // Callback takes care of updating UI. |
717 #endif | 730 #endif |
731 } | |
718 | 732 |
719 // If the user attempted to make Chrome the default browser, then he/she | 733 // If the user attempted to make Chrome the default browser, then he/she |
720 // arguably wants to be notified when that changes. | 734 // arguably wants to be notified when that changes. |
721 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 735 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
722 prefs->SetBoolean(prefs::kCheckDefaultBrowser, true); | 736 prefs->SetBoolean(prefs::kCheckDefaultBrowser, true); |
723 } | 737 } |
724 | 738 |
725 int BrowserOptionsHandler::StatusStringIdForState( | 739 int BrowserOptionsHandler::StatusStringIdForState( |
726 ShellIntegration::DefaultWebClientState state) { | 740 ShellIntegration::DefaultWebClientState state) { |
727 if (state == ShellIntegration::IS_DEFAULT_WEB_CLIENT) | 741 if (state == ShellIntegration::IS_DEFAULT_WEB_CLIENT) |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1421 } | 1435 } |
1422 | 1436 |
1423 void BrowserOptionsHandler::SetupSSLConfigSettings() { | 1437 void BrowserOptionsHandler::SetupSSLConfigSettings() { |
1424 base::FundamentalValue checked(rev_checking_enabled_.GetValue()); | 1438 base::FundamentalValue checked(rev_checking_enabled_.GetValue()); |
1425 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged()); | 1439 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged()); |
1426 web_ui()->CallJavascriptFunction( | 1440 web_ui()->CallJavascriptFunction( |
1427 "BrowserOptions.setCheckRevocationCheckboxState", checked, disabled); | 1441 "BrowserOptions.setCheckRevocationCheckboxState", checked, disabled); |
1428 } | 1442 } |
1429 | 1443 |
1430 } // namespace options2 | 1444 } // namespace options2 |
OLD | NEW |