| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_infobar_delegate.h" | 5 #include "chrome/browser/ui/startup/default_browser_infobar_delegate.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/metrics/user_metrics.h" | 10 #include "base/metrics/user_metrics.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 DefaultBrowserInfoBarDelegate::DefaultBrowserInfoBarDelegate(Profile* profile) | 29 DefaultBrowserInfoBarDelegate::DefaultBrowserInfoBarDelegate(Profile* profile) |
| 30 : ConfirmInfoBarDelegate(), | 30 : ConfirmInfoBarDelegate(), |
| 31 profile_(profile), | 31 profile_(profile), |
| 32 should_expire_(false), | 32 should_expire_(false), |
| 33 action_taken_(false), | 33 action_taken_(false), |
| 34 weak_factory_(this) { | 34 weak_factory_(this) { |
| 35 // We want the info-bar to stick-around for few seconds and then be hidden | 35 // We want the info-bar to stick-around for few seconds and then be hidden |
| 36 // on the next navigation after that. | 36 // on the next navigation after that. |
| 37 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 37 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 38 FROM_HERE, base::Bind(&DefaultBrowserInfoBarDelegate::AllowExpiry, | 38 FROM_HERE, |
| 39 weak_factory_.GetWeakPtr()), | 39 base::BindOnce(&DefaultBrowserInfoBarDelegate::AllowExpiry, |
| 40 weak_factory_.GetWeakPtr()), |
| 40 base::TimeDelta::FromSeconds(8)); | 41 base::TimeDelta::FromSeconds(8)); |
| 41 } | 42 } |
| 42 | 43 |
| 43 DefaultBrowserInfoBarDelegate::~DefaultBrowserInfoBarDelegate() { | 44 DefaultBrowserInfoBarDelegate::~DefaultBrowserInfoBarDelegate() { |
| 44 if (!action_taken_) { | 45 if (!action_taken_) { |
| 45 base::RecordAction(base::UserMetricsAction("DefaultBrowserInfoBar_Ignore")); | 46 base::RecordAction(base::UserMetricsAction("DefaultBrowserInfoBar_Ignore")); |
| 46 UMA_HISTOGRAM_ENUMERATION("DefaultBrowser.InfoBar.UserInteraction", | 47 UMA_HISTOGRAM_ENUMERATION("DefaultBrowser.InfoBar.UserInteraction", |
| 47 IGNORE_INFO_BAR, | 48 IGNORE_INFO_BAR, |
| 48 NUM_INFO_BAR_USER_INTERACTION_TYPES); | 49 NUM_INFO_BAR_USER_INTERACTION_TYPES); |
| 49 } | 50 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // The worker pointer is reference counted. While it is running, the | 115 // The worker pointer is reference counted. While it is running, the |
| 115 // message loops of the FILE and UI thread will hold references to it | 116 // message loops of the FILE and UI thread will hold references to it |
| 116 // and it will be automatically freed once all its tasks have finished. | 117 // and it will be automatically freed once all its tasks have finished. |
| 117 make_scoped_refptr(new shell_integration::DefaultBrowserWorker( | 118 make_scoped_refptr(new shell_integration::DefaultBrowserWorker( |
| 118 shell_integration::DefaultWebClientWorkerCallback())) | 119 shell_integration::DefaultWebClientWorkerCallback())) |
| 119 ->StartSetAsDefault(); | 120 ->StartSetAsDefault(); |
| 120 return true; | 121 return true; |
| 121 } | 122 } |
| 122 | 123 |
| 123 } // namespace chrome | 124 } // namespace chrome |
| OLD | NEW |