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

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

Issue 14295008: Add ash SessionStateDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for review. Created 7 years, 8 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 (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 "ash/shelf/shelf_widget.h" 5 #include "ash/shelf/shelf_widget.h"
6 6
7 #include "ash/focus_cycler.h" 7 #include "ash/focus_cycler.h"
8 #include "ash/launcher/launcher_delegate.h" 8 #include "ash/launcher/launcher_delegate.h"
9 #include "ash/launcher/launcher_model.h" 9 #include "ash/launcher/launcher_model.h"
10 #include "ash/launcher/launcher_navigator.h" 10 #include "ash/launcher/launcher_navigator.h"
11 #include "ash/launcher/launcher_view.h" 11 #include "ash/launcher/launcher_view.h"
12 #include "ash/root_window_controller.h" 12 #include "ash/root_window_controller.h"
13 #include "ash/session_state_delegate.h"
13 #include "ash/shelf/shelf_layout_manager.h" 14 #include "ash/shelf/shelf_layout_manager.h"
14 #include "ash/shelf/shelf_widget.h" 15 #include "ash/shelf/shelf_widget.h"
15 #include "ash/shell.h" 16 #include "ash/shell.h"
16 #include "ash/shell_delegate.h"
17 #include "ash/shell_window_ids.h" 17 #include "ash/shell_window_ids.h"
18 #include "ash/wm/property_util.h" 18 #include "ash/wm/property_util.h"
19 #include "ash/wm/status_area_layout_manager.h" 19 #include "ash/wm/status_area_layout_manager.h"
20 #include "ash/wm/window_properties.h" 20 #include "ash/wm/window_properties.h"
21 #include "ash/wm/workspace_controller.h" 21 #include "ash/wm/workspace_controller.h"
22 #include "grit/ash_resources.h" 22 #include "grit/ash_resources.h"
23 #include "ui/aura/client/activation_client.h" 23 #include "ui/aura/client/activation_client.h"
24 #include "ui/aura/root_window.h" 24 #include "ui/aura/root_window.h"
25 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
26 #include "ui/aura/window_observer.h" 26 #include "ui/aura/window_observer.h"
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 params.parent = shelf_container; 433 params.parent = shelf_container;
434 params.delegate = delegate_view_; 434 params.delegate = delegate_view_;
435 Init(params); 435 Init(params);
436 436
437 // The shelf should not take focus when initially shown. 437 // The shelf should not take focus when initially shown.
438 set_focus_on_creation(false); 438 set_focus_on_creation(false);
439 SetContentsView(delegate_view_); 439 SetContentsView(delegate_view_);
440 440
441 status_area_widget_ = new internal::StatusAreaWidget(status_container); 441 status_area_widget_ = new internal::StatusAreaWidget(status_container);
442 status_area_widget_->CreateTrayViews(); 442 status_area_widget_->CreateTrayViews();
443 if (Shell::GetInstance()->delegate()->IsSessionStarted()) 443 if (Shell::GetInstance()->session_state_delegate()->
444 IsActiveUserSessionStarted()) {
444 status_area_widget_->Show(); 445 status_area_widget_->Show();
446 }
445 Shell::GetInstance()->focus_cycler()->AddWidget(status_area_widget_); 447 Shell::GetInstance()->focus_cycler()->AddWidget(status_area_widget_);
446 448
447 shelf_layout_manager_ = new internal::ShelfLayoutManager(this); 449 shelf_layout_manager_ = new internal::ShelfLayoutManager(this);
448 shelf_container->SetLayoutManager(shelf_layout_manager_); 450 shelf_container->SetLayoutManager(shelf_layout_manager_);
449 shelf_layout_manager_->set_workspace_controller(workspace_controller); 451 shelf_layout_manager_->set_workspace_controller(workspace_controller);
450 workspace_controller->SetShelf(shelf_layout_manager_); 452 workspace_controller->SetShelf(shelf_layout_manager_);
451 453
452 status_container->SetLayoutManager( 454 status_container->SetLayoutManager(
453 new internal::StatusAreaLayoutManager(this)); 455 new internal::StatusAreaLayoutManager(this));
454 456
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 launcher_.reset(new Launcher(shell->launcher_model(), 493 launcher_.reset(new Launcher(shell->launcher_model(),
492 shell->GetLauncherDelegate(), 494 shell->GetLauncherDelegate(),
493 this)); 495 this));
494 496
495 SetFocusCycler(shell->focus_cycler()); 497 SetFocusCycler(shell->focus_cycler());
496 498
497 // Inform the root window controller. 499 // Inform the root window controller.
498 internal::RootWindowController::ForWindow(window_container_)-> 500 internal::RootWindowController::ForWindow(window_container_)->
499 OnLauncherCreated(); 501 OnLauncherCreated();
500 502
501 ShellDelegate* delegate = shell->delegate(); 503 launcher_->SetVisible(
502 if (delegate) 504 shell->session_state_delegate()->IsActiveUserSessionStarted());
503 launcher_->SetVisible(delegate->IsSessionStarted());
504 505
505 Show(); 506 Show();
506 } 507 }
507 } 508 }
508 509
509 bool ShelfWidget::IsLauncherVisible() const { 510 bool ShelfWidget::IsLauncherVisible() const {
510 return launcher_.get() && launcher_->IsVisible(); 511 return launcher_.get() && launcher_->IsVisible();
511 } 512 }
512 513
513 void ShelfWidget::SetLauncherVisibility(bool visible) { 514 void ShelfWidget::SetLauncherVisibility(bool visible) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 return -1; 556 return -1;
556 } 557 }
557 558
558 void ShelfWidget::DisableDimmingAnimationsForTest() { 559 void ShelfWidget::DisableDimmingAnimationsForTest() {
559 DCHECK(delegate_view_); 560 DCHECK(delegate_view_);
560 return delegate_view_->disable_dimming_animations_for_test(); 561 return delegate_view_->disable_dimming_animations_for_test();
561 } 562 }
562 563
563 } // namespace ash 564 } // namespace ash
564 565
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698