OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ash/launcher/chrome_launcher_controller_impl.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 #include "extensions/common/url_pattern.h" | 93 #include "extensions/common/url_pattern.h" |
94 #include "ui/aura/window.h" | 94 #include "ui/aura/window.h" |
95 #include "ui/aura/window_event_dispatcher.h" | 95 #include "ui/aura/window_event_dispatcher.h" |
96 #include "ui/base/l10n/l10n_util.h" | 96 #include "ui/base/l10n/l10n_util.h" |
97 #include "ui/base/resource/resource_bundle.h" | 97 #include "ui/base/resource/resource_bundle.h" |
98 #include "ui/base/window_open_disposition.h" | 98 #include "ui/base/window_open_disposition.h" |
99 #include "ui/keyboard/keyboard_util.h" | 99 #include "ui/keyboard/keyboard_util.h" |
100 #include "ui/resources/grit/ui_resources.h" | 100 #include "ui/resources/grit/ui_resources.h" |
101 #include "ui/wm/core/window_animations.h" | 101 #include "ui/wm/core/window_animations.h" |
102 | 102 |
| 103 #if defined(OS_CHROMEOS) |
| 104 #include "chrome/browser/ui/ash/metrics/stylus_metrics_recorder_chromeos.h" |
| 105 #endif |
| 106 |
103 using extensions::Extension; | 107 using extensions::Extension; |
104 using extensions::UnloadedExtensionInfo; | 108 using extensions::UnloadedExtensionInfo; |
105 using extension_misc::kGmailAppId; | 109 using extension_misc::kGmailAppId; |
106 using content::WebContents; | 110 using content::WebContents; |
107 | 111 |
108 namespace { | 112 namespace { |
109 | 113 |
110 int64_t GetDisplayIDForShelf(ash::WmShelf* shelf) { | 114 int64_t GetDisplayIDForShelf(ash::WmShelf* shelf) { |
111 display::Display display = | 115 display::Display display = |
112 shelf->GetWindow()->GetRootWindow()->GetDisplayNearestWindow(); | 116 shelf->GetWindow()->GetRootWindow()->GetDisplayNearestWindow(); |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 | 874 |
871 void ChromeLauncherControllerImpl::OnShelfCreated(ash::WmShelf* shelf) { | 875 void ChromeLauncherControllerImpl::OnShelfCreated(ash::WmShelf* shelf) { |
872 PrefService* prefs = profile_->GetPrefs(); | 876 PrefService* prefs = profile_->GetPrefs(); |
873 const int64_t display = GetDisplayIDForShelf(shelf); | 877 const int64_t display = GetDisplayIDForShelf(shelf); |
874 | 878 |
875 shelf->SetAutoHideBehavior( | 879 shelf->SetAutoHideBehavior( |
876 ash::launcher::GetShelfAutoHideBehaviorPref(prefs, display)); | 880 ash::launcher::GetShelfAutoHideBehaviorPref(prefs, display)); |
877 | 881 |
878 if (ash::ShelfWidget::ShelfAlignmentAllowed()) | 882 if (ash::ShelfWidget::ShelfAlignmentAllowed()) |
879 shelf->SetAlignment(ash::launcher::GetShelfAlignmentPref(prefs, display)); | 883 shelf->SetAlignment(ash::launcher::GetShelfAlignmentPref(prefs, display)); |
| 884 #if defined(OS_CHROMEOS) |
| 885 stylus_metrics_recorder_ = |
| 886 base::MakeUnique<chromeos::StylusMetricsRecorder>(); |
| 887 #endif |
880 } | 888 } |
881 | 889 |
882 void ChromeLauncherControllerImpl::OnShelfDestroyed(ash::WmShelf* shelf) {} | 890 void ChromeLauncherControllerImpl::OnShelfDestroyed(ash::WmShelf* shelf) { |
| 891 #if defined(OS_CHROMEOS) |
| 892 // To clean up stylus_metrics_recorder_ properly, a valid shell instance is |
| 893 // required. So explicityly delete it before the shell instance becomes |
| 894 // invalid. |
| 895 stylus_metrics_recorder_.reset(); |
| 896 #endif |
| 897 } |
883 | 898 |
884 void ChromeLauncherControllerImpl::OnShelfAlignmentChanged( | 899 void ChromeLauncherControllerImpl::OnShelfAlignmentChanged( |
885 ash::WmShelf* shelf) { | 900 ash::WmShelf* shelf) { |
886 ash::launcher::SetShelfAlignmentPref( | 901 ash::launcher::SetShelfAlignmentPref( |
887 profile_->GetPrefs(), GetDisplayIDForShelf(shelf), shelf->alignment()); | 902 profile_->GetPrefs(), GetDisplayIDForShelf(shelf), shelf->alignment()); |
888 } | 903 } |
889 | 904 |
890 void ChromeLauncherControllerImpl::OnShelfAutoHideBehaviorChanged( | 905 void ChromeLauncherControllerImpl::OnShelfAutoHideBehaviorChanged( |
891 ash::WmShelf* shelf) { | 906 ash::WmShelf* shelf) { |
892 ash::launcher::SetShelfAutoHideBehaviorPref(profile_->GetPrefs(), | 907 ash::launcher::SetShelfAutoHideBehaviorPref(profile_->GetPrefs(), |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 if (index == -1) | 1734 if (index == -1) |
1720 continue; | 1735 continue; |
1721 ash::ShelfItem item = model_->items()[index]; | 1736 ash::ShelfItem item = model_->items()[index]; |
1722 item.image = image; | 1737 item.image = image; |
1723 if (arc_deferred_launcher_) | 1738 if (arc_deferred_launcher_) |
1724 arc_deferred_launcher_->MaybeApplySpinningEffect(id, &item.image); | 1739 arc_deferred_launcher_->MaybeApplySpinningEffect(id, &item.image); |
1725 model_->Set(index, item); | 1740 model_->Set(index, item); |
1726 // It's possible we're waiting on more than one item, so don't break. | 1741 // It's possible we're waiting on more than one item, so don't break. |
1727 } | 1742 } |
1728 } | 1743 } |
OLD | NEW |