OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h" | 5 #include "chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h" |
6 | 6 |
| 7 #include <string> |
| 8 |
7 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
8 #include "base/linux_util.h" | 10 #include "base/env_var.h" |
9 #include "chrome/browser/chrome_thread.h" | 11 #include "chrome/browser/chrome_thread.h" |
10 #include "chrome/browser/gtk/gtk_util.h" | 12 #include "chrome/browser/gtk/gtk_util.h" |
11 #include "chrome/browser/shell_integration.h" | 13 #include "chrome/browser/shell_integration.h" |
12 #include "chrome/browser/tab_contents/tab_contents.h" | 14 #include "chrome/browser/tab_contents/tab_contents.h" |
13 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 15 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
14 #include "grit/chromium_strings.h" | 16 #include "grit/chromium_strings.h" |
15 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
16 #include "grit/locale_settings.h" | 18 #include "grit/locale_settings.h" |
17 | 19 |
18 // static | 20 // static |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 119 |
118 void CreateApplicationShortcutsDialogGtk::OnErrorDialogResponse( | 120 void CreateApplicationShortcutsDialogGtk::OnErrorDialogResponse( |
119 GtkWidget* widget, int response) { | 121 GtkWidget* widget, int response) { |
120 Release(); | 122 Release(); |
121 } | 123 } |
122 | 124 |
123 void CreateApplicationShortcutsDialogGtk::CreateDesktopShortcut( | 125 void CreateApplicationShortcutsDialogGtk::CreateDesktopShortcut( |
124 const ShellIntegration::ShortcutInfo& shortcut_info) { | 126 const ShellIntegration::ShortcutInfo& shortcut_info) { |
125 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); | 127 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); |
126 | 128 |
127 scoped_ptr<base::EnvironmentVariableGetter> env_getter( | 129 scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); |
128 base::EnvironmentVariableGetter::Create()); | |
129 | 130 |
130 std::string shortcut_template; | 131 std::string shortcut_template; |
131 if (ShellIntegration::GetDesktopShortcutTemplate(env_getter.get(), | 132 if (ShellIntegration::GetDesktopShortcutTemplate(env_getter.get(), |
132 &shortcut_template)) { | 133 &shortcut_template)) { |
133 ShellIntegration::CreateDesktopShortcut(shortcut_info, | 134 ShellIntegration::CreateDesktopShortcut(shortcut_info, |
134 shortcut_template); | 135 shortcut_template); |
135 Release(); | 136 Release(); |
136 } else { | 137 } else { |
137 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, | 138 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, |
138 NewRunnableMethod(this, | 139 NewRunnableMethod(this, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 IDS_CREATE_SHORTCUTS_ERROR_LABEL, | 172 IDS_CREATE_SHORTCUTS_ERROR_LABEL, |
172 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str()); | 173 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str()); |
173 gtk_label_set_line_wrap(GTK_LABEL(description), TRUE); | 174 gtk_label_set_line_wrap(GTK_LABEL(description), TRUE); |
174 gtk_misc_set_alignment(GTK_MISC(description), 0, 0); | 175 gtk_misc_set_alignment(GTK_MISC(description), 0, 0); |
175 gtk_box_pack_start(GTK_BOX(vbox), description, FALSE, FALSE, 0); | 176 gtk_box_pack_start(GTK_BOX(vbox), description, FALSE, FALSE, 0); |
176 | 177 |
177 g_signal_connect(error_dialog_, "response", | 178 g_signal_connect(error_dialog_, "response", |
178 G_CALLBACK(HandleOnResponseErrorDialog), this); | 179 G_CALLBACK(HandleOnResponseErrorDialog), this); |
179 gtk_widget_show_all(error_dialog_); | 180 gtk_widget_show_all(error_dialog_); |
180 } | 181 } |
OLD | NEW |