| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 SetVisible(!message.empty()); | 163 SetVisible(!message.empty()); |
| 164 label_->SetText(message); | 164 label_->SetText(message); |
| 165 SetAccessibleName(message); | 165 SetAccessibleName(message); |
| 166 Layout(); | 166 Layout(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 const views::Label* label() const { return label_; } | 169 const views::Label* label() const { return label_; } |
| 170 | 170 |
| 171 // Overridden from views::View. | 171 // Overridden from views::View. |
| 172 virtual bool GetTooltipText(const gfx::Point& p, | 172 virtual bool GetTooltipText(const gfx::Point& p, |
| 173 base::string16* tooltip) const OVERRIDE { | 173 base::string16* tooltip) const override { |
| 174 base::string16 tray_message = GetTrayDisplayMessage(NULL); | 174 base::string16 tray_message = GetTrayDisplayMessage(NULL); |
| 175 base::string16 display_message = GetAllDisplayInfo(); | 175 base::string16 display_message = GetAllDisplayInfo(); |
| 176 if (tray_message.empty() && display_message.empty()) | 176 if (tray_message.empty() && display_message.empty()) |
| 177 return false; | 177 return false; |
| 178 | 178 |
| 179 *tooltip = tray_message + base::ASCIIToUTF16("\n") + display_message; | 179 *tooltip = tray_message + base::ASCIIToUTF16("\n") + display_message; |
| 180 return true; | 180 return true; |
| 181 } | 181 } |
| 182 | 182 |
| 183 // Returns the name of the currently connected external display. | 183 // Returns the name of the currently connected external display. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 bool ShouldShowFirstDisplayInfo() const { | 262 bool ShouldShowFirstDisplayInfo() const { |
| 263 const DisplayInfo& display_info = GetDisplayManager()->GetDisplayInfo( | 263 const DisplayInfo& display_info = GetDisplayManager()->GetDisplayInfo( |
| 264 GetDisplayManager()->first_display_id()); | 264 GetDisplayManager()->first_display_id()); |
| 265 return display_info.rotation() != gfx::Display::ROTATE_0 || | 265 return display_info.rotation() != gfx::Display::ROTATE_0 || |
| 266 display_info.configured_ui_scale() != 1.0f || | 266 display_info.configured_ui_scale() != 1.0f || |
| 267 !display_info.overscan_insets_in_dip().empty() || | 267 !display_info.overscan_insets_in_dip().empty() || |
| 268 display_info.has_overscan(); | 268 display_info.has_overscan(); |
| 269 } | 269 } |
| 270 | 270 |
| 271 // Overridden from ActionableView. | 271 // Overridden from ActionableView. |
| 272 virtual bool PerformAction(const ui::Event& event) OVERRIDE { | 272 virtual bool PerformAction(const ui::Event& event) override { |
| 273 OpenSettings(); | 273 OpenSettings(); |
| 274 return true; | 274 return true; |
| 275 } | 275 } |
| 276 | 276 |
| 277 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE { | 277 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override { |
| 278 int label_max_width = bounds().width() - kTrayPopupPaddingHorizontal * 2 - | 278 int label_max_width = bounds().width() - kTrayPopupPaddingHorizontal * 2 - |
| 279 kTrayPopupPaddingBetweenItems - image_->GetPreferredSize().width(); | 279 kTrayPopupPaddingBetweenItems - image_->GetPreferredSize().width(); |
| 280 label_->SizeToFit(label_max_width); | 280 label_->SizeToFit(label_max_width); |
| 281 } | 281 } |
| 282 | 282 |
| 283 views::ImageView* image_; | 283 views::ImageView* image_; |
| 284 views::Label* label_; | 284 views::Label* label_; |
| 285 | 285 |
| 286 DISALLOW_COPY_AND_ASSIGN(DisplayView); | 286 DISALLOW_COPY_AND_ASSIGN(DisplayView); |
| 287 }; | 287 }; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { | 441 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { |
| 442 views::View* view = default_; | 442 views::View* view = default_; |
| 443 if (view) { | 443 if (view) { |
| 444 view->GetAccessibleState(state); | 444 view->GetAccessibleState(state); |
| 445 return true; | 445 return true; |
| 446 } | 446 } |
| 447 return false; | 447 return false; |
| 448 } | 448 } |
| 449 | 449 |
| 450 } // namespace ash | 450 } // namespace ash |
| OLD | NEW |