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

Side by Side Diff: chrome/browser/ui/views/create_application_shortcut_view.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: rebase, move app launcher and chrome app strings into the installer Created 7 years, 7 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/views/create_application_shortcut_view.h" 5 #include "chrome/browser/ui/views/create_application_shortcut_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 string16 CreateApplicationShortcutView::GetWindowTitle() const { 369 string16 CreateApplicationShortcutView::GetWindowTitle() const {
370 return l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_TITLE); 370 return l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_TITLE);
371 } 371 }
372 372
373 bool CreateApplicationShortcutView::Accept() { 373 bool CreateApplicationShortcutView::Accept() {
374 if (!IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)) 374 if (!IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK))
375 return false; 375 return false;
376 376
377 ShellIntegration::ShortcutLocations creation_locations; 377 ShellIntegration::ShortcutLocations creation_locations;
378 creation_locations.on_desktop = desktop_check_box_->checked(); 378 creation_locations.on_desktop = desktop_check_box_->checked();
379 creation_locations.in_applications_menu = menu_check_box_ == NULL ? false : 379 if (menu_check_box_ != NULL && menu_check_box_->checked()) {
Matt Giuca 2013/05/15 05:19:45 You will need to make this change in chrome/browse
380 menu_check_box_->checked(); 380 if (create_in_chrome_apps_subdir_)
381 creation_locations.applications_menu_subdir = shortcut_menu_subdir_; 381 creation_locations.in_applications_menu_chrome_apps_subdir = true;
382 382 else
383 creation_locations.in_applications_menu = true;
384 }
383 #if defined(OS_WIN) 385 #if defined(OS_WIN)
384 creation_locations.in_quick_launch_bar = quick_launch_check_box_ == NULL ? 386 creation_locations.in_quick_launch_bar = quick_launch_check_box_ == NULL ?
385 NULL : quick_launch_check_box_->checked(); 387 NULL : quick_launch_check_box_->checked();
386 #elif defined(OS_POSIX) 388 #elif defined(OS_POSIX)
387 // Create shortcut in Mac dock or as Linux (gnome/kde) application launcher 389 // Create shortcut in Mac dock or as Linux (gnome/kde) application launcher
388 // are not implemented yet. 390 // are not implemented yet.
389 creation_locations.in_quick_launch_bar = false; 391 creation_locations.in_quick_launch_bar = false;
390 #endif 392 #endif
391 393
392 web_app::CreateShortcuts(shortcut_info_, creation_locations); 394 web_app::CreateShortcuts(shortcut_info_, creation_locations);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 pending_download_id_(-1) { 428 pending_download_id_(-1) {
427 429
428 web_app::GetShortcutInfoForTab(web_contents_, &shortcut_info_); 430 web_app::GetShortcutInfoForTab(web_contents_, &shortcut_info_);
429 const WebApplicationInfo& app_info = 431 const WebApplicationInfo& app_info =
430 extensions::TabHelper::FromWebContents(web_contents_)->web_app_info(); 432 extensions::TabHelper::FromWebContents(web_contents_)->web_app_info();
431 if (!app_info.icons.empty()) { 433 if (!app_info.icons.empty()) {
432 web_app::GetIconsInfo(app_info, &unprocessed_icons_); 434 web_app::GetIconsInfo(app_info, &unprocessed_icons_);
433 FetchIcon(); 435 FetchIcon();
434 } 436 }
435 437
436 // NOTE: Leave shortcut_menu_subdir_ blank to create URL app shortcuts in the 438 // Create URL app shortcuts in the top-level menu.
437 // top-level menu. 439 create_in_chrome_apps_subdir_ = false;
Matt Giuca 2013/05/15 05:19:45 I'm glad this comment came in handy :)
438 440
439 InitControls(); 441 InitControls();
440 } 442 }
441 443
442 CreateUrlApplicationShortcutView::~CreateUrlApplicationShortcutView() { 444 CreateUrlApplicationShortcutView::~CreateUrlApplicationShortcutView() {
443 } 445 }
444 446
445 bool CreateUrlApplicationShortcutView::Accept() { 447 bool CreateUrlApplicationShortcutView::Accept() {
446 if (!CreateApplicationShortcutView::Accept()) 448 if (!CreateApplicationShortcutView::Accept())
447 return false; 449 return false;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 Profile* profile, 511 Profile* profile,
510 const extensions::Extension* app) : 512 const extensions::Extension* app) :
511 CreateApplicationShortcutView(profile), 513 CreateApplicationShortcutView(profile),
512 app_(app), 514 app_(app),
513 weak_ptr_factory_(this) { 515 weak_ptr_factory_(this) {
514 // Required by InitControls(). 516 // Required by InitControls().
515 shortcut_info_.title = UTF8ToUTF16(app->name()); 517 shortcut_info_.title = UTF8ToUTF16(app->name());
516 shortcut_info_.description = UTF8ToUTF16(app->description()); 518 shortcut_info_.description = UTF8ToUTF16(app->description());
517 519
518 // Place Chrome app shortcuts in the "Chrome Apps" submenu. 520 // Place Chrome app shortcuts in the "Chrome Apps" submenu.
519 shortcut_menu_subdir_ = web_app::GetAppShortcutsSubdirName(); 521 create_in_chrome_apps_subdir_ = true;
520 522
521 InitControls(); 523 InitControls();
522 524
523 // Get shortcut information and icon now; they are needed for our UI. 525 // Get shortcut information and icon now; they are needed for our UI.
524 web_app::UpdateShortcutInfoAndIconForApp( 526 web_app::UpdateShortcutInfoAndIconForApp(
525 *app, profile, 527 *app, profile,
526 base::Bind(&CreateChromeApplicationShortcutView::OnShortcutInfoLoaded, 528 base::Bind(&CreateChromeApplicationShortcutView::OnShortcutInfoLoaded,
527 weak_ptr_factory_.GetWeakPtr())); 529 weak_ptr_factory_.GetWeakPtr()));
528 } 530 }
529 531
530 CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {} 532 CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {}
531 533
532 // Called when the app's ShortcutInfo (with icon) is loaded. 534 // Called when the app's ShortcutInfo (with icon) is loaded.
533 void CreateChromeApplicationShortcutView::OnShortcutInfoLoaded( 535 void CreateChromeApplicationShortcutView::OnShortcutInfoLoaded(
534 const ShellIntegration::ShortcutInfo& shortcut_info) { 536 const ShellIntegration::ShortcutInfo& shortcut_info) {
535 shortcut_info_ = shortcut_info; 537 shortcut_info_ = shortcut_info;
536 538
537 CHECK(app_info_); 539 CHECK(app_info_);
538 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); 540 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon);
539 } 541 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698