OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/native_ui_contents.h" | 5 #include "chrome/browser/native_ui_contents.h" |
6 | 6 |
7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
8 #include "chrome/browser/history_tab_ui.h" | 8 #include "chrome/browser/history_tab_ui.h" |
9 #include "chrome/browser/navigation_entry.h" | 9 #include "chrome/browser/navigation_entry.h" |
10 #include "chrome/browser/views/download_tab_view.h" | 10 #include "chrome/browser/views/download_tab_view.h" |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 scroll_view_->SetContents(contents); | 586 scroll_view_->SetContents(contents); |
587 } | 587 } |
588 | 588 |
589 ChromeViews::View* SearchableUIContainer::GetContents() { | 589 ChromeViews::View* SearchableUIContainer::GetContents() { |
590 return scroll_view_->GetContents(); | 590 return scroll_view_->GetContents(); |
591 } | 591 } |
592 | 592 |
593 void SearchableUIContainer::Layout() { | 593 void SearchableUIContainer::Layout() { |
594 View::Layout(); | 594 View::Layout(); |
595 | 595 |
596 CSize search_button_size; | 596 gfx::Size search_button_size = search_button_->GetPreferredSize(); |
597 search_button_->GetPreferredSize(&search_button_size); | 597 gfx::Size product_logo_size = product_logo_->GetPreferredSize(); |
598 | |
599 CSize product_logo_size; | |
600 product_logo_->GetPreferredSize(&product_logo_size); | |
601 | 598 |
602 int field_width = kDestinationSearchOffset + | 599 int field_width = kDestinationSearchOffset + |
603 kDestinationSearchWidth + | 600 kDestinationSearchWidth + |
604 kDestinationSmallerMargin + | 601 kDestinationSmallerMargin + |
605 static_cast<int>(search_button_size.cx) + | 602 static_cast<int>(search_button_size.width()) + |
606 kDestinationSmallerMargin; | 603 kDestinationSmallerMargin; |
607 | 604 |
608 product_logo_->SetBounds(std::max(width() - kProductLogo->width() - | 605 product_logo_->SetBounds(std::max(width() - kProductLogo->width() - |
609 kProductLogoPadding, | 606 kProductLogoPadding, |
610 field_width), | 607 field_width), |
611 kProductLogoPadding, | 608 kProductLogoPadding, |
612 product_logo_size.cx, product_logo_size.cy); | 609 product_logo_size.width(), |
| 610 product_logo_size.height()); |
613 } | 611 } |
614 | 612 |
615 void SearchableUIContainer::Paint(ChromeCanvas* canvas) { | 613 void SearchableUIContainer::Paint(ChromeCanvas* canvas) { |
616 SkColor top_color(kBackground); | 614 SkColor top_color(kBackground); |
617 canvas->FillRectInt(top_color, 0, 0, | 615 canvas->FillRectInt(top_color, 0, 0, |
618 width(), scroll_view_->y()); | 616 width(), scroll_view_->y()); |
619 | 617 |
620 canvas->FillRectInt(kBottomMarginColor, 0, scroll_view_->y() - | 618 canvas->FillRectInt(kBottomMarginColor, 0, scroll_view_->y() - |
621 kBottomMargin, width(), kBottomMargin); | 619 kBottomMargin, width(), kBottomMargin); |
622 | 620 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 DoSearch(); | 664 DoSearch(); |
667 } | 665 } |
668 | 666 |
669 void SearchableUIContainer::DoSearch() { | 667 void SearchableUIContainer::DoSearch() { |
670 if (delegate_) | 668 if (delegate_) |
671 delegate_->DoSearch(search_field_->GetText()); | 669 delegate_->DoSearch(search_field_->GetText()); |
672 | 670 |
673 scroll_view_->ScrollToPosition(scroll_view_->vertical_scroll_bar(), 0); | 671 scroll_view_->ScrollToPosition(scroll_view_->vertical_scroll_bar(), 0); |
674 } | 672 } |
675 | 673 |
OLD | NEW |