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

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

Issue 231643002: Added labels under the windows in OverviewMode displaying their current name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed tests, code polishing Created 6 years, 8 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 #ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ 5 #ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_
6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ 6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string16.h"
9 #include "ui/gfx/rect.h" 11 #include "ui/gfx/rect.h"
10 12
11 namespace aura { 13 namespace aura {
12 class Window; 14 class Window;
13 } 15 }
14 16
17 namespace views {
18 class Widget;
19 }
20
15 namespace ash { 21 namespace ash {
16 22
17 // This class represents an item in overview mode. An item can have one or more 23 // This class represents an item in overview mode. An item can have one or more
18 // windows, of which only one can be activated by keyboard (i.e. alt+tab) but 24 // windows, of which only one can be activated by keyboard (i.e. alt+tab) but
19 // any can be selected with a pointer (touch or mouse). 25 // any can be selected with a pointer (touch or mouse).
20 class WindowSelectorItem { 26 class WindowSelectorItem {
27 friend class WindowSelectorTest;
flackr 2014/04/17 03:44:29 This belongs at the beginning of private: section.
Nina 2014/04/17 15:02:19 Done.
28
21 public: 29 public:
22 WindowSelectorItem(); 30 WindowSelectorItem();
23 virtual ~WindowSelectorItem(); 31 virtual ~WindowSelectorItem();
24 32
33 // The time for the close buttons and labels to fade in when initially shown
34 // on entering overview mode.
35 static const int kFadeInMilliseconds;
36
25 // Returns the root window on which this item is shown. 37 // Returns the root window on which this item is shown.
26 virtual aura::Window* GetRootWindow() = 0; 38 virtual aura::Window* GetRootWindow() = 0;
27 39
28 // Returns true if the window selector item has |window| as a selectable 40 // Returns true if the window selector item has |window| as a selectable
29 // window. 41 // window.
30 virtual bool HasSelectableWindow(const aura::Window* window) = 0; 42 virtual bool HasSelectableWindow(const aura::Window* window) = 0;
31 43
32 // Returns the targeted window given the event |target| window. 44 // Returns the targeted window given the event |target| window.
33 // Returns NULL if no Window in this item was selected. 45 // Returns NULL if no Window in this item was selected.
34 virtual aura::Window* TargetedWindow(const aura::Window* target) = 0; 46 virtual aura::Window* TargetedWindow(const aura::Window* target) = 0;
35 47
36 // Restores |window| on exiting window overview rather than returning it 48 // Restores |window| on exiting window overview rather than returning it
37 // to its previous state. 49 // to its previous state.
38 virtual void RestoreWindowOnExit(aura::Window* window) = 0; 50 virtual void RestoreWindowOnExit(aura::Window* window) = 0;
39 51
40 // Returns the |window| to activate on selecting of this item. 52 // Returns the |window| to activate on selecting of this item.
41 virtual aura::Window* SelectionWindow() = 0; 53 virtual aura::Window* SelectionWindow() = 0;
54 virtual const aura::Window* SelectionWindow() const = 0;
flackr 2014/04/17 03:44:29 I don't think you need the const version of this a
Nina 2014/04/17 15:02:19 Done.
42 55
43 // Removes |window| from this item. Check empty() after calling this to see 56 // Removes |window| from this item. Check empty() after calling this to see
44 // if the entire item is now empty. 57 // if the entire item is now empty.
45 virtual void RemoveWindow(const aura::Window* window) = 0; 58 virtual void RemoveWindow(const aura::Window* window) = 0;
46 59
47 // Returns true if this item has no more selectable windows (i.e. after 60 // Returns true if this item has no more selectable windows (i.e. after
48 // calling RemoveWindow for the last contained window). 61 // calling RemoveWindow for the last contained window).
49 virtual bool empty() const = 0; 62 virtual bool empty() const = 0;
50 63
51 // Dispatched before beginning window overview. This will do any necessary 64 // Dispatched before beginning window overview. This will do any necessary
(...skipping 15 matching lines...) Expand all
67 protected: 80 protected:
68 // Sets the bounds of this selector item to |target_bounds| in |root_window|. 81 // Sets the bounds of this selector item to |target_bounds| in |root_window|.
69 // If |animate| the windows are animated from their current location. 82 // If |animate| the windows are animated from their current location.
70 virtual void SetItemBounds(aura::Window* root_window, 83 virtual void SetItemBounds(aura::Window* root_window,
71 const gfx::Rect& target_bounds, 84 const gfx::Rect& target_bounds,
72 bool animate) = 0; 85 bool animate) = 0;
73 86
74 // Sets the bounds used by the selector item's windows. 87 // Sets the bounds used by the selector item's windows.
75 void set_bounds(const gfx::Rect& bounds) { bounds_ = bounds; } 88 void set_bounds(const gfx::Rect& bounds) { bounds_ = bounds; }
76 89
90 // Creates a label to display under the window selector item.
91 void UpdateWindowLabels(const gfx::Rect& target_bounds,
92 aura::Window* root_window);
93
77 private: 94 private:
78 // The root window this item is being displayed on. 95 // The root window this item is being displayed on.
79 aura::Window* root_window_; 96 aura::Window* root_window_;
80 97
81 // The target bounds this selector item is fit within. 98 // The target bounds this selector item is fit within.
82 gfx::Rect target_bounds_; 99 gfx::Rect target_bounds_;
83 100
84 // The actual bounds of the window(s) for this item. The aspect ratio of 101 // The actual bounds of the window(s) for this item. The aspect ratio of
85 // window(s) are maintained so they may not fill the target_bounds_. 102 // window(s) are maintained so they may not fill the target_bounds_.
86 gfx::Rect bounds_; 103 gfx::Rect bounds_;
87 104
88 // True if running SetItemBounds. This prevents recursive calls resulting from 105 // True if running SetItemBounds. This prevents recursive calls resulting from
89 // the bounds update when calling ::wm::RecreateWindowLayers to copy 106 // the bounds update when calling ::wm::RecreateWindowLayers to copy
90 // a window layer for display on another monitor. 107 // a window layer for display on another monitor.
91 bool in_bounds_update_; 108 bool in_bounds_update_;
92 109
110 // Label under the window displaying its active tab name.
111 scoped_ptr<views::Widget> window_label_;
112
93 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); 113 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem);
94 }; 114 };
95 115
96 } // namespace ash 116 } // namespace ash
97 117
98 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ 118 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_
OLDNEW
« no previous file with comments | « no previous file | ash/wm/overview/window_selector_item.cc » ('j') | ash/wm/overview/window_selector_item.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698