| 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/custom_frame_view_ash.h" | 35 #include "ash/wm/custom_frame_view_ash.h" |
| 39 #include "ash/wm/dialog_frame_view.h" | 36 #include "ash/wm/dialog_frame_view.h" |
| 40 #include "ash/wm/event_client_impl.h" | 37 #include "ash/wm/event_client_impl.h" |
| 41 #include "ash/wm/key_rewriter_event_filter.h" | 38 #include "ash/wm/key_rewriter_event_filter.h" |
| 42 #include "ash/wm/panel_layout_manager.h" | 39 #include "ash/wm/panel_layout_manager.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 59 #include "ash/wm/visibility_controller.h" | 56 #include "ash/wm/visibility_controller.h" |
| 60 #include "ash/wm/window_cycle_controller.h" | 57 #include "ash/wm/window_cycle_controller.h" |
| 61 #include "ash/wm/window_modality_controller.h" | 58 #include "ash/wm/window_modality_controller.h" |
| 62 #include "ash/wm/window_util.h" | 59 #include "ash/wm/window_util.h" |
| 63 #include "ash/wm/workspace/workspace_event_filter.h" | 60 #include "ash/wm/workspace/workspace_event_filter.h" |
| 64 #include "ash/wm/workspace/workspace_layout_manager.h" | 61 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 65 #include "ash/wm/workspace/workspace_manager.h" | 62 #include "ash/wm/workspace/workspace_manager.h" |
| 66 #include "ash/wm/workspace_controller.h" | 63 #include "ash/wm/workspace_controller.h" |
| 67 #include "base/bind.h" | 64 #include "base/bind.h" |
| 68 #include "base/command_line.h" | 65 #include "base/command_line.h" |
| 69 #include "base/utf_string_conversions.h" | |
| 70 #include "grit/ui_resources.h" | 66 #include "grit/ui_resources.h" |
| 71 #include "ui/aura/client/aura_constants.h" | 67 #include "ui/aura/client/aura_constants.h" |
| 72 #include "ui/aura/client/user_action_client.h" | 68 #include "ui/aura/client/user_action_client.h" |
| 73 #include "ui/aura/cursor_manager.h" | 69 #include "ui/aura/cursor_manager.h" |
| 74 #include "ui/aura/env.h" | 70 #include "ui/aura/env.h" |
| 75 #include "ui/aura/focus_manager.h" | 71 #include "ui/aura/focus_manager.h" |
| 76 #include "ui/aura/layout_manager.h" | 72 #include "ui/aura/layout_manager.h" |
| 77 #include "ui/aura/monitor_manager.h" | 73 #include "ui/aura/monitor_manager.h" |
| 78 #include "ui/aura/root_window.h" | 74 #include "ui/aura/root_window.h" |
| 79 #include "ui/aura/shared/compound_event_filter.h" | 75 #include "ui/aura/shared/compound_event_filter.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 lock_modal_container->SetEventFilter( | 204 lock_modal_container->SetEventFilter( |
| 209 new ToplevelWindowEventFilter(lock_modal_container)); | 205 new ToplevelWindowEventFilter(lock_modal_container)); |
| 210 lock_modal_container->SetLayoutManager( | 206 lock_modal_container->SetLayoutManager( |
| 211 new internal::SystemModalContainerLayoutManager(lock_modal_container)); | 207 new internal::SystemModalContainerLayoutManager(lock_modal_container)); |
| 212 SetChildWindowVisibilityChangesAnimated(lock_modal_container); | 208 SetChildWindowVisibilityChangesAnimated(lock_modal_container); |
| 213 | 209 |
| 214 CreateContainer(internal::kShellWindowId_StatusContainer, | 210 CreateContainer(internal::kShellWindowId_StatusContainer, |
| 215 "StatusContainer", | 211 "StatusContainer", |
| 216 lock_screen_related_containers); | 212 lock_screen_related_containers); |
| 217 | 213 |
| 214 aura::Window* settings_bubble_container = CreateContainer( |
| 215 internal::kShellWindowId_SettingBubbleContainer, |
| 216 "SettingBubbleContainer", |
| 217 lock_screen_related_containers); |
| 218 SetChildWindowVisibilityChangesAnimated(settings_bubble_container); |
| 219 |
| 218 aura::Window* menu_container = CreateContainer( | 220 aura::Window* menu_container = CreateContainer( |
| 219 internal::kShellWindowId_MenuContainer, | 221 internal::kShellWindowId_MenuContainer, |
| 220 "MenuContainer", | 222 "MenuContainer", |
| 221 lock_screen_related_containers); | 223 lock_screen_related_containers); |
| 222 SetChildWindowVisibilityChangesAnimated(menu_container); | 224 SetChildWindowVisibilityChangesAnimated(menu_container); |
| 223 | 225 |
| 224 aura::Window* drag_drop_container = CreateContainer( | 226 aura::Window* drag_drop_container = CreateContainer( |
| 225 internal::kShellWindowId_DragImageAndTooltipContainer, | 227 internal::kShellWindowId_DragImageAndTooltipContainer, |
| 226 "DragImageAndTooltipContainer", | 228 "DragImageAndTooltipContainer", |
| 227 lock_screen_related_containers); | 229 lock_screen_related_containers); |
| 228 SetChildWindowVisibilityChangesAnimated(drag_drop_container); | 230 SetChildWindowVisibilityChangesAnimated(drag_drop_container); |
| 229 | 231 |
| 230 aura::Window* settings_bubble_container = CreateContainer( | |
| 231 internal::kShellWindowId_SettingBubbleContainer, | |
| 232 "SettingBubbleContainer", | |
| 233 lock_screen_related_containers); | |
| 234 SetChildWindowVisibilityChangesAnimated(settings_bubble_container); | |
| 235 | |
| 236 CreateContainer(internal::kShellWindowId_OverlayContainer, | 232 CreateContainer(internal::kShellWindowId_OverlayContainer, |
| 237 "OverlayContainer", | 233 "OverlayContainer", |
| 238 lock_screen_related_containers); | 234 lock_screen_related_containers); |
| 239 } | 235 } |
| 240 | 236 |
| 241 // This dummy class is used for shell unit tests. We dont have chrome delegate | 237 // This dummy class is used for shell unit tests. We dont have chrome delegate |
| 242 // in these tests. | 238 // in these tests. |
| 243 class DummyUserWallpaperDelegate : public UserWallpaperDelegate { | 239 class DummyUserWallpaperDelegate : public UserWallpaperDelegate { |
| 244 public: | 240 public: |
| 245 DummyUserWallpaperDelegate() {} | 241 DummyUserWallpaperDelegate() {} |
| 246 | 242 |
| 247 virtual ~DummyUserWallpaperDelegate() {} | 243 virtual ~DummyUserWallpaperDelegate() {} |
| 248 | 244 |
| 249 virtual void SetLoggedInUserWallpaper() OVERRIDE { | 245 virtual void SetLoggedInUserWallpaper() OVERRIDE { |
| 250 ash::Shell::GetInstance()->desktop_background_controller()-> | 246 ash::Shell::GetInstance()->desktop_background_controller()-> |
| 251 CreateEmptyWallpaper(); | 247 CreateEmptyWallpaper(); |
| 252 } | 248 } |
| 253 | 249 |
| 254 virtual void OpenSetWallpaperPage() OVERRIDE { | 250 virtual void OpenSetWallpaperPage() OVERRIDE { |
| 255 } | 251 } |
| 256 | 252 |
| 257 virtual bool CanOpenSetWallpaperPage() OVERRIDE { | 253 virtual bool CanOpenSetWallpaperPage() OVERRIDE { |
| 258 return false; | 254 return false; |
| 259 } | 255 } |
| 260 | 256 |
| 261 private: | 257 private: |
| 262 DISALLOW_COPY_AND_ASSIGN(DummyUserWallpaperDelegate); | 258 DISALLOW_COPY_AND_ASSIGN(DummyUserWallpaperDelegate); |
| 263 }; | 259 }; |
| 264 | 260 |
| 265 class DummySystemTrayDelegate : public SystemTrayDelegate { | |
| 266 public: | |
| 267 DummySystemTrayDelegate() | |
| 268 : muted_(false), | |
| 269 wifi_enabled_(true), | |
| 270 cellular_enabled_(true), | |
| 271 bluetooth_enabled_(true), | |
| 272 volume_(0.5), | |
| 273 caps_lock_enabled_(false) { | |
| 274 } | |
| 275 | |
| 276 virtual ~DummySystemTrayDelegate() {} | |
| 277 | |
| 278 private: | |
| 279 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { return true; } | |
| 280 | |
| 281 // Overridden from SystemTrayDelegate: | |
| 282 virtual const string16 GetUserDisplayName() const OVERRIDE { | |
| 283 return UTF8ToUTF16("Über tray Über tray Über tray Über tray"); | |
| 284 } | |
| 285 | |
| 286 virtual const std::string GetUserEmail() const OVERRIDE { | |
| 287 return "über@tray"; | |
| 288 } | |
| 289 | |
| 290 virtual const gfx::ImageSkia& GetUserImage() const OVERRIDE { | |
| 291 return null_image_; | |
| 292 } | |
| 293 | |
| 294 virtual user::LoginStatus GetUserLoginStatus() const OVERRIDE { | |
| 295 return user::LOGGED_IN_USER; | |
| 296 } | |
| 297 | |
| 298 virtual bool SystemShouldUpgrade() const OVERRIDE { | |
| 299 return true; | |
| 300 } | |
| 301 | |
| 302 virtual base::HourClockType GetHourClockType() const OVERRIDE { | |
| 303 return base::k24HourClock; | |
| 304 } | |
| 305 | |
| 306 virtual PowerSupplyStatus GetPowerSupplyStatus() const OVERRIDE { | |
| 307 return PowerSupplyStatus(); | |
| 308 } | |
| 309 | |
| 310 virtual void RequestStatusUpdate() const OVERRIDE { | |
| 311 } | |
| 312 | |
| 313 virtual void ShowSettings() OVERRIDE { | |
| 314 } | |
| 315 | |
| 316 virtual void ShowDateSettings() OVERRIDE { | |
| 317 } | |
| 318 | |
| 319 virtual void ShowNetworkSettings() OVERRIDE { | |
| 320 } | |
| 321 | |
| 322 virtual void ShowBluetoothSettings() OVERRIDE { | |
| 323 } | |
| 324 | |
| 325 virtual void ShowDriveSettings() OVERRIDE { | |
| 326 } | |
| 327 | |
| 328 virtual void ShowIMESettings() OVERRIDE { | |
| 329 } | |
| 330 | |
| 331 virtual void ShowHelp() OVERRIDE { | |
| 332 } | |
| 333 | |
| 334 virtual bool IsAudioMuted() const OVERRIDE { | |
| 335 return muted_; | |
| 336 } | |
| 337 | |
| 338 virtual void SetAudioMuted(bool muted) OVERRIDE { | |
| 339 muted_ = muted; | |
| 340 } | |
| 341 | |
| 342 virtual float GetVolumeLevel() const OVERRIDE { | |
| 343 return volume_; | |
| 344 } | |
| 345 | |
| 346 virtual void SetVolumeLevel(float volume) OVERRIDE { | |
| 347 volume_ = volume; | |
| 348 } | |
| 349 | |
| 350 virtual bool IsCapsLockOn() const OVERRIDE { | |
| 351 return caps_lock_enabled_; | |
| 352 } | |
| 353 | |
| 354 virtual void SetCapsLockEnabled(bool enabled) OVERRIDE { | |
| 355 caps_lock_enabled_ = enabled; | |
| 356 } | |
| 357 | |
| 358 virtual bool IsInAccessibilityMode() const OVERRIDE { | |
| 359 return false; | |
| 360 } | |
| 361 | |
| 362 virtual void SetEnableSpokenFeedback(bool enable) OVERRIDE {} | |
| 363 | |
| 364 virtual void ShutDown() OVERRIDE {} | |
| 365 | |
| 366 virtual void SignOut() OVERRIDE { | |
| 367 MessageLoop::current()->Quit(); | |
| 368 } | |
| 369 | |
| 370 virtual void RequestLockScreen() OVERRIDE {} | |
| 371 | |
| 372 virtual void RequestRestart() OVERRIDE {} | |
| 373 | |
| 374 virtual void GetAvailableBluetoothDevices( | |
| 375 BluetoothDeviceList* list) OVERRIDE { | |
| 376 } | |
| 377 | |
| 378 virtual void ToggleBluetoothConnection(const std::string& address) OVERRIDE { | |
| 379 } | |
| 380 | |
| 381 virtual void GetCurrentIME(IMEInfo* info) OVERRIDE { | |
| 382 } | |
| 383 | |
| 384 virtual void GetAvailableIMEList(IMEInfoList* list) OVERRIDE { | |
| 385 } | |
| 386 | |
| 387 virtual void GetCurrentIMEProperties(IMEPropertyInfoList* list) OVERRIDE { | |
| 388 } | |
| 389 | |
| 390 virtual void SwitchIME(const std::string& ime_id) OVERRIDE { | |
| 391 } | |
| 392 | |
| 393 virtual void ActivateIMEProperty(const std::string& key) OVERRIDE { | |
| 394 } | |
| 395 | |
| 396 virtual void CancelDriveOperation(const FilePath&) OVERRIDE { | |
| 397 } | |
| 398 | |
| 399 virtual void GetDriveOperationStatusList( | |
| 400 ash::DriveOperationStatusList*) OVERRIDE { | |
| 401 } | |
| 402 | |
| 403 virtual void GetMostRelevantNetworkIcon(NetworkIconInfo* info, | |
| 404 bool large) OVERRIDE { | |
| 405 } | |
| 406 | |
| 407 virtual void GetAvailableNetworks( | |
| 408 std::vector<NetworkIconInfo>* list) OVERRIDE { | |
| 409 } | |
| 410 | |
| 411 virtual void ConnectToNetwork(const std::string& network_id) OVERRIDE { | |
| 412 } | |
| 413 | |
| 414 virtual void GetNetworkAddresses(std::string* ip_address, | |
| 415 std::string* ethernet_mac_address, | |
| 416 std::string* wifi_mac_address) OVERRIDE { | |
| 417 *ip_address = "127.0.0.1"; | |
| 418 *ethernet_mac_address = "00:11:22:33:44:55"; | |
| 419 *wifi_mac_address = "66:77:88:99:00:11"; | |
| 420 } | |
| 421 | |
| 422 virtual void RequestNetworkScan() OVERRIDE { | |
| 423 } | |
| 424 | |
| 425 virtual void AddBluetoothDevice() OVERRIDE { | |
| 426 } | |
| 427 | |
| 428 virtual void ToggleAirplaneMode() OVERRIDE { | |
| 429 } | |
| 430 | |
| 431 virtual void ToggleWifi() OVERRIDE { | |
| 432 wifi_enabled_ = !wifi_enabled_; | |
| 433 ash::NetworkObserver* observer = | |
| 434 ash::Shell::GetInstance()->system_tray()->network_observer(); | |
| 435 if (observer) { | |
| 436 ash::NetworkIconInfo info; | |
| 437 observer->OnNetworkRefresh(info); | |
| 438 } | |
| 439 } | |
| 440 | |
| 441 virtual void ToggleMobile() OVERRIDE { | |
| 442 cellular_enabled_ = !cellular_enabled_; | |
| 443 ash::NetworkObserver* observer = | |
| 444 ash::Shell::GetInstance()->system_tray()->network_observer(); | |
| 445 if (observer) { | |
| 446 ash::NetworkIconInfo info; | |
| 447 observer->OnNetworkRefresh(info); | |
| 448 } | |
| 449 } | |
| 450 | |
| 451 virtual void ToggleBluetooth() OVERRIDE { | |
| 452 bluetooth_enabled_ = !bluetooth_enabled_; | |
| 453 ash::BluetoothObserver* observer = | |
| 454 ash::Shell::GetInstance()->system_tray()->bluetooth_observer(); | |
| 455 if (observer) | |
| 456 observer->OnBluetoothRefresh(); | |
| 457 } | |
| 458 | |
| 459 virtual void ShowOtherWifi() OVERRIDE { | |
| 460 } | |
| 461 | |
| 462 virtual void ShowOtherCellular() OVERRIDE { | |
| 463 } | |
| 464 | |
| 465 virtual bool IsNetworkConnected() OVERRIDE { | |
| 466 return true; | |
| 467 } | |
| 468 | |
| 469 virtual bool GetWifiAvailable() OVERRIDE { | |
| 470 return true; | |
| 471 } | |
| 472 | |
| 473 virtual bool GetMobileAvailable() OVERRIDE { | |
| 474 return true; | |
| 475 } | |
| 476 | |
| 477 virtual bool GetBluetoothAvailable() OVERRIDE { | |
| 478 return true; | |
| 479 } | |
| 480 | |
| 481 virtual bool GetWifiEnabled() OVERRIDE { | |
| 482 return wifi_enabled_; | |
| 483 } | |
| 484 | |
| 485 virtual bool GetMobileEnabled() OVERRIDE { | |
| 486 return cellular_enabled_; | |
| 487 } | |
| 488 | |
| 489 virtual bool GetBluetoothEnabled() OVERRIDE { | |
| 490 return bluetooth_enabled_; | |
| 491 } | |
| 492 | |
| 493 virtual bool GetMobileScanSupported() OVERRIDE { | |
| 494 return true; | |
| 495 } | |
| 496 | |
| 497 virtual bool GetCellularCarrierInfo(std::string* carrier_id, | |
| 498 std::string* topup_url, | |
| 499 std::string* setup_url) OVERRIDE { | |
| 500 return false; | |
| 501 } | |
| 502 | |
| 503 virtual void ShowCellularURL(const std::string& url) OVERRIDE { | |
| 504 } | |
| 505 | |
| 506 virtual void ChangeProxySettings() OVERRIDE { | |
| 507 } | |
| 508 | |
| 509 bool muted_; | |
| 510 bool wifi_enabled_; | |
| 511 bool cellular_enabled_; | |
| 512 bool bluetooth_enabled_; | |
| 513 float volume_; | |
| 514 bool caps_lock_enabled_; | |
| 515 gfx::ImageSkia null_image_; | |
| 516 | |
| 517 DISALLOW_COPY_AND_ASSIGN(DummySystemTrayDelegate); | |
| 518 }; | |
| 519 | |
| 520 } // namespace | 261 } // namespace |
| 521 | 262 |
| 522 // static | 263 // static |
| 523 Shell* Shell::instance_ = NULL; | 264 Shell* Shell::instance_ = NULL; |
| 524 // static | 265 // static |
| 525 bool Shell::initially_hide_cursor_ = false; | 266 bool Shell::initially_hide_cursor_ = false; |
| 526 | 267 |
| 527 //////////////////////////////////////////////////////////////////////////////// | 268 //////////////////////////////////////////////////////////////////////////////// |
| 528 // Shell::TestApi | 269 // Shell::TestApi |
| 529 | 270 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 root_window_layout_->SetBackgroundWidget(NULL); | 337 root_window_layout_->SetBackgroundWidget(NULL); |
| 597 | 338 |
| 598 // TooltipController is deleted with the Shell so removing its references. | 339 // TooltipController is deleted with the Shell so removing its references. |
| 599 RemoveEnvEventFilter(tooltip_controller_.get()); | 340 RemoveEnvEventFilter(tooltip_controller_.get()); |
| 600 aura::client::SetTooltipClient(GetPrimaryRootWindow(), NULL); | 341 aura::client::SetTooltipClient(GetPrimaryRootWindow(), NULL); |
| 601 | 342 |
| 602 // Make sure we delete WorkspaceController before launcher is | 343 // Make sure we delete WorkspaceController before launcher is |
| 603 // deleted as it has a reference to launcher model. | 344 // deleted as it has a reference to launcher model. |
| 604 workspace_controller_.reset(); | 345 workspace_controller_.reset(); |
| 605 | 346 |
| 606 // The system tray needs to be reset before all the windows are destroyed. | 347 // The status area needs to be shut down before the windows are destroyed. |
| 607 system_tray_.reset(); | 348 status_area_widget_->Shutdown(); |
| 608 tray_delegate_.reset(); | |
| 609 | 349 |
| 610 // AppList needs to be released before shelf layout manager, which is | 350 // AppList needs to be released before shelf layout manager, which is |
| 611 // destroyed with launcher container in the loop below. However, app list | 351 // destroyed with launcher container in the loop below. However, app list |
| 612 // container is now on top of launcher container and released after it. | 352 // container is now on top of launcher container and released after it. |
| 613 // TODO(xiyuan): Move it back when app list container is no longer needed. | 353 // TODO(xiyuan): Move it back when app list container is no longer needed. |
| 614 app_list_controller_.reset(); | 354 app_list_controller_.reset(); |
| 615 | 355 |
| 616 // Destroy secondary monitor's widgets before all the windows are destroyed. | 356 // Destroy secondary monitor's widgets before all the windows are destroyed. |
| 617 monitor_controller_.reset(); | 357 monitor_controller_.reset(); |
| 618 | 358 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 AddEnvEventFilter(touch_observer_hud_.get()); | 513 AddEnvEventFilter(touch_observer_hud_.get()); |
| 774 } | 514 } |
| 775 | 515 |
| 776 stacking_controller_.reset(new internal::StackingController); | 516 stacking_controller_.reset(new internal::StackingController); |
| 777 | 517 |
| 778 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); | 518 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); |
| 779 root_window->SetLayoutManager(root_window_layout_); | 519 root_window->SetLayoutManager(root_window_layout_); |
| 780 | 520 |
| 781 event_client_.reset(new internal::EventClientImpl(root_window)); | 521 event_client_.reset(new internal::EventClientImpl(root_window)); |
| 782 | 522 |
| 783 status_area_widget_ = new internal::StatusAreaWidget; | 523 status_area_widget_ = new internal::StatusAreaWidget(); |
| 784 | 524 status_area_widget_->CreateTrayViews(delegate_.get()); |
| 785 system_tray_.reset(new SystemTray()); | |
| 786 status_area_widget_->AddTray(system_tray_.get()); | |
| 787 system_tray_->Initialize(); | |
| 788 | |
| 789 if (delegate_.get()) { | |
| 790 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate( | |
| 791 system_tray_.get())); | |
| 792 } | |
| 793 if (!tray_delegate_.get()) | |
| 794 tray_delegate_.reset(new DummySystemTrayDelegate()); | |
| 795 | |
| 796 system_tray_->CreateItems(); // Called after delegate is created. | |
| 797 | |
| 798 status_area_widget_->Show(); | 525 status_area_widget_->Show(); |
| 799 | 526 |
| 800 // This controller needs to be set before SetupManagedWindowMode. | 527 // This controller needs to be set before SetupManagedWindowMode. |
| 801 desktop_background_controller_.reset( | 528 desktop_background_controller_.reset( |
| 802 new DesktopBackgroundController(root_window)); | 529 new DesktopBackgroundController(root_window)); |
| 803 if (delegate_.get()) | 530 if (delegate_.get()) |
| 804 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); | 531 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); |
| 805 if (!user_wallpaper_delegate_.get()) | 532 if (!user_wallpaper_delegate_.get()) |
| 806 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); | 533 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); |
| 807 | 534 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 if (!shelf_->SetAlignment(alignment)) | 715 if (!shelf_->SetAlignment(alignment)) |
| 989 return; | 716 return; |
| 990 FOR_EACH_OBSERVER(ShellObserver, observers_, | 717 FOR_EACH_OBSERVER(ShellObserver, observers_, |
| 991 OnShelfAlignmentChanged()); | 718 OnShelfAlignmentChanged()); |
| 992 } | 719 } |
| 993 | 720 |
| 994 ShelfAlignment Shell::GetShelfAlignment() { | 721 ShelfAlignment Shell::GetShelfAlignment() { |
| 995 return shelf_->alignment(); | 722 return shelf_->alignment(); |
| 996 } | 723 } |
| 997 | 724 |
| 725 SystemTrayDelegate* Shell::tray_delegate() { |
| 726 return status_area_widget_->system_tray_delegate(); |
| 727 } |
| 728 |
| 729 SystemTray* Shell::system_tray() { |
| 730 return status_area_widget_->system_tray(); |
| 731 } |
| 732 |
| 998 int Shell::GetGridSize() const { | 733 int Shell::GetGridSize() const { |
| 999 return workspace_controller_->workspace_manager()->grid_size(); | 734 return workspace_controller_->workspace_manager()->grid_size(); |
| 1000 } | 735 } |
| 1001 | 736 |
| 1002 bool Shell::IsInMaximizedMode() const { | 737 bool Shell::IsInMaximizedMode() const { |
| 1003 return workspace_controller_->workspace_manager()->IsInMaximizedMode(); | 738 return workspace_controller_->workspace_manager()->IsInMaximizedMode(); |
| 1004 } | 739 } |
| 1005 | 740 |
| 1006 void Shell::InitRootWindowForSecondaryMonitor(aura::RootWindow* root) { | 741 void Shell::InitRootWindowForSecondaryMonitor(aura::RootWindow* root) { |
| 1007 root->set_focus_manager(focus_manager_.get()); | 742 root->set_focus_manager(focus_manager_.get()); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 void Shell::SetCursor(gfx::NativeCursor cursor) { | 808 void Shell::SetCursor(gfx::NativeCursor cursor) { |
| 1074 // TODO(oshima): set cursor to all root windows. | 809 // TODO(oshima): set cursor to all root windows. |
| 1075 GetPrimaryRootWindow()->SetCursor(cursor); | 810 GetPrimaryRootWindow()->SetCursor(cursor); |
| 1076 } | 811 } |
| 1077 | 812 |
| 1078 void Shell::ShowCursor(bool visible) { | 813 void Shell::ShowCursor(bool visible) { |
| 1079 GetPrimaryRootWindow()->ShowCursor(visible); | 814 GetPrimaryRootWindow()->ShowCursor(visible); |
| 1080 } | 815 } |
| 1081 | 816 |
| 1082 } // namespace ash | 817 } // namespace ash |
| OLD | NEW |