Chromium Code Reviews| Index: chrome/browser/ui/views/create_application_shortcut_view.cc |
| diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc |
| index 297e29eba2c5cb310bfced564719745203e3e4a8..682b9ec768e7b25127941244f28df627a094f908 100644 |
| --- a/chrome/browser/ui/views/create_application_shortcut_view.cc |
| +++ b/chrome/browser/ui/views/create_application_shortcut_view.cc |
| @@ -258,10 +258,12 @@ CreateApplicationShortcutView::CreateApplicationShortcutView(Profile* profile) |
| CreateApplicationShortcutView::~CreateApplicationShortcutView() {} |
| -void CreateApplicationShortcutView::InitControls() { |
| - // Create controls |
| +void CreateApplicationShortcutView::InitAppInfoControl() { |
| app_info_ = new AppInfoView(shortcut_info_.title, shortcut_info_.description, |
| shortcut_info_.favicon); |
| +} |
| + |
| +void CreateApplicationShortcutView::InitDialog() { |
| create_shortcuts_label_ = new views::Label( |
| l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_LABEL)); |
| create_shortcuts_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| @@ -308,10 +310,12 @@ void CreateApplicationShortcutView::InitControls() { |
| column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, |
| 100.0f, views::GridLayout::USE_PREF, 0, 0); |
| - layout->StartRow(0, kHeaderColumnSetId); |
| - layout->AddView(app_info_); |
| + if (app_info_) { |
| + layout->StartRow(0, kHeaderColumnSetId); |
| + layout->AddView(app_info_); |
| + layout->AddPaddingRow(0, views::kPanelSubVerticalSpacing); |
| + } |
| - layout->AddPaddingRow(0, views::kPanelSubVerticalSpacing); |
| layout->StartRow(0, kHeaderColumnSetId); |
| layout->AddView(create_shortcuts_label_); |
| @@ -440,7 +444,8 @@ CreateUrlApplicationShortcutView::CreateUrlApplicationShortcutView( |
| // Create URL app shortcuts in the top-level menu. |
| create_in_chrome_apps_subdir_ = false; |
| - InitControls(); |
| + InitAppInfoControl(); |
| + InitDialog(); |
| } |
| CreateUrlApplicationShortcutView::~CreateUrlApplicationShortcutView() { |
| @@ -524,20 +529,12 @@ CreateChromeApplicationShortcutView::CreateChromeApplicationShortcutView( |
| : CreateApplicationShortcutView(profile), |
| close_callback_(close_callback), |
| weak_ptr_factory_(this) { |
| - // Required by InitControls(). |
| - shortcut_info_.title = base::UTF8ToUTF16(app->name()); |
| - shortcut_info_.description = base::UTF8ToUTF16(app->description()); |
| - |
| // Place Chrome app shortcuts in the "Chrome Apps" submenu. |
| create_in_chrome_apps_subdir_ = true; |
| - InitControls(); |
| - |
| - // Get shortcut information and icon now; they are needed for our UI. |
| - web_app::UpdateShortcutInfoAndIconForApp( |
| - app, profile, |
| - base::Bind(&CreateChromeApplicationShortcutView::OnShortcutInfoLoaded, |
|
benwells
2014/05/29 04:49:34
How come this can be deleted?
sashab
2014/05/29 05:18:02
This loads the app's icon asynchronously, which is
|
| - weak_ptr_factory_.GetWeakPtr())); |
| + // Don't add the info control to dialogs for Chrome apps. In the places where |
| + // this dialog is created, it is always clear which app the shortcut is for. |
| + InitDialog(); |
| } |
| CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {} |