| 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 | 8 |
| 9 #include "ash/app_list/app_list.h" | 9 #include "ash/app_list/app_list.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| 11 #include "ash/drag_drop/drag_drop_controller.h" | 11 #include "ash/drag_drop/drag_drop_controller.h" |
| 12 #include "ash/focus_cycler.h" | 12 #include "ash/focus_cycler.h" |
| 13 #include "ash/ime/input_method_event_filter.h" | 13 #include "ash/ime/input_method_event_filter.h" |
| 14 #include "ash/launcher/launcher.h" | 14 #include "ash/launcher/launcher.h" |
| 15 #include "ash/shell_delegate.h" | 15 #include "ash/shell_delegate.h" |
| 16 #include "ash/shell_factory.h" | 16 #include "ash/shell_factory.h" |
| 17 #include "ash/shell_window_ids.h" | 17 #include "ash/shell_window_ids.h" |
| 18 #include "ash/system/audio/tray_volume.h" | 18 #include "ash/system/audio/tray_volume.h" |
| 19 #include "ash/system/brightness/tray_brightness.h" | 19 #include "ash/system/brightness/tray_brightness.h" |
| 20 #include "ash/system/settings/tray_settings.h" | 20 #include "ash/system/settings/tray_settings.h" |
| 21 #include "ash/system/tray/system_tray_delegate.h" | 21 #include "ash/system/tray/system_tray_delegate.h" |
| 22 #include "ash/system/tray/system_tray.h" | 22 #include "ash/system/tray/system_tray.h" |
| 23 #include "ash/system/tray_user.h" |
| 23 #include "ash/tooltips/tooltip_controller.h" | 24 #include "ash/tooltips/tooltip_controller.h" |
| 24 #include "ash/wm/activation_controller.h" | 25 #include "ash/wm/activation_controller.h" |
| 25 #include "ash/wm/base_layout_manager.h" | 26 #include "ash/wm/base_layout_manager.h" |
| 26 #include "ash/wm/compact_layout_manager.h" | 27 #include "ash/wm/compact_layout_manager.h" |
| 27 #include "ash/wm/compact_status_area_layout_manager.h" | 28 #include "ash/wm/compact_status_area_layout_manager.h" |
| 28 #include "ash/wm/dialog_frame_view.h" | 29 #include "ash/wm/dialog_frame_view.h" |
| 29 #include "ash/wm/panel_window_event_filter.h" | 30 #include "ash/wm/panel_window_event_filter.h" |
| 30 #include "ash/wm/panel_layout_manager.h" | 31 #include "ash/wm/panel_layout_manager.h" |
| 31 #include "ash/wm/partial_screenshot_event_filter.h" | 32 #include "ash/wm/partial_screenshot_event_filter.h" |
| 32 #include "ash/wm/power_button_controller.h" | 33 #include "ash/wm/power_button_controller.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 43 #include "ash/wm/visibility_controller.h" | 44 #include "ash/wm/visibility_controller.h" |
| 44 #include "ash/wm/window_cycle_controller.h" | 45 #include "ash/wm/window_cycle_controller.h" |
| 45 #include "ash/wm/window_modality_controller.h" | 46 #include "ash/wm/window_modality_controller.h" |
| 46 #include "ash/wm/window_util.h" | 47 #include "ash/wm/window_util.h" |
| 47 #include "ash/wm/workspace_controller.h" | 48 #include "ash/wm/workspace_controller.h" |
| 48 #include "ash/wm/workspace/workspace_event_filter.h" | 49 #include "ash/wm/workspace/workspace_event_filter.h" |
| 49 #include "ash/wm/workspace/workspace_layout_manager.h" | 50 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 50 #include "ash/wm/workspace/workspace_manager.h" | 51 #include "ash/wm/workspace/workspace_manager.h" |
| 51 #include "base/bind.h" | 52 #include "base/bind.h" |
| 52 #include "base/command_line.h" | 53 #include "base/command_line.h" |
| 54 #include "third_party/skia/include/core/SkBitmap.h" |
| 53 #include "ui/aura/client/aura_constants.h" | 55 #include "ui/aura/client/aura_constants.h" |
| 54 #include "ui/aura/layout_manager.h" | 56 #include "ui/aura/layout_manager.h" |
| 55 #include "ui/aura/root_window.h" | 57 #include "ui/aura/root_window.h" |
| 56 #include "ui/aura/window.h" | 58 #include "ui/aura/window.h" |
| 57 #include "ui/gfx/compositor/layer.h" | 59 #include "ui/gfx/compositor/layer.h" |
| 58 #include "ui/gfx/compositor/layer_animator.h" | 60 #include "ui/gfx/compositor/layer_animator.h" |
| 59 #include "ui/gfx/screen.h" | 61 #include "ui/gfx/screen.h" |
| 60 #include "ui/gfx/size.h" | 62 #include "ui/gfx/size.h" |
| 61 #include "ui/views/widget/native_widget_aura.h" | 63 #include "ui/views/widget/native_widget_aura.h" |
| 62 #include "ui/views/widget/widget.h" | 64 #include "ui/views/widget/widget.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 DummySystemTrayDelegate() | 184 DummySystemTrayDelegate() |
| 183 : muted_(false), | 185 : muted_(false), |
| 184 volume_(0.5) { | 186 volume_(0.5) { |
| 185 } | 187 } |
| 186 | 188 |
| 187 virtual ~DummySystemTrayDelegate() {} | 189 virtual ~DummySystemTrayDelegate() {} |
| 188 | 190 |
| 189 private: | 191 private: |
| 190 | 192 |
| 191 // SystemTrayDelegate implementation. | 193 // SystemTrayDelegate implementation. |
| 194 virtual const std::string GetUserDisplayName() OVERRIDE { |
| 195 return "chronos"; |
| 196 } |
| 197 |
| 198 virtual const std::string GetUserEmail() OVERRIDE { |
| 199 return "chr@nos"; |
| 200 } |
| 201 |
| 202 virtual const SkBitmap& GetUserImage() OVERRIDE { |
| 203 return null_image_; |
| 204 } |
| 205 |
| 192 virtual void ShowSettings() OVERRIDE { | 206 virtual void ShowSettings() OVERRIDE { |
| 193 } | 207 } |
| 194 | 208 |
| 195 virtual void ShowHelp() OVERRIDE { | 209 virtual void ShowHelp() OVERRIDE { |
| 196 } | 210 } |
| 197 | 211 |
| 198 virtual bool IsAudioMuted() const OVERRIDE { | 212 virtual bool IsAudioMuted() const OVERRIDE { |
| 199 return muted_; | 213 return muted_; |
| 200 } | 214 } |
| 201 | 215 |
| 202 virtual void SetAudioMuted(bool muted) OVERRIDE { | 216 virtual void SetAudioMuted(bool muted) OVERRIDE { |
| 203 muted_ = muted; | 217 muted_ = muted; |
| 204 } | 218 } |
| 205 | 219 |
| 206 virtual float GetVolumeLevel() const OVERRIDE { | 220 virtual float GetVolumeLevel() const OVERRIDE { |
| 207 return volume_; | 221 return volume_; |
| 208 } | 222 } |
| 209 | 223 |
| 210 virtual void SetVolumeLevel(float volume) OVERRIDE { | 224 virtual void SetVolumeLevel(float volume) OVERRIDE { |
| 211 volume_ = volume; | 225 volume_ = volume; |
| 212 } | 226 } |
| 213 | 227 |
| 228 virtual void ShutDown() OVERRIDE {} |
| 229 virtual void SignOut() OVERRIDE {} |
| 230 virtual void LockScreen() OVERRIDE {} |
| 231 |
| 214 bool muted_; | 232 bool muted_; |
| 215 float volume_; | 233 float volume_; |
| 234 SkBitmap null_image_; |
| 216 | 235 |
| 217 DISALLOW_COPY_AND_ASSIGN(DummySystemTrayDelegate); | 236 DISALLOW_COPY_AND_ASSIGN(DummySystemTrayDelegate); |
| 218 }; | 237 }; |
| 219 | 238 |
| 220 } // namespace | 239 } // namespace |
| 221 | 240 |
| 222 // static | 241 // static |
| 223 Shell* Shell::instance_ = NULL; | 242 Shell* Shell::instance_ = NULL; |
| 224 // static | 243 // static |
| 225 bool Shell::compact_window_mode_for_test_ = false; | 244 bool Shell::compact_window_mode_for_test_ = false; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // will soon get better once the new one is ready and the old one goes out | 408 // will soon get better once the new one is ready and the old one goes out |
| 390 // the door. | 409 // the door. |
| 391 if (delegate_.get()) | 410 if (delegate_.get()) |
| 392 status_widget_ = delegate_->CreateStatusArea(); | 411 status_widget_ = delegate_->CreateStatusArea(); |
| 393 if (!status_widget_) | 412 if (!status_widget_) |
| 394 status_widget_ = internal::CreateStatusArea(); | 413 status_widget_ = internal::CreateStatusArea(); |
| 395 status_widget_->GetContentsView()->RemoveAllChildViews(false); | 414 status_widget_->GetContentsView()->RemoveAllChildViews(false); |
| 396 tray_.reset(new SystemTray()); | 415 tray_.reset(new SystemTray()); |
| 397 status_widget_->GetContentsView()->AddChildView(tray_.get()); | 416 status_widget_->GetContentsView()->AddChildView(tray_.get()); |
| 398 | 417 |
| 418 if (delegate_.get()) |
| 419 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate(tray_.get())); |
| 420 if (!tray_delegate_.get()) |
| 421 tray_delegate_.reset(new DummySystemTrayDelegate()); |
| 422 |
| 399 internal::TrayVolume* tray_volume = new internal::TrayVolume(); | 423 internal::TrayVolume* tray_volume = new internal::TrayVolume(); |
| 400 internal::TrayBrightness* tray_brightness = new internal::TrayBrightness(); | 424 internal::TrayBrightness* tray_brightness = new internal::TrayBrightness(); |
| 401 audio_controller_ = tray_volume; | 425 audio_controller_ = tray_volume; |
| 402 brightness_controller_ = tray_brightness; | 426 brightness_controller_ = tray_brightness; |
| 403 | 427 |
| 428 tray_->AddTrayItem(new internal::TrayUser()); |
| 404 tray_->AddTrayItem(tray_volume); | 429 tray_->AddTrayItem(tray_volume); |
| 405 tray_->AddTrayItem(tray_brightness); | 430 tray_->AddTrayItem(tray_brightness); |
| 406 tray_->AddTrayItem(new internal::TraySettings()); | 431 tray_->AddTrayItem(new internal::TraySettings()); |
| 407 | |
| 408 if (delegate_.get()) | |
| 409 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate(tray_.get())); | |
| 410 if (!tray_delegate_.get()) | |
| 411 tray_delegate_.reset(new DummySystemTrayDelegate()); | |
| 412 } | 432 } |
| 413 | 433 |
| 414 aura::Window* default_container = | 434 aura::Window* default_container = |
| 415 GetContainer(internal::kShellWindowId_DefaultContainer); | 435 GetContainer(internal::kShellWindowId_DefaultContainer); |
| 416 launcher_.reset(new Launcher(default_container)); | 436 launcher_.reset(new Launcher(default_container)); |
| 417 | 437 |
| 418 if (window_mode_ == MODE_COMPACT) | 438 if (window_mode_ == MODE_COMPACT) |
| 419 SetupCompactWindowMode(); | 439 SetupCompactWindowMode(); |
| 420 else | 440 else |
| 421 SetupNonCompactWindowMode(); | 441 SetupNonCompactWindowMode(); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 | 655 |
| 636 // Create the desktop background image. | 656 // Create the desktop background image. |
| 637 SetDesktopBackgroundMode(BACKGROUND_IMAGE); | 657 SetDesktopBackgroundMode(BACKGROUND_IMAGE); |
| 638 } | 658 } |
| 639 | 659 |
| 640 void Shell::ResetLayoutManager(int container_id) { | 660 void Shell::ResetLayoutManager(int container_id) { |
| 641 GetContainer(container_id)->SetLayoutManager(NULL); | 661 GetContainer(container_id)->SetLayoutManager(NULL); |
| 642 } | 662 } |
| 643 | 663 |
| 644 } // namespace ash | 664 } // namespace ash |
| OLD | NEW |