Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: ash/wm/app_list_controller.cc

Issue 10868003: chromeos: Fix pixelated icons in app list and launcher (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win compile Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_icon_image.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/wm/app_list_controller.h" 5 #include "ash/wm/app_list_controller.h"
6 6
7 #include "ash/launcher/launcher.h" 7 #include "ash/launcher/launcher.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_delegate.h" 10 #include "ash/shell_delegate.h"
11 #include "ash/shell_window_ids.h" 11 #include "ash/shell_window_ids.h"
12 #include "ash/wm/property_util.h" 12 #include "ash/wm/property_util.h"
13 #include "ash/wm/shelf_layout_manager.h" 13 #include "ash/wm/shelf_layout_manager.h"
14 #include "ui/app_list/app_list_view.h" 14 #include "ui/app_list/app_list_view.h"
15 #include "ui/app_list/icon_cache.h"
16 #include "ui/app_list/pagination_model.h" 15 #include "ui/app_list/pagination_model.h"
17 #include "ui/aura/focus_manager.h" 16 #include "ui/aura/focus_manager.h"
18 #include "ui/aura/root_window.h" 17 #include "ui/aura/root_window.h"
19 #include "ui/aura/window.h" 18 #include "ui/aura/window.h"
20 #include "ui/base/events/event.h" 19 #include "ui/base/events/event.h"
21 #include "ui/compositor/layer.h" 20 #include "ui/compositor/layer.h"
22 #include "ui/compositor/scoped_layer_animation_settings.h" 21 #include "ui/compositor/scoped_layer_animation_settings.h"
23 #include "ui/gfx/transform_util.h" 22 #include "ui/gfx/transform_util.h"
24 #include "ui/views/widget/widget.h" 23 #include "ui/views/widget/widget.h"
25 24
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 79
81 } // namespace 80 } // namespace
82 81
83 //////////////////////////////////////////////////////////////////////////////// 82 ////////////////////////////////////////////////////////////////////////////////
84 // AppListController, public: 83 // AppListController, public:
85 84
86 AppListController::AppListController() 85 AppListController::AppListController()
87 : pagination_model_(new app_list::PaginationModel), 86 : pagination_model_(new app_list::PaginationModel),
88 is_visible_(false), 87 is_visible_(false),
89 view_(NULL) { 88 view_(NULL) {
90 app_list::IconCache::CreateInstance();
91 Shell::GetInstance()->AddShellObserver(this); 89 Shell::GetInstance()->AddShellObserver(this);
92 } 90 }
93 91
94 AppListController::~AppListController() { 92 AppListController::~AppListController() {
95 // Ensures app list view goes before the controller since pagination model 93 // Ensures app list view goes before the controller since pagination model
96 // lives in the controller and app list view would access it on destruction. 94 // lives in the controller and app list view would access it on destruction.
97 if (view_ && view_->GetWidget()) 95 if (view_ && view_->GetWidget())
98 view_->GetWidget()->CloseNow(); 96 view_->GetWidget()->CloseNow();
99 97
100 app_list::IconCache::DeleteInstance();
101 Shell::GetInstance()->RemoveShellObserver(this); 98 Shell::GetInstance()->RemoveShellObserver(this);
102 } 99 }
103 100
104 void AppListController::SetVisible(bool visible) { 101 void AppListController::SetVisible(bool visible) {
105 if (visible == is_visible_) 102 if (visible == is_visible_)
106 return; 103 return;
107 104
108 is_visible_ = visible; 105 is_visible_ = visible;
109 106
110 // App list needs to know the new shelf layout in order to calculate its 107 // App list needs to know the new shelf layout in order to calculate its
(...skipping 26 matching lines...) Expand all
137 return is_visible_ && view_ ? view_->GetWidget()->GetNativeWindow() : NULL; 134 return is_visible_ && view_ ? view_->GetWidget()->GetNativeWindow() : NULL;
138 } 135 }
139 136
140 //////////////////////////////////////////////////////////////////////////////// 137 ////////////////////////////////////////////////////////////////////////////////
141 // AppListController, private: 138 // AppListController, private:
142 139
143 void AppListController::SetView(app_list::AppListView* view) { 140 void AppListController::SetView(app_list::AppListView* view) {
144 DCHECK(view_ == NULL); 141 DCHECK(view_ == NULL);
145 142
146 if (is_visible_) { 143 if (is_visible_) {
147 app_list::IconCache::GetInstance()->MarkAllEntryUnused();
148
149 view_ = view; 144 view_ = view;
150 views::Widget* widget = view_->GetWidget(); 145 views::Widget* widget = view_->GetWidget();
151 widget->AddObserver(this); 146 widget->AddObserver(this);
152 Shell::GetInstance()->AddEnvEventFilter(this); 147 Shell::GetInstance()->AddEnvEventFilter(this);
153 Shell::GetInstance()->launcher()->AddIconObserver(this); 148 Shell::GetInstance()->launcher()->AddIconObserver(this);
154 widget->GetNativeView()->GetRootWindow()->AddRootWindowObserver(this); 149 widget->GetNativeView()->GetRootWindow()->AddRootWindowObserver(this);
155 widget->GetNativeView()->GetFocusManager()->AddObserver(this); 150 widget->GetNativeView()->GetFocusManager()->AddObserver(this);
156 widget->SetOpacity(0); 151 widget->SetOpacity(0);
157 ScheduleAnimation(); 152 ScheduleAnimation();
158 153
159 view_->GetWidget()->Show(); 154 view_->GetWidget()->Show();
160 } else { 155 } else {
161 view->GetWidget()->Close(); 156 view->GetWidget()->Close();
162 } 157 }
163 } 158 }
164 159
165 void AppListController::ResetView() { 160 void AppListController::ResetView() {
166 if (!view_) 161 if (!view_)
167 return; 162 return;
168 163
169 views::Widget* widget = view_->GetWidget(); 164 views::Widget* widget = view_->GetWidget();
170 widget->RemoveObserver(this); 165 widget->RemoveObserver(this);
171 GetLayer(widget)->GetAnimator()->RemoveObserver(this); 166 GetLayer(widget)->GetAnimator()->RemoveObserver(this);
172 Shell::GetInstance()->RemoveEnvEventFilter(this); 167 Shell::GetInstance()->RemoveEnvEventFilter(this);
173 Shell::GetInstance()->launcher()->RemoveIconObserver(this); 168 Shell::GetInstance()->launcher()->RemoveIconObserver(this);
174 widget->GetNativeView()->GetRootWindow()->RemoveRootWindowObserver(this); 169 widget->GetNativeView()->GetRootWindow()->RemoveRootWindowObserver(this);
175 widget->GetNativeView()->GetFocusManager()->RemoveObserver(this); 170 widget->GetNativeView()->GetFocusManager()->RemoveObserver(this);
176 view_ = NULL; 171 view_ = NULL;
177
178 app_list::IconCache::GetInstance()->PurgeAllUnused();
179 } 172 }
180 173
181 void AppListController::ScheduleAnimation() { 174 void AppListController::ScheduleAnimation() {
182 // Stop observing previous animation. 175 // Stop observing previous animation.
183 StopObservingImplicitAnimations(); 176 StopObservingImplicitAnimations();
184 177
185 ui::Layer* layer = GetLayer(view_->GetWidget()); 178 ui::Layer* layer = GetLayer(view_->GetWidget());
186 layer->GetAnimator()->StopAnimating(); 179 layer->GetAnimator()->StopAnimating();
187 180
188 gfx::Rect target_bounds; 181 gfx::Rect target_bounds;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 301
309 //////////////////////////////////////////////////////////////////////////////// 302 ////////////////////////////////////////////////////////////////////////////////
310 // AppListController, LauncherIconObserver implementation: 303 // AppListController, LauncherIconObserver implementation:
311 304
312 void AppListController::OnLauncherIconPositionsChanged() { 305 void AppListController::OnLauncherIconPositionsChanged() {
313 UpdateBounds(); 306 UpdateBounds();
314 } 307 }
315 308
316 } // namespace internal 309 } // namespace internal
317 } // namespace ash 310 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_icon_image.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698