| OLD | NEW |
| 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 #include "chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h" | 5 #include "chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/shell_integration.h" | 13 #include "chrome/browser/shell_integration.h" |
| 14 #include "chrome/browser/shell_integration_linux.h" |
| 14 #include "chrome/browser/ui/gtk/gtk_util.h" | 15 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 16 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 17 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
| 17 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 18 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 18 #include "chrome/browser/web_applications/web_app.h" | 19 #include "chrome/browser/web_applications/web_app.h" |
| 19 #include "chrome/common/extensions/extension.h" | 20 #include "chrome/common/extensions/extension.h" |
| 20 #include "chrome/common/extensions/extension_resource.h" | 21 #include "chrome/common/extensions/extension_resource.h" |
| 21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 23 #include "content/public/browser/web_contents_delegate.h" | 24 #include "content/public/browser/web_contents_delegate.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 Release(); | 213 Release(); |
| 213 } | 214 } |
| 214 | 215 |
| 215 void CreateApplicationShortcutsDialogGtk::CreateDesktopShortcut( | 216 void CreateApplicationShortcutsDialogGtk::CreateDesktopShortcut( |
| 216 const ShellIntegration::ShortcutInfo& shortcut_info) { | 217 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 217 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 218 | 219 |
| 219 scoped_ptr<base::Environment> env(base::Environment::Create()); | 220 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 220 | 221 |
| 221 std::string shortcut_template; | 222 std::string shortcut_template; |
| 222 if (ShellIntegration::GetDesktopShortcutTemplate(env.get(), | 223 if (ShellIntegrationLinux::GetDesktopShortcutTemplate(env.get(), |
| 223 &shortcut_template)) { | 224 &shortcut_template)) { |
| 224 ShellIntegration::CreateDesktopShortcut(shortcut_info, | 225 ShellIntegrationLinux::CreateDesktopShortcut(shortcut_info, |
| 225 shortcut_template); | 226 shortcut_template); |
| 226 Release(); | 227 Release(); |
| 227 } else { | 228 } else { |
| 228 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 229 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 229 base::Bind(&CreateApplicationShortcutsDialogGtk::ShowErrorDialog, | 230 base::Bind(&CreateApplicationShortcutsDialogGtk::ShowErrorDialog, |
| 230 this)); | 231 this)); |
| 231 } | 232 } |
| 232 } | 233 } |
| 233 | 234 |
| 234 void CreateApplicationShortcutsDialogGtk::ShowErrorDialog() { | 235 void CreateApplicationShortcutsDialogGtk::ShowErrorDialog() { |
| 235 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 361 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 361 | 362 |
| 362 if (web_app::CreateShortcutOnFileThread(profile_path_, shortcut_info)) { | 363 if (web_app::CreateShortcutOnFileThread(profile_path_, shortcut_info)) { |
| 363 Release(); | 364 Release(); |
| 364 } else { | 365 } else { |
| 365 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 366 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 366 base::Bind(&CreateChromeApplicationShortcutsDialogGtk::ShowErrorDialog, | 367 base::Bind(&CreateChromeApplicationShortcutsDialogGtk::ShowErrorDialog, |
| 367 this)); | 368 this)); |
| 368 } | 369 } |
| 369 } | 370 } |
| OLD | NEW |