OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/settings/settings_default_browser_handler.h" | 5 #include "chrome/browser/ui/webui/settings/settings_default_browser_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/metrics/user_metrics.h" | 9 #include "base/metrics/user_metrics.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 void DefaultBrowserHandler::OnDefaultBrowserWorkerFinished( | 83 void DefaultBrowserHandler::OnDefaultBrowserWorkerFinished( |
84 shell_integration::DefaultWebClientState state) { | 84 shell_integration::DefaultWebClientState state) { |
85 if (state == shell_integration::IS_DEFAULT) { | 85 if (state == shell_integration::IS_DEFAULT) { |
86 // Notify the user in the future if Chrome ceases to be the user's chosen | 86 // Notify the user in the future if Chrome ceases to be the user's chosen |
87 // default browser. | 87 // default browser. |
88 chrome::ResetDefaultBrowserPrompt(Profile::FromWebUI(web_ui())); | 88 chrome::ResetDefaultBrowserPrompt(Profile::FromWebUI(web_ui())); |
89 } | 89 } |
90 | 90 |
91 base::FundamentalValue is_default(state == shell_integration::IS_DEFAULT); | 91 base::DictionaryValue dict; |
92 base::FundamentalValue can_be_default( | 92 dict.SetBoolean("isDefault", state == shell_integration::IS_DEFAULT); |
93 state != shell_integration::UNKNOWN_DEFAULT && | 93 dict.SetBoolean("canBeDefault", |
94 !DefaultBrowserIsDisabledByPolicy() && | |
95 shell_integration::CanSetAsDefaultBrowser()); | 94 shell_integration::CanSetAsDefaultBrowser()); |
| 95 dict.SetBoolean("isUnknownError", |
| 96 state == shell_integration::UNKNOWN_DEFAULT); |
| 97 dict.SetBoolean("isDisabledByPolicy", DefaultBrowserIsDisabledByPolicy()); |
96 | 98 |
97 CallJavascriptFunction("Settings.updateDefaultBrowserState", is_default, | 99 CallJavascriptFunction("cr.webUIListenerCallback", |
98 can_be_default); | 100 base::StringValue("settings.updateDefaultBrowserState"), dict); |
99 } | 101 } |
100 | 102 |
101 } // namespace settings | 103 } // namespace settings |
OLD | NEW |