Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc |
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc |
index 66fc3b85a2e3f5291e5506d1d33a1e03db5ea378..48c48f08121ed231adf7694e1febb54728d37fb5 100644 |
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc |
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc |
@@ -877,9 +877,19 @@ void ChromeLauncherControllerImpl::OnShelfCreated(ash::WmShelf* shelf) { |
if (ash::ShelfWidget::ShelfAlignmentAllowed()) |
shelf->SetAlignment(ash::launcher::GetShelfAlignmentPref(prefs, display)); |
+#if defined(OS_CHROMEOS) |
+ stylus_metrics_recorder_ = |
+ base::MakeUnique<chromeos::StylusMetricsRecorder>(); |
+#endif |
} |
-void ChromeLauncherControllerImpl::OnShelfDestroyed(ash::WmShelf* shelf) {} |
+void ChromeLauncherControllerImpl::OnShelfDestroyed(ash::WmShelf* shelf) { |
+// To clean up stylus_metrics_recorder_ properly, a valid shell instance is |
+// required. So explicityly delete it before the shell instance becomes invalid. |
xiyuan
2016/09/16 20:07:54
nit: wrong indent. Comment should use the same ind
xiaoyinh(OOO Sep 11-29)
2016/09/16 22:34:25
Done.
|
+#if defined(OS_CHROMEOS) |
xiyuan
2016/09/16 20:07:54
nit: move this above the comment to keep it closer
xiaoyinh(OOO Sep 11-29)
2016/09/16 22:34:25
Done.
|
+ stylus_metrics_recorder_.reset(); |
+#endif |
+} |
void ChromeLauncherControllerImpl::OnShelfAlignmentChanged( |
ash::WmShelf* shelf) { |