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

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

Issue 231733005: Delete the GTK+ port of Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remerge to ToT Created 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_GTK_CREATE_APPLICATION_SHORTCUTS_DIALOG_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_CREATE_APPLICATION_SHORTCUTS_DIALOG_GTK_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/sequenced_task_runner_helpers.h"
12 #include "chrome/browser/shell_integration.h"
13 #include "content/public/browser/browser_thread.h"
14 #include "ui/base/gtk/gtk_signal.h"
15 #include "url/gurl.h"
16
17 using content::BrowserThread;
18
19 typedef struct _GdkPixbuf GdkPixbuf;
20 typedef struct _GtkWidget GtkWidget;
21 typedef struct _GtkWindow GtkWindow;
22
23 class Profile;
24
25 namespace content {
26 class WebContents;
27 }
28
29 namespace extensions {
30 class Extension;
31 }
32
33 namespace gfx {
34 class ImageFamily;
35 }
36
37 class CreateApplicationShortcutsDialogGtk
38 : public base::RefCountedThreadSafe<CreateApplicationShortcutsDialogGtk,
39 BrowserThread::DeleteOnUIThread> {
40 protected:
41 explicit CreateApplicationShortcutsDialogGtk(GtkWindow* parent);
42 virtual ~CreateApplicationShortcutsDialogGtk();
43
44 CHROMEGTK_CALLBACK_1(CreateApplicationShortcutsDialogGtk, void,
45 OnCreateDialogResponse, int);
46
47 CHROMEGTK_CALLBACK_1(CreateApplicationShortcutsDialogGtk, void,
48 OnErrorDialogResponse, int);
49
50 CHROMEGTK_CALLBACK_0(CreateApplicationShortcutsDialogGtk, void,
51 OnToggleCheckbox);
52
53 virtual void CreateDialogBox(GtkWindow* parent);
54 virtual void CreateIconPixBuf(const gfx::ImageFamily& image);
55
56 // This method is called after a shortcut is created.
57 // Subclasses can override it to take some action at that time.
58 virtual void OnCreatedShortcut(void) {}
59
60 virtual void CreateDesktopShortcut(
61 const ShellIntegration::ShortcutInfo& shortcut_info,
62 const ShellIntegration::ShortcutLocations& creation_locations);
63 virtual void ShowErrorDialog();
64
65 GtkWindow* parent_;
66
67 // UI elements.
68 GtkWidget* desktop_checkbox_;
69 GtkWidget* menu_checkbox_;
70
71 // ShortcutInfo for the new shortcut.
72 ShellIntegration::ShortcutInfo shortcut_info_;
73 // If false the shortcut will be created in the top-level menu.
74 bool create_in_chrome_apps_subdir_;
75
76 // Image associated with the site or app, scaled to the appropriate size to
77 // display in the dialog box.
78 GdkPixbuf* favicon_pixbuf_;
79
80 // Dialog box that allows the user to create an application shortcut.
81 GtkWidget* create_dialog_;
82
83 // Dialog box that shows the error message.
84 GtkWidget* error_dialog_;
85
86 private:
87 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
88 friend class base::DeleteHelper<CreateApplicationShortcutsDialogGtk>;
89 DISALLOW_COPY_AND_ASSIGN(CreateApplicationShortcutsDialogGtk);
90 };
91
92 class CreateWebApplicationShortcutsDialogGtk
93 : public CreateApplicationShortcutsDialogGtk {
94 public:
95 // Displays the dialog box to create application shortcuts for |web_contents|.
96 static void Show(GtkWindow* parent, content::WebContents* web_contents);
97
98 CreateWebApplicationShortcutsDialogGtk(GtkWindow* parent,
99 content::WebContents* web_contents);
100
101 virtual void OnCreatedShortcut(void) OVERRIDE;
102
103 protected:
104 virtual ~CreateWebApplicationShortcutsDialogGtk() {}
105
106 private:
107 // WebContents for which the shortcut will be created.
108 content::WebContents* web_contents_;
109
110 DISALLOW_COPY_AND_ASSIGN(CreateWebApplicationShortcutsDialogGtk);
111 };
112
113 class CreateChromeApplicationShortcutsDialogGtk
114 : public CreateApplicationShortcutsDialogGtk {
115 public:
116 CreateChromeApplicationShortcutsDialogGtk(
117 GtkWindow* parent,
118 Profile* profile,
119 const extensions::Extension* app,
120 const base::Closure& close_callback);
121
122 protected:
123 virtual ~CreateChromeApplicationShortcutsDialogGtk();
124
125 virtual void CreateDesktopShortcut(
126 const ShellIntegration::ShortcutInfo& shortcut_info,
127 const ShellIntegration::ShortcutLocations& creation_locations) OVERRIDE;
128
129 private:
130 void OnShortcutInfoLoaded(
131 const ShellIntegration::ShortcutInfo& shortcut_info);
132
133 const extensions::Extension* app_;
134 base::FilePath profile_path_;
135 base::Closure close_callback_;
136 DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutsDialogGtk);
137 };
138
139 #endif // CHROME_BROWSER_UI_GTK_CREATE_APPLICATION_SHORTCUTS_DIALOG_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698