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

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

Issue 9958006: Create Linux platform app shortcuts to run in their own process. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Moved new function into shell_integration_linux.h 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
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_CREATE_APPLICATION_SHORTCUTS_DIALOG_GTK_H_ 5 #ifndef CHROME_BROWSER_UI_GTK_CREATE_APPLICATION_SHORTCUTS_DIALOG_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_CREATE_APPLICATION_SHORTCUTS_DIALOG_GTK_H_ 6 #define CHROME_BROWSER_UI_GTK_CREATE_APPLICATION_SHORTCUTS_DIALOG_GTK_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/message_loop_helpers.h" 12 #include "base/message_loop_helpers.h"
13 #include "chrome/browser/extensions/image_loading_tracker.h" 13 #include "chrome/browser/extensions/image_loading_tracker.h"
14 #include "chrome/browser/shell_integration.h" 14 #include "chrome/browser/shell_integration.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
17 #include "ui/base/gtk/gtk_signal.h" 17 #include "ui/base/gtk/gtk_signal.h"
18 18
19 using content::BrowserThread; 19 using content::BrowserThread;
20 20
21 typedef struct _GdkPixbuf GdkPixbuf; 21 typedef struct _GdkPixbuf GdkPixbuf;
22 typedef struct _GtkWidget GtkWidget; 22 typedef struct _GtkWidget GtkWidget;
23 typedef struct _GtkWindow GtkWindow; 23 typedef struct _GtkWindow GtkWindow;
24 24
25 class Extension; 25 class Extension;
26 class Profile;
26 class TabContentsWrapper; 27 class TabContentsWrapper;
27 28
28 class CreateApplicationShortcutsDialogGtk 29 class CreateApplicationShortcutsDialogGtk
29 : public base::RefCountedThreadSafe<CreateApplicationShortcutsDialogGtk, 30 : public base::RefCountedThreadSafe<CreateApplicationShortcutsDialogGtk,
30 BrowserThread::DeleteOnUIThread> { 31 BrowserThread::DeleteOnUIThread> {
31 protected: 32 protected:
32 explicit CreateApplicationShortcutsDialogGtk(GtkWindow* parent); 33 explicit CreateApplicationShortcutsDialogGtk(GtkWindow* parent);
33 virtual ~CreateApplicationShortcutsDialogGtk(); 34 virtual ~CreateApplicationShortcutsDialogGtk();
34 35
35 CHROMEGTK_CALLBACK_1(CreateApplicationShortcutsDialogGtk, void, 36 CHROMEGTK_CALLBACK_1(CreateApplicationShortcutsDialogGtk, void,
36 OnCreateDialogResponse, int); 37 OnCreateDialogResponse, int);
37 38
38 CHROMEGTK_CALLBACK_1(CreateApplicationShortcutsDialogGtk, void, 39 CHROMEGTK_CALLBACK_1(CreateApplicationShortcutsDialogGtk, void,
39 OnErrorDialogResponse, int); 40 OnErrorDialogResponse, int);
40 41
41 CHROMEGTK_CALLBACK_0(CreateApplicationShortcutsDialogGtk, void, 42 CHROMEGTK_CALLBACK_0(CreateApplicationShortcutsDialogGtk, void,
42 OnToggleCheckbox); 43 OnToggleCheckbox);
43 44
44 virtual void CreateDialogBox(GtkWindow* parent); 45 virtual void CreateDialogBox(GtkWindow* parent);
45 virtual void CreateIconPixBuf(const gfx::Image& image); 46 virtual void CreateIconPixBuf(const gfx::Image& image);
46 47
47 // This method is called after a shortcut is created. 48 // This method is called after a shortcut is created.
48 // Subclasses can override it to take some action at that time. 49 // Subclasses can override it to take some action at that time.
49 virtual void OnCreatedShortcut(void) {} 50 virtual void OnCreatedShortcut(void) {}
50 51
51 void CreateDesktopShortcut( 52 virtual void CreateDesktopShortcut(
52 const ShellIntegration::ShortcutInfo& shortcut_info); 53 const ShellIntegration::ShortcutInfo& shortcut_info);
53 void ShowErrorDialog(); 54 virtual void ShowErrorDialog();
54 55
55 GtkWindow* parent_; 56 GtkWindow* parent_;
56 57
57 // UI elements. 58 // UI elements.
58 GtkWidget* desktop_checkbox_; 59 GtkWidget* desktop_checkbox_;
59 GtkWidget* menu_checkbox_; 60 GtkWidget* menu_checkbox_;
60 61
61 // ShortcutInfo for the new shortcut. 62 // ShortcutInfo for the new shortcut.
62 ShellIntegration::ShortcutInfo shortcut_info_; 63 ShellIntegration::ShortcutInfo shortcut_info_;
63 64
(...skipping 30 matching lines...) Expand all
94 TabContentsWrapper* tab_contents_; 95 TabContentsWrapper* tab_contents_;
95 96
96 DISALLOW_COPY_AND_ASSIGN(CreateWebApplicationShortcutsDialogGtk); 97 DISALLOW_COPY_AND_ASSIGN(CreateWebApplicationShortcutsDialogGtk);
97 }; 98 };
98 99
99 class CreateChromeApplicationShortcutsDialogGtk 100 class CreateChromeApplicationShortcutsDialogGtk
100 : public CreateApplicationShortcutsDialogGtk, 101 : public CreateApplicationShortcutsDialogGtk,
101 public ImageLoadingTracker::Observer { 102 public ImageLoadingTracker::Observer {
102 public: 103 public:
103 // Displays the dialog box to create application shortcuts for |app|. 104 // Displays the dialog box to create application shortcuts for |app|.
104 static void Show(GtkWindow* parent, const Extension* app); 105 static void Show(GtkWindow* parent, Profile* profile, const Extension* app);
105 106
106 CreateChromeApplicationShortcutsDialogGtk(GtkWindow* parent, 107 CreateChromeApplicationShortcutsDialogGtk(GtkWindow* parent,
108 Profile* profile,
107 const Extension* app); 109 const Extension* app);
108 virtual ~CreateChromeApplicationShortcutsDialogGtk() {} 110 virtual ~CreateChromeApplicationShortcutsDialogGtk() {}
109 111
110 // Implement ImageLoadingTracker::Observer. |tracker_| is used to 112 // Implement ImageLoadingTracker::Observer. |tracker_| is used to
111 // load the app's icon. This method recieves the icon, and adds 113 // load the app's icon. This method recieves the icon, and adds
112 // it to the "Create Shortcut" dailog box. 114 // it to the "Create Shortcut" dailog box.
113 virtual void OnImageLoaded(const gfx::Image& image, 115 virtual void OnImageLoaded(const gfx::Image& image,
114 const std::string& extension_id, 116 const std::string& extension_id,
115 int index) OVERRIDE; 117 int index) OVERRIDE;
116 118
119 protected:
120 virtual void CreateDesktopShortcut(
121 const ShellIntegration::ShortcutInfo& shortcut_info) OVERRIDE;
122
117 private: 123 private:
118 const Extension* app_; 124 const Extension* app_;
125 FilePath profile_path_;
119 ImageLoadingTracker tracker_; 126 ImageLoadingTracker tracker_;
120 DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutsDialogGtk); 127 DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutsDialogGtk);
121 }; 128 };
122 129
123 #endif // CHROME_BROWSER_UI_GTK_CREATE_APPLICATION_SHORTCUTS_DIALOG_GTK_H_ 130 #endif // CHROME_BROWSER_UI_GTK_CREATE_APPLICATION_SHORTCUTS_DIALOG_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.cc ('k') | chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698