| 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 #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 <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| 11 #include <vector> | 11 #include <vector> |
| 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_inline_disposition_delegate.h" | 17 #include "chrome/browser/ui/intents/web_intent_inline_disposition_delegate.h" |
| 18 #include "chrome/browser/ui/intents/web_intent_picker.h" | 18 #include "chrome/browser/ui/intents/web_intent_picker.h" |
| 19 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h" | 19 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h" |
| 20 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
| 21 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
| 22 #include "ui/base/gtk/gtk_signal.h" | 22 #include "ui/base/gtk/gtk_signal.h" |
| 23 #include "ui/base/gtk/owned_widget_gtk.h" | 23 #include "ui/base/gtk/owned_widget_gtk.h" |
| 24 | 24 |
| 25 class Browser; | 25 class Browser; |
| 26 class CustomDrawButton; | 26 class CustomDrawButton; |
| 27 class GURL; | 27 class GURL; |
| 28 class TabContentsContainerGtk; | 28 class TabContentsContainerGtk; |
| 29 class TabContentsWrapper; | 29 class TabContentsWrapper; |
| 30 class ThrobberGtk; |
| 30 class WebIntentPickerDelegate; | 31 class WebIntentPickerDelegate; |
| 31 | 32 |
| 32 // Gtk implementation of WebIntentPicker. | 33 // Gtk implementation of WebIntentPicker. |
| 33 class WebIntentPickerGtk : public WebIntentPicker, | 34 class WebIntentPickerGtk : public WebIntentPicker, |
| 34 public WebIntentPickerModelObserver, | 35 public WebIntentPickerModelObserver, |
| 35 public ConstrainedWindowGtkDelegate, | 36 public ConstrainedWindowGtkDelegate, |
| 36 public content::NotificationObserver { | 37 public content::NotificationObserver { |
| 37 public: | 38 public: |
| 38 WebIntentPickerGtk(Browser* browser, | 39 WebIntentPickerGtk(Browser* browser, |
| 39 TabContentsWrapper* tab_contents, | 40 TabContentsWrapper* tab_contents, |
| 40 WebIntentPickerDelegate* delegate, | 41 WebIntentPickerDelegate* delegate, |
| 41 WebIntentPickerModel* model); | 42 WebIntentPickerModel* model); |
| 42 virtual ~WebIntentPickerGtk(); | 43 virtual ~WebIntentPickerGtk(); |
| 43 | 44 |
| 44 // WebIntentPicker implementation. | 45 // WebIntentPicker implementation. |
| 45 virtual void Close() OVERRIDE; | 46 virtual void Close() OVERRIDE; |
| 47 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; |
| 48 virtual void OnExtensionInstallFailure(const std::string& id) OVERRIDE; |
| 46 | 49 |
| 47 // WebIntentPickerModelObserver implementation. | 50 // WebIntentPickerModelObserver implementation. |
| 48 virtual void OnModelChanged(WebIntentPickerModel* model) OVERRIDE; | 51 virtual void OnModelChanged(WebIntentPickerModel* model) OVERRIDE; |
| 49 virtual void OnFaviconChanged(WebIntentPickerModel* model, | 52 virtual void OnFaviconChanged(WebIntentPickerModel* model, |
| 50 size_t index) OVERRIDE; | 53 size_t index) OVERRIDE; |
| 51 virtual void OnExtensionIconChanged(WebIntentPickerModel* model, | 54 virtual void OnExtensionIconChanged(WebIntentPickerModel* model, |
| 52 const string16& extension_id) OVERRIDE; | 55 const string16& extension_id) OVERRIDE; |
| 53 virtual void OnInlineDisposition(WebIntentPickerModel* model, | 56 virtual void OnInlineDisposition(WebIntentPickerModel* model, |
| 54 const GURL& url) OVERRIDE; | 57 const GURL& url) OVERRIDE; |
| 55 | 58 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 83 | 86 |
| 84 // Update the installed service buttons from |model_|. | 87 // Update the installed service buttons from |model_|. |
| 85 void UpdateInstalledServices(); | 88 void UpdateInstalledServices(); |
| 86 | 89 |
| 87 // Update the Chrome Web Store label from |model_|. | 90 // Update the Chrome Web Store label from |model_|. |
| 88 void UpdateCWSLabel(); | 91 void UpdateCWSLabel(); |
| 89 | 92 |
| 90 // Update the suggested extension table from |model_|. | 93 // Update the suggested extension table from |model_|. |
| 91 void UpdateSuggestedExtensions(); | 94 void UpdateSuggestedExtensions(); |
| 92 | 95 |
| 96 // Enables/disables all service buttons and extension suggestions. |
| 97 void SetWidgetsEnabled(bool enabled); |
| 98 |
| 99 // Adds a throbber to the extension at |index|. |
| 100 void AddThrobberToExtensionAt(size_t index); |
| 101 |
| 102 // Removes the added throbber. |
| 103 void RemoveThrobber(); |
| 104 |
| 93 // Create a new widget displaying |rating| as 5 star images. Rating should be | 105 // Create a new widget displaying |rating| as 5 star images. Rating should be |
| 94 // in the range [0, 5]. | 106 // in the range [0, 5]. |
| 95 GtkWidget* CreateStarsWidget(double rating); | 107 GtkWidget* CreateStarsWidget(double rating); |
| 96 | 108 |
| 97 // A weak pointer to the tab contents on which to display the picker UI. | 109 // A weak pointer to the tab contents on which to display the picker UI. |
| 98 TabContentsWrapper* wrapper_; | 110 TabContentsWrapper* wrapper_; |
| 99 | 111 |
| 100 // A weak pointer to the WebIntentPickerDelegate to notify when the user | 112 // A weak pointer to the WebIntentPickerDelegate to notify when the user |
| 101 // chooses a service or cancels. | 113 // chooses a service or cancels. |
| 102 WebIntentPickerDelegate* delegate_; | 114 WebIntentPickerDelegate* delegate_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 117 | 129 |
| 118 // A weak pointer to the Chrome Web Store header label. | 130 // A weak pointer to the Chrome Web Store header label. |
| 119 GtkWidget* cws_label_; | 131 GtkWidget* cws_label_; |
| 120 | 132 |
| 121 // A weak pointer to the suggested extensions vbox. | 133 // A weak pointer to the suggested extensions vbox. |
| 122 GtkWidget* extensions_vbox_; | 134 GtkWidget* extensions_vbox_; |
| 123 | 135 |
| 124 // A button to close the picker. | 136 // A button to close the picker. |
| 125 scoped_ptr<CustomDrawButton> close_button_; | 137 scoped_ptr<CustomDrawButton> close_button_; |
| 126 | 138 |
| 139 // The throbber to display when installing an extension. |
| 140 scoped_ptr<ThrobberGtk> throbber_; |
| 141 |
| 127 // A weak pointer to the constrained window. | 142 // A weak pointer to the constrained window. |
| 128 ConstrainedWindowGtk* window_; | 143 ConstrainedWindowGtk* window_; |
| 129 | 144 |
| 130 // The browser we're in. | 145 // The browser we're in. |
| 131 Browser* browser_; | 146 Browser* browser_; |
| 132 | 147 |
| 133 // Container for the HTML in the inline disposition case. | 148 // Container for the HTML in the inline disposition case. |
| 134 scoped_ptr<TabContentsWrapper> inline_disposition_tab_contents_; | 149 scoped_ptr<TabContentsWrapper> inline_disposition_tab_contents_; |
| 135 | 150 |
| 136 // Widget for displaying the HTML in the inline disposition case. | 151 // Widget for displaying the HTML in the inline disposition case. |
| 137 scoped_ptr<TabContentsContainerGtk> tab_contents_container_; | 152 scoped_ptr<TabContentsContainerGtk> tab_contents_container_; |
| 138 | 153 |
| 139 // content::WebContentsDelegate for the inline disposition dialog. | 154 // content::WebContentsDelegate for the inline disposition dialog. |
| 140 scoped_ptr<WebIntentInlineDispositionDelegate> inline_disposition_delegate_; | 155 scoped_ptr<WebIntentInlineDispositionDelegate> inline_disposition_delegate_; |
| 141 | 156 |
| 142 content::NotificationRegistrar registrar_; | 157 content::NotificationRegistrar registrar_; |
| 143 | 158 |
| 144 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerGtk); | 159 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerGtk); |
| 145 }; | 160 }; |
| 146 | 161 |
| 147 #endif // CHROME_BROWSER_UI_GTK_WEB_INTENT_PICKER_GTK_H_ | 162 #endif // CHROME_BROWSER_UI_GTK_WEB_INTENT_PICKER_GTK_H_ |
| OLD | NEW |