OLD | NEW |
---|---|
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 "ui/app_list/views/app_list_view.h" | 5 #include "ui/app_list/views/app_list_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 #include "ui/app_list/views/custom_launcher_page_view.h" | 24 #include "ui/app_list/views/custom_launcher_page_view.h" |
25 #include "ui/app_list/views/search_box_view.h" | 25 #include "ui/app_list/views/search_box_view.h" |
26 #include "ui/app_list/views/speech_view.h" | 26 #include "ui/app_list/views/speech_view.h" |
27 #include "ui/app_list/views/start_page_view.h" | 27 #include "ui/app_list/views/start_page_view.h" |
28 #include "ui/aura/window.h" | 28 #include "ui/aura/window.h" |
29 #include "ui/aura/window_tree_host.h" | 29 #include "ui/aura/window_tree_host.h" |
30 #include "ui/base/ui_base_switches.h" | 30 #include "ui/base/ui_base_switches.h" |
31 #include "ui/compositor/layer.h" | 31 #include "ui/compositor/layer.h" |
32 #include "ui/compositor/layer_animation_observer.h" | 32 #include "ui/compositor/layer_animation_observer.h" |
33 #include "ui/compositor/scoped_layer_animation_settings.h" | 33 #include "ui/compositor/scoped_layer_animation_settings.h" |
34 #include "ui/display/display.h" | |
35 #include "ui/display/screen.h" | |
34 #include "ui/gfx/canvas.h" | 36 #include "ui/gfx/canvas.h" |
35 #include "ui/gfx/geometry/insets.h" | 37 #include "ui/gfx/geometry/insets.h" |
36 #include "ui/gfx/image/image_skia.h" | 38 #include "ui/gfx/image/image_skia.h" |
37 #include "ui/gfx/path.h" | 39 #include "ui/gfx/path.h" |
38 #include "ui/gfx/skia_util.h" | 40 #include "ui/gfx/skia_util.h" |
39 #include "ui/resources/grit/ui_resources.h" | 41 #include "ui/resources/grit/ui_resources.h" |
40 #include "ui/views/bubble/bubble_frame_view.h" | 42 #include "ui/views/bubble/bubble_frame_view.h" |
41 #include "ui/views/bubble/bubble_window_targeter.h" | 43 #include "ui/views/bubble/bubble_window_targeter.h" |
42 #include "ui/views/controls/image_view.h" | 44 #include "ui/views/controls/image_view.h" |
43 #include "ui/views/controls/textfield/textfield.h" | 45 #include "ui/views/controls/textfield/textfield.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 views::View* search_box_; | 124 views::View* search_box_; |
123 | 125 |
124 DISALLOW_COPY_AND_ASSIGN(SearchBoxWindowTargeter); | 126 DISALLOW_COPY_AND_ASSIGN(SearchBoxWindowTargeter); |
125 }; | 127 }; |
126 | 128 |
127 } // namespace | 129 } // namespace |
128 | 130 |
129 // An animation observer to hide the view at the end of the animation. | 131 // An animation observer to hide the view at the end of the animation. |
130 class HideViewAnimationObserver : public ui::ImplicitAnimationObserver { | 132 class HideViewAnimationObserver : public ui::ImplicitAnimationObserver { |
131 public: | 133 public: |
132 HideViewAnimationObserver() | 134 HideViewAnimationObserver() : frame_(NULL), target_(NULL) {} |
133 : frame_(NULL), | |
134 target_(NULL) { | |
135 } | |
136 | 135 |
137 ~HideViewAnimationObserver() override { | 136 ~HideViewAnimationObserver() override { |
138 if (target_) | 137 if (target_) |
139 StopObservingImplicitAnimations(); | 138 StopObservingImplicitAnimations(); |
140 } | 139 } |
141 | 140 |
142 void SetTarget(views::View* target) { | 141 void SetTarget(views::View* target) { |
143 if (target_) | 142 if (target_) |
144 StopObservingImplicitAnimations(); | 143 StopObservingImplicitAnimations(); |
145 target_ = target; | 144 target_ = target; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 delegate_->GetSpeechUI()->AddObserver(this); | 182 delegate_->GetSpeechUI()->AddObserver(this); |
184 } | 183 } |
185 | 184 |
186 AppListView::~AppListView() { | 185 AppListView::~AppListView() { |
187 delegate_->GetSpeechUI()->RemoveObserver(this); | 186 delegate_->GetSpeechUI()->RemoveObserver(this); |
188 animation_observer_.reset(); | 187 animation_observer_.reset(); |
189 // Remove child views first to ensure no remaining dependencies on delegate_. | 188 // Remove child views first to ensure no remaining dependencies on delegate_. |
190 RemoveAllChildViews(true); | 189 RemoveAllChildViews(true); |
191 } | 190 } |
192 | 191 |
193 void AppListView::InitAsBubble(gfx::NativeView parent, int initial_apps_page) { | 192 void AppListView::Initialize(gfx::NativeView parent, int initial_apps_page) { |
194 base::Time start_time = base::Time::Now(); | 193 base::Time start_time = base::Time::Now(); |
194 InitContents(parent, initial_apps_page); | |
195 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); | |
196 set_color(kContentsBackgroundColor); | |
195 | 197 |
196 InitContents(parent, initial_apps_page); | 198 if (switches::IsFullscreenAppListEnabled()) { |
sky
2017/04/21 21:02:38
no {}
newcomer
2017/04/21 22:44:15
roger
| |
199 InitializeFullscreen(parent, initial_apps_page); | |
200 } else { | |
201 InitializeBubble(parent, initial_apps_page); | |
202 } | |
197 | 203 |
198 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); | |
199 set_margins(gfx::Insets()); | |
200 set_parent_window(parent); | |
201 set_close_on_deactivate(false); | |
202 set_shadow(views::BubbleBorder::NO_ASSETS); | |
203 set_color(kContentsBackgroundColor); | |
204 // This creates the app list widget. (Before this, child widgets cannot be | |
205 // created.) | |
206 views::BubbleDialogDelegateView::CreateBubble(this); | |
207 | |
208 SetBubbleArrow(views::BubbleBorder::FLOAT); | |
209 // We can now create the internal widgets. | |
210 InitChildWidgets(); | 204 InitChildWidgets(); |
211 | |
212 aura::Window* window = GetWidget()->GetNativeWindow(); | |
213 window->SetEventTargeter(base::MakeUnique<views::BubbleWindowTargeter>(this)); | |
214 | |
215 const int kOverlayCornerRadius = | |
216 GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius(); | |
217 overlay_view_ = new AppListOverlayView(kOverlayCornerRadius); | |
218 overlay_view_->SetBoundsRect(GetContentsBounds()); | |
219 AddChildView(overlay_view_); | 205 AddChildView(overlay_view_); |
220 | |
221 if (delegate_) | 206 if (delegate_) |
222 delegate_->ViewInitialized(); | 207 delegate_->ViewInitialized(); |
223 | |
224 UMA_HISTOGRAM_TIMES("Apps.AppListCreationTime", | 208 UMA_HISTOGRAM_TIMES("Apps.AppListCreationTime", |
225 base::Time::Now() - start_time); | 209 base::Time::Now() - start_time); |
226 } | 210 } |
227 | 211 |
228 void AppListView::SetBubbleArrow(views::BubbleBorder::Arrow arrow) { | 212 void AppListView::SetBubbleArrow(views::BubbleBorder::Arrow arrow) { |
229 GetBubbleFrameView()->bubble_border()->set_arrow(arrow); | 213 GetBubbleFrameView()->bubble_border()->set_arrow(arrow); |
230 SizeToContents(); // Recalcuates with new border. | 214 SizeToContents(); // Recalcuates with new border. |
231 GetBubbleFrameView()->SchedulePaint(); | 215 GetBubbleFrameView()->SchedulePaint(); |
232 } | 216 } |
233 | 217 |
234 void AppListView::SetAnchorPoint(const gfx::Point& anchor_point) { | 218 void AppListView::MaybeSetAnchorPoint(const gfx::Point& anchor_point) { |
235 SetAnchorRect(gfx::Rect(anchor_point, gfx::Size())); | 219 // if the AppListView is a bubble |
220 if (!switches::IsFullscreenAppListEnabled()) { | |
sky
2017/04/21 21:02:38
no {}
newcomer
2017/04/21 22:44:15
roger
| |
221 SetAnchorRect(gfx::Rect(anchor_point, gfx::Size())); | |
222 } | |
236 } | 223 } |
237 | 224 |
238 void AppListView::SetDragAndDropHostOfCurrentAppList( | 225 void AppListView::SetDragAndDropHostOfCurrentAppList( |
239 ApplicationDragAndDropHost* drag_and_drop_host) { | 226 ApplicationDragAndDropHost* drag_and_drop_host) { |
240 app_list_main_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); | 227 app_list_main_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); |
241 } | 228 } |
242 | 229 |
243 void AppListView::ShowWhenReady() { | 230 void AppListView::ShowWhenReady() { |
244 app_list_main_view_->ShowAppListWhenReady(); | 231 app_list_main_view_->ShowAppListWhenReady(); |
245 } | 232 } |
246 | 233 |
247 void AppListView::CloseAppList() { | 234 void AppListView::CloseAppList() { |
248 app_list_main_view_->Close(); | 235 app_list_main_view_->Close(); |
249 delegate_->Dismiss(); | 236 delegate_->Dismiss(); |
250 } | 237 } |
251 | 238 |
252 void AppListView::UpdateBounds() { | 239 void AppListView::UpdateBounds() { |
253 SizeToContents(); | 240 // if the AppListView is a bubble |
241 if (!switches::IsFullscreenAppListEnabled()) { | |
sky
2017/04/21 21:02:38
no {}
newcomer
2017/04/21 22:44:15
Acknowledged.
| |
242 SizeToContents(); | |
243 } | |
254 } | 244 } |
255 | 245 |
256 void AppListView::SetAppListOverlayVisible(bool visible) { | 246 void AppListView::SetAppListOverlayVisible(bool visible) { |
257 DCHECK(overlay_view_); | 247 DCHECK(overlay_view_); |
258 | 248 |
259 // Display the overlay immediately so we can begin the animation. | 249 // Display the overlay immediately so we can begin the animation. |
260 overlay_view_->SetVisible(true); | 250 overlay_view_->SetVisible(true); |
261 | 251 |
262 ui::ScopedLayerAnimationSettings settings( | 252 ui::ScopedLayerAnimationSettings settings( |
263 overlay_view_->layer()->GetAnimator()); | 253 overlay_view_->layer()->GetAnimator()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
297 } | 287 } |
298 | 288 |
299 void AppListView::OnPaint(gfx::Canvas* canvas) { | 289 void AppListView::OnPaint(gfx::Canvas* canvas) { |
300 views::BubbleDialogDelegateView::OnPaint(canvas); | 290 views::BubbleDialogDelegateView::OnPaint(canvas); |
301 if (!next_paint_callback_.is_null()) { | 291 if (!next_paint_callback_.is_null()) { |
302 next_paint_callback_.Run(); | 292 next_paint_callback_.Run(); |
303 next_paint_callback_.Reset(); | 293 next_paint_callback_.Reset(); |
304 } | 294 } |
305 } | 295 } |
306 | 296 |
297 const char* AppListView::GetClassName() const { | |
298 return "AppListView"; | |
299 } | |
300 | |
307 bool AppListView::ShouldHandleSystemCommands() const { | 301 bool AppListView::ShouldHandleSystemCommands() const { |
308 return true; | 302 return true; |
309 } | 303 } |
310 | 304 |
311 bool AppListView::ShouldDescendIntoChildForEventHandling( | 305 bool AppListView::ShouldDescendIntoChildForEventHandling( |
312 gfx::NativeView child, | 306 gfx::NativeView child, |
313 const gfx::Point& location) { | 307 const gfx::Point& location) { |
314 // While on the start page, don't descend into the custom launcher page. Since | 308 // While on the start page, don't descend into the custom launcher page. Since |
315 // the only valid action is to open it. | 309 // the only valid action is to open it. |
316 ContentsView* contents_view = app_list_main_view_->contents_view(); | 310 ContentsView* contents_view = app_list_main_view_->contents_view(); |
(...skipping 19 matching lines...) Expand all Loading... | |
336 // crbug.com/441028 are fixed. | 330 // crbug.com/441028 are fixed. |
337 tracked_objects::ScopedTracker tracking_profile( | 331 tracked_objects::ScopedTracker tracking_profile( |
338 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 332 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
339 "440224, 441028 AppListView::InitContents")); | 333 "440224, 441028 AppListView::InitContents")); |
340 | 334 |
341 app_list_main_view_ = new AppListMainView(delegate_); | 335 app_list_main_view_ = new AppListMainView(delegate_); |
342 AddChildView(app_list_main_view_); | 336 AddChildView(app_list_main_view_); |
343 app_list_main_view_->SetPaintToLayer(); | 337 app_list_main_view_->SetPaintToLayer(); |
344 app_list_main_view_->layer()->SetFillsBoundsOpaquely(false); | 338 app_list_main_view_->layer()->SetFillsBoundsOpaquely(false); |
345 app_list_main_view_->layer()->SetMasksToBounds(true); | 339 app_list_main_view_->layer()->SetMasksToBounds(true); |
346 | |
347 // This will be added to the |search_box_widget_| after the app list widget is | 340 // This will be added to the |search_box_widget_| after the app list widget is |
348 // initialized. | 341 // initialized. |
349 search_box_view_ = new SearchBoxView(app_list_main_view_, delegate_); | 342 search_box_view_ = new SearchBoxView(app_list_main_view_, delegate_); |
350 search_box_view_->SetPaintToLayer(); | 343 search_box_view_->SetPaintToLayer(); |
351 search_box_view_->layer()->SetFillsBoundsOpaquely(false); | 344 search_box_view_->layer()->SetFillsBoundsOpaquely(false); |
352 search_box_view_->layer()->SetMasksToBounds(true); | 345 search_box_view_->layer()->SetMasksToBounds(true); |
353 | 346 |
354 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and | 347 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and |
355 // crbug.com/441028 are fixed. | 348 // crbug.com/441028 are fixed. |
356 tracked_objects::ScopedTracker tracking_profile1( | 349 tracked_objects::ScopedTracker tracking_profile1( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 GetWidget()->GetFocusTraversable()); | 396 GetWidget()->GetFocusTraversable()); |
404 | 397 |
405 // Mouse events on the search box shadow should not be captured. | 398 // Mouse events on the search box shadow should not be captured. |
406 aura::Window* window = search_box_widget_->GetNativeWindow(); | 399 aura::Window* window = search_box_widget_->GetNativeWindow(); |
407 window->SetEventTargeter( | 400 window->SetEventTargeter( |
408 base::MakeUnique<SearchBoxWindowTargeter>(search_box_view_)); | 401 base::MakeUnique<SearchBoxWindowTargeter>(search_box_view_)); |
409 | 402 |
410 app_list_main_view_->contents_view()->Layout(); | 403 app_list_main_view_->contents_view()->Layout(); |
411 } | 404 } |
412 | 405 |
413 void AppListView::OnBeforeBubbleWidgetInit( | 406 void AppListView::InitializeFullscreen(gfx::NativeView parent, |
414 views::Widget::InitParams* params, | 407 int initial_apps_page) { |
415 views::Widget* widget) const { | 408 const gfx::Rect& display_work_area_bounds = |
409 display::Screen::GetScreen()->GetDisplayNearestView(parent).work_area(); | |
410 views::Widget* widget = new views::Widget; | |
411 views::Widget::InitParams app_list_overlay_view_params( | |
412 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | |
sky
2017/04/21 21:02:38
Set app_list_overlay_view_params.opacity = Widget:
newcomer
2017/04/21 22:44:15
Done.
| |
413 | |
414 app_list_overlay_view_params.parent = parent; | |
sky
2017/04/21 21:02:39
The bubble code path parents the widget to |parent
newcomer
2017/04/21 22:44:15
Done! And moved the shared code to Initialize.
| |
415 app_list_overlay_view_params.delegate = this; | |
416 | |
417 widget->Init(app_list_overlay_view_params); | |
418 widget->SetBounds(display_work_area_bounds); | |
sky
2017/04/21 21:02:39
Rather than this, specify the bounds in the InitPa
newcomer
2017/04/21 22:44:15
Done.
| |
419 widget->GetLayer()->SetFillsBoundsOpaquely(false); | |
420 widget->GetLayer()->SetBackgroundBlur(10); | |
421 | |
422 overlay_view_ = new AppListOverlayView(0 /* no corners */); | |
423 } | |
424 | |
425 void AppListView::InitializeBubble(gfx::NativeView parent, | |
426 int initial_apps_page) { | |
427 set_margins(gfx::Insets()); | |
428 set_parent_window(parent); | |
429 set_close_on_deactivate(false); | |
430 set_shadow(views::BubbleBorder::NO_ASSETS); | |
431 | |
432 // This creates the app list widget. (Before this, child widgets cannot be | |
433 // created.) | |
434 views::BubbleDialogDelegateView::CreateBubble(this); | |
435 | |
436 SetBubbleArrow(views::BubbleBorder::FLOAT); | |
437 // We can now create the internal widgets. | |
438 | |
439 aura::Window* window = GetWidget()->GetNativeWindow(); | |
440 window->SetEventTargeter(base::MakeUnique<views::BubbleWindowTargeter>(this)); | |
441 | |
442 const int kOverlayCornerRadius = | |
443 GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius(); | |
444 overlay_view_ = new AppListOverlayView(kOverlayCornerRadius); | |
445 overlay_view_->SetBoundsRect(GetContentsBounds()); | |
446 } | |
447 | |
448 void AppListView::OnBeforeBubbleWidgetInit(views::Widget::InitParams* params, | |
449 views::Widget* widget) const { | |
416 if (!params->native_widget) { | 450 if (!params->native_widget) { |
417 views::ViewsDelegate* views_delegate = views::ViewsDelegate::GetInstance(); | 451 views::ViewsDelegate* views_delegate = views::ViewsDelegate::GetInstance(); |
418 if (views_delegate && !views_delegate->native_widget_factory().is_null()) { | 452 if (views_delegate && !views_delegate->native_widget_factory().is_null()) { |
419 params->native_widget = | 453 params->native_widget = |
420 views_delegate->native_widget_factory().Run(*params, widget); | 454 views_delegate->native_widget_factory().Run(*params, widget); |
421 } | 455 } |
422 } | 456 } |
423 // Apply a WM-provided shadow (see ui/wm/core/). | 457 // Apply a WM-provided shadow (see ui/wm/core/). |
424 params->shadow_type = views::Widget::InitParams::SHADOW_TYPE_DROP; | 458 params->shadow_type = views::Widget::InitParams::SHADOW_TYPE_DROP; |
425 params->shadow_elevation = wm::ShadowElevation::LARGE; | 459 params->shadow_elevation = wm::ShadowElevation::LARGE; |
426 } | 460 } |
427 | 461 |
428 int AppListView::GetDialogButtons() const { | 462 int AppListView::GetDialogButtons() const { |
429 return ui::DIALOG_BUTTON_NONE; | 463 return ui::DIALOG_BUTTON_NONE; |
430 } | 464 } |
431 | 465 |
432 views::View* AppListView::GetInitiallyFocusedView() { | 466 views::View* AppListView::GetInitiallyFocusedView() { |
433 return app_list_main_view_->search_box_view()->search_box(); | 467 return app_list_main_view_->search_box_view()->search_box(); |
434 } | 468 } |
435 | 469 |
436 bool AppListView::WidgetHasHitTestMask() const { | 470 bool AppListView::WidgetHasHitTestMask() const { |
437 return GetBubbleFrameView() != nullptr; | 471 return GetBubbleFrameView() != nullptr; |
438 } | 472 } |
439 | 473 |
440 void AppListView::GetWidgetHitTestMask(gfx::Path* mask) const { | 474 void AppListView::GetWidgetHitTestMask(gfx::Path* mask) const { |
441 DCHECK(mask); | 475 DCHECK(mask); |
442 DCHECK(GetBubbleFrameView()); | 476 DCHECK(GetBubbleFrameView()); |
443 | 477 |
444 mask->addRect(gfx::RectToSkRect( | 478 mask->addRect(gfx::RectToSkRect(GetBubbleFrameView()->GetContentsBounds())); |
445 GetBubbleFrameView()->GetContentsBounds())); | |
446 } | 479 } |
447 | 480 |
448 bool AppListView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 481 bool AppListView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
449 DCHECK_EQ(ui::VKEY_ESCAPE, accelerator.key_code()); | 482 DCHECK_EQ(ui::VKEY_ESCAPE, accelerator.key_code()); |
450 | 483 |
451 // If the ContentsView does not handle the back action, then this is the | 484 // If the ContentsView does not handle the back action, then this is the |
452 // top level, so we close the app list. | 485 // top level, so we close the app list. |
453 if (!app_list_main_view_->contents_view()->Back()) { | 486 if (!app_list_main_view_->contents_view()->Back()) { |
454 GetWidget()->Deactivate(); | 487 GetWidget()->Deactivate(); |
455 CloseAppList(); | 488 CloseAppList(); |
(...skipping 12 matching lines...) Expand all Loading... | |
468 centered_bounds.ClampToCenteredSize(gfx::Size( | 501 centered_bounds.ClampToCenteredSize(gfx::Size( |
469 app_list_main_view_->contents_view()->GetDefaultContentsBounds().width(), | 502 app_list_main_view_->contents_view()->GetDefaultContentsBounds().width(), |
470 contents_bounds.height())); | 503 contents_bounds.height())); |
471 | 504 |
472 app_list_main_view_->SetBoundsRect(centered_bounds); | 505 app_list_main_view_->SetBoundsRect(centered_bounds); |
473 | 506 |
474 if (speech_view_) { | 507 if (speech_view_) { |
475 gfx::Rect speech_bounds = centered_bounds; | 508 gfx::Rect speech_bounds = centered_bounds; |
476 int preferred_height = speech_view_->GetPreferredSize().height(); | 509 int preferred_height = speech_view_->GetPreferredSize().height(); |
477 speech_bounds.Inset(kSpeechUIMargin, kSpeechUIMargin); | 510 speech_bounds.Inset(kSpeechUIMargin, kSpeechUIMargin); |
478 speech_bounds.set_height(std::min(speech_bounds.height(), | 511 speech_bounds.set_height( |
479 preferred_height)); | 512 std::min(speech_bounds.height(), preferred_height)); |
480 speech_bounds.Inset(-speech_view_->GetInsets()); | 513 speech_bounds.Inset(-speech_view_->GetInsets()); |
481 speech_view_->SetBoundsRect(speech_bounds); | 514 speech_view_->SetBoundsRect(speech_bounds); |
482 } | 515 } |
483 } | 516 } |
484 | 517 |
485 void AppListView::SchedulePaintInRect(const gfx::Rect& rect) { | 518 void AppListView::SchedulePaintInRect(const gfx::Rect& rect) { |
486 BubbleDialogDelegateView::SchedulePaintInRect(rect); | 519 BubbleDialogDelegateView::SchedulePaintInRect(rect); |
487 if (GetBubbleFrameView()) | 520 if (GetBubbleFrameView()) |
488 GetBubbleFrameView()->SchedulePaint(); | 521 GetBubbleFrameView()->SchedulePaint(); |
489 } | 522 } |
(...skipping 25 matching lines...) Expand all Loading... | |
515 new_state == SPEECH_RECOGNITION_NETWORK_ERROR); | 548 new_state == SPEECH_RECOGNITION_NETWORK_ERROR); |
516 // No change for this class. | 549 // No change for this class. |
517 if (speech_view_->visible() == will_appear) | 550 if (speech_view_->visible() == will_appear) |
518 return; | 551 return; |
519 | 552 |
520 if (will_appear) | 553 if (will_appear) |
521 speech_view_->Reset(); | 554 speech_view_->Reset(); |
522 | 555 |
523 animation_observer_->set_frame(GetBubbleFrameView()); | 556 animation_observer_->set_frame(GetBubbleFrameView()); |
524 gfx::Transform speech_transform; | 557 gfx::Transform speech_transform; |
525 speech_transform.Translate( | 558 speech_transform.Translate(0, SkFloatToMScalar(kSpeechUIAppearingPosition)); |
526 0, SkFloatToMScalar(kSpeechUIAppearingPosition)); | |
527 if (will_appear) | 559 if (will_appear) |
528 speech_view_->layer()->SetTransform(speech_transform); | 560 speech_view_->layer()->SetTransform(speech_transform); |
529 | 561 |
530 { | 562 { |
531 ui::ScopedLayerAnimationSettings main_settings( | 563 ui::ScopedLayerAnimationSettings main_settings( |
532 app_list_main_view_->layer()->GetAnimator()); | 564 app_list_main_view_->layer()->GetAnimator()); |
533 if (will_appear) { | 565 if (will_appear) { |
534 animation_observer_->SetTarget(app_list_main_view_); | 566 animation_observer_->SetTarget(app_list_main_view_); |
535 main_settings.AddObserver(animation_observer_.get()); | 567 main_settings.AddObserver(animation_observer_.get()); |
536 } | 568 } |
(...skipping 30 matching lines...) Expand all Loading... | |
567 app_list_main_view_->SetVisible(true); | 599 app_list_main_view_->SetVisible(true); |
568 // Refocus the search box. However, if the app list widget does not have | 600 // Refocus the search box. However, if the app list widget does not have |
569 // focus, it means another window has already taken focus, and we *must not* | 601 // focus, it means another window has already taken focus, and we *must not* |
570 // focus the search box (or we would steal focus back into the app list). | 602 // focus the search box (or we would steal focus back into the app list). |
571 if (GetWidget()->IsActive()) | 603 if (GetWidget()->IsActive()) |
572 search_box_view_->search_box()->RequestFocus(); | 604 search_box_view_->search_box()->RequestFocus(); |
573 } | 605 } |
574 } | 606 } |
575 | 607 |
576 } // namespace app_list | 608 } // namespace app_list |
OLD | NEW |