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

Side by Side Diff: chrome/browser/gtk/browser_titlebar.cc

Issue 159745: Fix a bug where we tried to get the position of the tabstrip (Closed)
Patch Set: Created 11 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/gtk/tabs/tab_strip_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/gtk/browser_titlebar.h" 5 #include "chrome/browser/gtk/browser_titlebar.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // |||spy_guy||| |||+- button -++- button -+ ||| 104 // |||spy_guy||| |||+- button -++- button -+ |||
105 // ||| |||+- TabStripGtk ---------+|||| minimize || restore | ... ||| 105 // ||| |||+- TabStripGtk ---------+|||| minimize || restore | ... |||
106 // ||| )8\ |||| tab tab tabclose ||||+----------++----------+ ||| 106 // ||| )8\ |||| tab tab tabclose ||||+----------++----------+ |||
107 // ||+-------+||+------------------------+||+------------------------------+|| 107 // ||+-------+||+------------------------+||+------------------------------+||
108 // |+---------++--------------------------++--------------------------------+| 108 // |+---------++--------------------------++--------------------------------+|
109 // +-------------------------------------------------------------------------+ 109 // +-------------------------------------------------------------------------+
110 // 110 //
111 // If we're a popup window or in app mode, we don't display the spy guy or 111 // If we're a popup window or in app mode, we don't display the spy guy or
112 // the tab strip. Instead, put an hbox in titlebar_alignment_ in place of 112 // the tab strip. Instead, put an hbox in titlebar_alignment_ in place of
113 // the tab strip. 113 // the tab strip.
114 // +- Alignment (titlebar_alignment_) ----------------------------+ 114 // +- Alignment (titlebar_alignment_) -----------------------------------+
115 // |+ HBox ------------------------------------------------------+| 115 // |+ HBox -------------------------------------------------------------+|
116 // ||+- Image (app_mode_favicon_) -++- Label (app_mode_title_) -+|| 116 // ||+- TabStripGtk -++- Image ----------------++- Label --------------+||
117 // ||| favicon || page title ||| 117 // ||| hidden ++ (app_mode_favicon_) || (app_mode_title_) |||
118 // ||+-----------------------------++---------------------------+|| 118 // ||| || favicon || page title |||
119 // |+------------------------------------------------------------+| 119 // ||+---------------++------------------------++----------------------+||
120 // +--------------------------------------------------------------+ 120 // |+-------------------------------------------------------------------+|
121 // +---------------------------------------------------------------------+
121 GtkWidget* container_hbox = gtk_hbox_new(FALSE, 0); 122 GtkWidget* container_hbox = gtk_hbox_new(FALSE, 0);
122 123
123 container_ = gtk_event_box_new(); 124 container_ = gtk_event_box_new();
124 gtk_event_box_set_visible_window(GTK_EVENT_BOX(container_), FALSE); 125 gtk_event_box_set_visible_window(GTK_EVENT_BOX(container_), FALSE);
125 gtk_container_add(GTK_CONTAINER(container_), container_hbox); 126 gtk_container_add(GTK_CONTAINER(container_), container_hbox);
126 127
127 g_signal_connect(G_OBJECT(container_), "scroll-event", 128 g_signal_connect(G_OBJECT(container_), "scroll-event",
128 G_CALLBACK(OnScroll), this); 129 G_CALLBACK(OnScroll), this);
129 130
130 g_signal_connect(window_, "window-state-event", 131 g_signal_connect(window_, "window-state-event",
(...skipping 22 matching lines...) Expand all
153 // Put the tab strip in the titlebar. 154 // Put the tab strip in the titlebar.
154 gtk_container_add(GTK_CONTAINER(titlebar_alignment_), 155 gtk_container_add(GTK_CONTAINER(titlebar_alignment_),
155 browser_window_->tabstrip()->widget()); 156 browser_window_->tabstrip()->widget());
156 } else { 157 } else {
157 // App mode specific widgets. 158 // App mode specific widgets.
158 gtk_box_pack_start(GTK_BOX(container_hbox), titlebar_alignment_, TRUE, 159 gtk_box_pack_start(GTK_BOX(container_hbox), titlebar_alignment_, TRUE,
159 TRUE, 0); 160 TRUE, 0);
160 GtkWidget* app_mode_hbox = gtk_hbox_new(FALSE, kIconTitleSpacing); 161 GtkWidget* app_mode_hbox = gtk_hbox_new(FALSE, kIconTitleSpacing);
161 gtk_container_add(GTK_CONTAINER(titlebar_alignment_), app_mode_hbox); 162 gtk_container_add(GTK_CONTAINER(titlebar_alignment_), app_mode_hbox);
162 163
164 // Put the tab strip in the hbox even though we don't show it. Sometimes
165 // we need the position of the tab strip so make sure it's in our widget
166 // hierarchy.
167 gtk_box_pack_start(GTK_BOX(app_mode_hbox),
168 browser_window_->tabstrip()->widget(), FALSE, FALSE, 0);
169
163 // We use the app logo as a placeholder image so the title doesn't jump 170 // We use the app logo as a placeholder image so the title doesn't jump
164 // around. 171 // around.
165 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 172 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
166 // TODO(tc): Add a left click menu to this icon. 173 // TODO(tc): Add a left click menu to this icon.
167 app_mode_favicon_ = gtk_image_new_from_pixbuf( 174 app_mode_favicon_ = gtk_image_new_from_pixbuf(
168 rb.GetRTLEnabledPixbufNamed(IDR_PRODUCT_LOGO_16)); 175 rb.GetRTLEnabledPixbufNamed(IDR_PRODUCT_LOGO_16));
169 gtk_box_pack_start(GTK_BOX(app_mode_hbox), app_mode_favicon_, FALSE, 176 gtk_box_pack_start(GTK_BOX(app_mode_hbox), app_mode_favicon_, FALSE,
170 FALSE, 0); 177 FALSE, 0);
171 178
172 app_mode_title_ = gtk_label_new(NULL); 179 app_mode_title_ = gtk_label_new(NULL);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 size_t num_frames = frame_strip->width() / frame_size; 443 size_t num_frames = frame_strip->width() / frame_size;
437 g_throbber_frames = new std::vector<GdkPixbuf*>; 444 g_throbber_frames = new std::vector<GdkPixbuf*>;
438 445
439 // Make a separate GdkPixbuf for each frame of the animation. 446 // Make a separate GdkPixbuf for each frame of the animation.
440 for (size_t i = 0; i < num_frames; ++i) { 447 for (size_t i = 0; i < num_frames; ++i) {
441 SkBitmap frame = skia::ImageOperations::CreateTiledBitmap(*frame_strip, 448 SkBitmap frame = skia::ImageOperations::CreateTiledBitmap(*frame_strip,
442 i * frame_size, 0, frame_size, frame_size); 449 i * frame_size, 0, frame_size, frame_size);
443 g_throbber_frames->push_back(gfx::GdkPixbufFromSkBitmap(&frame)); 450 g_throbber_frames->push_back(gfx::GdkPixbufFromSkBitmap(&frame));
444 } 451 }
445 } 452 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/tabs/tab_strip_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698