Commit 901fd6ed authored by groby@chromium.org's avatar groby@chromium.org

[WebIntents, Views] Add dialog for empty picker.

Display separate dialog if there are neither installed nor suggested services.

BUG=129005
TEST=bring up intent picker without any intents installed, and none in CWS. (Easier in Chromium, since CWS suggestions are disabled there)

R=pkasting@chromium.org


Review URL: https://chromiumcodereview.appspot.com/10703121

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146257 0039d316-1c4b-4281-b951-d872f2087c98
parent e37ce37a
......@@ -688,6 +688,7 @@ class WebIntentPickerViews : public views::ButtonListener,
virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE;
virtual void OnExtensionInstallFailure(const std::string& id) OVERRIDE;
virtual void OnInlineDispositionAutoResize(const gfx::Size& size) OVERRIDE;
virtual void OnPendingAsyncCompleted() OVERRIDE;
virtual void OnInlineDispositionWebContentsLoaded(
content::WebContents* web_contents) OVERRIDE;
......@@ -891,6 +892,51 @@ void WebIntentPickerViews::OnInlineDispositionAutoResize(
SizeToContents();
}
void WebIntentPickerViews::OnPendingAsyncCompleted() {
// Requests to both the WebIntentService and the Chrome Web Store have
// completed. If there are any services, installed or suggested, there's
// nothing to do.
if (model_->GetInstalledServiceCount() ||
model_->GetSuggestedExtensionCount())
return;
// If there are no installed or suggested services at this point,
// inform the user about it.
contents_->RemoveAllChildViews(true);
more_suggestions_link_ = NULL;
views::GridLayout* grid_layout = new views::GridLayout(contents_);
contents_->SetLayoutManager(grid_layout);
grid_layout->SetInsets(kContentAreaBorder, kContentAreaBorder,
kContentAreaBorder, kContentAreaBorder);
views::ColumnSet* main_cs = grid_layout->AddColumnSet(0);
main_cs->AddColumn(GridLayout::FILL, GridLayout::LEADING, 1,
GridLayout::USE_PREF, 0, 0);
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
grid_layout->StartRow(0, 0);
views::Label* header = new views::Label();
header->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
header->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont));
header->SetText(l10n_util::GetStringUTF16(
IDS_INTENT_PICKER_NO_SERVICES_TITLE));
grid_layout->AddView(header);
grid_layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
grid_layout->StartRow(0, 0);
views::Label* body = new views::Label();
body->SetMultiLine(true);
body->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
body->SetText(l10n_util::GetStringUTF16(IDS_INTENT_PICKER_NO_SERVICES));
grid_layout->AddView(body);
contents_->Layout();
SizeToContents();
}
void WebIntentPickerViews::OnInlineDispositionWebContentsLoaded(
content::WebContents* web_contents) {
if (displaying_web_contents_)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment