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 std::string GetUserName() OVERRIDE { |
| 195 return "chronos"; |
| 196 } |
| 197 |
| 198 virtual 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 AudioMuted() OVERRIDE { | 212 virtual bool AudioMuted() 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 VolumeLevel() OVERRIDE { | 220 virtual float VolumeLevel() 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 // will soon get better once the new one is ready and the old one goes out | 399 // will soon get better once the new one is ready and the old one goes out |
381 // the door. | 400 // the door. |
382 if (delegate_.get()) | 401 if (delegate_.get()) |
383 status_widget_ = delegate_->CreateStatusArea(); | 402 status_widget_ = delegate_->CreateStatusArea(); |
384 if (!status_widget_) | 403 if (!status_widget_) |
385 status_widget_ = internal::CreateStatusArea(); | 404 status_widget_ = internal::CreateStatusArea(); |
386 status_widget_->GetContentsView()->RemoveAllChildViews(false); | 405 status_widget_->GetContentsView()->RemoveAllChildViews(false); |
387 tray_.reset(new SystemTray()); | 406 tray_.reset(new SystemTray()); |
388 status_widget_->GetContentsView()->AddChildView(tray_.get()); | 407 status_widget_->GetContentsView()->AddChildView(tray_.get()); |
389 | 408 |
| 409 if (delegate_.get()) |
| 410 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate(tray_.get())); |
| 411 if (!tray_delegate_.get()) |
| 412 tray_delegate_.reset(new DummySystemTrayDelegate()); |
| 413 |
390 internal::TrayVolume* tray_volume = new internal::TrayVolume(); | 414 internal::TrayVolume* tray_volume = new internal::TrayVolume(); |
391 internal::TrayBrightness* tray_brightness = new internal::TrayBrightness(); | 415 internal::TrayBrightness* tray_brightness = new internal::TrayBrightness(); |
392 audio_controller_ = tray_volume; | 416 audio_controller_ = tray_volume; |
393 brightness_controller_ = tray_brightness; | 417 brightness_controller_ = tray_brightness; |
394 | 418 |
| 419 tray_->AddTrayItem(new internal::TrayUser()); |
395 tray_->AddTrayItem(tray_volume); | 420 tray_->AddTrayItem(tray_volume); |
396 tray_->AddTrayItem(tray_brightness); | 421 tray_->AddTrayItem(tray_brightness); |
397 tray_->AddTrayItem(new internal::TraySettings()); | 422 tray_->AddTrayItem(new internal::TraySettings()); |
398 | |
399 if (delegate_.get()) | |
400 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate(tray_.get())); | |
401 if (!tray_delegate_.get()) | |
402 tray_delegate_.reset(new DummySystemTrayDelegate()); | |
403 } | 423 } |
404 | 424 |
405 aura::Window* default_container = | 425 aura::Window* default_container = |
406 GetContainer(internal::kShellWindowId_DefaultContainer); | 426 GetContainer(internal::kShellWindowId_DefaultContainer); |
407 launcher_.reset(new Launcher(default_container)); | 427 launcher_.reset(new Launcher(default_container)); |
408 | 428 |
409 if (window_mode_ == MODE_COMPACT) | 429 if (window_mode_ == MODE_COMPACT) |
410 SetupCompactWindowMode(); | 430 SetupCompactWindowMode(); |
411 else | 431 else |
412 SetupNonCompactWindowMode(); | 432 SetupNonCompactWindowMode(); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 | 646 |
627 // Create the desktop background image. | 647 // Create the desktop background image. |
628 SetDesktopBackgroundMode(BACKGROUND_IMAGE); | 648 SetDesktopBackgroundMode(BACKGROUND_IMAGE); |
629 } | 649 } |
630 | 650 |
631 void Shell::ResetLayoutManager(int container_id) { | 651 void Shell::ResetLayoutManager(int container_id) { |
632 GetContainer(container_id)->SetLayoutManager(NULL); | 652 GetContainer(container_id)->SetLayoutManager(NULL); |
633 } | 653 } |
634 | 654 |
635 } // namespace ash | 655 } // namespace ash |
OLD | NEW |