diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 21:14:09 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 21:14:09 +0000 |
commit | 02dc409419c556ab9feb505788d02dd21c472101 (patch) | |
tree | 6279b4306f0ffe93a954e2b0b422d8ae3fd0f2a9 /chrome/browser | |
parent | e9355143fde46a1d40237c1aa988df51b57a8f31 (diff) | |
download | chromium_src-02dc409419c556ab9feb505788d02dd21c472101.zip chromium_src-02dc409419c556ab9feb505788d02dd21c472101.tar.gz chromium_src-02dc409419c556ab9feb505788d02dd21c472101.tar.bz2 |
Convert tab to app after user clicks "create" button per issue 27905.
BUG=27905
TEST=Verify fix for 27095.
Review URL: http://codereview.chromium.org/1351001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42670 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.cc | 8 | ||||
-rw-r--r-- | chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc | 23 | ||||
-rw-r--r-- | chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h | 17 |
3 files changed, 22 insertions, 26 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index 8255c58..078c548 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -1031,13 +1031,7 @@ void BrowserWindowGtk::HandleKeyboardEvent( } void BrowserWindowGtk::ShowCreateShortcutsDialog(TabContents* tab_contents) { - SkBitmap bitmap; - if (tab_contents->FavIconIsValid()) - bitmap = tab_contents->GetFavIcon(); - CreateApplicationShortcutsDialogGtk::Show(window_, - tab_contents->GetURL(), - tab_contents->GetTitle(), - bitmap); + CreateApplicationShortcutsDialogGtk::Show(window_, tab_contents); } void BrowserWindowGtk::Cut() { diff --git a/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc b/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc index 5641408..1391e64 100644 --- a/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc +++ b/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc @@ -9,26 +9,26 @@ #include "chrome/browser/chrome_thread.h" #include "chrome/browser/gtk/gtk_util.h" #include "chrome/browser/shell_integration.h" +#include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/browser/tab_contents/tab_contents_delegate.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" // static void CreateApplicationShortcutsDialogGtk::Show(GtkWindow* parent, - const GURL& url, - const string16& title, - const SkBitmap& favicon) { - new CreateApplicationShortcutsDialogGtk(parent, url, title, favicon); + TabContents* tab_contents) { + new CreateApplicationShortcutsDialogGtk(parent, tab_contents); } CreateApplicationShortcutsDialogGtk::CreateApplicationShortcutsDialogGtk( GtkWindow* parent, - const GURL& url, - const string16& title, - const SkBitmap& favicon) - : url_(url), - title_(title), - favicon_(favicon), + TabContents* tab_contents) + : tab_contents_(tab_contents), + url_(tab_contents->GetURL()), + title_(tab_contents->GetTitle()), + favicon_(tab_contents->FavIconIsValid() ? tab_contents->GetFavIcon() : + SkBitmap()), error_dialog_(NULL) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); @@ -107,6 +107,9 @@ void CreateApplicationShortcutsDialogGtk::OnCreateDialogResponse( NewRunnableMethod(this, &CreateApplicationShortcutsDialogGtk::CreateDesktopShortcut, shortcut_info)); + + if (tab_contents_->delegate()) + tab_contents_->delegate()->ConvertContentsToApplication(tab_contents_); } else { Release(); } diff --git a/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h b/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h index 2e42437..22d8f2b 100644 --- a/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h +++ b/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h @@ -16,25 +16,21 @@ typedef struct _GtkWidget GtkWidget; typedef struct _GtkWindow GtkWindow; +class TabContents; + class CreateApplicationShortcutsDialogGtk : public base::RefCountedThreadSafe<CreateApplicationShortcutsDialogGtk, ChromeThread::DeleteOnUIThread> { public: - // Displays the dialog box to create application shortcuts for |url| with - // |title|. - static void Show(GtkWindow* parent, - const GURL& url, - const string16& title, - const SkBitmap& favicon); + // Displays the dialog box to create application shortcuts for |tab_contents|. + static void Show(GtkWindow* parent, TabContents* tab_contents); private: friend class ChromeThread; friend class DeleteTask<CreateApplicationShortcutsDialogGtk>; CreateApplicationShortcutsDialogGtk(GtkWindow* parent, - const GURL& url, - const string16& title, - const SkBitmap& favicon); + TabContents* tab_contents); ~CreateApplicationShortcutsDialogGtk(); static void HandleOnResponseCreateDialog(GtkWidget* widget, @@ -57,6 +53,9 @@ class CreateApplicationShortcutsDialogGtk GtkWidget* desktop_checkbox_; GtkWidget* menu_checkbox_; + // TabContents for which the shortcut will be created. + TabContents* tab_contents_; + // Target URL of the shortcut. GURL url_; |