| OLD | NEW |
| 1 // Copyright (c) 2010 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> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/gtk_util.h" | 9 #include "app/gtk_util.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| 11 #include "base/env_var.h" | 11 #include "base/environment.h" |
| 12 #include "chrome/browser/chrome_thread.h" | 12 #include "chrome/browser/chrome_thread.h" |
| 13 #include "chrome/browser/gtk/gtk_util.h" | 13 #include "chrome/browser/gtk/gtk_util.h" |
| 14 #include "chrome/browser/shell_integration.h" | 14 #include "chrome/browser/shell_integration.h" |
| 15 #include "chrome/browser/tab_contents/tab_contents.h" | 15 #include "chrome/browser/tab_contents/tab_contents.h" |
| 16 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 16 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 17 #include "chrome/browser/web_applications/web_app.h" | 17 #include "chrome/browser/web_applications/web_app.h" |
| 18 #include "gfx/gtk_util.h" | 18 #include "gfx/gtk_util.h" |
| 19 #include "grit/chromium_strings.h" | 19 #include "grit/chromium_strings.h" |
| 20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 21 #include "grit/locale_settings.h" | 21 #include "grit/locale_settings.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 void CreateApplicationShortcutsDialogGtk::OnErrorDialogResponse( | 181 void CreateApplicationShortcutsDialogGtk::OnErrorDialogResponse( |
| 182 GtkWidget* widget, int response) { | 182 GtkWidget* widget, int response) { |
| 183 Release(); | 183 Release(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void CreateApplicationShortcutsDialogGtk::CreateDesktopShortcut( | 186 void CreateApplicationShortcutsDialogGtk::CreateDesktopShortcut( |
| 187 const ShellIntegration::ShortcutInfo& shortcut_info) { | 187 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 188 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); | 188 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); |
| 189 | 189 |
| 190 scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create()); | 190 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 191 | 191 |
| 192 std::string shortcut_template; | 192 std::string shortcut_template; |
| 193 if (ShellIntegration::GetDesktopShortcutTemplate(env_getter.get(), | 193 if (ShellIntegration::GetDesktopShortcutTemplate(env.get(), |
| 194 &shortcut_template)) { | 194 &shortcut_template)) { |
| 195 ShellIntegration::CreateDesktopShortcut(shortcut_info, | 195 ShellIntegration::CreateDesktopShortcut(shortcut_info, |
| 196 shortcut_template); | 196 shortcut_template); |
| 197 Release(); | 197 Release(); |
| 198 } else { | 198 } else { |
| 199 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, | 199 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, |
| 200 NewRunnableMethod(this, | 200 NewRunnableMethod(this, |
| 201 &CreateApplicationShortcutsDialogGtk::ShowErrorDialog)); | 201 &CreateApplicationShortcutsDialogGtk::ShowErrorDialog)); |
| 202 } | 202 } |
| 203 } | 203 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(desktop_checkbox_)) || | 247 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(desktop_checkbox_)) || |
| 248 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(menu_checkbox_))) { | 248 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(menu_checkbox_))) { |
| 249 can_accept = TRUE; | 249 can_accept = TRUE; |
| 250 } | 250 } |
| 251 | 251 |
| 252 gtk_dialog_set_response_sensitive(GTK_DIALOG(create_dialog_), | 252 gtk_dialog_set_response_sensitive(GTK_DIALOG(create_dialog_), |
| 253 GTK_RESPONSE_ACCEPT, | 253 GTK_RESPONSE_ACCEPT, |
| 254 can_accept); | 254 can_accept); |
| 255 } | 255 } |
| OLD | NEW |