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