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

Unified Diff: ui/views/examples/throbber_example.cc

Issue 2343603003: [Chrome OS MD] Implement accessibility detailed view for the MD Ash system menu (Closed)
Patch Set: ' Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/vector_icons/check_circle.1x.icon ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/examples/throbber_example.cc
diff --git a/ui/views/examples/throbber_example.cc b/ui/views/examples/throbber_example.cc
index 5a1981219c1403c449b40365149ab680ebf0d232..c17cbb03cd652bc69c916b23d34786eb05065ca9 100644
--- a/ui/views/examples/throbber_example.cc
+++ b/ui/views/examples/throbber_example.cc
@@ -16,25 +16,40 @@ namespace {
class ThrobberView : public View {
public:
- ThrobberView() : throbber_(new Throbber()) {
+ ThrobberView() : throbber_(new Throbber()), is_checked_(false) {
AddChildView(throbber_);
throbber_->Start();
}
+ // View::
gfx::Size GetPreferredSize() const override {
return gfx::Size(width(), height());
}
void Layout() override {
- int diameter = 64;
+ int diameter = 16;
throbber_->SetBounds((width() - diameter) / 2,
(height() - diameter) / 2,
diameter, diameter);
SizeToPreferredSize();
}
+ bool OnMousePressed(const ui::MouseEvent& event) override {
+ if (GetEventHandlerForPoint(event.location()) != throbber_)
+ return false;
+
+ if (is_checked_)
+ throbber_->Start();
+ else
+ throbber_->Stop();
+ throbber_->SetChecked(!is_checked_);
+ is_checked_ = !is_checked_;
+ return true;
+ }
+
private:
Throbber* throbber_;
+ bool is_checked_;
DISALLOW_COPY_AND_ASSIGN(ThrobberView);
};
« no previous file with comments | « ui/gfx/vector_icons/check_circle.1x.icon ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698