| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/location_bar/keyword_hint_view.h" | 5 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 keyword_hint.substr(0, content_param_offsets.front())); | 73 keyword_hint.substr(0, content_param_offsets.front())); |
| 74 trailing_label_->SetText( | 74 trailing_label_->SetText( |
| 75 keyword_hint.substr(content_param_offsets.front())); | 75 keyword_hint.substr(content_param_offsets.front())); |
| 76 } else { | 76 } else { |
| 77 // See comments on an identical NOTREACHED() in search_provider.cc. | 77 // See comments on an identical NOTREACHED() in search_provider.cc. |
| 78 NOTREACHED(); | 78 NOTREACHED(); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 void KeywordHintView::OnPaint(gfx::Canvas* canvas) { | 82 void KeywordHintView::OnPaint(gfx::Canvas* canvas) { |
| 83 int image_x = leading_label_->IsVisible() ? leading_label_->width() : 0; | 83 int image_x = leading_label_->visible() ? leading_label_->width() : 0; |
| 84 | 84 |
| 85 // Since we paint the button image directly on the canvas (instead of using a | 85 // Since we paint the button image directly on the canvas (instead of using a |
| 86 // child view), we must mirror the button's position manually if the locale | 86 // child view), we must mirror the button's position manually if the locale |
| 87 // is right-to-left. | 87 // is right-to-left. |
| 88 gfx::Rect tab_button_bounds(image_x, | 88 gfx::Rect tab_button_bounds(image_x, |
| 89 kTabImageYOffset, | 89 kTabImageYOffset, |
| 90 kTabButtonBitmap->width(), | 90 kTabButtonBitmap->width(), |
| 91 kTabButtonBitmap->height()); | 91 kTabButtonBitmap->height()); |
| 92 tab_button_bounds.set_x(GetMirroredXForRect(tab_button_bounds)); | 92 tab_button_bounds.set_x(GetMirroredXForRect(tab_button_bounds)); |
| 93 canvas->DrawBitmapInt(*kTabButtonBitmap, | 93 canvas->DrawBitmapInt(*kTabButtonBitmap, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 123 | 123 |
| 124 if (show_labels) { | 124 if (show_labels) { |
| 125 pref = leading_label_->GetPreferredSize(); | 125 pref = leading_label_->GetPreferredSize(); |
| 126 leading_label_->SetBounds(x, 0, pref.width(), height()); | 126 leading_label_->SetBounds(x, 0, pref.width(), height()); |
| 127 | 127 |
| 128 x += pref.width() + kTabButtonBitmap->width(); | 128 x += pref.width() + kTabButtonBitmap->width(); |
| 129 pref = trailing_label_->GetPreferredSize(); | 129 pref = trailing_label_->GetPreferredSize(); |
| 130 trailing_label_->SetBounds(x, 0, pref.width(), height()); | 130 trailing_label_->SetBounds(x, 0, pref.width(), height()); |
| 131 } | 131 } |
| 132 } | 132 } |
| OLD | NEW |