| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/gtk/status_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/status_bubble_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 url_text_ = UTF16ToUTF8( | 115 url_text_ = UTF16ToUTF8( |
| 116 ui::ElideUrl(url_, gfx::Font(), desired_width, languages_)); | 116 ui::ElideUrl(url_, gfx::Font(), desired_width, languages_)); |
| 117 SetStatusTextTo(url_text_); | 117 SetStatusTextTo(url_text_); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void StatusBubbleGtk::Show() { | 120 void StatusBubbleGtk::Show() { |
| 121 // If we were going to hide, stop. | 121 // If we were going to hide, stop. |
| 122 hide_timer_.Stop(); | 122 hide_timer_.Stop(); |
| 123 | 123 |
| 124 gtk_widget_show(container_.get()); | 124 gtk_widget_show(container_.get()); |
| 125 if (container_->window) | 125 GdkWindow* gdk_window = gtk_widget_get_window(container_.get()); |
| 126 gdk_window_raise(container_->window); | 126 if (gdk_window) |
| 127 gdk_window_raise(gdk_window); |
| 127 } | 128 } |
| 128 | 129 |
| 129 void StatusBubbleGtk::Hide() { | 130 void StatusBubbleGtk::Hide() { |
| 130 // If we were going to expand the bubble, stop. | 131 // If we were going to expand the bubble, stop. |
| 131 expand_timer_.Stop(); | 132 expand_timer_.Stop(); |
| 132 expand_animation_.reset(); | 133 expand_animation_.reset(); |
| 133 | 134 |
| 134 gtk_widget_hide(container_.get()); | 135 gtk_widget_hide(container_.get()); |
| 135 } | 136 } |
| 136 | 137 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 192 |
| 192 GtkRequisition requisition; | 193 GtkRequisition requisition; |
| 193 gtk_widget_size_request(container_.get(), &requisition); | 194 gtk_widget_size_request(container_.get(), &requisition); |
| 194 | 195 |
| 195 GtkAllocation parent_allocation; | 196 GtkAllocation parent_allocation; |
| 196 gtk_widget_get_allocation(parent, &parent_allocation); | 197 gtk_widget_get_allocation(parent, &parent_allocation); |
| 197 | 198 |
| 198 // Get our base position (that is, not including the current offset) | 199 // Get our base position (that is, not including the current offset) |
| 199 // relative to the origin of the root window. | 200 // relative to the origin of the root window. |
| 200 gint toplevel_x = 0, toplevel_y = 0; | 201 gint toplevel_x = 0, toplevel_y = 0; |
| 201 gdk_window_get_position(toplevel->window, &toplevel_x, &toplevel_y); | 202 GdkWindow* gdk_window = gtk_widget_get_window(toplevel); |
| 203 gdk_window_get_position(gdk_window, &toplevel_x, &toplevel_y); |
| 202 gfx::Rect parent_rect = | 204 gfx::Rect parent_rect = |
| 203 gtk_util::GetWidgetRectRelativeToToplevel(parent); | 205 gtk_util::GetWidgetRectRelativeToToplevel(parent); |
| 204 gfx::Rect bubble_rect( | 206 gfx::Rect bubble_rect( |
| 205 toplevel_x + parent_rect.x() + | 207 toplevel_x + parent_rect.x() + |
| 206 (ltr ? 0 : parent_allocation.width - requisition.width), | 208 (ltr ? 0 : parent_allocation.width - requisition.width), |
| 207 toplevel_y + parent_rect.y() + | 209 toplevel_y + parent_rect.y() + |
| 208 parent_allocation.height - requisition.height, | 210 parent_allocation.height - requisition.height, |
| 209 requisition.width, | 211 requisition.width, |
| 210 requisition.height); | 212 requisition.height); |
| 211 | 213 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 return FALSE; | 370 return FALSE; |
| 369 } | 371 } |
| 370 | 372 |
| 371 void StatusBubbleGtk::AnimationEnded(const ui::Animation* animation) { | 373 void StatusBubbleGtk::AnimationEnded(const ui::Animation* animation) { |
| 372 UpdateLabelSizeRequest(); | 374 UpdateLabelSizeRequest(); |
| 373 } | 375 } |
| 374 | 376 |
| 375 void StatusBubbleGtk::AnimationProgressed(const ui::Animation* animation) { | 377 void StatusBubbleGtk::AnimationProgressed(const ui::Animation* animation) { |
| 376 UpdateLabelSizeRequest(); | 378 UpdateLabelSizeRequest(); |
| 377 } | 379 } |
| OLD | NEW |