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

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

Issue 7812036: Update base/timer.h code to pass through Location from call sites. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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
OLDNEW
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 GtkWidget* parent = gtk_widget_get_parent(container_.get()); 93 GtkWidget* parent = gtk_widget_get_parent(container_.get());
94 94
95 // It appears that parent can be NULL (probably only during shutdown). 95 // It appears that parent can be NULL (probably only during shutdown).
96 if (!parent || !GTK_WIDGET_REALIZED(parent)) 96 if (!parent || !GTK_WIDGET_REALIZED(parent))
97 return; 97 return;
98 98
99 int desired_width = parent->allocation.width; 99 int desired_width = parent->allocation.width;
100 if (!expanded()) { 100 if (!expanded()) {
101 expand_timer_.Stop(); 101 expand_timer_.Stop();
102 expand_timer_.Start(base::TimeDelta::FromMilliseconds(kExpandHoverDelay), 102 expand_timer_.Start(base::TimeDelta::FromMilliseconds(kExpandHoverDelay),
103 this, &StatusBubbleGtk::ExpandURL); 103 this, &StatusBubbleGtk::ExpandURL, FROM_HERE);
104 // When not expanded, we limit the size to one third the browser's 104 // When not expanded, we limit the size to one third the browser's
105 // width. 105 // width.
106 desired_width /= 3; 106 desired_width /= 3;
107 } 107 }
108 108
109 // TODO(tc): We don't actually use gfx::Font as the font in the status 109 // TODO(tc): We don't actually use gfx::Font as the font in the status
110 // bubble. We should extend ui::ElideUrl to take some sort of pango font. 110 // bubble. We should extend ui::ElideUrl to take some sort of pango font.
111 url_text_ = UTF16ToUTF8( 111 url_text_ = UTF16ToUTF8(
112 ui::ElideUrl(url_, gfx::Font(), desired_width, languages_)); 112 ui::ElideUrl(url_, gfx::Font(), desired_width, languages_));
113 SetStatusTextTo(url_text_); 113 SetStatusTextTo(url_text_);
(...skipping 13 matching lines...) Expand all
127 expand_timer_.Stop(); 127 expand_timer_.Stop();
128 expand_animation_.reset(); 128 expand_animation_.reset();
129 129
130 gtk_widget_hide(container_.get()); 130 gtk_widget_hide(container_.get());
131 } 131 }
132 132
133 void StatusBubbleGtk::SetStatusTextTo(const std::string& status_utf8) { 133 void StatusBubbleGtk::SetStatusTextTo(const std::string& status_utf8) {
134 if (status_utf8.empty()) { 134 if (status_utf8.empty()) {
135 hide_timer_.Stop(); 135 hide_timer_.Stop();
136 hide_timer_.Start(base::TimeDelta::FromMilliseconds(kHideDelay), 136 hide_timer_.Start(base::TimeDelta::FromMilliseconds(kHideDelay),
137 this, &StatusBubbleGtk::Hide); 137 this, &StatusBubbleGtk::Hide, FROM_HERE);
138 } else { 138 } else {
139 gtk_label_set_text(GTK_LABEL(label_.get()), status_utf8.c_str()); 139 gtk_label_set_text(GTK_LABEL(label_.get()), status_utf8.c_str());
140 GtkRequisition req; 140 GtkRequisition req;
141 gtk_widget_size_request(label_.get(), &req); 141 gtk_widget_size_request(label_.get(), &req);
142 desired_width_ = req.width; 142 desired_width_ = req.width;
143 143
144 UpdateLabelSizeRequest(); 144 UpdateLabelSizeRequest();
145 145
146 if (!last_mouse_left_content_) { 146 if (!last_mouse_left_content_) {
147 // Show the padding and label to update our requisition and then 147 // Show the padding and label to update our requisition and then
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 return FALSE; 359 return FALSE;
360 } 360 }
361 361
362 void StatusBubbleGtk::AnimationEnded(const ui::Animation* animation) { 362 void StatusBubbleGtk::AnimationEnded(const ui::Animation* animation) {
363 UpdateLabelSizeRequest(); 363 UpdateLabelSizeRequest();
364 } 364 }
365 365
366 void StatusBubbleGtk::AnimationProgressed(const ui::Animation* animation) { 366 void StatusBubbleGtk::AnimationProgressed(const ui::Animation* animation) {
367 UpdateLabelSizeRequest(); 367 UpdateLabelSizeRequest();
368 } 368 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698