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

Side by Side Diff: chrome/browser/ui/gtk/status_bubble_gtk.cc

Issue 23731010: Move text_elider to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update3 Created 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/gtk_util.cc ('k') | chrome/browser/ui/login/login_prompt.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) 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/gtk/gtk_theme_service.h" 16 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
17 #include "chrome/browser/ui/gtk/gtk_util.h" 17 #include "chrome/browser/ui/gtk/gtk_util.h"
18 #include "chrome/browser/ui/gtk/rounded_window.h" 18 #include "chrome/browser/ui/gtk/rounded_window.h"
19 #include "content/public/browser/notification_source.h" 19 #include "content/public/browser/notification_source.h"
20 #include "ui/base/animation/slide_animation.h" 20 #include "ui/base/animation/slide_animation.h"
21 #include "ui/base/gtk/gtk_compat.h" 21 #include "ui/base/gtk/gtk_compat.h"
22 #include "ui/base/gtk/gtk_hig_constants.h" 22 #include "ui/base/gtk/gtk_hig_constants.h"
23 #include "ui/base/text/text_elider.h"
24 #include "ui/gfx/font.h" 23 #include "ui/gfx/font.h"
24 #include "ui/gfx/text_elider.h"
25 25
26 namespace { 26 namespace {
27 27
28 // Inner padding between the border and the text label. 28 // Inner padding between the border and the text label.
29 const int kInternalTopBottomPadding = 1; 29 const int kInternalTopBottomPadding = 1;
30 const int kInternalLeftRightPadding = 2; 30 const int kInternalLeftRightPadding = 2;
31 31
32 // The radius of the edges of our bubble. 32 // The radius of the edges of our bubble.
33 const int kCornerSize = 3; 33 const int kCornerSize = 3;
34 34
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 expand_timer_.Stop(); 106 expand_timer_.Stop();
107 expand_timer_.Start(FROM_HERE, 107 expand_timer_.Start(FROM_HERE,
108 base::TimeDelta::FromMilliseconds(kExpandHoverDelay), 108 base::TimeDelta::FromMilliseconds(kExpandHoverDelay),
109 this, &StatusBubbleGtk::ExpandURL); 109 this, &StatusBubbleGtk::ExpandURL);
110 // When not expanded, we limit the size to one third the browser's 110 // When not expanded, we limit the size to one third the browser's
111 // width. 111 // width.
112 desired_width /= 3; 112 desired_width /= 3;
113 } 113 }
114 114
115 // TODO(tc): We don't actually use gfx::Font as the font in the status 115 // TODO(tc): We don't actually use gfx::Font as the font in the status
116 // bubble. We should extend ui::ElideUrl to take some sort of pango font. 116 // bubble. We should extend gfx::ElideUrl to take some sort of pango font.
117 url_text_ = UTF16ToUTF8( 117 url_text_ = UTF16ToUTF8(
118 ui::ElideUrl(url_, gfx::Font(), desired_width, languages_)); 118 gfx::ElideUrl(url_, gfx::Font(), desired_width, languages_));
119 SetStatusTextTo(url_text_); 119 SetStatusTextTo(url_text_);
120 } 120 }
121 121
122 void StatusBubbleGtk::Show() { 122 void StatusBubbleGtk::Show() {
123 // If we were going to hide, stop. 123 // If we were going to hide, stop.
124 hide_timer_.Stop(); 124 hide_timer_.Stop();
125 125
126 gtk_widget_show(container_.get()); 126 gtk_widget_show(container_.get());
127 GdkWindow* gdk_window = gtk_widget_get_window(container_.get()); 127 GdkWindow* gdk_window = gtk_widget_get_window(container_.get());
128 if (gdk_window) 128 if (gdk_window)
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 return FALSE; 372 return FALSE;
373 } 373 }
374 374
375 void StatusBubbleGtk::AnimationEnded(const ui::Animation* animation) { 375 void StatusBubbleGtk::AnimationEnded(const ui::Animation* animation) {
376 UpdateLabelSizeRequest(); 376 UpdateLabelSizeRequest();
377 } 377 }
378 378
379 void StatusBubbleGtk::AnimationProgressed(const ui::Animation* animation) { 379 void StatusBubbleGtk::AnimationProgressed(const ui::Animation* animation) {
380 UpdateLabelSizeRequest(); 380 UpdateLabelSizeRequest();
381 } 381 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/gtk_util.cc ('k') | chrome/browser/ui/login/login_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698