1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_THROBBER_LAYER_H_
6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_THROBBER_LAYER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/time/time.h"
12 #include "cc/layers/content_layer_client.h"
13 #include "chrome/browser/android/compositor/layer/layer.h"
14 #include "third_party/skia/include/core/SkColor.h"
15 #include "third_party/skia/include/core/SkPictureRecorder.h"
18 class DisplayItemList
;
30 // A layer representing throbber which we use as a reloading spinner on the
31 // tab strip for tablets.
32 // TODO(changwan): implement WAITING state for which we should spin
33 // counterclockwise until connection to the server is made.
34 class ThrobberLayer
: public Layer
, cc::ContentLayerClient
{
36 static scoped_refptr
<ThrobberLayer
> Create(SkColor color
);
38 void Show(const base::Time
& time
);
40 void SetColor(SkColor color
);
41 void UpdateThrobber(const base::Time
& time
);
44 scoped_refptr
<cc::Layer
> layer() override
;
46 // cc::ContentLayerClient:
49 const gfx::Rect
& clip
,
50 ContentLayerClient::PaintingControlSetting painting_control
) override
;
51 scoped_refptr
<cc::DisplayItemList
> PaintContentsToDisplayList(
52 const gfx::Rect
& clip
,
53 ContentLayerClient::PaintingControlSetting painting_control
) override
;
54 bool FillsBoundsCompletely() const override
;
55 size_t GetApproximateUnsharedMemoryUsage() const override
;
58 explicit ThrobberLayer(unsigned int color
);
59 ~ThrobberLayer() override
;
63 base::Time start_time_
;
64 base::Time update_time_
;
65 scoped_refptr
<cc::PictureLayer
> layer_
;
67 DISALLOW_COPY_AND_ASSIGN(ThrobberLayer
);
70 } // namespace android
73 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_THROBBER_LAYER_H_