| 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.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" | |
| 15 #include "chrome/browser/ui/gtk/gtk_util.h" | 14 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 16 #include "chrome/browser/ui/gtk/rounded_window.h" | 15 #include "chrome/browser/ui/gtk/rounded_window.h" |
| 17 #include "chrome/browser/ui/gtk/slide_animator_gtk.h" | 16 #include "chrome/browser/ui/gtk/slide_animator_gtk.h" |
| 17 #include "chrome/browser/ui/gtk/theme_service_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_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" | 23 #include "ui/base/text/text_elider.h" |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 // Inner padding between the border and the text label. | 27 // Inner padding between the border and the text label. |
| 28 const int kInternalTopBottomPadding = 1; | 28 const int kInternalTopBottomPadding = 1; |
| 29 const int kInternalLeftRightPadding = 2; | 29 const int kInternalLeftRightPadding = 2; |
| 30 | 30 |
| 31 // The radius of the edges of our bubble. | 31 // The radius of the edges of our bubble. |
| 32 const int kCornerSize = 3; | 32 const int kCornerSize = 3; |
| 33 | 33 |
| 34 // Milliseconds before we hide the status bubble widget when you mouseout. | 34 // Milliseconds before we hide the status bubble widget when you mouseout. |
| 35 const int kHideDelay = 250; | 35 const int kHideDelay = 250; |
| 36 | 36 |
| 37 // How close the mouse can get to the infobubble before it starts sliding | 37 // How close the mouse can get to the infobubble before it starts sliding |
| 38 // off-screen. | 38 // off-screen. |
| 39 const int kMousePadding = 20; | 39 const int kMousePadding = 20; |
| 40 | 40 |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 StatusBubbleGtk::StatusBubbleGtk(Profile* profile) | 43 StatusBubbleGtk::StatusBubbleGtk(Profile* profile) |
| 44 : theme_service_(GtkThemeService::GetFrom(profile)), | 44 : theme_service_(ThemeServiceGtk::GetFrom(profile)), |
| 45 padding_(NULL), | 45 padding_(NULL), |
| 46 flip_horizontally_(false), | 46 flip_horizontally_(false), |
| 47 y_offset_(0), | 47 y_offset_(0), |
| 48 download_shelf_is_visible_(false), | 48 download_shelf_is_visible_(false), |
| 49 last_mouse_location_(0, 0), | 49 last_mouse_location_(0, 0), |
| 50 last_mouse_left_content_(false), | 50 last_mouse_left_content_(false), |
| 51 ignore_next_left_content_(false) { | 51 ignore_next_left_content_(false) { |
| 52 InitWidgets(); | 52 InitWidgets(); |
| 53 | 53 |
| 54 theme_service_->InitThemesFor(this); | 54 theme_service_->InitThemesFor(this); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 return FALSE; | 370 return FALSE; |
| 371 } | 371 } |
| 372 | 372 |
| 373 void StatusBubbleGtk::AnimationEnded(const ui::Animation* animation) { | 373 void StatusBubbleGtk::AnimationEnded(const ui::Animation* animation) { |
| 374 UpdateLabelSizeRequest(); | 374 UpdateLabelSizeRequest(); |
| 375 } | 375 } |
| 376 | 376 |
| 377 void StatusBubbleGtk::AnimationProgressed(const ui::Animation* animation) { | 377 void StatusBubbleGtk::AnimationProgressed(const ui::Animation* animation) { |
| 378 UpdateLabelSizeRequest(); | 378 UpdateLabelSizeRequest(); |
| 379 } | 379 } |
| OLD | NEW |