| 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/shell_integration_linux.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_commands.h" | 16 #include "chrome/browser/ui/browser_commands.h" |
| 17 #include "chrome/browser/ui/browser_dialogs.h" |
| 17 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
| 18 #include "chrome/browser/ui/gtk/gtk_util.h" | 19 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 19 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 20 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 20 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 21 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
| 21 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 22 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 22 #include "chrome/browser/web_applications/web_app.h" | 23 #include "chrome/browser/web_applications/web_app.h" |
| 23 #include "chrome/common/extensions/extension.h" | 24 #include "chrome/common/extensions/extension.h" |
| 24 #include "chrome/common/extensions/extension_resource.h" | 25 #include "chrome/common/extensions/extension_resource.h" |
| 25 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 40 namespace { | 41 namespace { |
| 41 | 42 |
| 42 // Size (in pixels) of the icon preview. | 43 // Size (in pixels) of the icon preview. |
| 43 const int kIconPreviewSizePixels = 32; | 44 const int kIconPreviewSizePixels = 32; |
| 44 | 45 |
| 45 // Height (in lines) of the shortcut description label. | 46 // Height (in lines) of the shortcut description label. |
| 46 const int kDescriptionLabelHeightLines = 3; | 47 const int kDescriptionLabelHeightLines = 3; |
| 47 | 48 |
| 48 } // namespace | 49 } // namespace |
| 49 | 50 |
| 50 // static | 51 namespace chrome { |
| 51 void CreateWebApplicationShortcutsDialogGtk::Show( | 52 |
| 52 GtkWindow* parent, TabContents* tab_contents) { | 53 void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window, |
| 53 new CreateWebApplicationShortcutsDialogGtk(parent, tab_contents); | 54 TabContents* tab_contents) { |
| 55 new CreateWebApplicationShortcutsDialogGtk(parent_window, tab_contents); |
| 54 } | 56 } |
| 55 | 57 |
| 58 } // namespace chrome |
| 59 |
| 56 void CreateChromeApplicationShortcutsDialogGtk::Show(GtkWindow* parent, | 60 void CreateChromeApplicationShortcutsDialogGtk::Show(GtkWindow* parent, |
| 57 Profile* profile, | 61 Profile* profile, |
| 58 const Extension* app) { | 62 const Extension* app) { |
| 59 new CreateChromeApplicationShortcutsDialogGtk(parent, profile, app); | 63 new CreateChromeApplicationShortcutsDialogGtk(parent, profile, app); |
| 60 } | 64 } |
| 61 | 65 |
| 62 | 66 |
| 63 CreateApplicationShortcutsDialogGtk::CreateApplicationShortcutsDialogGtk( | 67 CreateApplicationShortcutsDialogGtk::CreateApplicationShortcutsDialogGtk( |
| 64 GtkWindow* parent) | 68 GtkWindow* parent) |
| 65 : parent_(parent), | 69 : parent_(parent), |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 371 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 368 | 372 |
| 369 if (web_app::CreateShortcutOnFileThread(profile_path_, shortcut_info)) { | 373 if (web_app::CreateShortcutOnFileThread(profile_path_, shortcut_info)) { |
| 370 Release(); | 374 Release(); |
| 371 } else { | 375 } else { |
| 372 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 376 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 373 base::Bind(&CreateChromeApplicationShortcutsDialogGtk::ShowErrorDialog, | 377 base::Bind(&CreateChromeApplicationShortcutsDialogGtk::ShowErrorDialog, |
| 374 this)); | 378 this)); |
| 375 } | 379 } |
| 376 } | 380 } |
| OLD | NEW |