| OLD | NEW |
| 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/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 void FindBarView::OnPaint(gfx::Canvas* canvas) { | 227 void FindBarView::OnPaint(gfx::Canvas* canvas) { |
| 228 // Paint drop down bar border and background. | 228 // Paint drop down bar border and background. |
| 229 DropdownBarView::OnPaint(canvas); | 229 DropdownBarView::OnPaint(canvas); |
| 230 | 230 |
| 231 // Then we draw the background image for the Find Textfield. We start by | 231 // Then we draw the background image for the Find Textfield. We start by |
| 232 // calculating the position of background images for the Find text box. | 232 // calculating the position of background images for the Find text box. |
| 233 int find_text_x = find_text_->x(); | 233 int find_text_x = find_text_->x(); |
| 234 gfx::Point back_button_origin = find_previous_button_->bounds().origin(); | 234 gfx::Point back_button_origin = find_previous_button_->bounds().origin(); |
| 235 | 235 |
| 236 // Draw the image to the left that creates a curved left edge for the box. | 236 // Draw the image to the left that creates a curved left edge for the box. |
| 237 canvas->TileImageInt(*text_box_background_left_, | 237 canvas->TileImage(*text_box_background_left_, |
| 238 find_text_x - text_box_background_left_->width(), | 238 gfx::Rect(find_text_x - text_box_background_left_->width(), |
| 239 back_button_origin.y(), text_box_background_left_->width(), | 239 back_button_origin.y(), text_box_background_left_->width(), |
| 240 text_box_background_left_->height()); | 240 text_box_background_left_->height())); |
| 241 | 241 |
| 242 // Draw the top and bottom border for whole text box (encompasses both the | 242 // Draw the top and bottom border for whole text box (encompasses both the |
| 243 // find_text_ edit box and the match_count_text_ label). | 243 // find_text_ edit box and the match_count_text_ label). |
| 244 canvas->TileImageInt(*text_box_background_, find_text_x, | 244 canvas->TileImage(*text_box_background_, gfx::Rect(find_text_x, |
| 245 back_button_origin.y(), | 245 back_button_origin.y(), back_button_origin.x() - find_text_x, |
| 246 back_button_origin.x() - find_text_x, | 246 text_box_background_->height())); |
| 247 text_box_background_->height()); | |
| 248 } | 247 } |
| 249 | 248 |
| 250 void FindBarView::Layout() { | 249 void FindBarView::Layout() { |
| 251 int panel_width = GetPreferredSize().width(); | 250 int panel_width = GetPreferredSize().width(); |
| 252 | 251 |
| 253 // Stay within view bounds. | 252 // Stay within view bounds. |
| 254 int view_width = width(); | 253 int view_width = width(); |
| 255 if (view_width && view_width < panel_width) | 254 if (view_width && view_width < panel_width) |
| 256 panel_width = view_width; | 255 panel_width = view_width; |
| 257 | 256 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 | 482 |
| 484 void FindBarView::OnThemeChanged() { | 483 void FindBarView::OnThemeChanged() { |
| 485 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 484 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 486 if (GetThemeProvider()) { | 485 if (GetThemeProvider()) { |
| 487 close_button_->SetBackground( | 486 close_button_->SetBackground( |
| 488 GetThemeProvider()->GetColor(ThemeService::COLOR_TAB_TEXT), | 487 GetThemeProvider()->GetColor(ThemeService::COLOR_TAB_TEXT), |
| 489 rb.GetBitmapNamed(IDR_CLOSE_BAR), | 488 rb.GetBitmapNamed(IDR_CLOSE_BAR), |
| 490 rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); | 489 rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); |
| 491 } | 490 } |
| 492 } | 491 } |
| OLD | NEW |