| 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 "ash/shell.h" | 5 #include "ash/shell.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/accelerators/focus_manager_factory.h" | 10 #include "ash/accelerators/focus_manager_factory.h" |
| 11 #include "ash/ash_switches.h" | 11 #include "ash/ash_switches.h" |
| 12 #include "ash/desktop_background/desktop_background_controller.h" | 12 #include "ash/desktop_background/desktop_background_controller.h" |
| 13 #include "ash/desktop_background/desktop_background_resources.h" | 13 #include "ash/desktop_background/desktop_background_resources.h" |
| 14 #include "ash/desktop_background/desktop_background_view.h" | 14 #include "ash/desktop_background/desktop_background_view.h" |
| 15 #include "ash/drag_drop/drag_drop_controller.h" | 15 #include "ash/drag_drop/drag_drop_controller.h" |
| 16 #include "ash/focus_cycler.h" | 16 #include "ash/focus_cycler.h" |
| 17 #include "ash/high_contrast/high_contrast_controller.h" | 17 #include "ash/high_contrast/high_contrast_controller.h" |
| 18 #include "ash/launcher/launcher.h" | 18 #include "ash/launcher/launcher.h" |
| 19 #include "ash/magnifier/magnification_controller.h" | 19 #include "ash/magnifier/magnification_controller.h" |
| 20 #include "ash/monitor/monitor_controller.h" | 20 #include "ash/monitor/monitor_controller.h" |
| 21 #include "ash/monitor/multi_monitor_manager.h" | 21 #include "ash/monitor/multi_monitor_manager.h" |
| 22 #include "ash/monitor/secondary_monitor_view.h" | 22 #include "ash/monitor/secondary_monitor_view.h" |
| 23 #include "ash/screen_ash.h" | 23 #include "ash/screen_ash.h" |
| 24 #include "ash/shell_context_menu.h" | 24 #include "ash/shell_context_menu.h" |
| 25 #include "ash/shell_delegate.h" | 25 #include "ash/shell_delegate.h" |
| 26 #include "ash/shell_factory.h" | 26 #include "ash/shell_factory.h" |
| 27 #include "ash/shell_window_ids.h" | 27 #include "ash/shell_window_ids.h" |
| 28 #include "ash/system/bluetooth/bluetooth_observer.h" | |
| 29 #include "ash/system/network/network_observer.h" | |
| 30 #include "ash/system/status_area_widget.h" | 28 #include "ash/system/status_area_widget.h" |
| 31 #include "ash/system/tray/system_tray.h" | 29 #include "ash/system/tray/system_tray.h" |
| 32 #include "ash/system/tray/system_tray_delegate.h" | |
| 33 #include "ash/tooltips/tooltip_controller.h" | 30 #include "ash/tooltips/tooltip_controller.h" |
| 34 #include "ash/touch/touch_observer_hud.h" | 31 #include "ash/touch/touch_observer_hud.h" |
| 35 #include "ash/wm/activation_controller.h" | 32 #include "ash/wm/activation_controller.h" |
| 36 #include "ash/wm/app_list_controller.h" | 33 #include "ash/wm/app_list_controller.h" |
| 37 #include "ash/wm/base_layout_manager.h" | 34 #include "ash/wm/base_layout_manager.h" |
| 38 #include "ash/wm/capture_controller.h" | 35 #include "ash/wm/capture_controller.h" |
| 39 #include "ash/wm/custom_frame_view_ash.h" | 36 #include "ash/wm/custom_frame_view_ash.h" |
| 40 #include "ash/wm/dialog_frame_view.h" | 37 #include "ash/wm/dialog_frame_view.h" |
| 41 #include "ash/wm/event_client_impl.h" | 38 #include "ash/wm/event_client_impl.h" |
| 42 #include "ash/wm/key_rewriter_event_filter.h" | 39 #include "ash/wm/key_rewriter_event_filter.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 60 #include "ash/wm/visibility_controller.h" | 57 #include "ash/wm/visibility_controller.h" |
| 61 #include "ash/wm/window_cycle_controller.h" | 58 #include "ash/wm/window_cycle_controller.h" |
| 62 #include "ash/wm/window_modality_controller.h" | 59 #include "ash/wm/window_modality_controller.h" |
| 63 #include "ash/wm/window_util.h" | 60 #include "ash/wm/window_util.h" |
| 64 #include "ash/wm/workspace/workspace_event_filter.h" | 61 #include "ash/wm/workspace/workspace_event_filter.h" |
| 65 #include "ash/wm/workspace/workspace_layout_manager.h" | 62 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 66 #include "ash/wm/workspace/workspace_manager.h" | 63 #include "ash/wm/workspace/workspace_manager.h" |
| 67 #include "ash/wm/workspace_controller.h" | 64 #include "ash/wm/workspace_controller.h" |
| 68 #include "base/bind.h" | 65 #include "base/bind.h" |
| 69 #include "base/command_line.h" | 66 #include "base/command_line.h" |
| 70 #include "base/utf_string_conversions.h" | |
| 71 #include "grit/ui_resources.h" | 67 #include "grit/ui_resources.h" |
| 72 #include "ui/aura/client/aura_constants.h" | 68 #include "ui/aura/client/aura_constants.h" |
| 73 #include "ui/aura/client/user_action_client.h" | 69 #include "ui/aura/client/user_action_client.h" |
| 74 #include "ui/aura/cursor_manager.h" | 70 #include "ui/aura/cursor_manager.h" |
| 75 #include "ui/aura/env.h" | 71 #include "ui/aura/env.h" |
| 76 #include "ui/aura/focus_manager.h" | 72 #include "ui/aura/focus_manager.h" |
| 77 #include "ui/aura/layout_manager.h" | 73 #include "ui/aura/layout_manager.h" |
| 78 #include "ui/aura/monitor_manager.h" | 74 #include "ui/aura/monitor_manager.h" |
| 79 #include "ui/aura/root_window.h" | 75 #include "ui/aura/root_window.h" |
| 80 #include "ui/aura/shared/compound_event_filter.h" | 76 #include "ui/aura/shared/compound_event_filter.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 lock_modal_container->SetEventFilter( | 205 lock_modal_container->SetEventFilter( |
| 210 new ToplevelWindowEventFilter(lock_modal_container)); | 206 new ToplevelWindowEventFilter(lock_modal_container)); |
| 211 lock_modal_container->SetLayoutManager( | 207 lock_modal_container->SetLayoutManager( |
| 212 new internal::SystemModalContainerLayoutManager(lock_modal_container)); | 208 new internal::SystemModalContainerLayoutManager(lock_modal_container)); |
| 213 SetChildWindowVisibilityChangesAnimated(lock_modal_container); | 209 SetChildWindowVisibilityChangesAnimated(lock_modal_container); |
| 214 | 210 |
| 215 CreateContainer(internal::kShellWindowId_StatusContainer, | 211 CreateContainer(internal::kShellWindowId_StatusContainer, |
| 216 "StatusContainer", | 212 "StatusContainer", |
| 217 lock_screen_related_containers); | 213 lock_screen_related_containers); |
| 218 | 214 |
| 215 aura::Window* settings_bubble_container = CreateContainer( |
| 216 internal::kShellWindowId_SettingBubbleContainer, |
| 217 "SettingBubbleContainer", |
| 218 lock_screen_related_containers); |
| 219 SetChildWindowVisibilityChangesAnimated(settings_bubble_container); |
| 220 |
| 219 aura::Window* menu_container = CreateContainer( | 221 aura::Window* menu_container = CreateContainer( |
| 220 internal::kShellWindowId_MenuContainer, | 222 internal::kShellWindowId_MenuContainer, |
| 221 "MenuContainer", | 223 "MenuContainer", |
| 222 lock_screen_related_containers); | 224 lock_screen_related_containers); |
| 223 SetChildWindowVisibilityChangesAnimated(menu_container); | 225 SetChildWindowVisibilityChangesAnimated(menu_container); |
| 224 | 226 |
| 225 aura::Window* drag_drop_container = CreateContainer( | 227 aura::Window* drag_drop_container = CreateContainer( |
| 226 internal::kShellWindowId_DragImageAndTooltipContainer, | 228 internal::kShellWindowId_DragImageAndTooltipContainer, |
| 227 "DragImageAndTooltipContainer", | 229 "DragImageAndTooltipContainer", |
| 228 lock_screen_related_containers); | 230 lock_screen_related_containers); |
| 229 SetChildWindowVisibilityChangesAnimated(drag_drop_container); | 231 SetChildWindowVisibilityChangesAnimated(drag_drop_container); |
| 230 | 232 |
| 231 aura::Window* settings_bubble_container = CreateContainer( | |
| 232 internal::kShellWindowId_SettingBubbleContainer, | |
| 233 "SettingBubbleContainer", | |
| 234 lock_screen_related_containers); | |
| 235 SetChildWindowVisibilityChangesAnimated(settings_bubble_container); | |
| 236 | |
| 237 CreateContainer(internal::kShellWindowId_OverlayContainer, | 233 CreateContainer(internal::kShellWindowId_OverlayContainer, |
| 238 "OverlayContainer", | 234 "OverlayContainer", |
| 239 lock_screen_related_containers); | 235 lock_screen_related_containers); |
| 240 } | 236 } |
| 241 | 237 |
| 242 // This dummy class is used for shell unit tests. We dont have chrome delegate | 238 // This dummy class is used for shell unit tests. We dont have chrome delegate |
| 243 // in these tests. | 239 // in these tests. |
| 244 class DummyUserWallpaperDelegate : public UserWallpaperDelegate { | 240 class DummyUserWallpaperDelegate : public UserWallpaperDelegate { |
| 245 public: | 241 public: |
| 246 DummyUserWallpaperDelegate() {} | 242 DummyUserWallpaperDelegate() {} |
| 247 | 243 |
| 248 virtual ~DummyUserWallpaperDelegate() {} | 244 virtual ~DummyUserWallpaperDelegate() {} |
| 249 | 245 |
| 250 virtual void InitializeWallpaper() OVERRIDE { | 246 virtual void InitializeWallpaper() OVERRIDE { |
| 251 ash::Shell::GetInstance()->desktop_background_controller()-> | 247 ash::Shell::GetInstance()->desktop_background_controller()-> |
| 252 CreateEmptyWallpaper(); | 248 CreateEmptyWallpaper(); |
| 253 } | 249 } |
| 254 | 250 |
| 255 virtual void OpenSetWallpaperPage() OVERRIDE { | 251 virtual void OpenSetWallpaperPage() OVERRIDE { |
| 256 } | 252 } |
| 257 | 253 |
| 258 virtual bool CanOpenSetWallpaperPage() OVERRIDE { | 254 virtual bool CanOpenSetWallpaperPage() OVERRIDE { |
| 259 return false; | 255 return false; |
| 260 } | 256 } |
| 261 | 257 |
| 262 private: | 258 private: |
| 263 DISALLOW_COPY_AND_ASSIGN(DummyUserWallpaperDelegate); | 259 DISALLOW_COPY_AND_ASSIGN(DummyUserWallpaperDelegate); |
| 264 }; | 260 }; |
| 265 | 261 |
| 266 class DummySystemTrayDelegate : public SystemTrayDelegate { | |
| 267 public: | |
| 268 DummySystemTrayDelegate() | |
| 269 : muted_(false), | |
| 270 wifi_enabled_(true), | |
| 271 cellular_enabled_(true), | |
| 272 bluetooth_enabled_(true), | |
| 273 volume_(0.5), | |
| 274 caps_lock_enabled_(false) { | |
| 275 } | |
| 276 | |
| 277 virtual ~DummySystemTrayDelegate() {} | |
| 278 | |
| 279 private: | |
| 280 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { return true; } | |
| 281 | |
| 282 // Overridden from SystemTrayDelegate: | |
| 283 virtual const string16 GetUserDisplayName() const OVERRIDE { | |
| 284 return UTF8ToUTF16("Über tray Über tray Über tray Über tray"); | |
| 285 } | |
| 286 | |
| 287 virtual const std::string GetUserEmail() const OVERRIDE { | |
| 288 return "über@tray"; | |
| 289 } | |
| 290 | |
| 291 virtual const gfx::ImageSkia& GetUserImage() const OVERRIDE { | |
| 292 return null_image_; | |
| 293 } | |
| 294 | |
| 295 virtual user::LoginStatus GetUserLoginStatus() const OVERRIDE { | |
| 296 return user::LOGGED_IN_USER; | |
| 297 } | |
| 298 | |
| 299 virtual bool SystemShouldUpgrade() const OVERRIDE { | |
| 300 return true; | |
| 301 } | |
| 302 | |
| 303 virtual base::HourClockType GetHourClockType() const OVERRIDE { | |
| 304 return base::k24HourClock; | |
| 305 } | |
| 306 | |
| 307 virtual PowerSupplyStatus GetPowerSupplyStatus() const OVERRIDE { | |
| 308 return PowerSupplyStatus(); | |
| 309 } | |
| 310 | |
| 311 virtual void RequestStatusUpdate() const OVERRIDE { | |
| 312 } | |
| 313 | |
| 314 virtual void ShowSettings() OVERRIDE { | |
| 315 } | |
| 316 | |
| 317 virtual void ShowDateSettings() OVERRIDE { | |
| 318 } | |
| 319 | |
| 320 virtual void ShowNetworkSettings() OVERRIDE { | |
| 321 } | |
| 322 | |
| 323 virtual void ShowBluetoothSettings() OVERRIDE { | |
| 324 } | |
| 325 | |
| 326 virtual void ShowDriveSettings() OVERRIDE { | |
| 327 } | |
| 328 | |
| 329 virtual void ShowIMESettings() OVERRIDE { | |
| 330 } | |
| 331 | |
| 332 virtual void ShowHelp() OVERRIDE { | |
| 333 } | |
| 334 | |
| 335 virtual bool IsAudioMuted() const OVERRIDE { | |
| 336 return muted_; | |
| 337 } | |
| 338 | |
| 339 virtual void SetAudioMuted(bool muted) OVERRIDE { | |
| 340 muted_ = muted; | |
| 341 } | |
| 342 | |
| 343 virtual float GetVolumeLevel() const OVERRIDE { | |
| 344 return volume_; | |
| 345 } | |
| 346 | |
| 347 virtual void SetVolumeLevel(float volume) OVERRIDE { | |
| 348 volume_ = volume; | |
| 349 } | |
| 350 | |
| 351 virtual bool IsCapsLockOn() const OVERRIDE { | |
| 352 return caps_lock_enabled_; | |
| 353 } | |
| 354 | |
| 355 virtual void SetCapsLockEnabled(bool enabled) OVERRIDE { | |
| 356 caps_lock_enabled_ = enabled; | |
| 357 } | |
| 358 | |
| 359 virtual bool IsInAccessibilityMode() const OVERRIDE { | |
| 360 return false; | |
| 361 } | |
| 362 | |
| 363 virtual void SetEnableSpokenFeedback(bool enable) OVERRIDE {} | |
| 364 | |
| 365 virtual void ShutDown() OVERRIDE {} | |
| 366 | |
| 367 virtual void SignOut() OVERRIDE { | |
| 368 MessageLoop::current()->Quit(); | |
| 369 } | |
| 370 | |
| 371 virtual void RequestLockScreen() OVERRIDE {} | |
| 372 | |
| 373 virtual void RequestRestart() OVERRIDE {} | |
| 374 | |
| 375 virtual void GetAvailableBluetoothDevices( | |
| 376 BluetoothDeviceList* list) OVERRIDE { | |
| 377 } | |
| 378 | |
| 379 virtual void ToggleBluetoothConnection(const std::string& address) OVERRIDE { | |
| 380 } | |
| 381 | |
| 382 virtual void GetCurrentIME(IMEInfo* info) OVERRIDE { | |
| 383 } | |
| 384 | |
| 385 virtual void GetAvailableIMEList(IMEInfoList* list) OVERRIDE { | |
| 386 } | |
| 387 | |
| 388 virtual void GetCurrentIMEProperties(IMEPropertyInfoList* list) OVERRIDE { | |
| 389 } | |
| 390 | |
| 391 virtual void SwitchIME(const std::string& ime_id) OVERRIDE { | |
| 392 } | |
| 393 | |
| 394 virtual void ActivateIMEProperty(const std::string& key) OVERRIDE { | |
| 395 } | |
| 396 | |
| 397 virtual void CancelDriveOperation(const FilePath&) OVERRIDE { | |
| 398 } | |
| 399 | |
| 400 virtual void GetDriveOperationStatusList( | |
| 401 ash::DriveOperationStatusList*) OVERRIDE { | |
| 402 } | |
| 403 | |
| 404 virtual void GetMostRelevantNetworkIcon(NetworkIconInfo* info, | |
| 405 bool large) OVERRIDE { | |
| 406 } | |
| 407 | |
| 408 virtual void GetAvailableNetworks( | |
| 409 std::vector<NetworkIconInfo>* list) OVERRIDE { | |
| 410 } | |
| 411 | |
| 412 virtual void ConnectToNetwork(const std::string& network_id) OVERRIDE { | |
| 413 } | |
| 414 | |
| 415 virtual void GetNetworkAddresses(std::string* ip_address, | |
| 416 std::string* ethernet_mac_address, | |
| 417 std::string* wifi_mac_address) OVERRIDE { | |
| 418 *ip_address = "127.0.0.1"; | |
| 419 *ethernet_mac_address = "00:11:22:33:44:55"; | |
| 420 *wifi_mac_address = "66:77:88:99:00:11"; | |
| 421 } | |
| 422 | |
| 423 virtual void RequestNetworkScan() OVERRIDE { | |
| 424 } | |
| 425 | |
| 426 virtual void AddBluetoothDevice() OVERRIDE { | |
| 427 } | |
| 428 | |
| 429 virtual void ToggleAirplaneMode() OVERRIDE { | |
| 430 } | |
| 431 | |
| 432 virtual void ToggleWifi() OVERRIDE { | |
| 433 wifi_enabled_ = !wifi_enabled_; | |
| 434 ash::NetworkObserver* observer = | |
| 435 ash::Shell::GetInstance()->system_tray()->network_observer(); | |
| 436 if (observer) { | |
| 437 ash::NetworkIconInfo info; | |
| 438 observer->OnNetworkRefresh(info); | |
| 439 } | |
| 440 } | |
| 441 | |
| 442 virtual void ToggleMobile() OVERRIDE { | |
| 443 cellular_enabled_ = !cellular_enabled_; | |
| 444 ash::NetworkObserver* observer = | |
| 445 ash::Shell::GetInstance()->system_tray()->network_observer(); | |
| 446 if (observer) { | |
| 447 ash::NetworkIconInfo info; | |
| 448 observer->OnNetworkRefresh(info); | |
| 449 } | |
| 450 } | |
| 451 | |
| 452 virtual void ToggleBluetooth() OVERRIDE { | |
| 453 bluetooth_enabled_ = !bluetooth_enabled_; | |
| 454 ash::BluetoothObserver* observer = | |
| 455 ash::Shell::GetInstance()->system_tray()->bluetooth_observer(); | |
| 456 if (observer) | |
| 457 observer->OnBluetoothRefresh(); | |
| 458 } | |
| 459 | |
| 460 virtual void ShowOtherWifi() OVERRIDE { | |
| 461 } | |
| 462 | |
| 463 virtual void ShowOtherCellular() OVERRIDE { | |
| 464 } | |
| 465 | |
| 466 virtual bool IsNetworkConnected() OVERRIDE { | |
| 467 return true; | |
| 468 } | |
| 469 | |
| 470 virtual bool GetWifiAvailable() OVERRIDE { | |
| 471 return true; | |
| 472 } | |
| 473 | |
| 474 virtual bool GetMobileAvailable() OVERRIDE { | |
| 475 return true; | |
| 476 } | |
| 477 | |
| 478 virtual bool GetBluetoothAvailable() OVERRIDE { | |
| 479 return true; | |
| 480 } | |
| 481 | |
| 482 virtual bool GetWifiEnabled() OVERRIDE { | |
| 483 return wifi_enabled_; | |
| 484 } | |
| 485 | |
| 486 virtual bool GetMobileEnabled() OVERRIDE { | |
| 487 return cellular_enabled_; | |
| 488 } | |
| 489 | |
| 490 virtual bool GetBluetoothEnabled() OVERRIDE { | |
| 491 return bluetooth_enabled_; | |
| 492 } | |
| 493 | |
| 494 virtual bool GetMobileScanSupported() OVERRIDE { | |
| 495 return true; | |
| 496 } | |
| 497 | |
| 498 virtual bool GetCellularCarrierInfo(std::string* carrier_id, | |
| 499 std::string* topup_url, | |
| 500 std::string* setup_url) OVERRIDE { | |
| 501 return false; | |
| 502 } | |
| 503 | |
| 504 virtual void ShowCellularURL(const std::string& url) OVERRIDE { | |
| 505 } | |
| 506 | |
| 507 virtual void ChangeProxySettings() OVERRIDE { | |
| 508 } | |
| 509 | |
| 510 bool muted_; | |
| 511 bool wifi_enabled_; | |
| 512 bool cellular_enabled_; | |
| 513 bool bluetooth_enabled_; | |
| 514 float volume_; | |
| 515 bool caps_lock_enabled_; | |
| 516 gfx::ImageSkia null_image_; | |
| 517 | |
| 518 DISALLOW_COPY_AND_ASSIGN(DummySystemTrayDelegate); | |
| 519 }; | |
| 520 | |
| 521 } // namespace | 262 } // namespace |
| 522 | 263 |
| 523 // static | 264 // static |
| 524 Shell* Shell::instance_ = NULL; | 265 Shell* Shell::instance_ = NULL; |
| 525 // static | 266 // static |
| 526 bool Shell::initially_hide_cursor_ = false; | 267 bool Shell::initially_hide_cursor_ = false; |
| 527 | 268 |
| 528 //////////////////////////////////////////////////////////////////////////////// | 269 //////////////////////////////////////////////////////////////////////////////// |
| 529 // Shell::TestApi | 270 // Shell::TestApi |
| 530 | 271 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 | 341 |
| 601 // TooltipController is deleted with the Shell so removing its references. | 342 // TooltipController is deleted with the Shell so removing its references. |
| 602 RemoveEnvEventFilter(tooltip_controller_.get()); | 343 RemoveEnvEventFilter(tooltip_controller_.get()); |
| 603 aura::client::SetTooltipClient(root_window, NULL); | 344 aura::client::SetTooltipClient(root_window, NULL); |
| 604 tooltip_controller_.reset(); | 345 tooltip_controller_.reset(); |
| 605 | 346 |
| 606 // Make sure we delete WorkspaceController before launcher is | 347 // Make sure we delete WorkspaceController before launcher is |
| 607 // deleted as it has a reference to launcher model. | 348 // deleted as it has a reference to launcher model. |
| 608 workspace_controller_.reset(); | 349 workspace_controller_.reset(); |
| 609 | 350 |
| 610 // The system tray needs to be reset before all the windows are destroyed. | 351 // The status area needs to be shut down before the windows are destroyed. |
| 611 system_tray_.reset(); | 352 status_area_widget_->Shutdown(); |
| 612 tray_delegate_.reset(); | |
| 613 | 353 |
| 614 // AppList needs to be released before shelf layout manager, which is | 354 // AppList needs to be released before shelf layout manager, which is |
| 615 // destroyed with launcher container in the loop below. However, app list | 355 // destroyed with launcher container in the loop below. However, app list |
| 616 // container is now on top of launcher container and released after it. | 356 // container is now on top of launcher container and released after it. |
| 617 // TODO(xiyuan): Move it back when app list container is no longer needed. | 357 // TODO(xiyuan): Move it back when app list container is no longer needed. |
| 618 app_list_controller_.reset(); | 358 app_list_controller_.reset(); |
| 619 | 359 |
| 620 // Destroy secondary monitor's widgets before all the windows are destroyed. | 360 // Destroy secondary monitor's widgets before all the windows are destroyed. |
| 621 monitor_controller_.reset(); | 361 monitor_controller_.reset(); |
| 622 | 362 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 AddEnvEventFilter(touch_observer_hud_.get()); | 546 AddEnvEventFilter(touch_observer_hud_.get()); |
| 807 } | 547 } |
| 808 | 548 |
| 809 stacking_controller_.reset(new internal::StackingController); | 549 stacking_controller_.reset(new internal::StackingController); |
| 810 | 550 |
| 811 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); | 551 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); |
| 812 root_window->SetLayoutManager(root_window_layout_); | 552 root_window->SetLayoutManager(root_window_layout_); |
| 813 | 553 |
| 814 event_client_.reset(new internal::EventClientImpl(root_window)); | 554 event_client_.reset(new internal::EventClientImpl(root_window)); |
| 815 | 555 |
| 816 status_area_widget_ = new internal::StatusAreaWidget; | 556 status_area_widget_ = new internal::StatusAreaWidget(); |
| 817 | 557 status_area_widget_->CreateTrayViews(delegate_.get()); |
| 818 system_tray_.reset(new SystemTray()); | |
| 819 status_area_widget_->AddTray(system_tray_.get()); | |
| 820 system_tray_->Initialize(); | |
| 821 | |
| 822 if (delegate_.get()) { | |
| 823 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate( | |
| 824 system_tray_.get())); | |
| 825 } | |
| 826 if (!tray_delegate_.get()) | |
| 827 tray_delegate_.reset(new DummySystemTrayDelegate()); | |
| 828 | |
| 829 system_tray_->CreateItems(); // Called after delegate is created. | |
| 830 | |
| 831 status_area_widget_->Show(); | 558 status_area_widget_->Show(); |
| 832 | 559 |
| 833 // This controller needs to be set before SetupManagedWindowMode. | 560 // This controller needs to be set before SetupManagedWindowMode. |
| 834 desktop_background_controller_.reset( | 561 desktop_background_controller_.reset( |
| 835 new DesktopBackgroundController(root_window)); | 562 new DesktopBackgroundController(root_window)); |
| 836 if (delegate_.get()) | 563 if (delegate_.get()) |
| 837 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); | 564 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); |
| 838 if (!user_wallpaper_delegate_.get()) | 565 if (!user_wallpaper_delegate_.get()) |
| 839 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); | 566 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); |
| 840 | 567 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 if (!shelf_->SetAlignment(alignment)) | 742 if (!shelf_->SetAlignment(alignment)) |
| 1016 return; | 743 return; |
| 1017 FOR_EACH_OBSERVER(ShellObserver, observers_, | 744 FOR_EACH_OBSERVER(ShellObserver, observers_, |
| 1018 OnShelfAlignmentChanged()); | 745 OnShelfAlignmentChanged()); |
| 1019 } | 746 } |
| 1020 | 747 |
| 1021 ShelfAlignment Shell::GetShelfAlignment() { | 748 ShelfAlignment Shell::GetShelfAlignment() { |
| 1022 return shelf_->alignment(); | 749 return shelf_->alignment(); |
| 1023 } | 750 } |
| 1024 | 751 |
| 752 SystemTrayDelegate* Shell::tray_delegate() { |
| 753 return status_area_widget_->system_tray_delegate(); |
| 754 } |
| 755 |
| 756 SystemTray* Shell::system_tray() { |
| 757 return status_area_widget_->system_tray(); |
| 758 } |
| 759 |
| 1025 int Shell::GetGridSize() const { | 760 int Shell::GetGridSize() const { |
| 1026 return workspace_controller_->workspace_manager()->grid_size(); | 761 return workspace_controller_->workspace_manager()->grid_size(); |
| 1027 } | 762 } |
| 1028 | 763 |
| 1029 bool Shell::IsInMaximizedMode() const { | 764 bool Shell::IsInMaximizedMode() const { |
| 1030 return workspace_controller_->workspace_manager()->IsInMaximizedMode(); | 765 return workspace_controller_->workspace_manager()->IsInMaximizedMode(); |
| 1031 } | 766 } |
| 1032 | 767 |
| 1033 void Shell::InitRootWindowForSecondaryMonitor(aura::RootWindow* root) { | 768 void Shell::InitRootWindowForSecondaryMonitor(aura::RootWindow* root) { |
| 1034 root->set_focus_manager(focus_manager_.get()); | 769 root->set_focus_manager(focus_manager_.get()); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 void Shell::SetCursor(gfx::NativeCursor cursor) { | 841 void Shell::SetCursor(gfx::NativeCursor cursor) { |
| 1107 // TODO(oshima): set cursor to all root windows. | 842 // TODO(oshima): set cursor to all root windows. |
| 1108 GetPrimaryRootWindow()->SetCursor(cursor); | 843 GetPrimaryRootWindow()->SetCursor(cursor); |
| 1109 } | 844 } |
| 1110 | 845 |
| 1111 void Shell::ShowCursor(bool visible) { | 846 void Shell::ShowCursor(bool visible) { |
| 1112 GetPrimaryRootWindow()->ShowCursor(visible); | 847 GetPrimaryRootWindow()->ShowCursor(visible); |
| 1113 } | 848 } |
| 1114 | 849 |
| 1115 } // namespace ash | 850 } // namespace ash |
| OLD | NEW |