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 9651024: [Web Intents] Fix crash in views picker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | « 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 "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_navigator.h" 10 #include "chrome/browser/ui/browser_navigator.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 : model_(model), 183 : model_(model),
184 delegate_(delegate) { 184 delegate_(delegate) {
185 Update(); 185 Update();
186 } 186 }
187 187
188 ServiceButtonsView::~ServiceButtonsView() { 188 ServiceButtonsView::~ServiceButtonsView() {
189 } 189 }
190 190
191 void ServiceButtonsView::Update() { 191 void ServiceButtonsView::Update() {
192 RemoveAllChildViews(true); 192 RemoveAllChildViews(true);
193 views::GridLayout* grid_layout = new views::GridLayout(this);
194 SetLayoutManager(grid_layout);
195
193 if (model_->GetInstalledServiceCount() == 0) 196 if (model_->GetInstalledServiceCount() == 0)
194 return; 197 return;
195 198
196 views::GridLayout* grid_layout = new views::GridLayout(this);
197 SetLayoutManager(grid_layout);
198
199 views::ColumnSet* cs = grid_layout->AddColumnSet(0); 199 views::ColumnSet* cs = grid_layout->AddColumnSet(0);
200 cs->AddPaddingColumn(1, 0); 200 cs->AddPaddingColumn(1, 0);
201 cs->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, 0, 201 cs->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, 0,
202 views::GridLayout::USE_PREF, 0, 0); 202 views::GridLayout::USE_PREF, 0, 0);
203 cs->AddPaddingColumn(1, 0); 203 cs->AddPaddingColumn(1, 0);
204 204
205 for (size_t i = 0; i < model_->GetInstalledServiceCount(); ++i) { 205 for (size_t i = 0; i < model_->GetInstalledServiceCount(); ++i) {
206 const WebIntentPickerModel::InstalledService& service = 206 const WebIntentPickerModel::InstalledService& service =
207 model_->GetInstalledServiceAt(i); 207 model_->GetInstalledServiceAt(i);
208 208
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 } 737 }
738 738
739 void WebIntentPickerViews::SizeToContents() { 739 void WebIntentPickerViews::SizeToContents() {
740 gfx::Size client_size = contents_->GetPreferredSize(); 740 gfx::Size client_size = contents_->GetPreferredSize();
741 gfx::Rect client_bounds(client_size); 741 gfx::Rect client_bounds(client_size);
742 gfx::Rect new_window_bounds = window_->non_client_view()->frame_view()-> 742 gfx::Rect new_window_bounds = window_->non_client_view()->frame_view()->
743 GetWindowBoundsForClientBounds(client_bounds); 743 GetWindowBoundsForClientBounds(client_bounds);
744 // TODO(binji): figure out how to get the constrained dialog centered... 744 // TODO(binji): figure out how to get the constrained dialog centered...
745 window_->SetSize(new_window_bounds.size()); 745 window_->SetSize(new_window_bounds.size());
746 } 746 }
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