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

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

Issue 8588068: GTK: Create the start of a compatibility header wrapping deprecated methods. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to ToT and remove views/ cleanups. Created 9 years, 1 month 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
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
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 14 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
15 #include "chrome/browser/ui/gtk/gtk_util.h" 15 #include "chrome/browser/ui/gtk/gtk_util.h"
16 #include "chrome/browser/ui/gtk/rounded_window.h" 16 #include "chrome/browser/ui/gtk/rounded_window.h"
17 #include "chrome/browser/ui/gtk/slide_animator_gtk.h" 17 #include "chrome/browser/ui/gtk/slide_animator_gtk.h"
18 #include "chrome/common/chrome_notification_types.h" 18 #include "chrome/common/chrome_notification_types.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_hig_constants.h" 22 #include "ui/base/gtk/gtk_hig_constants.h"
22 #include "ui/base/text/text_elider.h" 23 #include "ui/base/text/text_elider.h"
23 24
24 namespace { 25 namespace {
25 26
26 // Inner padding between the border and the text label. 27 // Inner padding between the border and the text label.
27 const int kInternalTopBottomPadding = 1; 28 const int kInternalTopBottomPadding = 1;
28 const int kInternalLeftRightPadding = 2; 29 const int kInternalLeftRightPadding = 2;
29 30
30 // The radius of the edges of our bubble. 31 // The radius of the edges of our bubble.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 return; 87 return;
87 } 88 }
88 89
89 SetStatusTextToURL(); 90 SetStatusTextToURL();
90 } 91 }
91 92
92 void StatusBubbleGtk::SetStatusTextToURL() { 93 void StatusBubbleGtk::SetStatusTextToURL() {
93 GtkWidget* parent = gtk_widget_get_parent(container_.get()); 94 GtkWidget* parent = gtk_widget_get_parent(container_.get());
94 95
95 // It appears that parent can be NULL (probably only during shutdown). 96 // It appears that parent can be NULL (probably only during shutdown).
96 if (!parent || !GTK_WIDGET_REALIZED(parent)) 97 if (!parent || !gtk_widget_get_realized(parent))
97 return; 98 return;
98 99
99 int desired_width = parent->allocation.width; 100 int desired_width = parent->allocation.width;
100 if (!expanded()) { 101 if (!expanded()) {
101 expand_timer_.Stop(); 102 expand_timer_.Stop();
102 expand_timer_.Start(FROM_HERE, 103 expand_timer_.Start(FROM_HERE,
103 base::TimeDelta::FromMilliseconds(kExpandHoverDelay), 104 base::TimeDelta::FromMilliseconds(kExpandHoverDelay),
104 this, &StatusBubbleGtk::ExpandURL); 105 this, &StatusBubbleGtk::ExpandURL);
105 // When not expanded, we limit the size to one third the browser's 106 // When not expanded, we limit the size to one third the browser's
106 // width. 107 // width.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 void StatusBubbleGtk::MouseMoved( 160 void StatusBubbleGtk::MouseMoved(
160 const gfx::Point& location, bool left_content) { 161 const gfx::Point& location, bool left_content) {
161 if (left_content && ignore_next_left_content_) { 162 if (left_content && ignore_next_left_content_) {
162 ignore_next_left_content_ = false; 163 ignore_next_left_content_ = false;
163 return; 164 return;
164 } 165 }
165 166
166 last_mouse_location_ = location; 167 last_mouse_location_ = location;
167 last_mouse_left_content_ = left_content; 168 last_mouse_left_content_ = left_content;
168 169
169 if (!GTK_WIDGET_REALIZED(container_.get())) 170 if (!gtk_widget_get_realized(container_.get()))
170 return; 171 return;
171 172
172 GtkWidget* parent = gtk_widget_get_parent(container_.get()); 173 GtkWidget* parent = gtk_widget_get_parent(container_.get());
173 if (!parent || !GTK_WIDGET_REALIZED(parent)) 174 if (!parent || !gtk_widget_get_realized(parent))
174 return; 175 return;
175 176
176 int old_y_offset = y_offset_; 177 int old_y_offset = y_offset_;
177 bool old_flip_horizontally = flip_horizontally_; 178 bool old_flip_horizontally = flip_horizontally_;
178 179
179 if (left_content) { 180 if (left_content) {
180 SetFlipHorizontally(false); 181 SetFlipHorizontally(false);
181 y_offset_ = 0; 182 y_offset_ = 0;
182 } else { 183 } else {
183 GtkWidget* toplevel = gtk_widget_get_toplevel(container_.get()); 184 GtkWidget* toplevel = gtk_widget_get_toplevel(container_.get());
184 if (!toplevel || !GTK_WIDGET_REALIZED(toplevel)) 185 if (!toplevel || !gtk_widget_get_realized(toplevel))
185 return; 186 return;
186 187
187 bool ltr = !base::i18n::IsRTL(); 188 bool ltr = !base::i18n::IsRTL();
188 189
189 GtkRequisition requisition; 190 GtkRequisition requisition;
190 gtk_widget_size_request(container_.get(), &requisition); 191 gtk_widget_size_request(container_.get(), &requisition);
191 192
192 // Get our base position (that is, not including the current offset) 193 // Get our base position (that is, not including the current offset)
193 // relative to the origin of the root window. 194 // relative to the origin of the root window.
194 gint toplevel_x = 0, toplevel_y = 0; 195 gint toplevel_x = 0, toplevel_y = 0;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 return FALSE; 361 return FALSE;
361 } 362 }
362 363
363 void StatusBubbleGtk::AnimationEnded(const ui::Animation* animation) { 364 void StatusBubbleGtk::AnimationEnded(const ui::Animation* animation) {
364 UpdateLabelSizeRequest(); 365 UpdateLabelSizeRequest();
365 } 366 }
366 367
367 void StatusBubbleGtk::AnimationProgressed(const ui::Animation* animation) { 368 void StatusBubbleGtk::AnimationProgressed(const ui::Animation* animation) {
368 UpdateLabelSizeRequest(); 369 UpdateLabelSizeRequest();
369 } 370 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/ssl_client_certificate_selector.cc ('k') | chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698