Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: chrome/browser/gtk/create_application_shortcuts_dialog_gtk.cc

Issue 249023: Use favicon for application shortcut icon. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fixed unittests, handle null favicon Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "chrome/browser/shell_integration.h" 8 #include "chrome/browser/shell_integration.h"
9 #include "chrome/common/gtk_util.h" 9 #include "chrome/common/gtk_util.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
11 11
12 // static 12 // static
13 void CreateApplicationShortcutsDialogGtk::Show(GtkWindow* parent, 13 void CreateApplicationShortcutsDialogGtk::Show(GtkWindow* parent,
14 const GURL& url, 14 const GURL& url,
15 const string16& title) { 15 const string16& title,
16 new CreateApplicationShortcutsDialogGtk(parent, url, title); 16 const SkBitmap& favicon) {
17 new CreateApplicationShortcutsDialogGtk(parent, url, title, favicon);
17 } 18 }
18 19
19 CreateApplicationShortcutsDialogGtk::CreateApplicationShortcutsDialogGtk( 20 CreateApplicationShortcutsDialogGtk::CreateApplicationShortcutsDialogGtk(
20 GtkWindow* parent, const GURL& url, const string16& title) 21 GtkWindow* parent,
22 const GURL& url,
23 const string16& title,
24 const SkBitmap& favicon)
21 : url_(url), 25 : url_(url),
22 title_(title) { 26 title_(title),
27 favicon_(favicon) {
23 // Build the dialog. 28 // Build the dialog.
24 GtkWidget* dialog = gtk_dialog_new_with_buttons( 29 GtkWidget* dialog = gtk_dialog_new_with_buttons(
25 l10n_util::GetStringUTF8(IDS_CREATE_SHORTCUTS_TITLE).c_str(), 30 l10n_util::GetStringUTF8(IDS_CREATE_SHORTCUTS_TITLE).c_str(),
26 parent, 31 parent,
27 (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), 32 (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR),
28 GTK_STOCK_CANCEL, 33 GTK_STOCK_CANCEL,
29 GTK_RESPONSE_REJECT, 34 GTK_RESPONSE_REJECT,
30 NULL); 35 NULL);
31 gtk_util::AddButtonToDialog(dialog, 36 gtk_util::AddButtonToDialog(dialog,
32 l10n_util::GetStringUTF8(IDS_CREATE_SHORTCUTS_COMMIT).c_str(), 37 l10n_util::GetStringUTF8(IDS_CREATE_SHORTCUTS_COMMIT).c_str(),
(...skipping 28 matching lines...) Expand all
61 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); 66 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
62 gtk_widget_show_all(dialog); 67 gtk_widget_show_all(dialog);
63 } 68 }
64 69
65 void CreateApplicationShortcutsDialogGtk::OnDialogResponse(GtkWidget* widget, 70 void CreateApplicationShortcutsDialogGtk::OnDialogResponse(GtkWidget* widget,
66 int response) { 71 int response) {
67 if (response == GTK_RESPONSE_ACCEPT) { 72 if (response == GTK_RESPONSE_ACCEPT) {
68 ShellIntegration::ShortcutInfo shortcut_info; 73 ShellIntegration::ShortcutInfo shortcut_info;
69 shortcut_info.url = url_; 74 shortcut_info.url = url_;
70 shortcut_info.title = title_; 75 shortcut_info.title = title_;
76 shortcut_info.favicon = favicon_;
71 shortcut_info.create_on_desktop = 77 shortcut_info.create_on_desktop =
72 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(desktop_checkbox_)); 78 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(desktop_checkbox_));
73 shortcut_info.create_in_applications_menu = 79 shortcut_info.create_in_applications_menu =
74 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(menu_checkbox_)); 80 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(menu_checkbox_));
75 ShellIntegration::CreateDesktopShortcut(shortcut_info); 81 ShellIntegration::CreateDesktopShortcut(shortcut_info);
76 } 82 }
77 83
78 delete this; 84 delete this;
79 gtk_widget_destroy(GTK_WIDGET(widget)); 85 gtk_widget_destroy(GTK_WIDGET(widget));
80 } 86 }
81 87
OLDNEW
« no previous file with comments | « chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h ('k') | chrome/browser/shell_integration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698