| 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/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/system/system_notifier.h" | 10 #include "ash/system/system_notifier.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "ui/message_center/message_center.h" | 24 #include "ui/message_center/message_center.h" |
| 25 #include "ui/message_center/notification.h" | 25 #include "ui/message_center/notification.h" |
| 26 #include "ui/message_center/notification_delegate.h" | 26 #include "ui/message_center/notification_delegate.h" |
| 27 #include "ui/views/controls/image_view.h" | 27 #include "ui/views/controls/image_view.h" |
| 28 #include "ui/views/controls/label.h" | 28 #include "ui/views/controls/label.h" |
| 29 #include "ui/views/layout/box_layout.h" | 29 #include "ui/views/layout/box_layout.h" |
| 30 | 30 |
| 31 using message_center::Notification; | 31 using message_center::Notification; |
| 32 | 32 |
| 33 namespace ash { | 33 namespace ash { |
| 34 namespace internal { | |
| 35 namespace { | 34 namespace { |
| 36 | 35 |
| 37 DisplayManager* GetDisplayManager() { | 36 DisplayManager* GetDisplayManager() { |
| 38 return Shell::GetInstance()->display_manager(); | 37 return Shell::GetInstance()->display_manager(); |
| 39 } | 38 } |
| 40 | 39 |
| 41 base::string16 GetDisplayName(int64 display_id) { | 40 base::string16 GetDisplayName(int64 display_id) { |
| 42 return base::UTF8ToUTF16( | 41 return base::UTF8ToUTF16( |
| 43 GetDisplayManager()->GetDisplayNameForId(display_id)); | 42 GetDisplayManager()->GetDisplayNameForId(display_id)); |
| 44 } | 43 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 case user::LOGGED_IN_LOCALLY_MANAGED: | 122 case user::LOGGED_IN_LOCALLY_MANAGED: |
| 124 case user::LOGGED_IN_KIOSK_APP: | 123 case user::LOGGED_IN_KIOSK_APP: |
| 125 Shell::GetInstance()->system_tray_delegate()->ShowDisplaySettings(); | 124 Shell::GetInstance()->system_tray_delegate()->ShowDisplaySettings(); |
| 126 } | 125 } |
| 127 } | 126 } |
| 128 | 127 |
| 129 } // namespace | 128 } // namespace |
| 130 | 129 |
| 131 const char TrayDisplay::kNotificationId[] = "chrome://settings/display"; | 130 const char TrayDisplay::kNotificationId[] = "chrome://settings/display"; |
| 132 | 131 |
| 133 class DisplayView : public internal::ActionableView { | 132 class DisplayView : public ActionableView { |
| 134 public: | 133 public: |
| 135 explicit DisplayView() { | 134 explicit DisplayView() { |
| 136 SetLayoutManager(new views::BoxLayout( | 135 SetLayoutManager(new views::BoxLayout( |
| 137 views::BoxLayout::kHorizontal, | 136 views::BoxLayout::kHorizontal, |
| 138 kTrayPopupPaddingHorizontal, 0, | 137 kTrayPopupPaddingHorizontal, 0, |
| 139 kTrayPopupPaddingBetweenItems)); | 138 kTrayPopupPaddingBetweenItems)); |
| 140 | 139 |
| 141 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 140 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 142 image_ = new internal::FixedSizedImageView(0, kTrayPopupItemHeight); | 141 image_ = new FixedSizedImageView(0, kTrayPopupItemHeight); |
| 143 image_->SetImage( | 142 image_->SetImage( |
| 144 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_DISPLAY).ToImageSkia()); | 143 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_DISPLAY).ToImageSkia()); |
| 145 AddChildView(image_); | 144 AddChildView(image_); |
| 146 | 145 |
| 147 label_ = new views::Label(); | 146 label_ = new views::Label(); |
| 148 label_->SetMultiLine(true); | 147 label_->SetMultiLine(true); |
| 149 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 148 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 150 AddChildView(label_); | 149 AddChildView(label_); |
| 151 Update(); | 150 Update(); |
| 152 } | 151 } |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 428 |
| 430 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { | 429 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { |
| 431 views::View* view = default_; | 430 views::View* view = default_; |
| 432 if (view) { | 431 if (view) { |
| 433 view->GetAccessibleState(state); | 432 view->GetAccessibleState(state); |
| 434 return true; | 433 return true; |
| 435 } | 434 } |
| 436 return false; | 435 return false; |
| 437 } | 436 } |
| 438 | 437 |
| 439 } // namespace internal | |
| 440 } // namespace ash | 438 } // namespace ash |
| OLD | NEW |