Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: ash/wm/overview/window_selector_item.cc

Issue 251103005: Added arrow key navigation to Overview Mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase with latest changes, test stub (don't look into that yet!) Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/auto_reset.h" 11 #include "base/auto_reset.h"
12 #include "third_party/skia/include/core/SkColor.h" 12 #include "third_party/skia/include/core/SkColor.h"
13 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
14 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
15 #include "ui/compositor/scoped_layer_animation_settings.h" 15 #include "ui/compositor/scoped_layer_animation_settings.h"
16 #include "ui/views/controls/label.h" 16 #include "ui/views/controls/window_label.h"
17 #include "ui/views/layout/box_layout.h" 17 #include "ui/views/layout/box_layout.h"
18 #include "ui/views/widget/widget.h" 18 #include "ui/views/widget/widget.h"
19 19
20 namespace ash { 20 namespace ash {
21 21
22 // Foreground label color. 22 // Foreground label color.
23 static const SkColor kLabelColor = SK_ColorWHITE; 23 static const SkColor kLabelColor = SK_ColorWHITE;
24 24
25 // Background label color. 25 // Background label color.
26 static const SkColor kLabelBackground = SK_ColorTRANSPARENT; 26 static const SkColor kLabelBackground = SK_ColorTRANSPARENT;
27 27
28 // Label shadow color. 28 // Label shadow color.
29 static const SkColor kLabelShadow = 0xB0000000; 29 static const SkColor kLabelShadow = 0xB0000000;
30 30
31 // Vertical padding for the label, both over and beneath it. 31 // Vertical padding for the label, both over and beneath it.
32 static const int kVerticalLabelPadding = 20; 32 static const int kVerticalLabelPadding = 20;
33 33
34 // Solid shadow length from the label 34 // Solid shadow length from the label
35 static const int kVerticalShadowOffset = 1; 35 static const int kVerticalShadowOffset = 1;
36 36
37 // Amount of blur applied to the label shadow 37 // Amount of blur applied to the label shadow
38 static const int kShadowBlur = 10; 38 static const int kShadowBlur = 10;
39 39
40 views::Widget* CreateWindowLabel(aura::Window* root_window, 40 views::Widget* CreateWindowLabel(aura::Window* root_window,
41 const base::string16 title) { 41 const base::string16 title) {
42 views::Widget* widget = new views::Widget; 42 views::Widget* widget = new views::Widget;
43 views::Widget::InitParams params; 43 views::Widget::InitParams params;
44 params.type = views::Widget::InitParams::TYPE_POPUP; 44 params.type = views::Widget::InitParams::TYPE_POPUP;
45 params.can_activate = false; 45 params.can_activate = true;
46 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 46 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
47 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 47 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
48 params.parent = 48 params.parent =
49 Shell::GetContainer(root_window, ash::kShellWindowId_OverlayContainer); 49 Shell::GetContainer(root_window, ash::kShellWindowId_OverlayContainer);
50 params.accept_events = false; 50 params.accept_events = false;
51 params.visible_on_all_workspaces = true;
tdanderson 2014/04/29 14:46:27 Why are you removing this?
Nina 2014/04/29 18:31:40 Actually, because I don't know how it got there. W
52 widget->set_focus_on_creation(false); 51 widget->set_focus_on_creation(false);
53 widget->Init(params); 52 widget->Init(params);
54 views::Label* label = new views::Label; 53 views::WindowLabel* label = new views::WindowLabel;
tdanderson 2014/04/29 14:46:27 I think that introducing a new class is overkill h
55 label->SetEnabledColor(kLabelColor); 54 label->SetEnabledColor(kLabelColor);
56 label->SetBackgroundColor(kLabelBackground); 55 label->SetBackgroundColor(kLabelBackground);
57 label->SetShadowColors(kLabelShadow, kLabelShadow); 56 label->SetShadowColors(kLabelShadow, kLabelShadow);
58 label->SetShadowOffset(0, kVerticalShadowOffset); 57 label->SetShadowOffset(0, kVerticalShadowOffset);
59 label->set_shadow_blur(kShadowBlur); 58 label->set_shadow_blur(kShadowBlur);
60 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 59 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
61 label->SetFontList(bundle.GetFontList(ui::ResourceBundle::BoldFont)); 60 label->SetFontList(bundle.GetFontList(ui::ResourceBundle::BoldFont));
62 label->SetText(title); 61 label->SetText(title);
63 views::BoxLayout* layout = new views::BoxLayout(views::BoxLayout::kVertical, 62 views::BoxLayout* layout = new views::BoxLayout(views::BoxLayout::kVertical,
64 0, 63 0,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 window_label_->GetNativeWindow()->layer()->GetAnimator()); 147 window_label_->GetNativeWindow()->layer()->GetAnimator());
149 settings.SetPreemptionStrategy( 148 settings.SetPreemptionStrategy(
150 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 149 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
151 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( 150 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
152 ScopedTransformOverviewWindow::kTransitionMilliseconds)); 151 ScopedTransformOverviewWindow::kTransitionMilliseconds));
153 window_label_->GetNativeWindow()->SetBounds(label_bounds); 152 window_label_->GetNativeWindow()->SetBounds(label_bounds);
154 } else { 153 } else {
155 window_label_->GetNativeWindow()->SetBounds(label_bounds); 154 window_label_->GetNativeWindow()->SetBounds(label_bounds);
156 } 155 }
157 } 156 }
157 }
158 158
159 views::Widget* WindowSelectorItem::get_window_label() {
160 return window_label_.get();
tdanderson 2014/04/29 14:46:27 Since this is a simple accessor, you can move the
Nina 2014/04/29 18:31:40 Done.
159 } 161 }
160 162
161 } // namespace ash 163 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698