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

Side by Side Diff: chrome/browser/ui/views/web_intent_picker_views.cc

Issue 10387142: [Views, WebIntents] Hide suggestion label if none are available. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix review issues Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "chrome/browser/tab_contents/tab_util.h" 10 #include "chrome/browser/tab_contents/tab_util.h"
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 // Inline web contents row. 944 // Inline web contents row.
945 grid_layout->StartRow(0, 1); 945 grid_layout->StartRow(0, 1);
946 grid_layout->AddView(webview_, 1, 1, GridLayout::CENTER, 946 grid_layout->AddView(webview_, 1, 1, GridLayout::CENTER,
947 GridLayout::CENTER, kDialogMinWidth, 140); 947 GridLayout::CENTER, kDialogMinWidth, 140);
948 contents_->Layout(); 948 contents_->Layout();
949 SizeToContents(); 949 SizeToContents();
950 displaying_web_contents_ = true; 950 displaying_web_contents_ = true;
951 } 951 }
952 952
953 void WebIntentPickerViews::OnModelChanged(WebIntentPickerModel* model) { 953 void WebIntentPickerViews::OnModelChanged(WebIntentPickerModel* model) {
954 if (model->GetInstalledServiceCount() == 0) { 954 suggestions_label_->SetText(l10n_util::GetStringUTF16(
955 suggestions_label_->SetText(l10n_util::GetStringUTF16( 955 model->GetInstalledServiceCount() ?
956 IDS_INTENT_PICKER_GET_MORE_SERVICES_NONE_INSTALLED)); 956 IDS_INTENT_PICKER_GET_MORE_SERVICES :
957 } else { 957 IDS_INTENT_PICKER_GET_MORE_SERVICES_NONE_INSTALLED));
958 suggestions_label_->SetText( 958
959 l10n_util::GetStringUTF16(IDS_INTENT_PICKER_GET_MORE_SERVICES)); 959 suggestions_label_->SetVisible(model->GetSuggestedExtensionCount() > 0);
960 }
961 960
962 service_buttons_->Update(); 961 service_buttons_->Update();
963 extensions_->Update(); 962 extensions_->Update();
964 contents_->Layout(); 963 contents_->Layout();
965 SizeToContents(); 964 SizeToContents();
966 } 965 }
967 966
968 void WebIntentPickerViews::OnFaviconChanged( 967 void WebIntentPickerViews::OnFaviconChanged(
969 WebIntentPickerModel* model, size_t index) { 968 WebIntentPickerModel* model, size_t index) {
970 service_buttons_->Update(); 969 service_buttons_->Update();
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 // Padding row. 1091 // Padding row.
1093 grid_layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1092 grid_layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
1094 1093
1095 // Service button row. 1094 // Service button row.
1096 grid_layout->StartRow(0, kFullWidthColumnSet); 1095 grid_layout->StartRow(0, kFullWidthColumnSet);
1097 service_buttons_ = new ServiceButtonsView(model_, this); 1096 service_buttons_ = new ServiceButtonsView(model_, this);
1098 grid_layout->AddView(service_buttons_); 1097 grid_layout->AddView(service_buttons_);
1099 1098
1100 // Row with app suggestions label. 1099 // Row with app suggestions label.
1101 grid_layout->StartRow(0, kIndentedFullWidthColumnSet); 1100 grid_layout->StartRow(0, kIndentedFullWidthColumnSet);
1102 suggestions_label_ = new views::Label( 1101 suggestions_label_ = new views::Label();
1103 l10n_util::GetStringUTF16(IDS_INTENT_PICKER_GET_MORE_SERVICES)); 1102 suggestions_label_->SetVisible(false);
1104 suggestions_label_->SetMultiLine(true); 1103 suggestions_label_->SetMultiLine(true);
1105 suggestions_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 1104 suggestions_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
1106 grid_layout->AddView(suggestions_label_); 1105 grid_layout->AddView(suggestions_label_);
1107 1106
1108 // Padding row. 1107 // Padding row.
1109 grid_layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1108 grid_layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
1110 1109
1111 // Row with extension suggestions. 1110 // Row with extension suggestions.
1112 grid_layout->StartRow(0, kIndentedFullWidthColumnSet); 1111 grid_layout->StartRow(0, kIndentedFullWidthColumnSet);
1113 extensions_ = new SuggestedExtensionsView(model_, this); 1112 extensions_ = new SuggestedExtensionsView(model_, this);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 views::ImageButton* close_button = new views::ImageButton(this); 1158 views::ImageButton* close_button = new views::ImageButton(this);
1160 close_button->SetImage(views::CustomButton::BS_NORMAL, 1159 close_button->SetImage(views::CustomButton::BS_NORMAL,
1161 rb.GetBitmapNamed(IDR_CLOSE_BAR)); 1160 rb.GetBitmapNamed(IDR_CLOSE_BAR));
1162 close_button->SetImage(views::CustomButton::BS_HOT, 1161 close_button->SetImage(views::CustomButton::BS_HOT,
1163 rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); 1162 rb.GetBitmapNamed(IDR_CLOSE_BAR_H));
1164 close_button->SetImage(views::CustomButton::BS_PUSHED, 1163 close_button->SetImage(views::CustomButton::BS_PUSHED,
1165 rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); 1164 rb.GetBitmapNamed(IDR_CLOSE_BAR_P));
1166 return close_button; 1165 return close_button;
1167 } 1166 }
1168 #endif 1167 #endif
OLDNEW
« 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