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

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

Issue 10483010: Change the visual appearance of panel on GTK per new UI design. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback Created 8 years, 6 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
« no previous file with comments | « chrome/browser/ui/gtk/browser_titlebar.h ('k') | chrome/browser/ui/gtk/browser_titlebar_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cea39035232f8923dd23c4c64f190e2a7bcce928 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_)
@@ -837,17 +828,6 @@ void BrowserTitlebar::UpdateAvatar() {
avatar_button_->set_menu_arrow_location(arrow_location);
}
-void BrowserTitlebar::ShowFaviconMenu(GdkEventButton* event) {
- if (!favicon_menu_model_.get()) {
- favicon_menu_model_.reset(
- new PopupPageMenuModel(this, browser_window_->browser()));
-
- favicon_menu_.reset(new MenuGtk(NULL, favicon_menu_model_.get()));
- }
-
- favicon_menu_->PopupForWidget(app_mode_favicon_, event->button, event->time);
-}
-
void BrowserTitlebar::MaximizeButtonClicked() {
GdkEvent* event = gtk_get_current_event();
if (event->button.button == 1) {
@@ -915,10 +895,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) {
@@ -935,7 +911,15 @@ gboolean BrowserTitlebar::OnFaviconMenuButtonPressed(GtkWidget* widget,
if (event->button != 1)
return FALSE;
- ShowFaviconMenu(event);
+ if (!favicon_menu_model_.get()) {
+ favicon_menu_model_.reset(
+ new PopupPageMenuModel(this, browser_window_->browser()));
+
+ favicon_menu_.reset(new MenuGtk(NULL, favicon_menu_model_.get()));
+ }
+
+ favicon_menu_->PopupForWidget(app_mode_favicon_, event->button, event->time);
+
return TRUE;
}
@@ -1053,60 +1037,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(
« no previous file with comments | « chrome/browser/ui/gtk/browser_titlebar.h ('k') | chrome/browser/ui/gtk/browser_titlebar_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698