| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_UI_GTK_STATUS_BUBBLE_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_STATUS_BUBBLE_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_STATUS_BUBBLE_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_STATUS_BUBBLE_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/timer.h" | 15 #include "base/timer.h" |
| 15 #include "chrome/browser/ui/gtk/owned_widget_gtk.h" | 16 #include "chrome/browser/ui/gtk/owned_widget_gtk.h" |
| 16 #include "chrome/browser/ui/status_bubble.h" | 17 #include "chrome/browser/ui/status_bubble.h" |
| 17 #include "content/common/notification_observer.h" | 18 #include "content/common/notification_observer.h" |
| 18 #include "content/common/notification_registrar.h" | 19 #include "content/common/notification_registrar.h" |
| 19 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 20 #include "ui/base/animation/animation_delegate.h" | 21 #include "ui/base/animation/animation_delegate.h" |
| 21 #include "ui/base/gtk/gtk_signal.h" | 22 #include "ui/base/gtk/gtk_signal.h" |
| 22 #include "ui/gfx/point.h" | 23 #include "ui/gfx/point.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 36 public NotificationObserver, | 37 public NotificationObserver, |
| 37 public ui::AnimationDelegate { | 38 public ui::AnimationDelegate { |
| 38 public: | 39 public: |
| 39 explicit StatusBubbleGtk(Profile* profile); | 40 explicit StatusBubbleGtk(Profile* profile); |
| 40 virtual ~StatusBubbleGtk(); | 41 virtual ~StatusBubbleGtk(); |
| 41 | 42 |
| 42 bool flip_horizontally() const { return flip_horizontally_; } | 43 bool flip_horizontally() const { return flip_horizontally_; } |
| 43 int y_offset() const { return y_offset_; } | 44 int y_offset() const { return y_offset_; } |
| 44 | 45 |
| 45 // StatusBubble implementation. | 46 // StatusBubble implementation. |
| 46 virtual void SetStatus(const string16& status); | 47 virtual void SetStatus(const string16& status) OVERRIDE; |
| 47 virtual void SetURL(const GURL& url, const string16& languages); | 48 virtual void SetURL(const GURL& url, const std::string& languages) OVERRIDE; |
| 48 virtual void Hide(); | 49 virtual void Hide() OVERRIDE; |
| 49 virtual void MouseMoved(const gfx::Point& location, bool left_content); | 50 virtual void MouseMoved(const gfx::Point& location, |
| 51 bool left_content) OVERRIDE; |
| 50 | 52 |
| 51 // ui::AnimationDelegate implementation. | 53 // ui::AnimationDelegate implementation. |
| 52 virtual void AnimationEnded(const ui::Animation* animation); | 54 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 53 virtual void AnimationProgressed(const ui::Animation* animation); | 55 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 54 | 56 |
| 55 // Called when the download shelf becomes visible or invisible. | 57 // Called when the download shelf becomes visible or invisible. |
| 56 // This is used by to ensure that the status bubble does not obscure | 58 // This is used by to ensure that the status bubble does not obscure |
| 57 // the download shelf, when it is visible. | 59 // the download shelf, when it is visible. |
| 58 virtual void UpdateDownloadShelfVisibility(bool visible); | 60 virtual void UpdateDownloadShelfVisibility(bool visible); |
| 59 | 61 |
| 60 // Overridden from NotificationObserver: | 62 // Overridden from NotificationObserver: |
| 61 virtual void Observe(int type, | 63 virtual void Observe(int type, |
| 62 const NotificationSource& source, | 64 const NotificationSource& source, |
| 63 const NotificationDetails& details); | 65 const NotificationDetails& details) OVERRIDE; |
| 64 | 66 |
| 65 // Top of the widget hierarchy for a StatusBubble. This top level widget is | 67 // Top of the widget hierarchy for a StatusBubble. This top level widget is |
| 66 // guarenteed to have its gtk_widget_name set to "status-bubble" for | 68 // guarenteed to have its gtk_widget_name set to "status-bubble" for |
| 67 // identification. | 69 // identification. |
| 68 GtkWidget* widget() { return container_.get(); } | 70 GtkWidget* widget() { return container_.get(); } |
| 69 | 71 |
| 70 private: | 72 private: |
| 71 // Sets the text of the label widget and controls visibility. (As contrasted | 73 // Sets the text of the label widget and controls visibility. (As contrasted |
| 72 // with setting the current status or URL text, which may be ignored for now). | 74 // with setting the current status or URL text, which may be ignored for now). |
| 73 void SetStatusTextTo(const std::string& status_utf8); | 75 void SetStatusTextTo(const std::string& status_utf8); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 std::string status_text_; | 131 std::string status_text_; |
| 130 | 132 |
| 131 // The URL we are displaying for. | 133 // The URL we are displaying for. |
| 132 GURL url_; | 134 GURL url_; |
| 133 | 135 |
| 134 // The possibly elided url text we want to display. | 136 // The possibly elided url text we want to display. |
| 135 std::string url_text_; | 137 std::string url_text_; |
| 136 | 138 |
| 137 // Used to determine the character set that the user can read (for eliding | 139 // Used to determine the character set that the user can read (for eliding |
| 138 // the url text). | 140 // the url text). |
| 139 string16 languages_; | 141 std::string languages_; |
| 140 | 142 |
| 141 // A timer that hides our window after a delay. | 143 // A timer that hides our window after a delay. |
| 142 base::OneShotTimer<StatusBubbleGtk> hide_timer_; | 144 base::OneShotTimer<StatusBubbleGtk> hide_timer_; |
| 143 | 145 |
| 144 // A timer that expands our window after a delay. | 146 // A timer that expands our window after a delay. |
| 145 base::OneShotTimer<StatusBubbleGtk> expand_timer_; | 147 base::OneShotTimer<StatusBubbleGtk> expand_timer_; |
| 146 | 148 |
| 147 // The animation for resizing the status bubble on long hovers. | 149 // The animation for resizing the status bubble on long hovers. |
| 148 scoped_ptr<ui::SlideAnimation> expand_animation_; | 150 scoped_ptr<ui::SlideAnimation> expand_animation_; |
| 149 | 151 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 167 // when its text changes, triggering a size change. | 169 // when its text changes, triggering a size change. |
| 168 gfx::Point last_mouse_location_; | 170 gfx::Point last_mouse_location_; |
| 169 bool last_mouse_left_content_; | 171 bool last_mouse_left_content_; |
| 170 | 172 |
| 171 // Shortly after the cursor enters the status bubble, we'll get a message | 173 // Shortly after the cursor enters the status bubble, we'll get a message |
| 172 // that the cursor left the content area. This lets us ignore that. | 174 // that the cursor left the content area. This lets us ignore that. |
| 173 bool ignore_next_left_content_; | 175 bool ignore_next_left_content_; |
| 174 }; | 176 }; |
| 175 | 177 |
| 176 #endif // CHROME_BROWSER_UI_GTK_STATUS_BUBBLE_GTK_H_ | 178 #endif // CHROME_BROWSER_UI_GTK_STATUS_BUBBLE_GTK_H_ |
| OLD | NEW |