OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/system/user/user_view.h" | 5 #include "ash/system/user/user_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/multi_profile_uma.h" | 9 #include "ash/multi_profile_uma.h" |
10 #include "ash/popup_message.h" | 10 #include "ash/popup_message.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 const base::string16& text, | 89 const base::string16& text, |
90 bool placeholder) | 90 bool placeholder) |
91 : TrayPopupLabelButton(listener, text), placeholder_(placeholder) { | 91 : TrayPopupLabelButton(listener, text), placeholder_(placeholder) { |
92 SetEnabled(!placeholder_); | 92 SetEnabled(!placeholder_); |
93 } | 93 } |
94 | 94 |
95 virtual ~LogoutButton() {} | 95 virtual ~LogoutButton() {} |
96 | 96 |
97 private: | 97 private: |
98 virtual void Paint(gfx::Canvas* canvas, | 98 virtual void Paint(gfx::Canvas* canvas, |
99 const views::CullSet& cull_set) OVERRIDE { | 99 const views::CullSet& cull_set) override { |
100 // Just skip paint if this button used as a placeholder. | 100 // Just skip paint if this button used as a placeholder. |
101 if (!placeholder_) | 101 if (!placeholder_) |
102 TrayPopupLabelButton::Paint(canvas, cull_set); | 102 TrayPopupLabelButton::Paint(canvas, cull_set); |
103 } | 103 } |
104 | 104 |
105 bool placeholder_; | 105 bool placeholder_; |
106 DISALLOW_COPY_AND_ASSIGN(LogoutButton); | 106 DISALLOW_COPY_AND_ASSIGN(LogoutButton); |
107 }; | 107 }; |
108 | 108 |
109 class UserViewMouseWatcherHost : public views::MouseWatcherHost { | 109 class UserViewMouseWatcherHost : public views::MouseWatcherHost { |
110 public: | 110 public: |
111 explicit UserViewMouseWatcherHost(const gfx::Rect& screen_area) | 111 explicit UserViewMouseWatcherHost(const gfx::Rect& screen_area) |
112 : screen_area_(screen_area) {} | 112 : screen_area_(screen_area) {} |
113 virtual ~UserViewMouseWatcherHost() {} | 113 virtual ~UserViewMouseWatcherHost() {} |
114 | 114 |
115 // Implementation of MouseWatcherHost. | 115 // Implementation of MouseWatcherHost. |
116 virtual bool Contains(const gfx::Point& screen_point, | 116 virtual bool Contains(const gfx::Point& screen_point, |
117 views::MouseWatcherHost::MouseEventType type) OVERRIDE { | 117 views::MouseWatcherHost::MouseEventType type) override { |
118 return screen_area_.Contains(screen_point); | 118 return screen_area_.Contains(screen_point); |
119 } | 119 } |
120 | 120 |
121 private: | 121 private: |
122 gfx::Rect screen_area_; | 122 gfx::Rect screen_area_; |
123 | 123 |
124 DISALLOW_COPY_AND_ASSIGN(UserViewMouseWatcherHost); | 124 DISALLOW_COPY_AND_ASSIGN(UserViewMouseWatcherHost); |
125 }; | 125 }; |
126 | 126 |
127 // The menu item view which gets shown when the user clicks in multi profile | 127 // The menu item view which gets shown when the user clicks in multi profile |
128 // mode onto the user item. | 128 // mode onto the user item. |
129 class AddUserView : public views::View { | 129 class AddUserView : public views::View { |
130 public: | 130 public: |
131 // The |owner| is the view for which this view gets created. | 131 // The |owner| is the view for which this view gets created. |
132 AddUserView(ButtonFromView* owner); | 132 AddUserView(ButtonFromView* owner); |
133 virtual ~AddUserView(); | 133 virtual ~AddUserView(); |
134 | 134 |
135 // Get the anchor view for a message. | 135 // Get the anchor view for a message. |
136 views::View* anchor() { return anchor_; } | 136 views::View* anchor() { return anchor_; } |
137 | 137 |
138 private: | 138 private: |
139 // Overridden from views::View. | 139 // Overridden from views::View. |
140 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 140 virtual gfx::Size GetPreferredSize() const override; |
141 | 141 |
142 // Create the additional client content for this item. | 142 // Create the additional client content for this item. |
143 void AddContent(); | 143 void AddContent(); |
144 | 144 |
145 // This is the content we create and show. | 145 // This is the content we create and show. |
146 views::View* add_user_; | 146 views::View* add_user_; |
147 | 147 |
148 // This is the owner view of this item. | 148 // This is the owner view of this item. |
149 ButtonFromView* owner_; | 149 ButtonFromView* owner_; |
150 | 150 |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 focus_manager_ = NULL; | 562 focus_manager_ = NULL; |
563 if (user_card_view_->GetFocusManager()) | 563 if (user_card_view_->GetFocusManager()) |
564 user_card_view_->GetFocusManager()->ClearFocus(); | 564 user_card_view_->GetFocusManager()->ClearFocus(); |
565 popup_message_.reset(); | 565 popup_message_.reset(); |
566 mouse_watcher_.reset(); | 566 mouse_watcher_.reset(); |
567 add_menu_option_.reset(); | 567 add_menu_option_.reset(); |
568 } | 568 } |
569 | 569 |
570 } // namespace tray | 570 } // namespace tray |
571 } // namespace ash | 571 } // namespace ash |
OLD | NEW |