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

Side by Side Diff: ash/shelf/shelf_widget.cc

Issue 2035543004: Shuffles and renames ash/common/wm classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: random changes for chrome tests Created 4 years, 6 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/shelf/shelf_widget.h" 5 #include "ash/shelf/shelf_widget.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/shell_window_ids.h" 9 #include "ash/common/shell_window_ids.h"
9 #include "ash/common/wm/shelf/wm_shelf_constants.h" 10 #include "ash/common/wm/shelf/wm_shelf_constants.h"
10 #include "ash/common/wm/shelf/wm_shelf_util.h" 11 #include "ash/common/wm/shelf/wm_shelf_util.h"
11 #include "ash/common/wm/wm_root_window_controller.h" 12 #include "ash/common/wm_root_window_controller.h"
12 #include "ash/focus_cycler.h" 13 #include "ash/focus_cycler.h"
13 #include "ash/session/session_state_delegate.h" 14 #include "ash/session/session_state_delegate.h"
14 #include "ash/shelf/shelf_constants.h" 15 #include "ash/shelf/shelf_constants.h"
15 #include "ash/shelf/shelf_delegate.h" 16 #include "ash/shelf/shelf_delegate.h"
16 #include "ash/shelf/shelf_layout_manager.h" 17 #include "ash/shelf/shelf_layout_manager.h"
17 #include "ash/shelf/shelf_model.h" 18 #include "ash/shelf/shelf_model.h"
18 #include "ash/shelf/shelf_navigator.h" 19 #include "ash/shelf/shelf_navigator.h"
19 #include "ash/shelf/shelf_util.h" 20 #include "ash/shelf/shelf_util.h"
20 #include "ash/shelf/shelf_view.h" 21 #include "ash/shelf/shelf_view.h"
21 #include "ash/shelf/shelf_widget.h" 22 #include "ash/shelf/shelf_widget.h"
22 #include "ash/shell.h" 23 #include "ash/shell.h"
23 #include "ash/system/tray/system_tray_delegate.h" 24 #include "ash/system/tray/system_tray_delegate.h"
24 #include "ash/wm/aura/wm_window_aura.h"
25 #include "ash/wm/status_area_layout_manager.h" 25 #include "ash/wm/status_area_layout_manager.h"
26 #include "ash/wm/window_properties.h" 26 #include "ash/wm/window_properties.h"
27 #include "ash/wm/workspace_controller.h" 27 #include "ash/wm/workspace_controller.h"
28 #include "grit/ash_resources.h" 28 #include "grit/ash_resources.h"
29 #include "ui/aura/window.h" 29 #include "ui/aura/window.h"
30 #include "ui/aura/window_event_dispatcher.h" 30 #include "ui/aura/window_event_dispatcher.h"
31 #include "ui/aura/window_observer.h" 31 #include "ui/aura/window_observer.h"
32 #include "ui/base/resource/resource_bundle.h" 32 #include "ui/base/resource/resource_bundle.h"
33 #include "ui/compositor/layer.h" 33 #include "ui/compositor/layer.h"
34 #include "ui/compositor/scoped_layer_animation_settings.h" 34 #include "ui/compositor/scoped_layer_animation_settings.h"
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 if (GetDimmed()) 550 if (GetDimmed())
551 return dimmer_view_->GetBoundsInScreen(); 551 return dimmer_view_->GetBoundsInScreen();
552 return gfx::Rect(); 552 return gfx::Rect();
553 } 553 }
554 554
555 void ShelfWidget::DelegateView::UpdateBackground(int alpha) { 555 void ShelfWidget::DelegateView::UpdateBackground(int alpha) {
556 alpha_ = alpha; 556 alpha_ = alpha;
557 SchedulePaint(); 557 SchedulePaint();
558 } 558 }
559 559
560 ShelfWidget::ShelfWidget(wm::WmWindow* wm_shelf_container, 560 ShelfWidget::ShelfWidget(WmWindow* wm_shelf_container,
561 wm::WmWindow* wm_status_container, 561 WmWindow* wm_status_container,
562 WorkspaceController* workspace_controller) 562 WorkspaceController* workspace_controller)
563 : delegate_view_(new DelegateView(this)), 563 : delegate_view_(new DelegateView(this)),
564 background_animator_(delegate_view_, 0, wm::kShelfBackgroundAlpha), 564 background_animator_(delegate_view_, 0, wm::kShelfBackgroundAlpha),
565 activating_as_fallback_(false) { 565 activating_as_fallback_(false) {
566 views::Widget::InitParams params( 566 views::Widget::InitParams params(
567 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 567 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
568 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 568 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
569 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 569 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
570 params.delegate = delegate_view_; 570 params.delegate = delegate_view_;
571 wm_shelf_container->GetRootWindowController() 571 wm_shelf_container->GetRootWindowController()
572 ->ConfigureWidgetInitParamsForContainer( 572 ->ConfigureWidgetInitParamsForContainer(
573 this, wm_shelf_container->GetShellWindowId(), &params); 573 this, wm_shelf_container->GetShellWindowId(), &params);
574 Init(params); 574 Init(params);
575 575
576 // The shelf should not take focus when initially shown. 576 // The shelf should not take focus when initially shown.
577 set_focus_on_creation(false); 577 set_focus_on_creation(false);
578 SetContentsView(delegate_view_); 578 SetContentsView(delegate_view_);
579 delegate_view_->SetParentLayer(GetLayer()); 579 delegate_view_->SetParentLayer(GetLayer());
580 580
581 shelf_layout_manager_ = new ShelfLayoutManager(this); 581 shelf_layout_manager_ = new ShelfLayoutManager(this);
582 shelf_layout_manager_->AddObserver(this); 582 shelf_layout_manager_->AddObserver(this);
583 aura::Window* shelf_container = 583 aura::Window* shelf_container =
584 wm::WmWindowAura::GetAuraWindow(wm_shelf_container); 584 WmWindowAura::GetAuraWindow(wm_shelf_container);
585 shelf_container->SetLayoutManager(shelf_layout_manager_); 585 shelf_container->SetLayoutManager(shelf_layout_manager_);
586 shelf_layout_manager_->set_workspace_controller(workspace_controller); 586 shelf_layout_manager_->set_workspace_controller(workspace_controller);
587 workspace_controller->SetShelf(shelf_layout_manager_); 587 workspace_controller->SetShelf(shelf_layout_manager_);
588 588
589 status_area_widget_ = new StatusAreaWidget(wm_status_container, this); 589 status_area_widget_ = new StatusAreaWidget(wm_status_container, this);
590 status_area_widget_->CreateTrayViews(); 590 status_area_widget_->CreateTrayViews();
591 if (Shell::GetInstance()->session_state_delegate()-> 591 if (Shell::GetInstance()->session_state_delegate()->
592 IsActiveUserSessionStarted()) { 592 IsActiveUserSessionStarted()) {
593 status_area_widget_->Show(); 593 status_area_widget_->Show();
594 } 594 }
595 Shell::GetInstance()->focus_cycler()->AddWidget(status_area_widget_); 595 Shell::GetInstance()->focus_cycler()->AddWidget(status_area_widget_);
596 596
597 aura::Window* status_container = 597 aura::Window* status_container =
598 wm::WmWindowAura::GetAuraWindow(wm_status_container); 598 WmWindowAura::GetAuraWindow(wm_status_container);
599 status_container->SetLayoutManager( 599 status_container->SetLayoutManager(
600 new StatusAreaLayoutManager(status_container, this)); 600 new StatusAreaLayoutManager(status_container, this));
601 601
602 shelf_container->SetEventTargeter(std::unique_ptr<ui::EventTargeter>( 602 shelf_container->SetEventTargeter(std::unique_ptr<ui::EventTargeter>(
603 new ShelfWindowTargeter(shelf_container, shelf_layout_manager_))); 603 new ShelfWindowTargeter(shelf_container, shelf_layout_manager_)));
604 status_container->SetEventTargeter(std::unique_ptr<ui::EventTargeter>( 604 status_container->SetEventTargeter(std::unique_ptr<ui::EventTargeter>(
605 new ShelfWindowTargeter(status_container, shelf_layout_manager_))); 605 new ShelfWindowTargeter(status_container, shelf_layout_manager_)));
606 606
607 views::Widget::AddObserver(this); 607 views::Widget::AddObserver(this);
608 } 608 }
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 shelf_layout_manager_->UpdateAutoHideForMouseEvent(event); 812 shelf_layout_manager_->UpdateAutoHideForMouseEvent(event);
813 } 813 }
814 814
815 void ShelfWidget::OnGestureEvent(ui::GestureEvent* event) { 815 void ShelfWidget::OnGestureEvent(ui::GestureEvent* event) {
816 Widget::OnGestureEvent(event); 816 Widget::OnGestureEvent(event);
817 if (Shell::GetInstance()->in_mus() && shelf_layout_manager_) 817 if (Shell::GetInstance()->in_mus() && shelf_layout_manager_)
818 shelf_layout_manager_->UpdateAutoHideForGestureEvent(event); 818 shelf_layout_manager_->UpdateAutoHideForGestureEvent(event);
819 } 819 }
820 820
821 } // namespace ash 821 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698