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

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

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/find_bar_view.h ('k') | chrome/browser/ui/views/frame/browser_frame.h » ('j') | 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 "chrome/browser/ui/views/find_bar_view.h" 5 #include "chrome/browser/ui/views/find_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 // The focus forwarder view is a hidden view that should cover the area 330 // The focus forwarder view is a hidden view that should cover the area
331 // between the find text box and the find button so that when the user clicks 331 // between the find text box and the find button so that when the user clicks
332 // in that area we focus on the find text box. 332 // in that area we focus on the find text box.
333 int find_text_edge = find_text_->x() + find_text_->width(); 333 int find_text_edge = find_text_->x() + find_text_->width();
334 focus_forwarder_view_->SetBounds( 334 focus_forwarder_view_->SetBounds(
335 find_text_edge, find_previous_button_->y(), 335 find_text_edge, find_previous_button_->y(),
336 find_previous_button_->x() - find_text_edge, 336 find_previous_button_->x() - find_text_edge,
337 find_previous_button_->height()); 337 find_previous_button_->height());
338 } 338 }
339 339
340 gfx::Size FindBarView::GetPreferredSize() { 340 gfx::Size FindBarView::GetPreferredSize() const {
341 gfx::Size prefsize = find_text_->GetPreferredSize(); 341 gfx::Size prefsize = find_text_->GetPreferredSize();
342 prefsize.set_height(preferred_height_); 342 prefsize.set_height(preferred_height_);
343 343
344 // Add up all the preferred sizes and margins of the rest of the controls. 344 // Add up all the preferred sizes and margins of the rest of the controls.
345 prefsize.Enlarge(kMarginLeftOfCloseButton + kMarginRightOfCloseButton + 345 prefsize.Enlarge(kMarginLeftOfCloseButton + kMarginRightOfCloseButton +
346 kMarginLeftOfFindTextfield, 346 kMarginLeftOfFindTextfield,
347 0); 347 0);
348 prefsize.Enlarge(find_previous_button_->GetPreferredSize().width(), 0); 348 prefsize.Enlarge(find_previous_button_->GetPreferredSize().width(), 0);
349 prefsize.Enlarge(find_next_button_->GetPreferredSize().width(), 0); 349 prefsize.Enlarge(find_next_button_->GetPreferredSize().width(), 0);
350 prefsize.Enlarge(close_button_->GetPreferredSize().width(), 0); 350 prefsize.Enlarge(close_button_->GetPreferredSize().width(), 0);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 489
490 void FindBarView::OnThemeChanged() { 490 void FindBarView::OnThemeChanged() {
491 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 491 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
492 if (GetThemeProvider()) { 492 if (GetThemeProvider()) {
493 close_button_->SetBackground( 493 close_button_->SetBackground(
494 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TAB_TEXT), 494 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TAB_TEXT),
495 rb.GetImageSkiaNamed(IDR_CLOSE_1), 495 rb.GetImageSkiaNamed(IDR_CLOSE_1),
496 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); 496 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK));
497 } 497 }
498 } 498 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/find_bar_view.h ('k') | chrome/browser/ui/views/frame/browser_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698