| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/shell/panel_window.h" | 5 #include "ash/shell/panel_window.h" |
| 6 | 6 |
| 7 #include "ash/common/wm/panels/panel_frame_view.h" | 7 #include "ash/common/wm/panels/panel_frame_view.h" |
| 8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wm/window_properties.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 11 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
| 12 #include "ui/aura/window_event_dispatcher.h" | |
| 13 #include "ui/gfx/canvas.h" | 13 #include "ui/gfx/canvas.h" |
| 14 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 const int kMinWidth = 100; | 17 const int kMinWidth = 100; |
| 18 const int kMinHeight = 100; | 18 const int kMinHeight = 100; |
| 19 const int kDefaultWidth = 200; | 19 const int kDefaultWidth = 200; |
| 20 const int kDefaultHeight = 300; | 20 const int kDefaultHeight = 300; |
| 21 } | 21 } |
| 22 | 22 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 42 | 42 |
| 43 if (params().bounds.width() == 0) | 43 if (params().bounds.width() == 0) |
| 44 params().bounds.set_width(kDefaultWidth); | 44 params().bounds.set_width(kDefaultWidth); |
| 45 if (params().bounds.height() == 0) | 45 if (params().bounds.height() == 0) |
| 46 params().bounds.set_height(kDefaultHeight); | 46 params().bounds.set_height(kDefaultHeight); |
| 47 params().bounds = ScreenUtil::ConvertRectToScreen( | 47 params().bounds = ScreenUtil::ConvertRectToScreen( |
| 48 Shell::GetTargetRootWindow(), params().bounds); | 48 Shell::GetTargetRootWindow(), params().bounds); |
| 49 | 49 |
| 50 widget->Init(params()); | 50 widget->Init(params()); |
| 51 widget->GetNativeView()->SetName(name_); | 51 widget->GetNativeView()->SetName(name_); |
| 52 widget->GetNativeWindow()->SetProperty<int>(kShelfItemTypeKey, |
| 53 TYPE_APP_PANEL); |
| 52 widget->Show(); | 54 widget->Show(); |
| 53 | 55 |
| 54 return widget; | 56 return widget; |
| 55 } | 57 } |
| 56 | 58 |
| 57 gfx::Size PanelWindow::GetPreferredSize() const { | 59 gfx::Size PanelWindow::GetPreferredSize() const { |
| 58 return gfx::Size(kMinWidth, kMinHeight); | 60 return gfx::Size(kMinWidth, kMinHeight); |
| 59 } | 61 } |
| 60 | 62 |
| 61 void PanelWindow::OnPaint(gfx::Canvas* canvas) { | 63 void PanelWindow::OnPaint(gfx::Canvas* canvas) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 77 bool PanelWindow::CanMinimize() const { | 79 bool PanelWindow::CanMinimize() const { |
| 78 return false; | 80 return false; |
| 79 } | 81 } |
| 80 | 82 |
| 81 views::NonClientFrameView* PanelWindow::CreateNonClientFrameView( | 83 views::NonClientFrameView* PanelWindow::CreateNonClientFrameView( |
| 82 views::Widget* widget) { | 84 views::Widget* widget) { |
| 83 return new PanelFrameView(widget, PanelFrameView::FRAME_NONE); | 85 return new PanelFrameView(widget, PanelFrameView::FRAME_NONE); |
| 84 } | 86 } |
| 85 | 87 |
| 86 } // namespace ash | 88 } // namespace ash |
| OLD | NEW |