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

Unified Diff: chrome/browser/ui/gtk/titlebar_throb_animation.cc

Issue 231733005: Delete the GTK+ port of Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remerge to ToT Created 6 years, 8 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
Index: chrome/browser/ui/gtk/titlebar_throb_animation.cc
diff --git a/chrome/browser/ui/gtk/titlebar_throb_animation.cc b/chrome/browser/ui/gtk/titlebar_throb_animation.cc
deleted file mode 100644
index 538aa847a57b9547230c870a3b5a1deb675a17f4..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/gtk/titlebar_throb_animation.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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.
-
-#include "chrome/browser/ui/gtk/titlebar_throb_animation.h"
-#include "grit/theme_resources.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/skbitmap_operations.h"
-
-namespace {
-
-// We don't bother to clean up these or the pixbufs they contain when we exit.
-std::vector<GdkPixbuf*>* g_throbber_frames = NULL;
-std::vector<GdkPixbuf*>* g_throbber_waiting_frames = NULL;
-
-// Load |resource_id| from the ResourceBundle and split it into a series of
-// square GdkPixbufs that get stored in |frames|.
-void MakeThrobberFrames(int resource_id, std::vector<GdkPixbuf*>* frames) {
- ui::ResourceBundle &rb = ui::ResourceBundle::GetSharedInstance();
- SkBitmap frame_strip = rb.GetImageNamed(resource_id).AsBitmap();
-
- // Each frame of the animation is a square, so we use the height as the
- // frame size.
- int frame_size = frame_strip.height();
- size_t num_frames = frame_strip.width() / frame_size;
-
- // Make a separate GdkPixbuf for each frame of the animation.
- for (size_t i = 0; i < num_frames; ++i) {
- SkBitmap frame = SkBitmapOperations::CreateTiledBitmap(frame_strip,
- i * frame_size, 0, frame_size, frame_size);
- frames->push_back(gfx::GdkPixbufFromSkBitmap(frame));
- }
-}
-
-} // namespace
-
-// TODO(tc): Handle anti-clockwise spinning when waiting for a connection.
-
-TitlebarThrobAnimation::TitlebarThrobAnimation()
- : current_frame_(0),
- current_waiting_frame_(0) {
-}
-
-GdkPixbuf* TitlebarThrobAnimation::GetNextFrame(bool is_waiting) {
- InitFrames();
- if (is_waiting) {
- return (*g_throbber_waiting_frames)[current_waiting_frame_++ %
- g_throbber_waiting_frames->size()];
- } else {
- return (*g_throbber_frames)[current_frame_++ % g_throbber_frames->size()];
- }
-}
-
-void TitlebarThrobAnimation::Reset() {
- current_frame_ = 0;
- current_waiting_frame_ = 0;
-}
-
-// static
-void TitlebarThrobAnimation::InitFrames() {
- if (g_throbber_frames)
- return;
-
- // We load the light version of the throbber since it'll be in the titlebar.
- g_throbber_frames = new std::vector<GdkPixbuf*>;
- MakeThrobberFrames(IDR_THROBBER_LIGHT, g_throbber_frames);
-
- g_throbber_waiting_frames = new std::vector<GdkPixbuf*>;
- MakeThrobberFrames(IDR_THROBBER_WAITING_LIGHT, g_throbber_waiting_frames);
-}

Powered by Google App Engine
This is Rietveld 408576698