Home | History | Annotate | Download | only in test
      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
      3 // found in the LICENSE file.
      4 
      5 #include "ash/test/shell_test_api.h"
      6 
      7 #include "ash/root_window_controller.h"
      8 #include "ash/session/session_state_delegate.h"
      9 #include "ash/shelf/shelf_delegate.h"
     10 #include "ash/shell.h"
     11 
     12 #if defined(OS_CHROMEOS)
     13 #include "ash/display/display_configurator_animation.h"
     14 #include "ui/display/chromeos/display_configurator.h"
     15 #endif
     16 
     17 namespace ash {
     18 namespace test {
     19 
     20 ShellTestApi::ShellTestApi(Shell* shell) : shell_(shell) {}
     21 
     22 RootWindowLayoutManager* ShellTestApi::root_window_layout() {
     23   return shell_->GetPrimaryRootWindowController()->root_window_layout();
     24 }
     25 
     26 wm::InputMethodEventFilter*
     27 ShellTestApi::input_method_event_filter() {
     28   return shell_->input_method_filter_.get();
     29 }
     30 
     31 SystemGestureEventFilter* ShellTestApi::system_gesture_event_filter() {
     32   return shell_->system_gesture_filter_.get();
     33 }
     34 
     35 WorkspaceController* ShellTestApi::workspace_controller() {
     36   return shell_->GetPrimaryRootWindowController()->workspace_controller();
     37 }
     38 
     39 ScreenPositionController* ShellTestApi::screen_position_controller() {
     40   return shell_->screen_position_controller_.get();
     41 }
     42 
     43 AshNativeCursorManager* ShellTestApi::ash_native_cursor_manager() {
     44   return shell_->native_cursor_manager_;
     45 }
     46 
     47 ShelfModel* ShellTestApi::shelf_model() {
     48   return shell_->shelf_model_.get();
     49 }
     50 
     51 DragDropController* ShellTestApi::drag_drop_controller() {
     52   return shell_->drag_drop_controller_.get();
     53 }
     54 
     55 AppListController* ShellTestApi::app_list_controller() {
     56   return shell_->app_list_controller_.get();
     57 }
     58 
     59 void ShellTestApi::DisableDisplayConfiguratorAnimation() {
     60 #if defined(OS_CHROMEOS)
     61   if (shell_->display_configurator_animation_) {
     62     shell_->display_configurator_->RemoveObserver(
     63         shell_->display_configurator_animation_.get());
     64     shell_->display_configurator_animation_.reset();
     65   }
     66 #endif  // defined(OS_CHROMEOS)
     67 }
     68 
     69 void ShellTestApi::SetShelfDelegate(ShelfDelegate* delegate) {
     70   shell_->shelf_delegate_.reset(delegate);
     71 }
     72 
     73 void ShellTestApi::SetSessionStateDelegate(
     74     SessionStateDelegate* session_state_delegate) {
     75   shell_->session_state_delegate_.reset(session_state_delegate);
     76 }
     77 
     78 }  // namespace test
     79 }  // namespace ash
     80