blob: e046a8b21c69d9866d81dda6d506c41449c918a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// Copyright (c) 2011 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 "ash/desktop_background/desktop_background_view.h"
#include "base/utf_string_conversions.h"
#include "grit/ui_resources.h"
#include "ui/aura/root_window.h"
#include "ui/aura_shell/aura_shell_export.h"
#include "ui/aura_shell/shell.h"
#include "ui/aura_shell/shell_window_ids.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/views/widget/widget.h"
namespace aura_shell {
namespace internal {
////////////////////////////////////////////////////////////////////////////////
// DesktopBackgroundView, public:
DesktopBackgroundView::DesktopBackgroundView() {
wallpaper_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed(
IDR_AURA_WALLPAPER);
wallpaper_.buildMipMap(false);
}
DesktopBackgroundView::~DesktopBackgroundView() {
}
////////////////////////////////////////////////////////////////////////////////
// DesktopBackgroundView, views::View overrides:
void DesktopBackgroundView::OnPaint(gfx::Canvas* canvas) {
canvas->DrawBitmapInt(wallpaper_,
0, 0, wallpaper_.width(), wallpaper_.height(),
0, 0, width(), height(),
true);
}
bool DesktopBackgroundView::OnMousePressed(const views::MouseEvent& event) {
return true;
}
void DesktopBackgroundView::OnMouseReleased(const views::MouseEvent& event) {
Shell::GetInstance()->ToggleOverview();
}
views::Widget* CreateDesktopBackground() {
views::Widget* desktop_widget = new views::Widget;
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
DesktopBackgroundView* view = new DesktopBackgroundView;
params.delegate = view;
desktop_widget->Init(params);
Shell::GetInstance()->GetContainer(
aura_shell::internal::kShellWindowId_DesktopBackgroundContainer)->
AddChild(desktop_widget->GetNativeView());
desktop_widget->SetContentsView(view);
desktop_widget->Show();
desktop_widget->GetNativeView()->SetName("DesktopBackgroundView");
return desktop_widget;
}
} // namespace internal
} // namespace aura_shell
|