OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
15 #include "chrome/browser/themes/theme_properties.h" | 15 #include "chrome/browser/themes/theme_properties.h" |
| 16 #include "chrome/browser/ui/elide_url.h" |
16 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 17 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
17 #include "chrome/browser/ui/gtk/gtk_util.h" | 18 #include "chrome/browser/ui/gtk/gtk_util.h" |
18 #include "chrome/browser/ui/gtk/rounded_window.h" | 19 #include "chrome/browser/ui/gtk/rounded_window.h" |
19 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
20 #include "ui/base/gtk/gtk_hig_constants.h" | 21 #include "ui/base/gtk/gtk_hig_constants.h" |
21 #include "ui/gfx/animation/slide_animation.h" | 22 #include "ui/gfx/animation/slide_animation.h" |
22 #include "ui/gfx/font_list.h" | 23 #include "ui/gfx/font_list.h" |
23 #include "ui/gfx/gtk_compat.h" | 24 #include "ui/gfx/gtk_compat.h" |
24 #include "ui/gfx/text_elider.h" | 25 #include "ui/gfx/text_elider.h" |
25 | 26 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 expand_timer_.Stop(); | 107 expand_timer_.Stop(); |
107 expand_timer_.Start(FROM_HERE, | 108 expand_timer_.Start(FROM_HERE, |
108 base::TimeDelta::FromMilliseconds(kExpandHoverDelay), | 109 base::TimeDelta::FromMilliseconds(kExpandHoverDelay), |
109 this, &StatusBubbleGtk::ExpandURL); | 110 this, &StatusBubbleGtk::ExpandURL); |
110 // When not expanded, we limit the size to one third the browser's | 111 // When not expanded, we limit the size to one third the browser's |
111 // width. | 112 // width. |
112 desired_width /= 3; | 113 desired_width /= 3; |
113 } | 114 } |
114 | 115 |
115 // TODO(tc): We don't actually use gfx::Font as the font in the status | 116 // TODO(tc): We don't actually use gfx::Font as the font in the status |
116 // bubble. We should extend gfx::ElideUrl to take some sort of pango font. | 117 // bubble. We should extend ElideUrl to take some sort of pango font. |
117 url_text_ = base::UTF16ToUTF8( | 118 url_text_ = base::UTF16ToUTF8( |
118 gfx::ElideUrl(url_, gfx::FontList(), desired_width, languages_)); | 119 ElideUrl(url_, gfx::FontList(), desired_width, languages_)); |
119 SetStatusTextTo(url_text_); | 120 SetStatusTextTo(url_text_); |
120 } | 121 } |
121 | 122 |
122 void StatusBubbleGtk::Show() { | 123 void StatusBubbleGtk::Show() { |
123 // If we were going to hide, stop. | 124 // If we were going to hide, stop. |
124 hide_timer_.Stop(); | 125 hide_timer_.Stop(); |
125 | 126 |
126 gtk_widget_show(container_.get()); | 127 gtk_widget_show(container_.get()); |
127 GdkWindow* gdk_window = gtk_widget_get_window(container_.get()); | 128 GdkWindow* gdk_window = gtk_widget_get_window(container_.get()); |
128 if (gdk_window) | 129 if (gdk_window) |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 return FALSE; | 373 return FALSE; |
373 } | 374 } |
374 | 375 |
375 void StatusBubbleGtk::AnimationEnded(const gfx::Animation* animation) { | 376 void StatusBubbleGtk::AnimationEnded(const gfx::Animation* animation) { |
376 UpdateLabelSizeRequest(); | 377 UpdateLabelSizeRequest(); |
377 } | 378 } |
378 | 379 |
379 void StatusBubbleGtk::AnimationProgressed(const gfx::Animation* animation) { | 380 void StatusBubbleGtk::AnimationProgressed(const gfx::Animation* animation) { |
380 UpdateLabelSizeRequest(); | 381 UpdateLabelSizeRequest(); |
381 } | 382 } |
OLD | NEW |