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

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

Issue 195048: Simplify the gtk location bar padding and make it more consistent. (Closed)
Patch Set: simplify tab to search comment Created 11 years, 3 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 | « chrome/browser/gtk/location_bar_view_gtk.h ('k') | no next file » | 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/location_bar_view_gtk.h" 5 #include "chrome/browser/gtk/location_bar_view_gtk.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 30 matching lines...) Expand all
41 // We draw a border on the top and bottom (but not on left or right). 41 // We draw a border on the top and bottom (but not on left or right).
42 const int kBorderThickness = 1; 42 const int kBorderThickness = 1;
43 43
44 // Left margin of first run bubble. 44 // Left margin of first run bubble.
45 const int kFirstRunBubbleLeftMargin = 8; 45 const int kFirstRunBubbleLeftMargin = 8;
46 // Extra vertical spacing for first run bubble. 46 // Extra vertical spacing for first run bubble.
47 const int kFirstRunBubbleTopMargin = 1; 47 const int kFirstRunBubbleTopMargin = 1;
48 // Task delay (in milliseconds) to show first run bubble. 48 // Task delay (in milliseconds) to show first run bubble.
49 const int kFirstRunBubbleTaskDelay = 200; 49 const int kFirstRunBubbleTaskDelay = 200;
50 50
51 // Left and right padding/margin. 51 // The padding around the top, bottom, and sides of the location bar hbox.
52 // no icon/text : 4px url_text 4px 52 // We don't want to edit control's text to be right against the edge,
53 // [4px|url text|4px] <hide ssl icon> <hide ev text> 53 // as well the tab to search box and other widgets need to have the padding on
54 // with icon : 4px url_text 6px ssl_icon 8px 54 // top and bottom to avoid drawing larger than the location bar space.
55 // [4px|url text|4px] [2px|ssl icon|8px] <hide ev text> 55 const int kHboxBorder = 4;
56 // with icon/text: 4px url_text 6px ssl_icon 8px ev_text 4px]
57 // [4px|url text|4px] [2px|ssl icon|8px] [ev text|4px]
58 56
59 // We don't want to edit control's text to be right against the edge. 57 // Padding between the elements in the bar.
60 const int kEditLeftRightPadding = 4; 58 static const int kInnerPadding = 4;
61
62 // Padding around the security icon.
63 const int kSecurityIconPaddingLeft = 0;
64 const int kSecurityIconPaddingRight = 6;
65
66 const int kEvTextPaddingRight = 4;
67
68 const int kKeywordTopBottomPadding = 4;
69 const int kKeywordLeftRightPadding = 4;
70 59
71 // TODO(deanm): Eventually this should be painted with the background png 60 // TODO(deanm): Eventually this should be painted with the background png
72 // image, but for now we get pretty close by just drawing a solid border. 61 // image, but for now we get pretty close by just drawing a solid border.
73 const GdkColor kBorderColor = GDK_COLOR_RGB(0xbe, 0xc8, 0xd4); 62 const GdkColor kBorderColor = GDK_COLOR_RGB(0xbe, 0xc8, 0xd4);
74 const GdkColor kEvTextColor = GDK_COLOR_RGB(0x00, 0x96, 0x14); // Green. 63 const GdkColor kEvTextColor = GDK_COLOR_RGB(0x00, 0x96, 0x14); // Green.
75 const GdkColor kKeywordBackgroundColor = GDK_COLOR_RGB(0xf0, 0xf4, 0xfa); 64 const GdkColor kKeywordBackgroundColor = GDK_COLOR_RGB(0xf0, 0xf4, 0xfa);
76 const GdkColor kKeywordBorderColor = GDK_COLOR_RGB(0xcb, 0xde, 0xf7); 65 const GdkColor kKeywordBorderColor = GDK_COLOR_RGB(0xcb, 0xde, 0xf7);
77 66
78 // Size of the rounding of the "Search site for:" box. 67 // Size of the rounding of the "Search site for:" box.
79 const int kCornerSize = 3; 68 const int kCornerSize = 3;
(...skipping 15 matching lines...) Expand all
95 84
96 // static 85 // static
97 const GdkColor LocationBarViewGtk::kBackgroundColorByLevel[3] = { 86 const GdkColor LocationBarViewGtk::kBackgroundColorByLevel[3] = {
98 GDK_COLOR_RGB(255, 245, 195), // SecurityLevel SECURE: Yellow. 87 GDK_COLOR_RGB(255, 245, 195), // SecurityLevel SECURE: Yellow.
99 GDK_COLOR_RGB(255, 255, 255), // SecurityLevel NORMAL: White. 88 GDK_COLOR_RGB(255, 255, 255), // SecurityLevel NORMAL: White.
100 GDK_COLOR_RGB(255, 255, 255), // SecurityLevel INSECURE: White. 89 GDK_COLOR_RGB(255, 255, 255), // SecurityLevel INSECURE: White.
101 }; 90 };
102 91
103 LocationBarViewGtk::LocationBarViewGtk(CommandUpdater* command_updater, 92 LocationBarViewGtk::LocationBarViewGtk(CommandUpdater* command_updater,
104 ToolbarModel* toolbar_model, AutocompletePopupPositioner* popup_positioner) 93 ToolbarModel* toolbar_model, AutocompletePopupPositioner* popup_positioner)
105 : security_icon_align_(NULL), 94 : security_icon_event_box_(NULL),
106 security_lock_icon_image_(NULL), 95 security_lock_icon_image_(NULL),
107 security_warning_icon_image_(NULL), 96 security_warning_icon_image_(NULL),
108 info_label_align_(NULL),
109 info_label_(NULL), 97 info_label_(NULL),
110 tab_to_search_(NULL),
111 tab_to_search_box_(NULL), 98 tab_to_search_box_(NULL),
112 tab_to_search_label_(NULL), 99 tab_to_search_label_(NULL),
113 tab_to_search_hint_(NULL), 100 tab_to_search_hint_(NULL),
114 tab_to_search_hint_leading_label_(NULL), 101 tab_to_search_hint_leading_label_(NULL),
115 tab_to_search_hint_icon_(NULL), 102 tab_to_search_hint_icon_(NULL),
116 tab_to_search_hint_trailing_label_(NULL), 103 tab_to_search_hint_trailing_label_(NULL),
117 profile_(NULL), 104 profile_(NULL),
118 command_updater_(command_updater), 105 command_updater_(command_updater),
119 toolbar_model_(toolbar_model), 106 toolbar_model_(toolbar_model),
120 popup_positioner_(popup_positioner), 107 popup_positioner_(popup_positioner),
(...skipping 12 matching lines...) Expand all
133 void LocationBarViewGtk::Init(bool popup_window_mode) { 120 void LocationBarViewGtk::Init(bool popup_window_mode) {
134 popup_window_mode_ = popup_window_mode; 121 popup_window_mode_ = popup_window_mode;
135 location_entry_.reset(new AutocompleteEditViewGtk(this, 122 location_entry_.reset(new AutocompleteEditViewGtk(this,
136 toolbar_model_, 123 toolbar_model_,
137 profile_, 124 profile_,
138 command_updater_, 125 command_updater_,
139 popup_window_mode_, 126 popup_window_mode_,
140 popup_positioner_)); 127 popup_positioner_));
141 location_entry_->Init(); 128 location_entry_->Init();
142 129
143 hbox_.Own(gtk_hbox_new(FALSE, 0)); 130 hbox_.Own(gtk_hbox_new(FALSE, kInnerPadding));
131 gtk_container_set_border_width(GTK_CONTAINER(hbox_.get()), kHboxBorder);
144 // We will paint for the alignment, to paint the background and border. 132 // We will paint for the alignment, to paint the background and border.
145 gtk_widget_set_app_paintable(hbox_.get(), TRUE); 133 gtk_widget_set_app_paintable(hbox_.get(), TRUE);
146 // Have GTK double buffer around the expose signal. 134 // Have GTK double buffer around the expose signal.
147 gtk_widget_set_double_buffered(hbox_.get(), TRUE); 135 gtk_widget_set_double_buffered(hbox_.get(), TRUE);
148 // Redraw the whole location bar when it changes size (e.g., when toggling 136 // Redraw the whole location bar when it changes size (e.g., when toggling
149 // the home button on/off. 137 // the home button on/off.
150 gtk_widget_set_redraw_on_allocate(hbox_.get(), TRUE); 138 gtk_widget_set_redraw_on_allocate(hbox_.get(), TRUE);
151 139
152 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 140 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
153 security_lock_icon_image_ = gtk_image_new_from_pixbuf( 141 security_lock_icon_image_ = gtk_image_new_from_pixbuf(
154 rb.GetPixbufNamed(IDR_LOCK)); 142 rb.GetPixbufNamed(IDR_LOCK));
155 gtk_widget_hide(GTK_WIDGET(security_lock_icon_image_)); 143 gtk_widget_hide(GTK_WIDGET(security_lock_icon_image_));
156 security_warning_icon_image_ = gtk_image_new_from_pixbuf( 144 security_warning_icon_image_ = gtk_image_new_from_pixbuf(
157 rb.GetPixbufNamed(IDR_WARNING)); 145 rb.GetPixbufNamed(IDR_WARNING));
158 gtk_widget_hide(GTK_WIDGET(security_warning_icon_image_)); 146 gtk_widget_hide(GTK_WIDGET(security_warning_icon_image_));
159 147
160 info_label_ = gtk_label_new(NULL); 148 info_label_ = gtk_label_new(NULL);
161 gtk_widget_modify_base(info_label_, GTK_STATE_NORMAL, 149 gtk_widget_modify_base(info_label_, GTK_STATE_NORMAL,
162 &LocationBarViewGtk::kBackgroundColorByLevel[0]); 150 &LocationBarViewGtk::kBackgroundColorByLevel[0]);
163 gtk_widget_hide(GTK_WIDGET(info_label_)); 151 gtk_widget_hide(GTK_WIDGET(info_label_));
164 152
165 g_signal_connect(hbox_.get(), "expose-event", 153 g_signal_connect(hbox_.get(), "expose-event",
166 G_CALLBACK(&HandleExposeThunk), this); 154 G_CALLBACK(&HandleExposeThunk), this);
167 155
168 // Tab to search (the keyword box on the left hand side). 156 // Tab to search (the keyword box on the left hand side).
169 tab_to_search_label_ = gtk_label_new(NULL); 157 tab_to_search_label_ = gtk_label_new(NULL);
170 // We need an alignment to pad our box inside the edit area.
171 tab_to_search_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
172 gtk_alignment_set_padding(GTK_ALIGNMENT(tab_to_search_),
173 kKeywordTopBottomPadding, kKeywordTopBottomPadding,
174 kKeywordLeftRightPadding, kKeywordLeftRightPadding);
175 158
176 // This crazy stack of alignments and event boxes creates a box around the 159 // This creates a box around the keyword text with a border, background color,
177 // keyword text with a border, background color, and padding around the text. 160 // and padding around the text.
178 tab_to_search_box_ = gtk_util::CreateGtkBorderBin( 161 tab_to_search_box_ = gtk_util::CreateGtkBorderBin(
179 tab_to_search_label_, NULL, 1, 1, 2, 2); 162 tab_to_search_label_, NULL, 1, 1, 2, 2);
180 gtk_util::ActAsRoundedWindow(tab_to_search_box_, kBorderColor, kCornerSize, 163 gtk_util::ActAsRoundedWindow(tab_to_search_box_, kBorderColor, kCornerSize,
181 gtk_util::ROUNDED_ALL, gtk_util::BORDER_ALL); 164 gtk_util::ROUNDED_ALL, gtk_util::BORDER_ALL);
182 gtk_container_add(GTK_CONTAINER(tab_to_search_), tab_to_search_box_); 165 gtk_box_pack_start(GTK_BOX(hbox_.get()), tab_to_search_box_, FALSE, FALSE, 0);
183 gtk_box_pack_start(GTK_BOX(hbox_.get()), tab_to_search_, FALSE, FALSE, 0);
184 166
185 GtkWidget* align = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); 167 GtkWidget* align = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
186 // TODO(erg): Like in BrowserToolbarGtk, this used to have a code path on 168 // TODO(erg): Like in BrowserToolbarGtk, this used to have a code path on
187 // construction for with GTK themes and without. Doing that only on 169 // construction for with GTK themes and without. Doing that only on
188 // construction was wrong, and I can't see a difference between the two ways 170 // construction was wrong, and I can't see a difference between the two ways
189 // anyway... Investigate more later. 171 // anyway... Investigate more later.
190 if (popup_window_mode_) { 172 if (popup_window_mode_) {
191 gtk_alignment_set_padding(GTK_ALIGNMENT(align), 173 gtk_alignment_set_padding(GTK_ALIGNMENT(align),
192 kTopMargin + kBorderThickness, 174 kTopMargin + kBorderThickness,
193 kBottomMargin + kBorderThickness, 175 kBottomMargin + kBorderThickness,
194 kEditLeftRightPadding + kBorderThickness, 176 kBorderThickness,
195 kEditLeftRightPadding + kBorderThickness); 177 kBorderThickness);
196 } else { 178 } else {
197 gtk_alignment_set_padding(GTK_ALIGNMENT(align), 179 gtk_alignment_set_padding(GTK_ALIGNMENT(align),
198 kTopMargin + kBorderThickness, 180 kTopMargin + kBorderThickness,
199 kBottomMargin + kBorderThickness, 181 kBottomMargin + kBorderThickness,
200 kEditLeftRightPadding, kEditLeftRightPadding); 182 0, 0);
201 } 183 }
202 gtk_container_add(GTK_CONTAINER(align), location_entry_->widget()); 184 gtk_container_add(GTK_CONTAINER(align), location_entry_->widget());
203 gtk_box_pack_start(GTK_BOX(hbox_.get()), align, TRUE, TRUE, 0); 185 gtk_box_pack_start(GTK_BOX(hbox_.get()), align, TRUE, TRUE, 0);
204 186
205 // Tab to search notification (the hint on the right hand side). 187 // Tab to search notification (the hint on the right hand side).
206 tab_to_search_hint_ = gtk_hbox_new(FALSE, 0); 188 tab_to_search_hint_ = gtk_hbox_new(FALSE, 0);
207 tab_to_search_hint_leading_label_ = gtk_label_new(NULL); 189 tab_to_search_hint_leading_label_ = gtk_label_new(NULL);
208 tab_to_search_hint_icon_ = gtk_image_new_from_pixbuf( 190 tab_to_search_hint_icon_ = gtk_image_new_from_pixbuf(
209 rb.GetPixbufNamed(IDR_LOCATION_BAR_KEYWORD_HINT_TAB)); 191 rb.GetPixbufNamed(IDR_LOCATION_BAR_KEYWORD_HINT_TAB));
210 tab_to_search_hint_trailing_label_ = gtk_label_new(NULL); 192 tab_to_search_hint_trailing_label_ = gtk_label_new(NULL);
211 gtk_box_pack_start(GTK_BOX(tab_to_search_hint_), 193 gtk_box_pack_start(GTK_BOX(tab_to_search_hint_),
212 tab_to_search_hint_leading_label_, 194 tab_to_search_hint_leading_label_,
213 FALSE, FALSE, 0); 195 FALSE, FALSE, 0);
214 gtk_box_pack_start(GTK_BOX(tab_to_search_hint_), 196 gtk_box_pack_start(GTK_BOX(tab_to_search_hint_),
215 tab_to_search_hint_icon_, 197 tab_to_search_hint_icon_,
216 FALSE, FALSE, 0); 198 FALSE, FALSE, 0);
217 gtk_box_pack_start(GTK_BOX(tab_to_search_hint_), 199 gtk_box_pack_start(GTK_BOX(tab_to_search_hint_),
218 tab_to_search_hint_trailing_label_, 200 tab_to_search_hint_trailing_label_,
219 FALSE, FALSE, 0); 201 FALSE, FALSE, 0);
220 // tab_to_search_hint_ gets hidden initially in OnChanged. Hiding it here 202 // tab_to_search_hint_ gets hidden initially in OnChanged. Hiding it here
221 // doesn't work, someone is probably calling show_all on our parent box. 203 // doesn't work, someone is probably calling show_all on our parent box.
222 gtk_box_pack_end(GTK_BOX(hbox_.get()), tab_to_search_hint_, FALSE, FALSE, 4); 204 gtk_box_pack_end(GTK_BOX(hbox_.get()), tab_to_search_hint_, FALSE, FALSE, 4);
223 205
224 // Pack info_label_ and security icons in hbox. We hide/show them 206 // Pack info_label_ and security icons in hbox. We hide/show them
225 // by SetSecurityIcon() and SetInfoText(). 207 // by SetSecurityIcon() and SetInfoText().
226 info_label_align_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); 208 gtk_box_pack_end(GTK_BOX(hbox_.get()), info_label_, FALSE, FALSE, 0);
227 gtk_alignment_set_padding(GTK_ALIGNMENT(info_label_align_),
228 kTopMargin + kBorderThickness,
229 kBottomMargin + kBorderThickness,
230 0, kEvTextPaddingRight);
231 gtk_container_add(GTK_CONTAINER(info_label_align_), info_label_);
232 gtk_box_pack_end(GTK_BOX(hbox_.get()), info_label_align_, FALSE, FALSE, 0);
233 209
234 GtkWidget* security_icon_box = gtk_hbox_new(FALSE, 0); 210 GtkWidget* security_icon_box = gtk_hbox_new(FALSE, 0);
235 gtk_box_pack_start(GTK_BOX(security_icon_box), 211 gtk_box_pack_start(GTK_BOX(security_icon_box),
236 security_lock_icon_image_, FALSE, FALSE, 0); 212 security_lock_icon_image_, FALSE, FALSE, 0);
237 gtk_box_pack_start(GTK_BOX(security_icon_box), 213 gtk_box_pack_start(GTK_BOX(security_icon_box),
238 security_warning_icon_image_, FALSE, FALSE, 0); 214 security_warning_icon_image_, FALSE, FALSE, 0);
239 215
240 security_icon_align_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
241 gtk_alignment_set_padding(GTK_ALIGNMENT(security_icon_align_),
242 kTopMargin + kBorderThickness,
243 kBottomMargin + kBorderThickness,
244 kSecurityIconPaddingLeft,
245 kSecurityIconPaddingRight);
246 // GtkImage is a "no window" widget and requires a GtkEventBox to receive 216 // GtkImage is a "no window" widget and requires a GtkEventBox to receive
247 // events. 217 // events.
248 GtkWidget* event_box = gtk_event_box_new(); 218 security_icon_event_box_ = gtk_event_box_new();
249 // Make the event box not visible so it does not paint a background. 219 // Make the event box not visible so it does not paint a background.
250 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box), FALSE); 220 gtk_event_box_set_visible_window(GTK_EVENT_BOX(security_icon_event_box_),
251 g_signal_connect(event_box, "button-press-event", 221 FALSE);
222 g_signal_connect(security_icon_event_box_, "button-press-event",
252 G_CALLBACK(&OnSecurityIconPressed), this); 223 G_CALLBACK(&OnSecurityIconPressed), this);
253 224
254 gtk_container_add(GTK_CONTAINER(event_box), security_icon_box); 225 gtk_container_add(GTK_CONTAINER(security_icon_event_box_), security_icon_box);
255 gtk_container_add(GTK_CONTAINER(security_icon_align_), event_box); 226 gtk_box_pack_end(GTK_BOX(hbox_.get()), security_icon_event_box_,
256 gtk_box_pack_end(GTK_BOX(hbox_.get()), security_icon_align_, FALSE, FALSE, 0); 227 FALSE, FALSE, 0);
257 228
258 registrar_.Add(this, 229 registrar_.Add(this,
259 NotificationType::BROWSER_THEME_CHANGED, 230 NotificationType::BROWSER_THEME_CHANGED,
260 NotificationService::AllSources()); 231 NotificationService::AllSources());
261 theme_provider_ = GtkThemeProvider::GetFrom(profile_); 232 theme_provider_ = GtkThemeProvider::GetFrom(profile_);
262 theme_provider_->InitThemesFor(this); 233 theme_provider_->InitThemesFor(this);
263 } 234 }
264 235
265 void LocationBarViewGtk::SetProfile(Profile* profile) { 236 void LocationBarViewGtk::SetProfile(Profile* profile) {
266 profile_ = profile; 237 profile_ = profile;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 287 }
317 288
318 void LocationBarViewGtk::OnChanged() { 289 void LocationBarViewGtk::OnChanged() {
319 const std::wstring keyword(location_entry_->model()->keyword()); 290 const std::wstring keyword(location_entry_->model()->keyword());
320 const bool is_keyword_hint = location_entry_->model()->is_keyword_hint(); 291 const bool is_keyword_hint = location_entry_->model()->is_keyword_hint();
321 const bool show_selected_keyword = !keyword.empty() && !is_keyword_hint; 292 const bool show_selected_keyword = !keyword.empty() && !is_keyword_hint;
322 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; 293 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint;
323 294
324 if (show_selected_keyword) { 295 if (show_selected_keyword) {
325 SetKeywordLabel(keyword); 296 SetKeywordLabel(keyword);
326 gtk_widget_show_all(tab_to_search_); 297 gtk_widget_show_all(tab_to_search_box_);
327 } else { 298 } else {
328 gtk_widget_hide_all(tab_to_search_); 299 gtk_widget_hide_all(tab_to_search_box_);
329 } 300 }
330 301
331 if (show_keyword_hint) { 302 if (show_keyword_hint) {
332 SetKeywordHintLabel(keyword); 303 SetKeywordHintLabel(keyword);
333 gtk_widget_show_all(tab_to_search_hint_); 304 gtk_widget_show_all(tab_to_search_hint_);
334 } else { 305 } else {
335 gtk_widget_hide_all(tab_to_search_hint_); 306 gtk_widget_hide_all(tab_to_search_hint_);
336 } 307 }
337 } 308 }
338 309
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 g_object_unref(gc); 474 g_object_unref(gc);
504 } 475 }
505 476
506 return FALSE; // Continue propagating the expose. 477 return FALSE; // Continue propagating the expose.
507 } 478 }
508 479
509 void LocationBarViewGtk::SetSecurityIcon(ToolbarModel::Icon icon) { 480 void LocationBarViewGtk::SetSecurityIcon(ToolbarModel::Icon icon) {
510 gtk_widget_hide(GTK_WIDGET(security_lock_icon_image_)); 481 gtk_widget_hide(GTK_WIDGET(security_lock_icon_image_));
511 gtk_widget_hide(GTK_WIDGET(security_warning_icon_image_)); 482 gtk_widget_hide(GTK_WIDGET(security_warning_icon_image_));
512 if (icon != ToolbarModel::NO_ICON) 483 if (icon != ToolbarModel::NO_ICON)
513 gtk_widget_show(GTK_WIDGET(security_icon_align_)); 484 gtk_widget_show(GTK_WIDGET(security_icon_event_box_));
514 else 485 else
515 gtk_widget_hide(GTK_WIDGET(security_icon_align_)); 486 gtk_widget_hide(GTK_WIDGET(security_icon_event_box_));
516 switch (icon) { 487 switch (icon) {
517 case ToolbarModel::LOCK_ICON: 488 case ToolbarModel::LOCK_ICON:
518 gtk_widget_show(GTK_WIDGET(security_lock_icon_image_)); 489 gtk_widget_show(GTK_WIDGET(security_lock_icon_image_));
519 break; 490 break;
520 case ToolbarModel::WARNING_ICON: 491 case ToolbarModel::WARNING_ICON:
521 gtk_widget_show(GTK_WIDGET(security_warning_icon_image_)); 492 gtk_widget_show(GTK_WIDGET(security_warning_icon_image_));
522 break; 493 break;
523 case ToolbarModel::NO_ICON: 494 case ToolbarModel::NO_ICON:
524 break; 495 break;
525 default: 496 default:
526 NOTREACHED(); 497 NOTREACHED();
527 break; 498 break;
528 } 499 }
529 } 500 }
530 501
531 void LocationBarViewGtk::SetInfoText() { 502 void LocationBarViewGtk::SetInfoText() {
532 std::wstring info_text, info_tooltip; 503 std::wstring info_text, info_tooltip;
533 ToolbarModel::InfoTextType info_text_type = 504 ToolbarModel::InfoTextType info_text_type =
534 toolbar_model_->GetInfoText(&info_text, &info_tooltip); 505 toolbar_model_->GetInfoText(&info_text, &info_tooltip);
535 if (info_text_type == ToolbarModel::INFO_EV_TEXT) { 506 if (info_text_type == ToolbarModel::INFO_EV_TEXT) {
536 gtk_widget_modify_fg(GTK_WIDGET(info_label_), GTK_STATE_NORMAL, 507 gtk_widget_modify_fg(GTK_WIDGET(info_label_), GTK_STATE_NORMAL,
537 &kEvTextColor); 508 &kEvTextColor);
538 gtk_widget_show(GTK_WIDGET(info_label_align_)); 509 gtk_widget_show(GTK_WIDGET(info_label_));
539 } else { 510 } else {
540 DCHECK_EQ(info_text_type, ToolbarModel::INFO_NO_INFO); 511 DCHECK_EQ(info_text_type, ToolbarModel::INFO_NO_INFO);
541 DCHECK(info_text.empty()); 512 DCHECK(info_text.empty());
542 // Clear info_text. Should we reset the fg here? 513 // Clear info_text. Should we reset the fg here?
543 gtk_widget_hide(GTK_WIDGET(info_label_align_)); 514 gtk_widget_hide(GTK_WIDGET(info_label_));
544 } 515 }
545 gtk_label_set_text(GTK_LABEL(info_label_), WideToUTF8(info_text).c_str()); 516 gtk_label_set_text(GTK_LABEL(info_label_), WideToUTF8(info_text).c_str());
546 gtk_widget_set_tooltip_text(GTK_WIDGET(info_label_), 517 gtk_widget_set_tooltip_text(GTK_WIDGET(info_label_),
547 WideToUTF8(info_tooltip).c_str()); 518 WideToUTF8(info_tooltip).c_str());
548 } 519 }
549 520
550 void LocationBarViewGtk::SetKeywordLabel(const std::wstring& keyword) { 521 void LocationBarViewGtk::SetKeywordLabel(const std::wstring& keyword) {
551 if (keyword.empty()) 522 if (keyword.empty())
552 return; 523 return;
553 524
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 LocationBarViewGtk* location_bar) { 593 LocationBarViewGtk* location_bar) {
623 TabContents* tab = BrowserList::GetLastActive()->GetSelectedTabContents(); 594 TabContents* tab = BrowserList::GetLastActive()->GetSelectedTabContents();
624 NavigationEntry* nav_entry = tab->controller().GetActiveEntry(); 595 NavigationEntry* nav_entry = tab->controller().GetActiveEntry();
625 if (!nav_entry) { 596 if (!nav_entry) {
626 NOTREACHED(); 597 NOTREACHED();
627 return true; 598 return true;
628 } 599 }
629 tab->ShowPageInfo(nav_entry->url(), nav_entry->ssl(), true); 600 tab->ShowPageInfo(nav_entry->url(), nav_entry->ssl(), true);
630 return true; 601 return true;
631 } 602 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/location_bar_view_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698