summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/gtk/titlebar_throb_animation.h
blob: 547aa7ec9d38f5049d598e9f7e7cb912decf5248 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) 2012 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.

#ifndef CHROME_BROWSER_UI_GTK_TITLEBAR_THROB_ANIMATION_H_
#define CHROME_BROWSER_UI_GTK_TITLEBAR_THROB_ANIMATION_H_

#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "ui/gfx/gtk_util.h"

// A helper class to keep track of which frame of the throbber animation
// we're showing.
class TitlebarThrobAnimation {
 public:
  TitlebarThrobAnimation();

  // Get the next frame in the animation. The image is owned by the throbber
  // so the caller doesn't need to unref. |is_waiting| is true if we're
  // still waiting for a response.
  GdkPixbuf* GetNextFrame(bool is_waiting);

  // Reset back to the first frame.
  void Reset();

 private:
  // Make sure the frames are loaded.
  static void InitFrames();

  int current_frame_;
  int current_waiting_frame_;

  DISALLOW_COPY_AND_ASSIGN(TitlebarThrobAnimation);
};

#endif  // CHROME_BROWSER_UI_GTK_TITLEBAR_THROB_ANIMATION_H_