This source file includes following definitions.
- CopyHostContentLayerDelegate
- CopyHostContentLayerDelegate
- OnPaintLayer
- OnDeviceScaleFactorChanged
- PrepareForLayerBoundsChange
- layer_
- StartHideAnimation
#include "ash/wm/boot_splash_screen_chromeos.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/x/x11_util.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_type.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/canvas.h"
namespace ash {
class BootSplashScreen::CopyHostContentLayerDelegate
: public ui::LayerDelegate {
public:
explicit CopyHostContentLayerDelegate(aura::WindowTreeHost* host)
: host_(host) {
}
virtual ~CopyHostContentLayerDelegate() {}
virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE {
ui::CopyAreaToCanvas(host_->GetAcceleratedWidget(),
host_->GetBounds(), gfx::Point(), canvas);
}
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {}
virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE {
return base::Closure();
}
private:
aura::WindowTreeHost* host_;
DISALLOW_COPY_AND_ASSIGN(CopyHostContentLayerDelegate);
};
BootSplashScreen::BootSplashScreen(aura::WindowTreeHost* host)
: layer_delegate_(new CopyHostContentLayerDelegate(host)),
layer_(new ui::Layer(ui::LAYER_TEXTURED)) {
layer_->set_delegate(layer_delegate_.get());
ui::Layer* root_layer = host->window()->layer();
layer_->SetBounds(gfx::Rect(host->window()->bounds().size()));
root_layer->Add(layer_.get());
root_layer->StackAtTop(layer_.get());
}
BootSplashScreen::~BootSplashScreen() {
}
void BootSplashScreen::StartHideAnimation(base::TimeDelta duration) {
ui::ScopedLayerAnimationSettings settings(layer_->GetAnimator());
settings.SetTransitionDuration(duration);
settings.SetPreemptionStrategy(ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
layer_->SetOpacity(0.0f);
}
}