Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_GTK_STATUS_BUBBLE_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_ | 6 #define CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "base/task.h" | 13 #include "base/task.h" |
| 14 #include "chrome/browser/status_bubble.h" | 14 #include "chrome/browser/status_bubble.h" |
| 15 #include "chrome/common/owned_widget_gtk.h" | 15 #include "chrome/common/owned_widget_gtk.h" |
| 16 | 16 |
| 17 class GtkThemeProperties; | |
| 17 class GURL; | 18 class GURL; |
| 19 class Profile; | |
| 18 | 20 |
| 19 // GTK implementation of StatusBubble. Unlike Windows, our status bubble | 21 // GTK implementation of StatusBubble. Unlike Windows, our status bubble |
| 20 // doesn't have the nice leave-the-window effect since we can't rely on the | 22 // doesn't have the nice leave-the-window effect since we can't rely on the |
| 21 // window manager to not try to be "helpful" and center our popups, etc. | 23 // window manager to not try to be "helpful" and center our popups, etc. |
| 22 // We therefore position it absolutely in a GtkFixed, that we don't own. | 24 // We therefore position it absolutely in a GtkFixed, that we don't own. |
| 23 class StatusBubbleGtk : public StatusBubble { | 25 class StatusBubbleGtk : public StatusBubble { |
| 24 public: | 26 public: |
| 25 StatusBubbleGtk(); | 27 StatusBubbleGtk(Profile* profile); |
| 26 virtual ~StatusBubbleGtk(); | 28 virtual ~StatusBubbleGtk(); |
| 27 | 29 |
| 28 // StatusBubble implementation. | 30 // StatusBubble implementation. |
| 29 virtual void SetStatus(const std::wstring& status); | 31 virtual void SetStatus(const std::wstring& status); |
| 30 virtual void SetURL(const GURL& url, const std::wstring& languages); | 32 virtual void SetURL(const GURL& url, const std::wstring& languages); |
| 31 virtual void Hide(); | 33 virtual void Hide(); |
| 32 virtual void MouseMoved(); | 34 virtual void MouseMoved(); |
| 33 | 35 |
| 34 // Called when the download shelf becomes visible or invisible. | 36 // Called when the download shelf becomes visible or invisible. |
| 35 // This is used by to ensure that the status bubble does not obscure | 37 // This is used by to ensure that the status bubble does not obscure |
| 36 // the download shelf, when it is visible. | 38 // the download shelf, when it is visible. |
| 37 virtual void UpdateDownloadShelfVisibility(bool visible) { } | 39 virtual void UpdateDownloadShelfVisibility(bool visible) { } |
| 38 | 40 |
| 39 // Top of the widget hierarchy for a StatusBubble. This top level widget is | 41 // Top of the widget hierarchy for a StatusBubble. This top level widget is |
| 40 // guarenteed to have its gtk_widget_name set to "status-bubble" for | 42 // guarenteed to have its gtk_widget_name set to "status-bubble" for |
| 41 // identification. | 43 // identification. |
| 42 GtkWidget* widget() { return container_.get(); } | 44 GtkWidget* widget() { return container_.get(); } |
| 43 | 45 |
| 46 // Notification from the window that we should retheme ourself. | |
| 47 void UserChangedTheme(GtkThemeProperties* properties); | |
| 48 | |
| 44 private: | 49 private: |
| 45 // Sets the text of the label widget and controls visibility. (As contrasted | 50 // Sets the text of the label widget and controls visibility. (As contrasted |
| 46 // with setting the current status or URL text, which may be ignored for now). | 51 // with setting the current status or URL text, which may be ignored for now). |
| 47 void SetStatusTextTo(const std::string& status_utf8); | 52 void SetStatusTextTo(const std::string& status_utf8); |
| 48 | 53 |
| 49 // Sets the status bubble's location in the parent GtkFixed, shows the widget | 54 // Sets the status bubble's location in the parent GtkFixed, shows the widget |
| 50 // and makes sure that the status bubble has the highest z-order. | 55 // and makes sure that the status bubble has the highest z-order. |
| 51 void Show(); | 56 void Show(); |
| 52 | 57 |
| 53 // Sets an internal timer to hide the status bubble after a delay. | 58 // Sets an internal timer to hide the status bubble after a delay. |
| 54 void HideInASecond(); | 59 void HideInASecond(); |
| 55 | 60 |
| 56 // Builds the widgets, containers, etc. | 61 // Builds the widgets, containers, etc. |
| 57 void InitWidgets(); | 62 void InitWidgets(); |
| 58 | 63 |
| 59 // A GtkAlignment that is the child of |slide_widget_|. | 64 // A GtkAlignment that is the child of |slide_widget_|. |
| 60 OwnedWidgetGtk container_; | 65 OwnedWidgetGtk container_; |
| 61 | 66 |
| 62 // The GtkLabel holding the text. | 67 // The GtkLabel holding the text. |
| 63 GtkWidget* label_; | 68 GtkWidget* label_; |
| 64 | 69 |
| 70 // The background event box. We keep this so we can change it's background | |
|
Evan Martin
2009/07/07 17:35:25
s/it's/its/
| |
| 71 // color. | |
| 72 GtkWidget* bg_box_; | |
| 73 | |
| 65 // The status text we want to display when there are no URLs to display. | 74 // The status text we want to display when there are no URLs to display. |
| 66 std::string status_text_; | 75 std::string status_text_; |
| 67 | 76 |
| 68 // The url we want to display when there is no status text to display. | 77 // The url we want to display when there is no status text to display. |
| 69 std::string url_text_; | 78 std::string url_text_; |
| 70 | 79 |
| 71 // A timer that hides our window after a delay. | 80 // A timer that hides our window after a delay. |
| 72 ScopedRunnableMethodFactory<StatusBubbleGtk> timer_factory_; | 81 ScopedRunnableMethodFactory<StatusBubbleGtk> timer_factory_; |
| 73 }; | 82 }; |
| 74 | 83 |
| 75 #endif // CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_ | 84 #endif // CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_ |
| OLD | NEW |