| 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/system/chromeos/tray_display.h" | 5 #include "ash/system/chromeos/tray_display.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/display/multi_display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/system/tray/system_tray.h" | 11 #include "ash/system/tray/system_tray.h" |
| 12 #include "ash/system/tray/system_tray_delegate.h" | 12 #include "ash/system/tray/system_tray_delegate.h" |
| 13 #include "ash/system/tray/tray_constants.h" | 13 #include "ash/system/tray/tray_constants.h" |
| 14 #include "ash/system/tray/tray_views.h" | 14 #include "ash/system/tray/tray_views.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "grit/ash_resources.h" | 16 #include "grit/ash_resources.h" |
| 17 #include "grit/ash_strings.h" | 17 #include "grit/ash_strings.h" |
| 18 #include "ui/aura/display_manager.h" | |
| 19 #include "ui/aura/env.h" | 18 #include "ui/aura/env.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 22 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
| 23 #include "ui/views/controls/image_view.h" | 22 #include "ui/views/controls/image_view.h" |
| 24 #include "ui/views/controls/label.h" | 23 #include "ui/views/controls/label.h" |
| 25 #include "ui/views/layout/box_layout.h" | 24 #include "ui/views/layout/box_layout.h" |
| 26 | 25 |
| 27 namespace ash { | 26 namespace ash { |
| 28 namespace internal { | 27 namespace internal { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 return; | 70 return; |
| 72 } | 71 } |
| 73 default: | 72 default: |
| 74 NOTREACHED(); | 73 NOTREACHED(); |
| 75 } | 74 } |
| 76 } | 75 } |
| 77 | 76 |
| 78 private: | 77 private: |
| 79 // Returns the name of the currently connected external display. | 78 // Returns the name of the currently connected external display. |
| 80 string16 GetExternalDisplayName() { | 79 string16 GetExternalDisplayName() { |
| 81 MultiDisplayManager* display_manager = static_cast<MultiDisplayManager*>( | 80 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 82 aura::Env::GetInstance()->display_manager()); | |
| 83 | 81 |
| 84 gfx::Display external_display(gfx::Display::kInvalidDisplayID); | 82 gfx::Display external_display(gfx::Display::kInvalidDisplayID); |
| 85 if (display_manager->HasInternalDisplay()) { | 83 if (display_manager->HasInternalDisplay()) { |
| 86 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { | 84 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { |
| 87 gfx::Display* display = display_manager->GetDisplayAt(i); | 85 gfx::Display* display = display_manager->GetDisplayAt(i); |
| 88 if (!display_manager->IsInternalDisplayId(display->id())) { | 86 if (!display_manager->IsInternalDisplayId(display->id())) { |
| 89 external_display = *display; | 87 external_display = *display; |
| 90 break; | 88 break; |
| 91 } | 89 } |
| 92 } | 90 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 111 } | 109 } |
| 112 | 110 |
| 113 user::LoginStatus login_status_; | 111 user::LoginStatus login_status_; |
| 114 views::Label* label_; | 112 views::Label* label_; |
| 115 | 113 |
| 116 DISALLOW_COPY_AND_ASSIGN(DisplayView); | 114 DISALLOW_COPY_AND_ASSIGN(DisplayView); |
| 117 }; | 115 }; |
| 118 | 116 |
| 119 TrayDisplay::TrayDisplay() | 117 TrayDisplay::TrayDisplay() |
| 120 : default_(NULL) { | 118 : default_(NULL) { |
| 121 aura::Env::GetInstance()->display_manager()->AddObserver(this); | 119 Shell::GetScreen()->AddObserver(this); |
| 122 ash::Shell::GetInstance()->output_configurator()->AddObserver(this); | 120 Shell::GetInstance()->output_configurator()->AddObserver(this); |
| 123 } | 121 } |
| 124 | 122 |
| 125 TrayDisplay::~TrayDisplay() { | 123 TrayDisplay::~TrayDisplay() { |
| 126 aura::Env::GetInstance()->display_manager()->RemoveObserver(this); | 124 Shell::GetScreen()->RemoveObserver(this); |
| 127 ash::Shell::GetInstance()->output_configurator()->RemoveObserver(this); | 125 Shell::GetInstance()->output_configurator()->RemoveObserver(this); |
| 128 } | 126 } |
| 129 | 127 |
| 130 views::View* TrayDisplay::CreateDefaultView(user::LoginStatus status) { | 128 views::View* TrayDisplay::CreateDefaultView(user::LoginStatus status) { |
| 131 default_ = new DisplayView(status); | 129 default_ = new DisplayView(status); |
| 132 return default_; | 130 return default_; |
| 133 } | 131 } |
| 134 | 132 |
| 135 void TrayDisplay::DestroyDefaultView() { | 133 void TrayDisplay::DestroyDefaultView() { |
| 136 default_ = NULL; | 134 default_ = NULL; |
| 137 } | 135 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 151 default_->Update(); | 149 default_->Update(); |
| 152 } | 150 } |
| 153 | 151 |
| 154 void TrayDisplay::OnDisplayModeChanged() { | 152 void TrayDisplay::OnDisplayModeChanged() { |
| 155 if (default_) | 153 if (default_) |
| 156 default_->Update(); | 154 default_->Update(); |
| 157 } | 155 } |
| 158 | 156 |
| 159 } // namespace internal | 157 } // namespace internal |
| 160 } // namespace ash | 158 } // namespace ash |
| OLD | NEW |