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

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

Issue 9148032: [Web Intents] Refactor picker to use WebIntentPickerModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: groby's fix Created 8 years, 10 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) 2011 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/bubble/bubble_gtk.h" 16 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
17 #include "chrome/browser/ui/intents/web_intent_picker.h" 17 #include "chrome/browser/ui/intents/web_intent_picker.h"
18 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h"
18 #include "content/public/browser/web_contents_delegate.h" 19 #include "content/public/browser/web_contents_delegate.h"
19 #include "ui/base/gtk/gtk_signal.h" 20 #include "ui/base/gtk/gtk_signal.h"
20 #include "ui/base/gtk/owned_widget_gtk.h" 21 #include "ui/base/gtk/owned_widget_gtk.h"
21 22
22 class Browser; 23 class Browser;
23 class CustomDrawButton; 24 class CustomDrawButton;
24 class GURL; 25 class GURL;
25 class TabContents; 26 class TabContents;
26 class TabContentsContainerGtk; 27 class TabContentsContainerGtk;
27 class TabContentsWrapper; 28 class TabContentsWrapper;
28 class WebIntentPickerDelegate; 29 class WebIntentPickerDelegate;
29 30
30 // Gtk implementation of WebIntentPicker. 31 // Gtk implementation of WebIntentPicker.
31 class WebIntentPickerGtk : public WebIntentPicker, 32 class WebIntentPickerGtk : public WebIntentPicker,
33 public WebIntentPickerModelObserver,
32 public BubbleDelegateGtk { 34 public BubbleDelegateGtk {
33 public: 35 public:
34 WebIntentPickerGtk(Browser* browser, 36 WebIntentPickerGtk(Browser* browser,
35 TabContentsWrapper* tab_contents, 37 TabContentsWrapper* tab_contents,
36 WebIntentPickerDelegate* delegate); 38 WebIntentPickerDelegate* delegate,
39 WebIntentPickerModel* model);
37 virtual ~WebIntentPickerGtk(); 40 virtual ~WebIntentPickerGtk();
38 41
39 // WebIntentPicker implementation. 42 // WebIntentPicker implementation.
40 virtual void SetServiceURLs(const std::vector<GURL>& urls) OVERRIDE;
41 virtual void SetServiceIcon(size_t index, const SkBitmap& icon) OVERRIDE;
42 virtual void SetDefaultServiceIcon(size_t index) OVERRIDE;
43 virtual void Close() OVERRIDE; 43 virtual void Close() OVERRIDE;
44 virtual content::WebContents* SetInlineDisposition(const GURL& url) OVERRIDE; 44
45 // WebIntentPickerModelObserver implementation.
46 virtual void OnModelChanged(WebIntentPickerModel* model) OVERRIDE;
47 virtual void OnFaviconChanged(WebIntentPickerModel* model,
48 size_t index) OVERRIDE;
49 virtual void OnInlineDisposition(WebIntentPickerModel* model) OVERRIDE;
45 50
46 // BubbleDelegateGtk implementation. 51 // BubbleDelegateGtk implementation.
47 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; 52 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE;
48 53
49 private: 54 private:
55 // Callback when picker is destroyed.
56 CHROMEGTK_CALLBACK_0(WebIntentPickerGtk, void, OnDestroy);
50 // Callback when a service button is clicked. 57 // Callback when a service button is clicked.
51 CHROMEGTK_CALLBACK_0(WebIntentPickerGtk, void, OnServiceButtonClick); 58 CHROMEGTK_CALLBACK_0(WebIntentPickerGtk, void, OnServiceButtonClick);
52 // Callback when close button is clicked. 59 // Callback when close button is clicked.
53 CHROMEGTK_CALLBACK_0(WebIntentPickerGtk, void, OnCloseButtonClick); 60 CHROMEGTK_CALLBACK_0(WebIntentPickerGtk, void, OnCloseButtonClick);
54 61
55 // This class is the policy delegate for the rendered page in the intents 62 // This class is the policy delegate for the rendered page in the intents
56 // inline disposition bubble. 63 // inline disposition bubble.
57 // TODO(gbillock): Move up to WebIntentPicker? 64 // TODO(gbillock): Move up to WebIntentPicker?
58 class InlineDispositionDelegate : public content::WebContentsDelegate { 65 class InlineDispositionDelegate : public content::WebContentsDelegate {
59 public: 66 public:
(...skipping 13 matching lines...) Expand all
73 // Get the button widget at |index|. 80 // Get the button widget at |index|.
74 GtkWidget* GetServiceButton(size_t index); 81 GtkWidget* GetServiceButton(size_t index);
75 82
76 // A weak pointer to the tab contents on which to display the picker UI. 83 // A weak pointer to the tab contents on which to display the picker UI.
77 TabContentsWrapper* wrapper_; 84 TabContentsWrapper* wrapper_;
78 85
79 // A weak pointer to the WebIntentPickerDelegate to notify when the user 86 // A weak pointer to the WebIntentPickerDelegate to notify when the user
80 // chooses a service or cancels. 87 // chooses a service or cancels.
81 WebIntentPickerDelegate* delegate_; 88 WebIntentPickerDelegate* delegate_;
82 89
90 // A weak pointer to the picker model.
91 WebIntentPickerModel* model_;
92
83 // A weak pointer to the widget that contains all other widgets in 93 // A weak pointer to the widget that contains all other widgets in
84 // the bubble. 94 // the bubble.
85 GtkWidget* contents_; 95 GtkWidget* contents_;
86 96
87 // A weak pointer to the hbox that contains the buttons used to choose the 97 // A weak pointer to the vbox that contains the buttons used to choose the
88 // service. 98 // service.
89 GtkWidget* button_hbox_; 99 GtkWidget* button_vbox_;
90 100
91 // A button to close the bubble. 101 // A button to close the bubble.
92 scoped_ptr<CustomDrawButton> close_button_; 102 scoped_ptr<CustomDrawButton> close_button_;
93 103
94 // A weak pointer to the bubble widget. 104 // A weak pointer to the bubble widget.
95 BubbleGtk* bubble_; 105 BubbleGtk* bubble_;
96 106
97 // The browser we're in. 107 // The browser we're in.
98 Browser* browser_; 108 Browser* browser_;
99 109
100 // Container for the HTML in the inline disposition case. 110 // Container for the HTML in the inline disposition case.
101 scoped_ptr<TabContentsWrapper> inline_disposition_tab_contents_; 111 scoped_ptr<TabContentsWrapper> inline_disposition_tab_contents_;
102 112
103 // Widget for displaying the HTML in the inline disposition case. 113 // Widget for displaying the HTML in the inline disposition case.
104 scoped_ptr<TabContentsContainerGtk> tab_contents_container_; 114 scoped_ptr<TabContentsContainerGtk> tab_contents_container_;
105 115
106 // content::WebContentsDelegate for the inline disposition dialog. 116 // content::WebContentsDelegate for the inline disposition dialog.
107 scoped_ptr<InlineDispositionDelegate> inline_disposition_delegate_; 117 scoped_ptr<InlineDispositionDelegate> inline_disposition_delegate_;
108 118
109 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerGtk); 119 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerGtk);
110 }; 120 };
111 121
112 #endif // CHROME_BROWSER_UI_GTK_WEB_INTENT_PICKER_GTK_H_ 122 #endif // CHROME_BROWSER_UI_GTK_WEB_INTENT_PICKER_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/web_intent_picker_cocoa.mm ('k') | chrome/browser/ui/gtk/web_intent_picker_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698