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/startup/default_browser_prompt.h" | 5 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
6 | 6 |
7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
37 void SetChromeAsDefaultBrowser(bool interactive_flow, PrefService* prefs) { | 37 void SetChromeAsDefaultBrowser(bool interactive_flow, PrefService* prefs) { |
38 if (interactive_flow) { | 38 if (interactive_flow) { |
39 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.SetAsDefaultUI", 1); | 39 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.SetAsDefaultUI", 1); |
40 if (!ShellIntegration::SetAsDefaultBrowserInteractive()) { | 40 if (!ShellIntegration::SetAsDefaultBrowserInteractive()) { |
41 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.SetAsDefaultUIFailed", 1); | 41 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.SetAsDefaultUIFailed", 1); |
42 } else if (!ShellIntegration::IsDefaultBrowser()) { | 42 } else if (!ShellIntegration::IsDefaultBrowser()) { |
43 // If the interaction succeeded but we are still not the default browser | 43 // If the interaction succeeded but we are still not the default browser |
44 // it likely means the user simply selected another browser from the | 44 // it likely means the user simply selected another browser from the |
45 // panel. We will respect this choice and write it down as 'no, thanks'. | 45 // panel. We will respect this choice and write it down as 'no, thanks'. |
46 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.DontSetAsDefault", 1); | 46 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.DontSetAsDefault", 1); |
47 // User clicked "Don't ask me again", remember that. | |
sky
2012/08/15 21:09:28
Is the pref needed anymore?
motek.
2012/08/15 21:19:36
Yes. It is set and read in the same file, upon 'ca
| |
48 if (prefs) | |
49 prefs->SetBoolean(prefs::kCheckDefaultBrowser, false); | |
50 } | 47 } |
51 } else { | 48 } else { |
52 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.SetAsDefault", 1); | 49 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.SetAsDefault", 1); |
53 ShellIntegration::SetAsDefaultBrowser(); | 50 ShellIntegration::SetAsDefaultBrowser(); |
54 } | 51 } |
55 } | 52 } |
56 | 53 |
57 // The delegate for the infobar shown when Chrome is not the default browser. | 54 // The delegate for the infobar shown when Chrome is not the default browser. |
58 class DefaultBrowserInfoBarDelegate : public ConfirmInfoBarDelegate { | 55 class DefaultBrowserInfoBarDelegate : public ConfirmInfoBarDelegate { |
59 public: | 56 public: |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 bool interactive_flow = ShellIntegration::CanSetAsDefaultBrowser() == | 228 bool interactive_flow = ShellIntegration::CanSetAsDefaultBrowser() == |
232 ShellIntegration::SET_DEFAULT_INTERACTIVE; | 229 ShellIntegration::SET_DEFAULT_INTERACTIVE; |
233 infobar_helper->AddInfoBar( | 230 infobar_helper->AddInfoBar( |
234 new DefaultBrowserInfoBarDelegate(infobar_helper, | 231 new DefaultBrowserInfoBarDelegate(infobar_helper, |
235 tab->profile()->GetPrefs(), | 232 tab->profile()->GetPrefs(), |
236 interactive_flow)); | 233 interactive_flow)); |
237 } | 234 } |
238 | 235 |
239 } // namespace internal | 236 } // namespace internal |
240 } // namespace chrome | 237 } // namespace chrome |
OLD | NEW |