Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1190)

Side by Side Diff: chrome/browser/ui/gtk/web_intent_picker_gtk.h

Issue 9837011: [Web Intents] CWS inline install for GTK (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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|. Returns the alignment widget
100 // containing the throbber.
101 GtkWidget* AddThrobberToExtensionAt(size_t index);
102
103 // Removes the added throbber.
104 void RemoveThrobber();
105
93 // Create a new widget displaying |rating| as 5 star images. Rating should be 106 // Create a new widget displaying |rating| as 5 star images. Rating should be
94 // in the range [0, 5]. 107 // in the range [0, 5].
95 GtkWidget* CreateStarsWidget(double rating); 108 GtkWidget* CreateStarsWidget(double rating);
96 109
97 // A weak pointer to the tab contents on which to display the picker UI. 110 // A weak pointer to the tab contents on which to display the picker UI.
98 TabContentsWrapper* wrapper_; 111 TabContentsWrapper* wrapper_;
99 112
100 // A weak pointer to the WebIntentPickerDelegate to notify when the user 113 // A weak pointer to the WebIntentPickerDelegate to notify when the user
101 // chooses a service or cancels. 114 // chooses a service or cancels.
102 WebIntentPickerDelegate* delegate_; 115 WebIntentPickerDelegate* delegate_;
(...skipping 14 matching lines...) Expand all
117 130
118 // A weak pointer to the Chrome Web Store header label. 131 // A weak pointer to the Chrome Web Store header label.
119 GtkWidget* cws_label_; 132 GtkWidget* cws_label_;
120 133
121 // A weak pointer to the suggested extensions vbox. 134 // A weak pointer to the suggested extensions vbox.
122 GtkWidget* extensions_vbox_; 135 GtkWidget* extensions_vbox_;
123 136
124 // A button to close the picker. 137 // A button to close the picker.
125 scoped_ptr<CustomDrawButton> close_button_; 138 scoped_ptr<CustomDrawButton> close_button_;
126 139
140 // The throbber to display when installing an extension.
141 scoped_ptr<ThrobberGtk> throbber_;
142
127 // A weak pointer to the constrained window. 143 // A weak pointer to the constrained window.
128 ConstrainedWindowGtk* window_; 144 ConstrainedWindowGtk* window_;
129 145
130 // The browser we're in. 146 // The browser we're in.
131 Browser* browser_; 147 Browser* browser_;
132 148
133 // Container for the HTML in the inline disposition case. 149 // Container for the HTML in the inline disposition case.
134 scoped_ptr<TabContentsWrapper> inline_disposition_tab_contents_; 150 scoped_ptr<TabContentsWrapper> inline_disposition_tab_contents_;
135 151
136 // Widget for displaying the HTML in the inline disposition case. 152 // Widget for displaying the HTML in the inline disposition case.
137 scoped_ptr<TabContentsContainerGtk> tab_contents_container_; 153 scoped_ptr<TabContentsContainerGtk> tab_contents_container_;
138 154
139 // content::WebContentsDelegate for the inline disposition dialog. 155 // content::WebContentsDelegate for the inline disposition dialog.
140 scoped_ptr<WebIntentInlineDispositionDelegate> inline_disposition_delegate_; 156 scoped_ptr<WebIntentInlineDispositionDelegate> inline_disposition_delegate_;
141 157
142 content::NotificationRegistrar registrar_; 158 content::NotificationRegistrar registrar_;
143 159
144 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerGtk); 160 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerGtk);
145 }; 161 };
146 162
147 #endif // CHROME_BROWSER_UI_GTK_WEB_INTENT_PICKER_GTK_H_ 163 #endif // CHROME_BROWSER_UI_GTK_WEB_INTENT_PICKER_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698