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

Unified Diff: views/controls/throbber.h

Issue 8687031: views: Move the remaining files to ui/views/controls/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « views/controls/single_split_view_unittest.cc ('k') | views/controls/throbber.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/throbber.h
diff --git a/views/controls/throbber.h b/views/controls/throbber.h
deleted file mode 100644
index b2aa5993a86eff38dfee5c1ca9e51f1b48c3653d..0000000000000000000000000000000000000000
--- a/views/controls/throbber.h
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Throbbers display an animation, usually used as a status indicator.
-
-#ifndef VIEWS_CONTROLS_THROBBER_H_
-#define VIEWS_CONTROLS_THROBBER_H_
-#pragma once
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/time.h"
-#include "base/timer.h"
-#include "views/view.h"
-
-class SkBitmap;
-
-namespace views {
-
-class VIEWS_EXPORT Throbber : public View {
- public:
- // |frame_time_ms| is the amount of time that should elapse between frames
- // (in milliseconds)
- // If |paint_while_stopped| is false, this view will be invisible when not
- // running.
- Throbber(int frame_time_ms, bool paint_while_stopped);
- Throbber(int frame_time_ms, bool paint_while_stopped, SkBitmap* frames);
- virtual ~Throbber();
-
- // Start and stop the throbber animation
- virtual void Start();
- virtual void Stop();
-
- // Set custom throbber frames. Otherwise IDR_THROBBER is loaded.
- void SetFrames(SkBitmap* frames);
-
- // overridden from View
- virtual gfx::Size GetPreferredSize() OVERRIDE;
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
-
- protected:
- // Specifies whether the throbber is currently animating or not
- bool running_;
-
- private:
- void Run();
-
- bool paint_while_stopped_;
- int frame_count_; // How many frames we have.
- base::Time start_time_; // Time when Start was called.
- SkBitmap* frames_; // Frames bitmaps.
- base::TimeDelta frame_time_; // How long one frame is displayed.
- base::RepeatingTimer<Throbber> timer_; // Used to schedule Run calls.
-
- DISALLOW_COPY_AND_ASSIGN(Throbber);
-};
-
-// A SmoothedThrobber is a throbber that is representing potentially short
-// and nonoverlapping bursts of work. SmoothedThrobber ignores small
-// pauses in the work stops and starts, and only starts its throbber after
-// a small amount of work time has passed.
-class VIEWS_EXPORT SmoothedThrobber : public Throbber {
- public:
- SmoothedThrobber(int frame_delay_ms);
- SmoothedThrobber(int frame_delay_ms, SkBitmap* frames);
- virtual ~SmoothedThrobber();
-
- virtual void Start() OVERRIDE;
- virtual void Stop() OVERRIDE;
-
- void set_start_delay_ms(int value) { start_delay_ms_ = value; }
- void set_stop_delay_ms(int value) { stop_delay_ms_ = value; }
-
- private:
- // Called when the startup-delay timer fires
- // This function starts the actual throbbing.
- void StartDelayOver();
-
- // Called when the shutdown-delay timer fires.
- // This function stops the actual throbbing.
- void StopDelayOver();
-
- // Delay after work starts before starting throbber, in milliseconds.
- int start_delay_ms_;
-
- // Delay after work stops before stopping, in milliseconds.
- int stop_delay_ms_;
-
- base::OneShotTimer<SmoothedThrobber> start_timer_;
- base::OneShotTimer<SmoothedThrobber> stop_timer_;
-
- DISALLOW_COPY_AND_ASSIGN(SmoothedThrobber);
-};
-
-// A CheckmarkThrobber is a special variant of throbber that has three states:
-// 1. not yet completed (which paints nothing)
-// 2. working (which paints the throbber animation)
-// 3. completed (which paints a checkmark)
-//
-class VIEWS_EXPORT CheckmarkThrobber : public Throbber {
- public:
- CheckmarkThrobber();
-
- // If checked is true, the throbber stops spinning and displays a checkmark.
- // If checked is false, the throbber stops spinning and displays nothing.
- void SetChecked(bool checked);
-
- // Overridden from Throbber:
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
-
- private:
- static const int kFrameTimeMs = 30;
-
- static void InitClass();
-
- // Whether or not we should display a checkmark.
- bool checked_;
-
- // The checkmark image.
- static SkBitmap* checkmark_;
-
- DISALLOW_COPY_AND_ASSIGN(CheckmarkThrobber);
-};
-
-} // namespace views
-
-#endif // VIEWS_CONTROLS_THROBBER_H_
« no previous file with comments | « views/controls/single_split_view_unittest.cc ('k') | views/controls/throbber.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698