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

Side by Side Diff: ui/app_list/views/search_result_view.cc

Issue 13926010: ui/app_list: Remove unnecessary scoped_ptr ".get()" calls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
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 "ui/app_list/views/search_result_view.h" 5 #include "ui/app_list/views/search_result_view.h"
6 6
7 #include "ui/app_list/app_list_constants.h" 7 #include "ui/app_list/app_list_constants.h"
8 #include "ui/app_list/search_result.h" 8 #include "ui/app_list/search_result.h"
9 #include "ui/app_list/views/search_result_list_view.h" 9 #include "ui/app_list/views/search_result_list_view.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 gfx::Rect text_bounds(rect); 197 gfx::Rect text_bounds(rect);
198 text_bounds.set_x(kIconViewWidth); 198 text_bounds.set_x(kIconViewWidth);
199 text_bounds.set_width( 199 text_bounds.set_width(
200 rect.width() - kIconViewWidth - kTextTrailPadding - 200 rect.width() - kIconViewWidth - kTextTrailPadding -
201 action_buttons_.size() * kActionButtonWidth - 201 action_buttons_.size() * kActionButtonWidth -
202 (!action_buttons_.empty() ? kActionButtonRightMargin : 0)); 202 (!action_buttons_.empty() ? kActionButtonRightMargin : 0));
203 text_bounds.set_x(GetMirroredXWithWidthInView(text_bounds.x(), 203 text_bounds.set_x(GetMirroredXWithWidthInView(text_bounds.x(),
204 text_bounds.width())); 204 text_bounds.width()));
205 205
206 if (title_text_.get() && details_text_.get()) { 206 if (title_text_.get() && details_text_) {
xiyuan 2013/04/16 22:37:20 title_text_.get() could be changed too.
tfarina 2013/04/16 23:15:48 Done.
207 gfx::Size title_size(text_bounds.width(), 207 gfx::Size title_size(text_bounds.width(),
208 title_text_->GetStringSize().height()); 208 title_text_->GetStringSize().height());
209 gfx::Size details_size(text_bounds.width(), 209 gfx::Size details_size(text_bounds.width(),
210 details_text_->GetStringSize().height()); 210 details_text_->GetStringSize().height());
211 int total_height = title_size.height() + + details_size.height(); 211 int total_height = title_size.height() + + details_size.height();
212 int y = text_bounds.y() + (text_bounds.height() - total_height) / 2; 212 int y = text_bounds.y() + (text_bounds.height() - total_height) / 2;
213 213
214 title_text_->SetDisplayRect(gfx::Rect(gfx::Point(text_bounds.x(), y), 214 title_text_->SetDisplayRect(gfx::Rect(gfx::Point(text_bounds.x(), y),
215 title_size)); 215 title_size));
216 title_text_->Draw(canvas); 216 title_text_->Draw(canvas);
217 217
218 y += title_size.height(); 218 y += title_size.height();
219 details_text_->SetDisplayRect(gfx::Rect(gfx::Point(text_bounds.x(), y), 219 details_text_->SetDisplayRect(gfx::Rect(gfx::Point(text_bounds.x(), y),
220 details_size)); 220 details_size));
221 details_text_->Draw(canvas); 221 details_text_->Draw(canvas);
222 } else if (title_text_.get()) { 222 } else if (title_text_) {
223 gfx::Size title_size(text_bounds.width(), 223 gfx::Size title_size(text_bounds.width(),
224 title_text_->GetStringSize().height()); 224 title_text_->GetStringSize().height());
225 gfx::Rect centered_title_rect(text_bounds); 225 gfx::Rect centered_title_rect(text_bounds);
226 centered_title_rect.ClampToCenteredSize(title_size); 226 centered_title_rect.ClampToCenteredSize(title_size);
227 title_text_->SetDisplayRect(centered_title_rect); 227 title_text_->SetDisplayRect(centered_title_rect);
228 title_text_->Draw(canvas); 228 title_text_->Draw(canvas);
229 } 229 }
230 } 230 }
231 231
232 void SearchResultView::ButtonPressed(views::Button* sender, 232 void SearchResultView::ButtonPressed(views::Button* sender,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 views::ImageButton* button = action_buttons_[i]; 290 views::ImageButton* button = action_buttons_[i];
291 button->SetImage(views::CustomButton::STATE_NORMAL, &icon.base_image); 291 button->SetImage(views::CustomButton::STATE_NORMAL, &icon.base_image);
292 button->SetImage(views::CustomButton::STATE_HOVERED, &icon.hover_image); 292 button->SetImage(views::CustomButton::STATE_HOVERED, &icon.hover_image);
293 button->SetImage(views::CustomButton::STATE_PRESSED, &icon.pressed_image); 293 button->SetImage(views::CustomButton::STATE_PRESSED, &icon.pressed_image);
294 button->SetTooltipText(icon.tooltip_text); 294 button->SetTooltipText(icon.tooltip_text);
295 } 295 }
296 } 296 }
297 } 297 }
298 298
299 } // namespace app_list 299 } // namespace app_list
OLDNEW
« ui/app_list/cocoa/apps_grid_view_item.mm ('K') | « ui/app_list/views/app_list_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698