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

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

Issue 10870092: [WebIntents, Views] First version of "Waiting" dialog for views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Upload missing fix. Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker_controller.cc ('k') | 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/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 const int kThrobberFrameTimeMs = 50; 73 const int kThrobberFrameTimeMs = 50;
74 74
75 // Enables or disables all child views of |view|. 75 // Enables or disables all child views of |view|.
76 void EnableChildViews(views::View* view, bool enabled) { 76 void EnableChildViews(views::View* view, bool enabled) {
77 for (int i = 0; i < view->child_count(); ++i) { 77 for (int i = 0; i < view->child_count(); ++i) {
78 views::View* child = view->child_at(i); 78 views::View* child = view->child_at(i);
79 child->SetEnabled(enabled); 79 child->SetEnabled(enabled);
80 } 80 }
81 } 81 }
82 82
83 // Create a "close" button.
84 views::ImageButton* CreateCloseButton(views::ButtonListener* listener) {
85 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
86 views::ImageButton* close_button = new views::ImageButton(listener);
87 close_button->SetImage(views::CustomButton::BS_NORMAL,
88 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X));
89 close_button->SetImage(views::CustomButton::BS_HOT,
90 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER));
91 close_button->SetImage(views::CustomButton::BS_PUSHED,
92 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER));
93 return close_button;
94 }
95
83 // StarsView ------------------------------------------------------------------- 96 // StarsView -------------------------------------------------------------------
84 97
85 // A view that displays 5 stars: empty, full or half full, given a rating in 98 // A view that displays 5 stars: empty, full or half full, given a rating in
86 // the range [0,5]. 99 // the range [0,5].
87 class StarsView : public views::View { 100 class StarsView : public views::View {
88 public: 101 public:
89 explicit StarsView(double rating); 102 explicit StarsView(double rating);
90 virtual ~StarsView(); 103 virtual ~StarsView();
91 104
92 private: 105 private:
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 this_frame_ = gfx::ImageSkiaOperations::ExtractSubset(*frames_, subset_rect); 237 this_frame_ = gfx::ImageSkiaOperations::ExtractSubset(*frames_, subset_rect);
225 return this_frame_; 238 return this_frame_;
226 } 239 }
227 240
228 void ThrobberNativeTextButton::Run() { 241 void ThrobberNativeTextButton::Run() {
229 DCHECK(running_); 242 DCHECK(running_);
230 243
231 SchedulePaint(); 244 SchedulePaint();
232 } 245 }
233 246
247 // WaitingView ----------------------------------------------------------
248 class WaitingView : public views::View {
249 public:
250 WaitingView(views::ButtonListener* listener, bool use_close_button);
251
252 private:
253 DISALLOW_COPY_AND_ASSIGN(WaitingView);
254 };
255
256 WaitingView::WaitingView(views::ButtonListener* listener,
257 bool use_close_button) {
258 views::GridLayout* layout = new views::GridLayout(this);
259 layout->set_minimum_size(gfx::Size(WebIntentPicker::kWindowWidth, 0));
260 layout->SetInsets(WebIntentPicker::kContentAreaBorder,
261 WebIntentPicker::kContentAreaBorder,
262 WebIntentPicker::kContentAreaBorder,
263 WebIntentPicker::kContentAreaBorder);
264 SetLayoutManager(layout);
265
266 views::ColumnSet* cs = layout->AddColumnSet(0);
267 views::ColumnSet* header_cs = NULL;
tfarina 2012/08/29 01:04:01 looks like this could be moved inside the if claus
268 if (use_close_button) {
269 header_cs = layout->AddColumnSet(1);
270 header_cs->AddPaddingColumn(1, views::kUnrelatedControlHorizontalSpacing);
271 header_cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0,
272 GridLayout::USE_PREF, 0, 0); // Close Button.
273 }
274 cs->AddPaddingColumn(0, views::kPanelHorizIndentation);
275 cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER,
276 1, GridLayout::USE_PREF, 0, 0);
277 cs->AddPaddingColumn(0, views::kPanelHorizIndentation);
278
279 // Create throbber.
280 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
281 const gfx::ImageSkia* frames =
282 rb.GetImageNamed(IDR_SPEECH_INPUT_SPINNER).ToImageSkia();
283 views::Throbber* throbber = new views::Throbber(kThrobberFrameTimeMs, true);
284 throbber->SetFrames(frames);
285 throbber->Start();
286
287 // Create text.
288 views::Label* label = new views::Label();
289 label->SetHorizontalAlignment(views::Label::ALIGN_CENTER);
290 label->SetFont(rb.GetFont(ui::ResourceBundle::MediumBoldFont));
291 label->SetText(l10n_util::GetStringUTF16(IDS_INTENT_PICKER_WAIT_FOR_CWS));
292
293 // Layout the view.
294 if (use_close_button) {
295 layout->StartRow(0, 1);
296 layout->AddView(CreateCloseButton(listener));
297 }
298
299 layout->AddPaddingRow(0, views::kUnrelatedControlLargeVerticalSpacing);
300 layout->StartRow(0, 0);
301 layout->AddView(throbber);
302 layout->AddPaddingRow(0, views::kUnrelatedControlLargeVerticalSpacing);
303 layout->StartRow(0, 0);
304 layout->AddView(label);
305 layout->AddPaddingRow(0, views::kUnrelatedControlLargeVerticalSpacing);
306 }
307
234 // ServiceButtonsView ---------------------------------------------------------- 308 // ServiceButtonsView ----------------------------------------------------------
235 309
236 // A view that contains all service buttons (i.e. the installed services). 310 // A view that contains all service buttons (i.e. the installed services).
237 class ServiceButtonsView : public views::View, 311 class ServiceButtonsView : public views::View,
238 public views::ButtonListener { 312 public views::ButtonListener {
239 public: 313 public:
240 class Delegate { 314 class Delegate {
241 public: 315 public:
242 // Called when a service button is clicked. |index| is the index of the 316 // Called when a service button is clicked. |index| is the index of the
243 // service button in the model. 317 // service button in the model.
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 772
699 // SuggestedExtensionsRowView::Delegate implementation. 773 // SuggestedExtensionsRowView::Delegate implementation.
700 virtual void OnExtensionInstallClicked(const string16& extension_id) OVERRIDE; 774 virtual void OnExtensionInstallClicked(const string16& extension_id) OVERRIDE;
701 virtual void OnExtensionLinkClicked(const string16& extension_id) OVERRIDE; 775 virtual void OnExtensionLinkClicked(const string16& extension_id) OVERRIDE;
702 776
703 private: 777 private:
704 // Initialize the contents of the picker. After this call, contents_ will be 778 // Initialize the contents of the picker. After this call, contents_ will be
705 // non-NULL. 779 // non-NULL.
706 void InitContents(); 780 void InitContents();
707 781
782 // Initialize the main contents of the picker. (Suggestions, services).
783 void InitMainContents();
784
708 // Restore the contents of the picker to the initial contents. 785 // Restore the contents of the picker to the initial contents.
709 void ResetContents(); 786 void ResetContents();
710 787
711 // Resize the constrained window to the size of its contents. 788 // Resize the constrained window to the size of its contents.
712 void SizeToContents(); 789 void SizeToContents();
713 790
714 // Returns a new close button.
715 views::ImageButton* CreateCloseButton();
716
717 // A weak pointer to the WebIntentPickerDelegate to notify when the user 791 // A weak pointer to the WebIntentPickerDelegate to notify when the user
718 // chooses a service or cancels. 792 // chooses a service or cancels.
719 WebIntentPickerDelegate* delegate_; 793 WebIntentPickerDelegate* delegate_;
720 794
721 // A weak pointer to the picker model. 795 // A weak pointer to the picker model.
722 WebIntentPickerModel* model_; 796 WebIntentPickerModel* model_;
723 797
724 // A weak pointer to the service button view. 798 // A weak pointer to the service button view.
725 // Created locally, owned by Views. 799 // Created locally, owned by Views.
726 ServiceButtonsView* service_buttons_; 800 ServiceButtonsView* service_buttons_;
(...skipping 29 matching lines...) Expand all
756 ConstrainedWindowViews* window_; 830 ConstrainedWindowViews* window_;
757 831
758 // A weak pointer to the more suggestions link. 832 // A weak pointer to the more suggestions link.
759 // Created locally, owned by Views. 833 // Created locally, owned by Views.
760 views::Link* more_suggestions_link_; 834 views::Link* more_suggestions_link_;
761 835
762 // A weak pointer to the choose another service link. 836 // A weak pointer to the choose another service link.
763 // Created locally, owned by Views. 837 // Created locally, owned by Views.
764 views::Link* choose_another_service_link_; 838 views::Link* choose_another_service_link_;
765 839
840 // Weak pointer to "Waiting for CWS" display. Owned by parent view.
841 WaitingView* waiting_view_;
842
766 // Set to true when displaying the inline disposition web contents. Used to 843 // Set to true when displaying the inline disposition web contents. Used to
767 // prevent laying out the inline disposition widgets twice. 844 // prevent laying out the inline disposition widgets twice.
768 bool displaying_web_contents_; 845 bool displaying_web_contents_;
769 846
770 // The text for the current action. 847 // The text for the current action.
771 string16 action_text_; 848 string16 action_text_;
772 849
773 // Ownership of the WebContents we are displaying in the inline disposition. 850 // Ownership of the WebContents we are displaying in the inline disposition.
774 scoped_ptr<WebContents> inline_web_contents_; 851 scoped_ptr<WebContents> inline_web_contents_;
775 852
(...skipping 20 matching lines...) Expand all
796 service_buttons_(NULL), 873 service_buttons_(NULL),
797 action_label_(NULL), 874 action_label_(NULL),
798 suggestions_label_(NULL), 875 suggestions_label_(NULL),
799 extensions_(NULL), 876 extensions_(NULL),
800 tab_contents_(tab_contents), 877 tab_contents_(tab_contents),
801 webview_(new views::WebView(tab_contents->profile())), 878 webview_(new views::WebView(tab_contents->profile())),
802 contents_(NULL), 879 contents_(NULL),
803 window_(NULL), 880 window_(NULL),
804 more_suggestions_link_(NULL), 881 more_suggestions_link_(NULL),
805 choose_another_service_link_(NULL), 882 choose_another_service_link_(NULL),
883 waiting_view_(NULL),
806 displaying_web_contents_(false) { 884 displaying_web_contents_(false) {
807 use_close_button_ = CommandLine::ForCurrentProcess()->HasSwitch( 885 use_close_button_ = CommandLine::ForCurrentProcess()->HasSwitch(
808 switches::kEnableFramelessConstrainedDialogs); 886 switches::kEnableFramelessConstrainedDialogs);
809 887
810 model_->set_observer(this); 888 model_->set_observer(this);
811 InitContents(); 889 InitContents();
812 890
813 // Show the dialog. 891 // Show the dialog.
814 window_ = new ConstrainedWindowViews(tab_contents, this); 892 window_ = new ConstrainedWindowViews(tab_contents, this);
815 } 893 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 NOTREACHED(); 936 NOTREACHED();
859 } 937 }
860 } 938 }
861 939
862 void WebIntentPickerViews::Close() { 940 void WebIntentPickerViews::Close() {
863 window_->CloseConstrainedWindow(); 941 window_->CloseConstrainedWindow();
864 } 942 }
865 943
866 void WebIntentPickerViews::SetActionString(const string16& action) { 944 void WebIntentPickerViews::SetActionString(const string16& action) {
867 action_text_ = action; 945 action_text_ = action;
868 action_label_->SetText(action); 946
947 if (action_label_)
948 action_label_->SetText(action);
869 } 949 }
870 950
871 void WebIntentPickerViews::OnExtensionInstallSuccess(const std::string& id) { 951 void WebIntentPickerViews::OnExtensionInstallSuccess(const std::string& id) {
872 } 952 }
873 953
874 void WebIntentPickerViews::OnExtensionInstallFailure(const std::string& id) { 954 void WebIntentPickerViews::OnExtensionInstallFailure(const std::string& id) {
875 service_buttons_->SetEnabled(true); 955 service_buttons_->SetEnabled(true);
876 extensions_->StopThrobber(); 956 extensions_->StopThrobber();
877 more_suggestions_link_->SetEnabled(true); 957 more_suggestions_link_->SetEnabled(true);
878 contents_->Layout(); 958 contents_->Layout();
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 // or if more than one (the current) service is installed. 1062 // or if more than one (the current) service is installed.
983 if (model_->GetInstalledServiceCount() > 1 || 1063 if (model_->GetInstalledServiceCount() > 1 ||
984 model_->GetSuggestedExtensionCount()) { 1064 model_->GetSuggestedExtensionCount()) {
985 choose_another_service_link_ = new views::Link( 1065 choose_another_service_link_ = new views::Link(
986 l10n_util::GetStringUTF16(IDS_INTENT_PICKER_USE_ALTERNATE_SERVICE)); 1066 l10n_util::GetStringUTF16(IDS_INTENT_PICKER_USE_ALTERNATE_SERVICE));
987 grid_layout->AddView(choose_another_service_link_); 1067 grid_layout->AddView(choose_another_service_link_);
988 choose_another_service_link_->set_listener(this); 1068 choose_another_service_link_->set_listener(this);
989 } 1069 }
990 1070
991 if (use_close_button_) 1071 if (use_close_button_)
992 grid_layout->AddView(CreateCloseButton()); 1072 grid_layout->AddView(CreateCloseButton(this));
993 1073
994 // Inline web contents row. 1074 // Inline web contents row.
995 grid_layout->StartRow(0, 1); 1075 grid_layout->StartRow(0, 1);
996 grid_layout->AddView(webview_, 1, 1, GridLayout::CENTER, 1076 grid_layout->AddView(webview_, 1, 1, GridLayout::CENTER,
997 GridLayout::CENTER, 0, 0); 1077 GridLayout::CENTER, 0, 0);
998 contents_->Layout(); 1078 contents_->Layout();
999 SizeToContents(); 1079 SizeToContents();
1000 displaying_web_contents_ = true; 1080 displaying_web_contents_ = true;
1001 } 1081 }
1002 1082
1003 void WebIntentPickerViews::OnModelChanged(WebIntentPickerModel* model) { 1083 void WebIntentPickerViews::OnModelChanged(WebIntentPickerModel* model) {
1004 string16 label_text = model->GetSuggestionsLinkText(); 1084 if (waiting_view_ && !model->IsWaitingForSuggestions()) {
tfarina 2012/08/29 01:04:01 no need of { } for single line statements.
1005 suggestions_label_->SetText(label_text); 1085 InitMainContents();
1086 }
1087 if (suggestions_label_) {
1088 string16 label_text = model->GetSuggestionsLinkText();
1089 suggestions_label_->SetText(label_text);
1090 suggestions_label_->SetVisible(!label_text.empty());
1091 }
1006 1092
1007 suggestions_label_->SetVisible(!label_text.empty()); 1093 if (service_buttons_)
1094 service_buttons_->Update();
1008 1095
1009 service_buttons_->Update(); 1096 if (extensions_)
1010 extensions_->Update(); 1097 extensions_->Update();
1011 contents_->Layout(); 1098 contents_->Layout();
1012 SizeToContents(); 1099 SizeToContents();
1013 } 1100 }
1014 1101
1015 void WebIntentPickerViews::OnFaviconChanged( 1102 void WebIntentPickerViews::OnFaviconChanged(
1016 WebIntentPickerModel* model, size_t index) { 1103 WebIntentPickerModel* model, size_t index) {
1017 service_buttons_->Update(); 1104 if (service_buttons_)
1105 service_buttons_->Update();
1106
1018 contents_->Layout(); 1107 contents_->Layout();
1019 SizeToContents(); 1108 SizeToContents();
1020 } 1109 }
1021 1110
1022 void WebIntentPickerViews::OnExtensionIconChanged( 1111 void WebIntentPickerViews::OnExtensionIconChanged(
1023 WebIntentPickerModel* model, 1112 WebIntentPickerModel* model,
1024 const string16& extension_id) { 1113 const string16& extension_id) {
1025 extensions_->Update(); 1114 if (extensions_)
1115 extensions_->Update();
1116
1026 contents_->Layout(); 1117 contents_->Layout();
1027 SizeToContents(); 1118 SizeToContents();
1028 } 1119 }
1029 1120
1030 void WebIntentPickerViews::OnInlineDisposition( 1121 void WebIntentPickerViews::OnInlineDisposition(
1031 const string16&, const GURL& url) { 1122 const string16&, const GURL& url) {
1032 if (!webview_) 1123 if (!webview_)
1033 webview_ = new views::WebView(tab_contents_->profile()); 1124 webview_ = new views::WebView(tab_contents_->profile());
1034 1125
1035 inline_web_contents_.reset(WebContents::Create( 1126 inline_web_contents_.reset(WebContents::Create(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 contents_->Layout(); 1167 contents_->Layout();
1077 delegate_->OnExtensionInstallRequested(UTF16ToUTF8(extension_id)); 1168 delegate_->OnExtensionInstallRequested(UTF16ToUTF8(extension_id));
1078 } 1169 }
1079 1170
1080 void WebIntentPickerViews::OnExtensionLinkClicked( 1171 void WebIntentPickerViews::OnExtensionLinkClicked(
1081 const string16& extension_id) { 1172 const string16& extension_id) {
1082 delegate_->OnExtensionLinkClicked(UTF16ToUTF8(extension_id)); 1173 delegate_->OnExtensionLinkClicked(UTF16ToUTF8(extension_id));
1083 } 1174 }
1084 1175
1085 void WebIntentPickerViews::InitContents() { 1176 void WebIntentPickerViews::InitContents() {
1177 DCHECK(!contents_);
1178 contents_ = new views::View();
1179
1180 if (model_ && model_->IsWaitingForSuggestions()) {
1181 contents_->RemoveAllChildViews(true);
1182 contents_->SetLayoutManager(new views::FillLayout());
1183 waiting_view_ = new WaitingView(this, use_close_button_);
1184 contents_->AddChildView(waiting_view_);
1185 contents_->Layout();
1186 } else {
1187 InitMainContents();
1188 }
1189 }
1190
1191 void WebIntentPickerViews::InitMainContents() {
1192 DCHECK(contents_);
1086 enum { 1193 enum {
1087 kHeaderRowColumnSet, // Column set for header layout. 1194 kHeaderRowColumnSet, // Column set for header layout.
1088 kFullWidthColumnSet, // Column set with a single full-width column. 1195 kFullWidthColumnSet, // Column set with a single full-width column.
1089 kIndentedFullWidthColumnSet, // Single full-width column, indented. 1196 kIndentedFullWidthColumnSet, // Single full-width column, indented.
1090 }; 1197 };
1091 1198
1092 if (contents_) { 1199 contents_->RemoveAllChildViews(true);
1093 // Replace the picker with the inline disposition. 1200 displaying_web_contents_ = false;
1094 contents_->RemoveAllChildViews(true); 1201
1095 displaying_web_contents_ = false;
1096 } else {
1097 contents_ = new views::View();
1098 }
1099 views::GridLayout* grid_layout = new views::GridLayout(contents_); 1202 views::GridLayout* grid_layout = new views::GridLayout(contents_);
1100 contents_->SetLayoutManager(grid_layout); 1203 contents_->SetLayoutManager(grid_layout);
1101 1204
1102 grid_layout->set_minimum_size(gfx::Size(kWindowWidth, 0)); 1205 grid_layout->set_minimum_size(gfx::Size(kWindowWidth, 0));
1103 grid_layout->SetInsets(kContentAreaBorder, kContentAreaBorder, 1206 grid_layout->SetInsets(kContentAreaBorder, kContentAreaBorder,
1104 kContentAreaBorder, kContentAreaBorder); 1207 kContentAreaBorder, kContentAreaBorder);
1105 views::ColumnSet* header_cs = grid_layout->AddColumnSet(kHeaderRowColumnSet); 1208 views::ColumnSet* header_cs = grid_layout->AddColumnSet(kHeaderRowColumnSet);
1106 header_cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0, 1209 header_cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0,
1107 GridLayout::USE_PREF, 0, 0); // Title. 1210 GridLayout::USE_PREF, 0, 0); // Title.
1108 header_cs->AddPaddingColumn(1, views::kUnrelatedControlHorizontalSpacing); 1211 header_cs->AddPaddingColumn(1, views::kUnrelatedControlHorizontalSpacing);
(...skipping 15 matching lines...) Expand all
1124 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 1227 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
1125 1228
1126 // Header row. 1229 // Header row.
1127 grid_layout->StartRow(0, kHeaderRowColumnSet); 1230 grid_layout->StartRow(0, kHeaderRowColumnSet);
1128 action_label_ = new views::Label(); 1231 action_label_ = new views::Label();
1129 action_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 1232 action_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
1130 action_label_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); 1233 action_label_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont));
1131 grid_layout->AddView(action_label_); 1234 grid_layout->AddView(action_label_);
1132 1235
1133 if (use_close_button_) 1236 if (use_close_button_)
1134 grid_layout->AddView(CreateCloseButton()); 1237 grid_layout->AddView(CreateCloseButton(this));
1135 1238
1136 // Padding row. 1239 // Padding row.
1137 grid_layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1240 grid_layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
1138 1241
1139 // Service button row. 1242 // Service button row.
1140 grid_layout->StartRow(0, kFullWidthColumnSet); 1243 grid_layout->StartRow(0, kFullWidthColumnSet);
1141 service_buttons_ = new ServiceButtonsView(model_, this); 1244 service_buttons_ = new ServiceButtonsView(model_, this);
1142 grid_layout->AddView(service_buttons_); 1245 grid_layout->AddView(service_buttons_);
1143 1246
1144 // Row with app suggestions label. 1247 // Row with app suggestions label.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 SizeToContents(); 1290 SizeToContents();
1188 } 1291 }
1189 1292
1190 void WebIntentPickerViews::SizeToContents() { 1293 void WebIntentPickerViews::SizeToContents() {
1191 gfx::Size client_size = contents_->GetPreferredSize(); 1294 gfx::Size client_size = contents_->GetPreferredSize();
1192 gfx::Rect client_bounds(client_size); 1295 gfx::Rect client_bounds(client_size);
1193 gfx::Rect new_window_bounds = window_->non_client_view()->frame_view()-> 1296 gfx::Rect new_window_bounds = window_->non_client_view()->frame_view()->
1194 GetWindowBoundsForClientBounds(client_bounds); 1297 GetWindowBoundsForClientBounds(client_bounds);
1195 window_->CenterWindow(new_window_bounds.size()); 1298 window_->CenterWindow(new_window_bounds.size());
1196 } 1299 }
1197 1300
tfarina 2012/08/29 01:04:01 please, remove these two empty lines.
1198 views::ImageButton* WebIntentPickerViews::CreateCloseButton() { 1301
1199 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
1200 views::ImageButton* close_button = new views::ImageButton(this);
1201 close_button->SetImage(views::CustomButton::BS_NORMAL,
1202 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X));
1203 close_button->SetImage(views::CustomButton::BS_HOT,
1204 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER));
1205 close_button->SetImage(views::CustomButton::BS_PUSHED,
1206 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER));
1207 return close_button;
1208 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698