| 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_WEB_INTENT_PICKER_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_WEB_INTENT_PICKER_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_WEB_INTENT_PICKER_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_WEB_INTENT_PICKER_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include <gtk/gtk.h> | 11 #include <gtk/gtk.h> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" | 16 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" |
| 17 #include "chrome/browser/ui/intents/web_intent_picker.h" | 17 #include "chrome/browser/ui/intents/web_intent_picker.h" |
| 18 #include "ui/base/gtk/gtk_signal.h" | 18 #include "ui/base/gtk/gtk_signal.h" |
| 19 | 19 |
| 20 class CustomDrawButton; | 20 class CustomDrawButton; |
| 21 class GURL; | 21 class GURL; |
| 22 class TabContents; | 22 class TabContents; |
| 23 class WebIntentController; | 23 class WebIntentController; |
| 24 class WebIntentPickerDelegate; | 24 class WebIntentPickerDelegate; |
| 25 | 25 |
| 26 // Gtk implementation of WebIntentPicker. | 26 // Gtk implementation of WebIntentPicker. |
| 27 class WebIntentPickerGtk : public WebIntentPicker, | 27 class WebIntentPickerGtk : public WebIntentPicker, |
| 28 public ConstrainedWindowGtkDelegate { | 28 public ConstrainedWindowGtkDelegate { |
| 29 public: | 29 public: |
| 30 WebIntentPickerGtk(TabContents* tab_contents, | 30 WebIntentPickerGtk(TabContentsWrapper* tab_contents, |
| 31 WebIntentPickerDelegate* delegate); | 31 WebIntentPickerDelegate* delegate); |
| 32 virtual ~WebIntentPickerGtk(); | 32 virtual ~WebIntentPickerGtk(); |
| 33 | 33 |
| 34 // WebIntentPicker implementation. | 34 // WebIntentPicker implementation. |
| 35 virtual void SetServiceURLs(const std::vector<GURL>& urls) OVERRIDE; | 35 virtual void SetServiceURLs(const std::vector<GURL>& urls) OVERRIDE; |
| 36 virtual void SetServiceIcon(size_t index, const SkBitmap& icon) OVERRIDE; | 36 virtual void SetServiceIcon(size_t index, const SkBitmap& icon) OVERRIDE; |
| 37 virtual void SetDefaultServiceIcon(size_t index) OVERRIDE; | 37 virtual void SetDefaultServiceIcon(size_t index) OVERRIDE; |
| 38 virtual void Show() OVERRIDE; | 38 virtual void Show() OVERRIDE; |
| 39 virtual void Close() OVERRIDE; | 39 virtual void Close() OVERRIDE; |
| 40 | 40 |
| 41 // ConstrainedWindowGtkDelegate implementation. | 41 // ConstrainedWindowGtkDelegate implementation. |
| 42 virtual GtkWidget* GetWidgetRoot() OVERRIDE; | 42 virtual GtkWidget* GetWidgetRoot() OVERRIDE; |
| 43 virtual GtkWidget* GetFocusWidget() OVERRIDE; | 43 virtual GtkWidget* GetFocusWidget() OVERRIDE; |
| 44 virtual void DeleteDelegate() OVERRIDE; | 44 virtual void DeleteDelegate() OVERRIDE; |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 // Callback when a service button is clicked. | 47 // Callback when a service button is clicked. |
| 48 CHROMEGTK_CALLBACK_0(WebIntentPickerGtk, void, OnServiceButtonClick); | 48 CHROMEGTK_CALLBACK_0(WebIntentPickerGtk, void, OnServiceButtonClick); |
| 49 // Callback when close button is clicked. | 49 // Callback when close button is clicked. |
| 50 CHROMEGTK_CALLBACK_0(WebIntentPickerGtk, void, OnCloseButtonClick); | 50 CHROMEGTK_CALLBACK_0(WebIntentPickerGtk, void, OnCloseButtonClick); |
| 51 | 51 |
| 52 // A weak pointer to the tab contents on which to display the picker UI. | 52 // A weak pointer to the tab contents on which to display the picker UI. |
| 53 TabContents* tab_contents_; | 53 TabContentsWrapper* wrapper_; |
| 54 | 54 |
| 55 // A weak pointer to the WebIntentPickerDelegate to notify when the user | 55 // A weak pointer to the WebIntentPickerDelegate to notify when the user |
| 56 // chooses a service or cancels. | 56 // chooses a service or cancels. |
| 57 WebIntentPickerDelegate* delegate_; | 57 WebIntentPickerDelegate* delegate_; |
| 58 | 58 |
| 59 // The root GtkWidget of the dialog. | 59 // The root GtkWidget of the dialog. |
| 60 ui::OwnedWidgetGtk root_; | 60 ui::OwnedWidgetGtk root_; |
| 61 | 61 |
| 62 // A weak pointer to the hbox that contains the buttons used to choose the | 62 // A weak pointer to the hbox that contains the buttons used to choose the |
| 63 // service. | 63 // service. |
| 64 GtkWidget* button_hbox_; | 64 GtkWidget* button_hbox_; |
| 65 | 65 |
| 66 // A button to close the dialog delegate. | 66 // A button to close the dialog delegate. |
| 67 scoped_ptr<CustomDrawButton> close_button_; | 67 scoped_ptr<CustomDrawButton> close_button_; |
| 68 | 68 |
| 69 // The displayed constrained window. Technically owned by the TabContents | 69 // The displayed constrained window. Technically owned by the TabContents |
| 70 // page, but this object tells it when to destroy. | 70 // page, but this object tells it when to destroy. |
| 71 ConstrainedWindow* window_; | 71 ConstrainedWindow* window_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerGtk); | 73 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerGtk); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 #endif // CHROME_BROWSER_UI_GTK_WEB_INTENT_PICKER_GTK_H_ | 76 #endif // CHROME_BROWSER_UI_GTK_WEB_INTENT_PICKER_GTK_H_ |
| OLD | NEW |