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

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

Issue 13864015: Move app launcher and chrome apps shortcut strings into the installer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@migrate_app_id_fix
Patch Set: fix linux unit tests Created 7 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
OLDNEW
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"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 206 }
207 207
208 void CreateApplicationShortcutsDialogGtk::OnCreateDialogResponse( 208 void CreateApplicationShortcutsDialogGtk::OnCreateDialogResponse(
209 GtkWidget* widget, int response) { 209 GtkWidget* widget, int response) {
210 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 210 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
211 211
212 if (response == GTK_RESPONSE_ACCEPT) { 212 if (response == GTK_RESPONSE_ACCEPT) {
213 ShellIntegration::ShortcutLocations creation_locations; 213 ShellIntegration::ShortcutLocations creation_locations;
214 creation_locations.on_desktop = 214 creation_locations.on_desktop =
215 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(desktop_checkbox_)); 215 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(desktop_checkbox_));
216 creation_locations.in_applications_menu = 216 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(menu_checkbox_))) {
217 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(menu_checkbox_)); 217 if (create_in_chrome_apps_subdir_)
218 creation_locations.applications_menu_subdir = shortcut_menu_subdir_; 218 creation_locations.in_applications_menu_chrome_apps_subdir = true;
219 else
220 creation_locations.in_applications_menu_root = true;
221 }
219 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 222 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
220 base::Bind(&CreateApplicationShortcutsDialogGtk::CreateDesktopShortcut, 223 base::Bind(&CreateApplicationShortcutsDialogGtk::CreateDesktopShortcut,
221 this, shortcut_info_, creation_locations)); 224 this, shortcut_info_, creation_locations));
222 225
223 OnCreatedShortcut(); 226 OnCreatedShortcut();
224 } else { 227 } else {
225 Release(); 228 Release();
226 } 229 }
227 } 230 }
228 231
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 CreateWebApplicationShortcutsDialogGtk::CreateWebApplicationShortcutsDialogGtk( 297 CreateWebApplicationShortcutsDialogGtk::CreateWebApplicationShortcutsDialogGtk(
295 GtkWindow* parent, 298 GtkWindow* parent,
296 content::WebContents* web_contents) 299 content::WebContents* web_contents)
297 : CreateApplicationShortcutsDialogGtk(parent), 300 : CreateApplicationShortcutsDialogGtk(parent),
298 web_contents_(web_contents) { 301 web_contents_(web_contents) {
299 302
300 // Get shortcut information now, it's needed for our UI. 303 // Get shortcut information now, it's needed for our UI.
301 web_app::GetShortcutInfoForTab(web_contents, &shortcut_info_); 304 web_app::GetShortcutInfoForTab(web_contents, &shortcut_info_);
302 CreateIconPixBuf(shortcut_info_.favicon); 305 CreateIconPixBuf(shortcut_info_.favicon);
303 306
304 // NOTE: Leave shortcut_menu_subdir_ blank to create URL app shortcuts in the 307 // Create URL app shortcuts in the top-level menu.
305 // top-level menu. 308 create_in_chrome_apps_subdir_ = false;
306 309
307 CreateDialogBox(parent); 310 CreateDialogBox(parent);
308 } 311 }
309 312
310 void CreateWebApplicationShortcutsDialogGtk::OnCreatedShortcut() { 313 void CreateWebApplicationShortcutsDialogGtk::OnCreatedShortcut() {
311 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); 314 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
312 if (browser) 315 if (browser)
313 chrome::ConvertTabToAppWindow(browser, web_contents_); 316 chrome::ConvertTabToAppWindow(browser, web_contents_);
314 } 317 }
315 318
316 CreateChromeApplicationShortcutsDialogGtk:: 319 CreateChromeApplicationShortcutsDialogGtk::
317 CreateChromeApplicationShortcutsDialogGtk( 320 CreateChromeApplicationShortcutsDialogGtk(
318 GtkWindow* parent, 321 GtkWindow* parent,
319 Profile* profile, 322 Profile* profile,
320 const Extension* app) 323 const Extension* app)
321 : CreateApplicationShortcutsDialogGtk(parent), 324 : CreateApplicationShortcutsDialogGtk(parent),
322 app_(app), 325 app_(app),
323 profile_path_(profile->GetPath()) { 326 profile_path_(profile->GetPath()) {
324 327
325 // Place Chrome app shortcuts in the "Chrome Apps" submenu. 328 // Place Chrome app shortcuts in the "Chrome Apps" submenu.
326 shortcut_menu_subdir_ = web_app::GetAppShortcutsSubdirName(); 329 create_in_chrome_apps_subdir_ = true;
327 330
328 // Get shortcut information and icon now; they are needed for our UI. 331 // Get shortcut information and icon now; they are needed for our UI.
329 web_app::UpdateShortcutInfoAndIconForApp( 332 web_app::UpdateShortcutInfoAndIconForApp(
330 *app, profile, 333 *app, profile,
331 base::Bind( 334 base::Bind(
332 &CreateChromeApplicationShortcutsDialogGtk::OnShortcutInfoLoaded, 335 &CreateChromeApplicationShortcutsDialogGtk::OnShortcutInfoLoaded,
333 this)); 336 this));
334 } 337 }
335 338
336 // Called when the app's ShortcutInfo (with icon) is loaded. 339 // Called when the app's ShortcutInfo (with icon) is loaded.
(...skipping 13 matching lines...) Expand all
350 if (web_app::CreateShortcutsOnFileThread( 353 if (web_app::CreateShortcutsOnFileThread(
351 shortcut_info, creation_locations, 354 shortcut_info, creation_locations,
352 web_app::SHORTCUT_CREATION_BY_USER)) { 355 web_app::SHORTCUT_CREATION_BY_USER)) {
353 Release(); 356 Release();
354 } else { 357 } else {
355 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 358 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
356 base::Bind(&CreateChromeApplicationShortcutsDialogGtk::ShowErrorDialog, 359 base::Bind(&CreateChromeApplicationShortcutsDialogGtk::ShowErrorDialog,
357 this)); 360 this));
358 } 361 }
359 } 362 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698