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

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

Issue 2072023003: mash: Break ash system tray dependencies on ash::ShelfWidget (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
« no previous file with comments | « ash/shelf/shelf_widget.h ('k') | ash/system/DEPS » ('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 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/aura/wm_shelf_aura.h" 7 #include "ash/aura/wm_shelf_aura.h"
8 #include "ash/aura/wm_window_aura.h" 8 #include "ash/aura/wm_window_aura.h"
9 #include "ash/common/ash_switches.h" 9 #include "ash/common/ash_switches.h"
10 #include "ash/common/focus_cycler.h" 10 #include "ash/common/focus_cycler.h"
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 return gfx::Rect(); 558 return gfx::Rect();
559 } 559 }
560 560
561 void ShelfWidget::DelegateView::UpdateBackground(int alpha) { 561 void ShelfWidget::DelegateView::UpdateBackground(int alpha) {
562 alpha_ = alpha; 562 alpha_ = alpha;
563 SchedulePaint(); 563 SchedulePaint();
564 } 564 }
565 565
566 ShelfWidget::ShelfWidget(WmWindow* wm_shelf_container, 566 ShelfWidget::ShelfWidget(WmWindow* wm_shelf_container,
567 WmWindow* wm_status_container, 567 WmWindow* wm_status_container,
568 WmShelfAura* wm_shelf_aura,
568 WorkspaceController* workspace_controller) 569 WorkspaceController* workspace_controller)
569 : delegate_view_(new DelegateView(this)), 570 : delegate_view_(new DelegateView(this)),
570 background_animator_( 571 background_animator_(
571 delegate_view_, 0, GetShelfConstant(SHELF_BACKGROUND_ALPHA)), 572 delegate_view_, 0, GetShelfConstant(SHELF_BACKGROUND_ALPHA)),
572 activating_as_fallback_(false) { 573 activating_as_fallback_(false) {
573 views::Widget::InitParams params( 574 views::Widget::InitParams params(
574 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 575 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
575 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 576 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
576 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 577 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
577 params.delegate = delegate_view_; 578 params.delegate = delegate_view_;
578 wm_shelf_container->GetRootWindowController() 579 wm_shelf_container->GetRootWindowController()
579 ->ConfigureWidgetInitParamsForContainer( 580 ->ConfigureWidgetInitParamsForContainer(
580 this, wm_shelf_container->GetShellWindowId(), &params); 581 this, wm_shelf_container->GetShellWindowId(), &params);
581 Init(params); 582 Init(params);
582 583
583 // The shelf should not take focus when initially shown. 584 // The shelf should not take focus when initially shown.
584 set_focus_on_creation(false); 585 set_focus_on_creation(false);
585 SetContentsView(delegate_view_); 586 SetContentsView(delegate_view_);
586 delegate_view_->SetParentLayer(GetLayer()); 587 delegate_view_->SetParentLayer(GetLayer());
587 588
588 shelf_layout_manager_ = new ShelfLayoutManager(this); 589 shelf_layout_manager_ = new ShelfLayoutManager(this);
589 shelf_layout_manager_->AddObserver(this); 590 shelf_layout_manager_->AddObserver(this);
590 aura::Window* shelf_container = 591 aura::Window* shelf_container =
591 WmWindowAura::GetAuraWindow(wm_shelf_container); 592 WmWindowAura::GetAuraWindow(wm_shelf_container);
592 shelf_container->SetLayoutManager(shelf_layout_manager_); 593 shelf_container->SetLayoutManager(shelf_layout_manager_);
593 shelf_layout_manager_->set_workspace_controller(workspace_controller); 594 shelf_layout_manager_->set_workspace_controller(workspace_controller);
594 workspace_controller->SetShelf(shelf_layout_manager_); 595 workspace_controller->SetShelf(shelf_layout_manager_);
596 wm_shelf_aura->SetShelfLayoutManager(shelf_layout_manager_);
595 597
596 status_area_widget_ = new StatusAreaWidget(wm_status_container, this); 598 // TODO(jamescook): Move ownership to RootWindowController.
599 status_area_widget_ =
600 new StatusAreaWidget(wm_status_container, wm_shelf_aura);
597 status_area_widget_->CreateTrayViews(); 601 status_area_widget_->CreateTrayViews();
598 if (Shell::GetInstance()->session_state_delegate()-> 602 if (Shell::GetInstance()->session_state_delegate()->
599 IsActiveUserSessionStarted()) { 603 IsActiveUserSessionStarted()) {
600 status_area_widget_->Show(); 604 status_area_widget_->Show();
601 } 605 }
602 WmShell::Get()->focus_cycler()->AddWidget(status_area_widget_); 606 WmShell::Get()->focus_cycler()->AddWidget(status_area_widget_);
603 607
604 aura::Window* status_container = 608 aura::Window* status_container =
605 WmWindowAura::GetAuraWindow(wm_status_container); 609 WmWindowAura::GetAuraWindow(wm_status_container);
606 status_container->SetLayoutManager( 610 status_container->SetLayoutManager(
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 shelf_layout_manager_->UpdateAutoHideForMouseEvent(event); 826 shelf_layout_manager_->UpdateAutoHideForMouseEvent(event);
823 } 827 }
824 828
825 void ShelfWidget::OnGestureEvent(ui::GestureEvent* event) { 829 void ShelfWidget::OnGestureEvent(ui::GestureEvent* event) {
826 Widget::OnGestureEvent(event); 830 Widget::OnGestureEvent(event);
827 if (Shell::GetInstance()->in_mus() && shelf_layout_manager_) 831 if (Shell::GetInstance()->in_mus() && shelf_layout_manager_)
828 shelf_layout_manager_->UpdateAutoHideForGestureEvent(event); 832 shelf_layout_manager_->UpdateAutoHideForGestureEvent(event);
829 } 833 }
830 834
831 } // namespace ash 835 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_widget.h ('k') | ash/system/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698