| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/system/public/system_ui.h" | 5 #include "athena/system/public/system_ui.h" |
| 6 | 6 |
| 7 #include "athena/screen/public/screen_manager.h" | 7 #include "athena/screen/public/screen_manager.h" |
| 8 #include "athena/system/background_controller.h" | 8 #include "athena/system/background_controller.h" |
| 9 #include "athena/system/orientation_controller.h" | 9 #include "athena/system/orientation_controller.h" |
| 10 #include "athena/system/power_button_controller.h" | 10 #include "athena/system/power_button_controller.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 status_icon_view_( | 33 status_icon_view_( |
| 34 new StatusIconContainerView(color_scheme, system_modal_container)) { | 34 new StatusIconContainerView(color_scheme, system_modal_container)) { |
| 35 AddChildView(time_view_); | 35 AddChildView(time_view_); |
| 36 AddChildView(status_icon_view_); | 36 AddChildView(status_icon_view_); |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual ~SystemInfoView() { | 39 virtual ~SystemInfoView() { |
| 40 } | 40 } |
| 41 | 41 |
| 42 // views::View: | 42 // views::View: |
| 43 virtual gfx::Size GetPreferredSize() const OVERRIDE { | 43 virtual gfx::Size GetPreferredSize() const override { |
| 44 // The view should be as wide as its parent view. | 44 // The view should be as wide as its parent view. |
| 45 return gfx::Size(0, | 45 return gfx::Size(0, |
| 46 std::max(time_view_->GetPreferredSize().height(), | 46 std::max(time_view_->GetPreferredSize().height(), |
| 47 status_icon_view_->GetPreferredSize().height())); | 47 status_icon_view_->GetPreferredSize().height())); |
| 48 } | 48 } |
| 49 | 49 |
| 50 virtual void Layout() OVERRIDE { | 50 virtual void Layout() override { |
| 51 time_view_->SetBoundsRect(gfx::Rect(time_view_->GetPreferredSize())); | 51 time_view_->SetBoundsRect(gfx::Rect(time_view_->GetPreferredSize())); |
| 52 gfx::Size status_icon_preferred_size = | 52 gfx::Size status_icon_preferred_size = |
| 53 status_icon_view_->GetPreferredSize(); | 53 status_icon_view_->GetPreferredSize(); |
| 54 status_icon_view_->SetBoundsRect( | 54 status_icon_view_->SetBoundsRect( |
| 55 gfx::Rect(width() - status_icon_preferred_size.width(), | 55 gfx::Rect(width() - status_icon_preferred_size.width(), |
| 56 0, | 56 0, |
| 57 status_icon_preferred_size.width(), | 57 status_icon_preferred_size.width(), |
| 58 status_icon_preferred_size.height())); | 58 status_icon_preferred_size.height())); |
| 59 } | 59 } |
| 60 | 60 |
| 61 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE { | 61 virtual void ChildPreferredSizeChanged(views::View* child) override { |
| 62 // Relayout to take into account changes in |status_icon_view_|'s width. | 62 // Relayout to take into account changes in |status_icon_view_|'s width. |
| 63 // Assume that |time_view_|'s and |status_icon_view_|'s preferred height | 63 // Assume that |time_view_|'s and |status_icon_view_|'s preferred height |
| 64 // does not change. | 64 // does not change. |
| 65 Layout(); | 65 Layout(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 views::View* time_view_; | 69 views::View* time_view_; |
| 70 views::View* status_icon_view_; | 70 views::View* status_icon_view_; |
| 71 | 71 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // Use |login_screen_system_modal_container_| for the power button's dialog | 105 // Use |login_screen_system_modal_container_| for the power button's dialog |
| 106 // because it needs to show over the login screen. | 106 // because it needs to show over the login screen. |
| 107 // TODO(pkotwicz): Pick the most appropriate container based on whether the | 107 // TODO(pkotwicz): Pick the most appropriate container based on whether the |
| 108 // user has logged in. | 108 // user has logged in. |
| 109 power_button_controller_.reset( | 109 power_button_controller_.reset( |
| 110 new PowerButtonController(login_screen_system_modal_container_)); | 110 new PowerButtonController(login_screen_system_modal_container_)); |
| 111 background_controller_.reset( | 111 background_controller_.reset( |
| 112 new BackgroundController(background_container_)); | 112 new BackgroundController(background_container_)); |
| 113 } | 113 } |
| 114 | 114 |
| 115 virtual void SetBackgroundImage(const gfx::ImageSkia& image) OVERRIDE { | 115 virtual void SetBackgroundImage(const gfx::ImageSkia& image) override { |
| 116 background_controller_->SetImage(image); | 116 background_controller_->SetImage(image); |
| 117 } | 117 } |
| 118 | 118 |
| 119 virtual views::View* CreateSystemInfoView(ColorScheme color_scheme) OVERRIDE { | 119 virtual views::View* CreateSystemInfoView(ColorScheme color_scheme) override { |
| 120 return new SystemInfoView(color_scheme, system_modal_container_); | 120 return new SystemInfoView(color_scheme, system_modal_container_); |
| 121 } | 121 } |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 scoped_ptr<OrientationController> orientation_controller_; | 124 scoped_ptr<OrientationController> orientation_controller_; |
| 125 scoped_ptr<PowerButtonController> power_button_controller_; | 125 scoped_ptr<PowerButtonController> power_button_controller_; |
| 126 scoped_ptr<BackgroundController> background_controller_; | 126 scoped_ptr<BackgroundController> background_controller_; |
| 127 | 127 |
| 128 // The parent container for the background. | 128 // The parent container for the background. |
| 129 aura::Window* background_container_; | 129 aura::Window* background_container_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 156 } | 156 } |
| 157 | 157 |
| 158 // static | 158 // static |
| 159 void SystemUI::Shutdown() { | 159 void SystemUI::Shutdown() { |
| 160 CHECK(instance); | 160 CHECK(instance); |
| 161 delete instance; | 161 delete instance; |
| 162 instance = NULL; | 162 instance = NULL; |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace athena | 165 } // namespace athena |
| OLD | NEW |