| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/aura_shell/desktop_background_view.h" | 5 #include "ui/aura_shell/desktop_background_view.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
| 9 #include "ui/aura/desktop.h" | 9 #include "ui/aura/desktop.h" |
| 10 #include "ui/aura_shell/aura_shell_export.h" | 10 #include "ui/aura_shell/aura_shell_export.h" |
| 11 #include "ui/aura_shell/shell_window_ids.h" |
| 11 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
| 12 #include "ui/gfx/canvas.h" | 13 #include "ui/gfx/canvas.h" |
| 13 #include "views/widget/widget.h" | 14 #include "views/widget/widget.h" |
| 14 | 15 |
| 15 namespace aura_shell { | 16 namespace aura_shell { |
| 16 namespace internal { | 17 namespace internal { |
| 17 | 18 |
| 18 //////////////////////////////////////////////////////////////////////////////// | 19 //////////////////////////////////////////////////////////////////////////////// |
| 19 // DesktopBackgroundView, public: | 20 // DesktopBackgroundView, public: |
| 20 | 21 |
| 21 DesktopBackgroundView::DesktopBackgroundView() { | 22 DesktopBackgroundView::DesktopBackgroundView() { |
| 22 wallpaper_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed( | 23 wallpaper_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 23 IDR_AURA_WALLPAPER); | 24 IDR_AURA_WALLPAPER); |
| 24 } | 25 } |
| 25 | 26 |
| 26 DesktopBackgroundView::~DesktopBackgroundView() { | 27 DesktopBackgroundView::~DesktopBackgroundView() { |
| 27 } | 28 } |
| 28 | 29 |
| 29 //////////////////////////////////////////////////////////////////////////////// | 30 //////////////////////////////////////////////////////////////////////////////// |
| 30 // DesktopBackgroundView, views::View overrides: | 31 // DesktopBackgroundView, views::View overrides: |
| 31 | 32 |
| 32 void DesktopBackgroundView::OnPaint(gfx::Canvas* canvas) { | 33 void DesktopBackgroundView::OnPaint(gfx::Canvas* canvas) { |
| 33 canvas->TileImageInt(wallpaper_, 0, 0, width(), height()); | 34 canvas->TileImageInt(wallpaper_, 0, 0, width(), height()); |
| 34 } | 35 } |
| 35 | 36 |
| 36 AURA_SHELL_EXPORT views::Widget* CreateDesktopBackground() { | 37 views::Widget* CreateDesktopBackground() { |
| 37 views::Widget* desktop_widget = new views::Widget; | 38 views::Widget* desktop_widget = new views::Widget; |
| 38 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); | 39 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |
| 39 params.bounds = gfx::Rect(0, 0, 1024, 768); | 40 params.parent = aura::Desktop::GetInstance()->window()->GetChildById( |
| 41 aura_shell::internal::kShellWindowId_DesktopBackgroundContainer); |
| 40 DesktopBackgroundView* view = new DesktopBackgroundView; | 42 DesktopBackgroundView* view = new DesktopBackgroundView; |
| 41 params.delegate = view; | 43 params.delegate = view; |
| 42 desktop_widget->Init(params); | 44 desktop_widget->Init(params); |
| 43 desktop_widget->SetContentsView(view); | 45 desktop_widget->SetContentsView(view); |
| 44 desktop_widget->Show(); | 46 desktop_widget->Show(); |
| 45 desktop_widget->GetNativeView()->set_name("DesktopBackgroundView"); | 47 desktop_widget->GetNativeView()->set_name("DesktopBackgroundView"); |
| 46 return desktop_widget; | 48 return desktop_widget; |
| 47 } | 49 } |
| 48 | 50 |
| 49 } // namespace internal | 51 } // namespace internal |
| 50 } // namespace aura_shell | 52 } // namespace aura_shell |
| OLD | NEW |