Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Unified Diff: athena/system/system_ui_impl.cc

Issue 715053003: Introduce system_info as an independent container. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: athena/system/system_ui_impl.cc
diff --git a/athena/system/system_ui_impl.cc b/athena/system/system_ui_impl.cc
index aa65e5e7fe8666ecdcba500f0a8b6260547dde02..f2e254c5a50a7957df3e3148e66228efb305c33c 100644
--- a/athena/system/system_ui_impl.cc
+++ b/athena/system/system_ui_impl.cc
@@ -10,19 +10,35 @@
#include "athena/system/shutdown_dialog.h"
#include "athena/system/status_icon_container_view.h"
#include "athena/system/time_view.h"
+#include "athena/util/athena_constants.h"
#include "athena/util/container_priorities.h"
#include "athena/util/fill_layout_manager.h"
+#include "athena/wm/public/window_manager.h"
+#include "athena/wm/public/window_manager_observer.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "ui/aura/window.h"
+#include "ui/compositor/closure_animation_observer.h"
+#include "ui/compositor/layer.h"
+#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/gfx/animation/tween.h"
+#include "ui/gfx/transform.h"
#include "ui/views/view.h"
+#include "ui/views/widget/widget.h"
namespace athena {
namespace {
SystemUI* instance = nullptr;
+void ClearSystemInfo(views::Widget* widget) {
+ aura::Window* container = widget->GetNativeWindow()->parent();
+ container->Hide();
+ container->parent()->RemoveChild(container);
+ delete container;
+}
+
// View which positions the TimeView on the left and the StatusIconView on the
// right.
class SystemInfoView : public views::View {
@@ -69,15 +85,19 @@ class SystemInfoView : public views::View {
DISALLOW_COPY_AND_ASSIGN(SystemInfoView);
};
-class SystemUIImpl : public SystemUI {
+class SystemUIImpl : public SystemUI, public WindowManagerObserver {
public:
SystemUIImpl(scoped_refptr<base::TaskRunner> blocking_task_runner)
: orientation_controller_(new OrientationController()),
- background_container_(nullptr) {
+ background_container_(nullptr),
+ system_info_widget_(nullptr) {
orientation_controller_->InitWith(blocking_task_runner);
+ WindowManager::Get()->AddObserver(this);
}
~SystemUIImpl() override {
+ WindowManager::Get()->RemoveObserver(this);
+
// Stops file watching now if exists. Waiting until message loop shutdon
// leads to FilePathWatcher crash.
orientation_controller_->Shutdown();
@@ -97,14 +117,58 @@ class SystemUIImpl : public SystemUI {
private:
// SystemUI:
- virtual void SetBackgroundImage(const gfx::ImageSkia& image) override {
+ void SetBackgroundImage(const gfx::ImageSkia& image) override {
background_controller_->SetImage(image);
}
- virtual views::View* CreateSystemInfoView(ColorScheme color_scheme) override {
- return new SystemInfoView(color_scheme);
+ // WindowManagerObserver:
+ void OnOverviewModeEnter() override {
+ DCHECK(!system_info_widget_);
+
+ ScreenManager* screen_manager = ScreenManager::Get();
+ aura::Window* container = screen_manager->CreateContainer(
+ ScreenManager::ContainerParams("SystemInfo", CP_SYSTEM_INFO));
+
+ system_info_widget_ = new views::Widget();
+ views::Widget::InitParams widget_params(
+ views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
+ widget_params.parent = container;
+ widget_params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
+ widget_params.bounds =
+ gfx::Rect(0, 0, container->bounds().width(), kSystemUIHeight);
+ system_info_widget_->Init(widget_params);
+ system_info_widget_->SetContentsView(
+ new SystemInfoView(SystemUI::COLOR_SCHEME_LIGHT));
+ system_info_widget_->Show();
+
+ gfx::Transform transform;
+ transform.Translate(0, SkMScalar(-kSystemUIHeight));
+ system_info_widget_->GetLayer()->SetTransform(transform);
+
+ {
+ ui::ScopedLayerAnimationSettings settings(
+ system_info_widget_->GetLayer()->GetAnimator());
+ settings.SetTweenType(gfx::Tween::EASE_OUT);
+ system_info_widget_->GetLayer()->SetTransform(gfx::Transform());
+ }
+ }
+
+ void OnOverviewModeExit() override {
+ ui::ScopedLayerAnimationSettings settings(
+ system_info_widget_->GetLayer()->GetAnimator());
+ settings.SetTweenType(gfx::Tween::EASE_IN);
+ gfx::Transform transform;
+ transform.Translate(0, SkIntToMScalar(-kSystemUIHeight));
+ system_info_widget_->GetLayer()->SetTransform(transform);
+ settings.AddObserver(new ui::ClosureAnimationObserver(
+ base::Bind(&ClearSystemInfo, system_info_widget_)));
oshima 2014/11/12 20:35:03 It's probably better to use ScopedHidingAnimatinoS
Jun Mukai 2014/11/12 21:39:58 Removed the the code around here and replaced by u
+ system_info_widget_ = nullptr;
}
+ void OnSplitViewModeEnter() override {}
+
+ void OnSplitViewModeExit() override {}
+
scoped_ptr<OrientationController> orientation_controller_;
scoped_ptr<ShutdownDialog> shutdown_dialog_;
scoped_ptr<BackgroundController> background_controller_;
@@ -112,12 +176,7 @@ class SystemUIImpl : public SystemUI {
// The parent container for the background.
aura::Window* background_container_;
- // The parent container used by system modal dialogs.
- aura::Window* system_modal_container_;
-
- // The parent container used by system modal dialogs when the login screen is
- // visible.
- aura::Window* login_screen_system_modal_container_;
+ views::Widget* system_info_widget_;
DISALLOW_COPY_AND_ASSIGN(SystemUIImpl);
};

Powered by Google App Engine
This is Rietveld 408576698