| Index: chrome/browser/ui/gtk/browser_titlebar.cc
|
| diff --git a/chrome/browser/ui/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc
|
| index 06596f126ae69326bf64b31d1a48b750f16992e1..9d12015d43d623ec26b71432bae4cc0885817377 100644
|
| --- a/chrome/browser/ui/gtk/browser_titlebar.cc
|
| +++ b/chrome/browser/ui/gtk/browser_titlebar.cc
|
| @@ -56,7 +56,6 @@
|
| #include "ui/base/x/active_window_watcher_x.h"
|
| #include "ui/gfx/gtk_util.h"
|
| #include "ui/gfx/image/image.h"
|
| -#include "ui/gfx/skbitmap_operations.h"
|
|
|
| using content::WebContents;
|
|
|
| @@ -477,10 +476,10 @@ GtkWidget* BrowserTitlebar::GetButtonHBox(bool left_side) {
|
| titlebar_right_buttons_vbox_;
|
|
|
| GtkWidget* top_padding = gtk_fixed_new();
|
| - gtk_widget_set_size_request(top_padding, -1, GetButtonOuterPadding());
|
| + gtk_widget_set_size_request(top_padding, -1, kButtonOuterPadding);
|
| gtk_box_pack_start(GTK_BOX(vbox), top_padding, FALSE, FALSE, 0);
|
|
|
| - GtkWidget* buttons_hbox = gtk_hbox_new(FALSE, GetButtonSpacing());
|
| + GtkWidget* buttons_hbox = gtk_hbox_new(FALSE, kButtonSpacing);
|
| gtk_box_pack_start(GTK_BOX(vbox), buttons_hbox, FALSE, FALSE, 0);
|
|
|
| if (left_side) {
|
| @@ -494,14 +493,6 @@ GtkWidget* BrowserTitlebar::GetButtonHBox(bool left_side) {
|
| return buttons_hbox;
|
| }
|
|
|
| -int BrowserTitlebar::GetButtonOuterPadding() const {
|
| - return kButtonOuterPadding;
|
| -}
|
| -
|
| -int BrowserTitlebar::GetButtonSpacing() const {
|
| - return kButtonSpacing;
|
| -}
|
| -
|
| CustomDrawButton* BrowserTitlebar::CreateTitlebarButton(
|
| const std::string& button_name, bool left_side) {
|
| int normal_image_id;
|
| @@ -707,10 +698,10 @@ void BrowserTitlebar::UpdateTitlebarAlignment() {
|
| GtkRequisition minimize_button_req = minimize_button_req_;
|
| GtkRequisition restore_button_req = restore_button_req_;
|
| if (using_custom_frame_ && browser_window_->IsMaximized()) {
|
| - close_button_req.width += GetButtonOuterPadding();
|
| - close_button_req.height += GetButtonOuterPadding();
|
| - minimize_button_req.height += GetButtonOuterPadding();
|
| - restore_button_req.height += GetButtonOuterPadding();
|
| + close_button_req.width += kButtonOuterPadding;
|
| + close_button_req.height += kButtonOuterPadding;
|
| + minimize_button_req.height += kButtonOuterPadding;
|
| + restore_button_req.height += kButtonOuterPadding;
|
| if (top_padding_left_)
|
| gtk_widget_hide(top_padding_left_);
|
| if (top_padding_right_)
|
| @@ -915,10 +906,6 @@ gboolean BrowserTitlebar::OnScroll(GtkWidget* widget, GdkEventScroll* event) {
|
| }
|
|
|
| void BrowserTitlebar::OnButtonClicked(GtkWidget* button) {
|
| - HandleButtonClick(button);
|
| -}
|
| -
|
| -void BrowserTitlebar::HandleButtonClick(GtkWidget* button) {
|
| if (close_button_.get() && close_button_->widget() == button) {
|
| browser_window_->Close();
|
| } else if (restore_button_.get() && restore_button_->widget() == button) {
|
| @@ -1053,60 +1040,16 @@ bool BrowserTitlebar::IsOffTheRecord() {
|
| return browser_window_->browser()->profile()->IsOffTheRecord();
|
| }
|
|
|
| -///////////////////////////////////////////////////////////////////////////////
|
| -// BrowserTitlebar::Throbber implementation
|
| -// TODO(tc): Handle anti-clockwise spinning when waiting for a connection.
|
| -
|
| -// We don't bother to clean up these or the pixbufs they contain when we exit.
|
| -static std::vector<GdkPixbuf*>* g_throbber_frames = NULL;
|
| -static 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|.
|
| -static void MakeThrobberFrames(int resource_id,
|
| - std::vector<GdkPixbuf*>* frames) {
|
| - ui::ResourceBundle &rb = ui::ResourceBundle::GetSharedInstance();
|
| - SkBitmap* frame_strip = rb.GetBitmapNamed(resource_id);
|
| -
|
| - // 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));
|
| - }
|
| +GtkWidget* BrowserTitlebar::widget() const {
|
| + return container_;
|
| }
|
|
|
| -GdkPixbuf* BrowserTitlebar::Throbber::GetNextFrame(bool is_waiting) {
|
| - Throbber::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 BrowserTitlebar::Throbber::Reset() {
|
| - current_frame_ = 0;
|
| - current_waiting_frame_ = 0;
|
| +void BrowserTitlebar::set_window(GtkWindow* window) {
|
| + window_ = window;
|
| }
|
|
|
| -// static
|
| -void BrowserTitlebar::Throbber::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);
|
| +AvatarMenuButtonGtk* BrowserTitlebar::avatar_button() const {
|
| + return avatar_button_.get();
|
| }
|
|
|
| BrowserTitlebar::ContextMenuModel::ContextMenuModel(
|
|
|