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

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

Issue 11418312: app_list: Improve initial icon loading. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, stop timer when showing widget because no pending icon loads Created 8 years 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 | « ash/wm/app_list_controller.h ('k') | ui/app_list/app_list_constants.h » ('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"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 aura::Window* AppListController::GetWindow() { 139 aura::Window* AppListController::GetWindow() {
140 return is_visible_ && view_ ? view_->GetWidget()->GetNativeWindow() : NULL; 140 return is_visible_ && view_ ? view_->GetWidget()->GetNativeWindow() : NULL;
141 } 141 }
142 142
143 //////////////////////////////////////////////////////////////////////////////// 143 ////////////////////////////////////////////////////////////////////////////////
144 // AppListController, private: 144 // AppListController, private:
145 145
146 void AppListController::SetView(app_list::AppListView* view) { 146 void AppListController::SetView(app_list::AppListView* view) {
147 DCHECK(view_ == NULL); 147 DCHECK(view_ == NULL);
148 DCHECK(is_visible_);
148 149
149 if (is_visible_) { 150 view_ = view;
150 view_ = view; 151 views::Widget* widget = view_->GetWidget();
151 views::Widget* widget = view_->GetWidget(); 152 widget->AddObserver(this);
152 widget->AddObserver(this); 153 Shell::GetInstance()->AddPreTargetHandler(this);
153 Shell::GetInstance()->AddPreTargetHandler(this); 154 Launcher::ForWindow(GetWindow())->AddIconObserver(this);
154 Launcher::ForWindow(GetWindow())->AddIconObserver(this); 155 widget->GetNativeView()->GetRootWindow()->AddRootWindowObserver(this);
155 widget->GetNativeView()->GetRootWindow()->AddRootWindowObserver(this); 156 aura::client::GetFocusClient(widget->GetNativeView())->AddObserver(this);
156 aura::client::GetFocusClient(widget->GetNativeView())->AddObserver(this);
157 widget->SetOpacity(0);
158 ScheduleAnimation();
159 157
160 view_->GetWidget()->Show(); 158 view_->ShowWhenReady();
161 } else {
162 view->GetWidget()->Close();
163 }
164 } 159 }
165 160
166 void AppListController::ResetView() { 161 void AppListController::ResetView() {
167 if (!view_) 162 if (!view_)
168 return; 163 return;
169 164
170 views::Widget* widget = view_->GetWidget(); 165 views::Widget* widget = view_->GetWidget();
171 widget->RemoveObserver(this); 166 widget->RemoveObserver(this);
172 GetLayer(widget)->GetAnimator()->RemoveObserver(this); 167 GetLayer(widget)->GetAnimator()->RemoveObserver(this);
173 Shell::GetInstance()->RemovePreTargetHandler(this); 168 Shell::GetInstance()->RemovePreTargetHandler(this);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 should_snap_back_ = false; 342 should_snap_back_ = false;
348 ui::ScopedLayerAnimationSettings animation(widget_animator); 343 ui::ScopedLayerAnimationSettings animation(widget_animator);
349 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( 344 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
350 app_list::kOverscrollPageTransitionDurationMs)); 345 app_list::kOverscrollPageTransitionDurationMs));
351 widget->SetBounds(view_bounds_); 346 widget->SetBounds(view_bounds_);
352 } 347 }
353 } 348 }
354 349
355 } // namespace internal 350 } // namespace internal
356 } // namespace ash 351 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/app_list_controller.h ('k') | ui/app_list/app_list_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698