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

Unified Diff: chrome/browser/ui/views/web_intent_picker_views.cc

Issue 10703121: [WebIntents, Views] Add dialog for empty picker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review suggestions. Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/web_intent_picker_views.cc
diff --git a/chrome/browser/ui/views/web_intent_picker_views.cc b/chrome/browser/ui/views/web_intent_picker_views.cc
index a17afd610d2f747a700a4b1247c72532584f8973..30be1894a352db769407fdda8119d06469e90ad1 100644
--- a/chrome/browser/ui/views/web_intent_picker_views.cc
+++ b/chrome/browser/ui/views/web_intent_picker_views.cc
@@ -689,6 +689,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;
@@ -892,6 +893,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_)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698