blob: 9b5ce7ebf4ffb4f42a7702357bc917ad4833c48b (
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
|
// 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 "ui/aura_shell/desktop_background_view.h"
#include "base/utf_string_conversions.h"
#include "grit/ui_resources.h"
#include "ui/aura/desktop.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 "views/widget/widget.h"
namespace aura_shell {
namespace internal {
////////////////////////////////////////////////////////////////////////////////
// DesktopBackgroundView, public:
DesktopBackgroundView::DesktopBackgroundView() {
wallpaper_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed(
IDR_AURA_WALLPAPER);
}
DesktopBackgroundView::~DesktopBackgroundView() {
}
////////////////////////////////////////////////////////////////////////////////
// DesktopBackgroundView, views::View overrides:
void DesktopBackgroundView::OnPaint(gfx::Canvas* canvas) {
canvas->TileImageInt(wallpaper_, 0, 0, width(), height());
}
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()->set_name("DesktopBackgroundView");
return desktop_widget;
}
} // namespace internal
} // namespace aura_shell
|