| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/wm/overview/window_selector_item.h" | 5 #include "ash/wm/overview/window_selector_item.h" |
| 6 | 6 |
| 7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/wm/overview/scoped_transform_overview_window.h" | 10 #include "ash/wm/overview/scoped_transform_overview_window.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 static const int kVerticalShadowOffset = 1; | 71 static const int kVerticalShadowOffset = 1; |
| 72 | 72 |
| 73 // Amount of blur applied to the label shadow | 73 // Amount of blur applied to the label shadow |
| 74 static const int kShadowBlur = 10; | 74 static const int kShadowBlur = 10; |
| 75 | 75 |
| 76 const int WindowSelectorItem::kFadeInMilliseconds = 80; | 76 const int WindowSelectorItem::kFadeInMilliseconds = 80; |
| 77 | 77 |
| 78 // Opacity for dimmed items. | 78 // Opacity for dimmed items. |
| 79 static const float kDimmedItemOpacity = 0.5f; | 79 static const float kDimmedItemOpacity = 0.5f; |
| 80 | 80 |
| 81 views::Widget* CreateWindowLabel(aura::Window* root_window, | |
| 82 const base::string16 title) { | |
| 83 views::Widget* widget = new views::Widget; | |
| 84 views::Widget::InitParams params; | |
| 85 params.type = views::Widget::InitParams::TYPE_POPUP; | |
| 86 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | |
| 87 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | |
| 88 params.parent = | |
| 89 Shell::GetContainer(root_window, ash::kShellWindowId_OverlayContainer); | |
| 90 params.accept_events = false; | |
| 91 params.visible_on_all_workspaces = true; | |
| 92 widget->set_focus_on_creation(false); | |
| 93 widget->Init(params); | |
| 94 views::Label* label = new views::Label; | |
| 95 label->SetEnabledColor(kLabelColor); | |
| 96 label->SetBackgroundColor(kLabelBackground); | |
| 97 label->set_shadows(gfx::ShadowValues(1, gfx::ShadowValue( | |
| 98 gfx::Point(0, kVerticalShadowOffset), kShadowBlur, kLabelShadow))); | |
| 99 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | |
| 100 label->SetFontList(bundle.GetFontList(ui::ResourceBundle::BoldFont)); | |
| 101 label->SetText(title); | |
| 102 views::BoxLayout* layout = new views::BoxLayout(views::BoxLayout::kVertical, | |
| 103 0, | |
| 104 kVerticalLabelPadding, | |
| 105 0); | |
| 106 label->SetLayoutManager(layout); | |
| 107 widget->SetContentsView(label); | |
| 108 widget->Show(); | |
| 109 return widget; | |
| 110 } | |
| 111 | |
| 112 WindowSelectorItem::WindowSelectorItem() | 81 WindowSelectorItem::WindowSelectorItem() |
| 113 : dimmed_(false), | 82 : dimmed_(false), |
| 114 root_window_(NULL), | 83 root_window_(NULL), |
| 115 in_bounds_update_(false), | 84 in_bounds_update_(false), |
| 116 window_label_view_(NULL) { | 85 window_label_view_(NULL) { |
| 117 } | 86 } |
| 118 | 87 |
| 119 WindowSelectorItem::~WindowSelectorItem() { | 88 WindowSelectorItem::~WindowSelectorItem() { |
| 120 } | 89 } |
| 121 | 90 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 views::BoxLayout* layout = new views::BoxLayout(views::BoxLayout::kVertical, | 305 views::BoxLayout* layout = new views::BoxLayout(views::BoxLayout::kVertical, |
| 337 0, | 306 0, |
| 338 kVerticalLabelPadding, | 307 kVerticalLabelPadding, |
| 339 0); | 308 0); |
| 340 window_label_view_->SetLayoutManager(layout); | 309 window_label_view_->SetLayoutManager(layout); |
| 341 window_label_->SetContentsView(window_label_view_); | 310 window_label_->SetContentsView(window_label_view_); |
| 342 window_label_->Show(); | 311 window_label_->Show(); |
| 343 } | 312 } |
| 344 | 313 |
| 345 } // namespace ash | 314 } // namespace ash |
| OLD | NEW |