| 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/gtk/gtk_util.h" | 15 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 17 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 17 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
| 18 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 18 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 19 #include "chrome/browser/web_applications/web_app.h" | 19 #include "chrome/browser/web_applications/web_app.h" |
| 20 #include "chrome/common/extensions/extension.h" | 20 #include "chrome/common/extensions/extension.h" |
| 21 #include "chrome/common/extensions/extension_resource.h" | 21 #include "chrome/common/extensions/extension_resource.h" |
| 22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 23 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 24 #include "content/public/browser/web_contents_delegate.h" | 24 #include "content/public/browser/web_contents_delegate.h" |
| 25 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
| 26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 39 // Size (in pixels) of the icon preview. | 39 // Size (in pixels) of the icon preview. |
| 40 const int kIconPreviewSizePixels = 32; | 40 const int kIconPreviewSizePixels = 32; |
| 41 | 41 |
| 42 // Height (in lines) of the shortcut description label. | 42 // Height (in lines) of the shortcut description label. |
| 43 const int kDescriptionLabelHeightLines = 3; | 43 const int kDescriptionLabelHeightLines = 3; |
| 44 | 44 |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 // static | 47 // static |
| 48 void CreateWebApplicationShortcutsDialogGtk::Show( | 48 void CreateWebApplicationShortcutsDialogGtk::Show( |
| 49 GtkWindow* parent, TabContentsWrapper* tab_contents) { | 49 GtkWindow* parent, TabContents* tab_contents) { |
| 50 new CreateWebApplicationShortcutsDialogGtk(parent, tab_contents); | 50 new CreateWebApplicationShortcutsDialogGtk(parent, tab_contents); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void CreateChromeApplicationShortcutsDialogGtk::Show(GtkWindow* parent, | 53 void CreateChromeApplicationShortcutsDialogGtk::Show(GtkWindow* parent, |
| 54 Profile* profile, | 54 Profile* profile, |
| 55 const Extension* app) { | 55 const Extension* app) { |
| 56 new CreateChromeApplicationShortcutsDialogGtk(parent, profile, app); | 56 new CreateChromeApplicationShortcutsDialogGtk(parent, profile, app); |
| 57 } | 57 } |
| 58 | 58 |
| 59 | 59 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 can_accept = TRUE; | 279 can_accept = TRUE; |
| 280 } | 280 } |
| 281 | 281 |
| 282 gtk_dialog_set_response_sensitive(GTK_DIALOG(create_dialog_), | 282 gtk_dialog_set_response_sensitive(GTK_DIALOG(create_dialog_), |
| 283 GTK_RESPONSE_ACCEPT, | 283 GTK_RESPONSE_ACCEPT, |
| 284 can_accept); | 284 can_accept); |
| 285 } | 285 } |
| 286 | 286 |
| 287 CreateWebApplicationShortcutsDialogGtk::CreateWebApplicationShortcutsDialogGtk( | 287 CreateWebApplicationShortcutsDialogGtk::CreateWebApplicationShortcutsDialogGtk( |
| 288 GtkWindow* parent, | 288 GtkWindow* parent, |
| 289 TabContentsWrapper* tab_contents) | 289 TabContents* tab_contents) |
| 290 : CreateApplicationShortcutsDialogGtk(parent), | 290 : CreateApplicationShortcutsDialogGtk(parent), |
| 291 tab_contents_(tab_contents) { | 291 tab_contents_(tab_contents) { |
| 292 | 292 |
| 293 // Get shortcut information now, it's needed for our UI. | 293 // Get shortcut information now, it's needed for our UI. |
| 294 web_app::GetShortcutInfoForTab(tab_contents_, &shortcut_info_); | 294 web_app::GetShortcutInfoForTab(tab_contents_, &shortcut_info_); |
| 295 CreateIconPixBuf(shortcut_info_.favicon); | 295 CreateIconPixBuf(shortcut_info_.favicon); |
| 296 | 296 |
| 297 CreateDialogBox(parent); | 297 CreateDialogBox(parent); |
| 298 } | 298 } |
| 299 | 299 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 362 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 363 | 363 |
| 364 if (web_app::CreateShortcutOnFileThread(profile_path_, shortcut_info)) { | 364 if (web_app::CreateShortcutOnFileThread(profile_path_, shortcut_info)) { |
| 365 Release(); | 365 Release(); |
| 366 } else { | 366 } else { |
| 367 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 367 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 368 base::Bind(&CreateChromeApplicationShortcutsDialogGtk::ShowErrorDialog, | 368 base::Bind(&CreateChromeApplicationShortcutsDialogGtk::ShowErrorDialog, |
| 369 this)); | 369 this)); |
| 370 } | 370 } |
| 371 } | 371 } |
| OLD | NEW |