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..5fbc66c6be008d47ba1d6d97607c358e2e60b923 100644 |
--- a/chrome/browser/ui/views/create_application_shortcut_view.cc |
+++ b/chrome/browser/ui/views/create_application_shortcut_view.cc |
@@ -258,10 +258,13 @@ CreateApplicationShortcutView::CreateApplicationShortcutView(Profile* profile) |
CreateApplicationShortcutView::~CreateApplicationShortcutView() {} |
-void CreateApplicationShortcutView::InitControls() { |
- // Create controls |
- app_info_ = new AppInfoView(shortcut_info_.title, shortcut_info_.description, |
- shortcut_info_.favicon); |
+void CreateApplicationShortcutView::InitControls( |
+ enum DialogLayout dialog_layout) { |
sky
2014/06/03 17:14:12
no enum here either.
sashab
2014/06/11 05:53:13
Done.
|
+ if (dialog_layout == URL_SHORTCUT_LAYOUT) { |
+ app_info_ = new AppInfoView(shortcut_info_.title, |
+ shortcut_info_.description, |
+ shortcut_info_.favicon); |
+ } |
create_shortcuts_label_ = new views::Label( |
l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_LABEL)); |
create_shortcuts_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
@@ -308,10 +311,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 +445,7 @@ CreateUrlApplicationShortcutView::CreateUrlApplicationShortcutView( |
// Create URL app shortcuts in the top-level menu. |
create_in_chrome_apps_subdir_ = false; |
- InitControls(); |
+ InitControls(URL_SHORTCUT_LAYOUT); |
} |
CreateUrlApplicationShortcutView::~CreateUrlApplicationShortcutView() { |
@@ -524,20 +529,10 @@ 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, |
- weak_ptr_factory_.GetWeakPtr())); |
+ InitControls(APP_SHORTCUT_LAYOUT); |
} |
CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {} |
@@ -553,12 +548,3 @@ bool CreateChromeApplicationShortcutView::Cancel() { |
close_callback_.Run(false); |
return CreateApplicationShortcutView::Cancel(); |
} |
- |
-// Called when the app's ShortcutInfo (with icon) is loaded. |
-void CreateChromeApplicationShortcutView::OnShortcutInfoLoaded( |
- const web_app::ShortcutInfo& shortcut_info) { |
- shortcut_info_ = shortcut_info; |
- |
- CHECK(app_info_); |
- static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); |
-} |