| 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/status_area_view.h" | 5 #include "ui/aura_shell/status_area_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 StatusAreaView::StatusAreaView() | 19 StatusAreaView::StatusAreaView() |
| 19 : status_mock_(*ResourceBundle::GetSharedInstance().GetBitmapNamed( | 20 : status_mock_(*ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 20 IDR_AURA_STATUS_MOCK)) { | 21 IDR_AURA_STATUS_MOCK)) { |
| 21 } | 22 } |
| 22 StatusAreaView::~StatusAreaView() { | 23 StatusAreaView::~StatusAreaView() { |
| 23 } | 24 } |
| 24 | 25 |
| 25 gfx::Size StatusAreaView::GetPreferredSize() { | 26 gfx::Size StatusAreaView::GetPreferredSize() { |
| 26 return gfx::Size(status_mock_.width(), status_mock_.height()); | 27 return gfx::Size(status_mock_.width(), status_mock_.height()); |
| 27 } | 28 } |
| 28 | 29 |
| 29 void StatusAreaView::OnPaint(gfx::Canvas* canvas) { | 30 void StatusAreaView::OnPaint(gfx::Canvas* canvas) { |
| 30 canvas->DrawBitmapInt(status_mock_, 0, 0); | 31 canvas->DrawBitmapInt(status_mock_, 0, 0); |
| 31 } | 32 } |
| 32 | 33 |
| 33 AURA_SHELL_EXPORT views::Widget* CreateStatusArea() { | 34 views::Widget* CreateStatusArea() { |
| 34 StatusAreaView* status_area_view = new StatusAreaView; | 35 StatusAreaView* status_area_view = new StatusAreaView; |
| 35 views::Widget* widget = new views::Widget; | 36 views::Widget* widget = new views::Widget; |
| 36 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); | 37 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |
| 37 gfx::Size ps = status_area_view->GetPreferredSize(); | 38 gfx::Size ps = status_area_view->GetPreferredSize(); |
| 38 params.bounds = gfx::Rect(0, 0, ps.width(), ps.height()); | 39 params.bounds = gfx::Rect(0, 0, ps.width(), ps.height()); |
| 40 params.parent = aura::Desktop::GetInstance()->window()->GetChildById( |
| 41 aura_shell::internal::kShellWindowId_StatusContainer); |
| 39 params.delegate = status_area_view; | 42 params.delegate = status_area_view; |
| 40 widget->Init(params); | 43 widget->Init(params); |
| 41 widget->SetContentsView(status_area_view); | 44 widget->SetContentsView(status_area_view); |
| 42 widget->Show(); | 45 widget->Show(); |
| 43 widget->GetNativeView()->set_name("StatusAreaView"); | 46 widget->GetNativeView()->set_name("StatusAreaView"); |
| 44 return widget; | 47 return widget; |
| 45 } | 48 } |
| 46 | 49 |
| 47 } // namespace internal | 50 } // namespace internal |
| 48 } // namespace aura_shell | 51 } // namespace aura_shell |
| OLD | NEW |