| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // If |placeholder| is true, button is used as placeholder. That means that | 85 // If |placeholder| is true, button is used as placeholder. That means that |
| 86 // button is inactive and is not painted, but consume the same ammount of | 86 // button is inactive and is not painted, but consume the same ammount of |
| 87 // space, as if it was painted. | 87 // space, as if it was painted. |
| 88 LogoutButton(views::ButtonListener* listener, | 88 LogoutButton(views::ButtonListener* listener, |
| 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 ~LogoutButton() override {} |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 virtual void Paint(gfx::Canvas* canvas, | 98 void Paint(gfx::Canvas* canvas, const views::CullSet& cull_set) override { |
| 99 const views::CullSet& cull_set) override { | |
| 100 // Just skip paint if this button used as a placeholder. | 99 // Just skip paint if this button used as a placeholder. |
| 101 if (!placeholder_) | 100 if (!placeholder_) |
| 102 TrayPopupLabelButton::Paint(canvas, cull_set); | 101 TrayPopupLabelButton::Paint(canvas, cull_set); |
| 103 } | 102 } |
| 104 | 103 |
| 105 bool placeholder_; | 104 bool placeholder_; |
| 106 DISALLOW_COPY_AND_ASSIGN(LogoutButton); | 105 DISALLOW_COPY_AND_ASSIGN(LogoutButton); |
| 107 }; | 106 }; |
| 108 | 107 |
| 109 class UserViewMouseWatcherHost : public views::MouseWatcherHost { | 108 class UserViewMouseWatcherHost : public views::MouseWatcherHost { |
| 110 public: | 109 public: |
| 111 explicit UserViewMouseWatcherHost(const gfx::Rect& screen_area) | 110 explicit UserViewMouseWatcherHost(const gfx::Rect& screen_area) |
| 112 : screen_area_(screen_area) {} | 111 : screen_area_(screen_area) {} |
| 113 virtual ~UserViewMouseWatcherHost() {} | 112 ~UserViewMouseWatcherHost() override {} |
| 114 | 113 |
| 115 // Implementation of MouseWatcherHost. | 114 // Implementation of MouseWatcherHost. |
| 116 virtual bool Contains(const gfx::Point& screen_point, | 115 bool Contains(const gfx::Point& screen_point, |
| 117 views::MouseWatcherHost::MouseEventType type) override { | 116 views::MouseWatcherHost::MouseEventType type) override { |
| 118 return screen_area_.Contains(screen_point); | 117 return screen_area_.Contains(screen_point); |
| 119 } | 118 } |
| 120 | 119 |
| 121 private: | 120 private: |
| 122 gfx::Rect screen_area_; | 121 gfx::Rect screen_area_; |
| 123 | 122 |
| 124 DISALLOW_COPY_AND_ASSIGN(UserViewMouseWatcherHost); | 123 DISALLOW_COPY_AND_ASSIGN(UserViewMouseWatcherHost); |
| 125 }; | 124 }; |
| 126 | 125 |
| 127 // The menu item view which gets shown when the user clicks in multi profile | 126 // The menu item view which gets shown when the user clicks in multi profile |
| 128 // mode onto the user item. | 127 // mode onto the user item. |
| 129 class AddUserView : public views::View { | 128 class AddUserView : public views::View { |
| 130 public: | 129 public: |
| 131 // The |owner| is the view for which this view gets created. | 130 // The |owner| is the view for which this view gets created. |
| 132 AddUserView(ButtonFromView* owner); | 131 AddUserView(ButtonFromView* owner); |
| 133 virtual ~AddUserView(); | 132 ~AddUserView() override; |
| 134 | 133 |
| 135 // Get the anchor view for a message. | 134 // Get the anchor view for a message. |
| 136 views::View* anchor() { return anchor_; } | 135 views::View* anchor() { return anchor_; } |
| 137 | 136 |
| 138 private: | 137 private: |
| 139 // Overridden from views::View. | 138 // Overridden from views::View. |
| 140 virtual gfx::Size GetPreferredSize() const override; | 139 gfx::Size GetPreferredSize() const override; |
| 141 | 140 |
| 142 // Create the additional client content for this item. | 141 // Create the additional client content for this item. |
| 143 void AddContent(); | 142 void AddContent(); |
| 144 | 143 |
| 145 // This is the content we create and show. | 144 // This is the content we create and show. |
| 146 views::View* add_user_; | 145 views::View* add_user_; |
| 147 | 146 |
| 148 // This is the owner view of this item. | 147 // This is the owner view of this item. |
| 149 ButtonFromView* owner_; | 148 ButtonFromView* owner_; |
| 150 | 149 |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 focus_manager_ = NULL; | 561 focus_manager_ = NULL; |
| 563 if (user_card_view_->GetFocusManager()) | 562 if (user_card_view_->GetFocusManager()) |
| 564 user_card_view_->GetFocusManager()->ClearFocus(); | 563 user_card_view_->GetFocusManager()->ClearFocus(); |
| 565 popup_message_.reset(); | 564 popup_message_.reset(); |
| 566 mouse_watcher_.reset(); | 565 mouse_watcher_.reset(); |
| 567 add_menu_option_.reset(); | 566 add_menu_option_.reset(); |
| 568 } | 567 } |
| 569 | 568 |
| 570 } // namespace tray | 569 } // namespace tray |
| 571 } // namespace ash | 570 } // namespace ash |
| OLD | NEW |