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

Side by Side Diff: ash/system/user/user_view.cc

Issue 1037443003: views: Make the LogoutButton not visible instead of early out in Paint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 class LogoutButton : public TrayPopupLabelButton { 83 class LogoutButton : public TrayPopupLabelButton {
84 public: 84 public:
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 SetVisible(!placeholder_);
93 } 93 }
94 94
95 ~LogoutButton() override {} 95 ~LogoutButton() override {}
96 96
97 private: 97 private:
98 void Paint(gfx::Canvas* canvas, const views::CullSet& cull_set) override {
99 // Just skip paint if this button used as a placeholder.
100 if (!placeholder_)
101 TrayPopupLabelButton::Paint(canvas, cull_set);
102 }
103
104 bool placeholder_; 98 bool placeholder_;
105 DISALLOW_COPY_AND_ASSIGN(LogoutButton); 99 DISALLOW_COPY_AND_ASSIGN(LogoutButton);
106 }; 100 };
107 101
108 class UserViewMouseWatcherHost : public views::MouseWatcherHost { 102 class UserViewMouseWatcherHost : public views::MouseWatcherHost {
109 public: 103 public:
110 explicit UserViewMouseWatcherHost(const gfx::Rect& screen_area) 104 explicit UserViewMouseWatcherHost(const gfx::Rect& screen_area)
111 : screen_area_(screen_area) {} 105 : screen_area_(screen_area) {}
112 ~UserViewMouseWatcherHost() override {} 106 ~UserViewMouseWatcherHost() override {}
113 107
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 focus_manager_ = NULL; 555 focus_manager_ = NULL;
562 if (user_card_view_->GetFocusManager()) 556 if (user_card_view_->GetFocusManager())
563 user_card_view_->GetFocusManager()->ClearFocus(); 557 user_card_view_->GetFocusManager()->ClearFocus();
564 popup_message_.reset(); 558 popup_message_.reset();
565 mouse_watcher_.reset(); 559 mouse_watcher_.reset();
566 add_menu_option_.reset(); 560 add_menu_option_.reset();
567 } 561 }
568 562
569 } // namespace tray 563 } // namespace tray
570 } // namespace ash 564 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698