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

Unified Diff: athena/screen/background_controller.cc

Issue 483363003: [Athena] Add status icons and system time to the desktop background (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months 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/screen/background_controller.cc
diff --git a/athena/screen/background_controller.cc b/athena/screen/background_controller.cc
deleted file mode 100644
index bcdf40fa15d46b9cc05a059561b5661ca752b73a..0000000000000000000000000000000000000000
--- a/athena/screen/background_controller.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "athena/screen/background_controller.h"
-
-#include "base/strings/stringprintf.h"
-#include "base/strings/utf_string_conversions.h"
-#include "extensions/shell/common/version.h"
-#include "third_party/skia/include/core/SkColor.h"
-#include "ui/aura/window.h"
-#include "ui/compositor/layer.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/image/image_skia.h"
-#include "ui/views/controls/label.h"
-#include "ui/views/view.h"
-#include "ui/views/widget/widget.h"
-
-namespace athena {
-
-namespace {
-
-const SkColor kVersionColor = SK_ColorWHITE;
-const SkColor kVersionBackground = SK_ColorTRANSPARENT;
-const SkColor kVersionShadow = 0xB0000000;
-const int kVersionShadowBlur = 10;
-
-class VersionView : public views::Label {
- public:
- VersionView() {
- SetEnabledColor(kVersionColor);
- SetBackgroundColor(kVersionBackground);
- SetShadows(gfx::ShadowValues(1, gfx::ShadowValue(gfx::Point(0, 1),
- kVersionShadowBlur,
- kVersionShadow)));
- SetText(base::UTF8ToUTF16(base::StringPrintf("%s (Build %s)",
- PRODUCT_VERSION,
- LAST_CHANGE)));
- SetBoundsRect(gfx::Rect(gfx::Point(), GetPreferredSize()));
- }
- virtual ~VersionView() {
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(VersionView);
-};
-
-} // namespace
-
-class BackgroundView : public views::View {
- public:
- BackgroundView() {
- AddChildView(new VersionView);
- }
- virtual ~BackgroundView() {}
-
- void SetImage(const gfx::ImageSkia& image) {
- image_ = image;
- SchedulePaint();
- }
-
- // views::View
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
- canvas->DrawImageInt(image_,
- 0,
- 0,
- image_.width(),
- image_.height(),
- 0,
- 0,
- width(),
- height(),
- true);
- }
-
- private:
- gfx::ImageSkia image_;
-
- DISALLOW_COPY_AND_ASSIGN(BackgroundView);
-};
-
-BackgroundController::BackgroundController(aura::Window* container) {
- // TODO(oshima): Using widget to just draw an image is probably
- // overkill. Just use WindowDelegate to draw the background and
- // remove dependency to ui/views.
-
- views::Widget* background_widget = new views::Widget;
- views::Widget::InitParams params(
- views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
- params.accept_events = false;
- params.parent = container;
- background_widget->Init(params);
- background_widget->GetNativeWindow()->layer()->SetMasksToBounds(true);
- background_view_ = new BackgroundView;
- background_widget->SetContentsView(background_view_);
- background_widget->GetNativeView()->SetName("BackgroundWidget");
- background_widget->Show();
-}
-
-BackgroundController::~BackgroundController() {
- // background_widget is owned by the container and will be deleted
- // when the container is deleted.
-}
-
-void BackgroundController::SetImage(const gfx::ImageSkia& image) {
- // TODO(oshima): implement cross fede animation.
- background_view_->SetImage(image);
-}
-
-} // namespace athena

Powered by Google App Engine
This is Rietveld 408576698