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