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

Unified Diff: chrome/browser/ui/views/find_bar_view.cc

Issue 6913026: Compact Navigation prototype (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Clang build fix. After commit/revert. Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/find_bar_host.cc ('k') | chrome/browser/ui/views/frame/browser_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/find_bar_view.cc
===================================================================
--- chrome/browser/ui/views/find_bar_view.cc (revision 84869)
+++ chrome/browser/ui/views/find_bar_view.cc (working copy)
@@ -67,11 +67,6 @@
static const SkBitmap* kDialog_middle = NULL;
static const SkBitmap* kDialog_right = NULL;
-// When we are animating, we draw only the top part of the left and right
-// edges to give the illusion that the find dialog is attached to the
-// window during this animation; this is the height of the items we draw.
-static const int kAnimatingEdgeHeight = 5;
-
// The background image for the Find text box, which we draw behind the Find box
// to provide the Chrome look to the edge of the text box.
static const SkBitmap* kBackground = NULL;
@@ -170,6 +165,7 @@
kBackground = rb.GetBitmapNamed(IDR_FIND_BOX_BACKGROUND);
kBackground_left = rb.GetBitmapNamed(IDR_FIND_BOX_BACKGROUND_LEFT);
}
+ SetDialogBorderBitmaps(kDialog_left, kDialog_middle, kDialog_right);
}
FindBarView::~FindBarView() {
@@ -246,26 +242,8 @@
void FindBarView::OnPaint(gfx::Canvas* canvas) {
SkPaint paint;
- // Determine the find bar size as well as the offset from which to tile the
- // toolbar background image. First, get the widget bounds.
- gfx::Rect bounds = GetWidget()->GetWindowScreenBounds();
- // Now convert from screen to parent coordinates.
- gfx::Point origin(bounds.origin());
- BrowserView* browser_view = host()->browser_view();
- ConvertPointToView(NULL, browser_view, &origin);
- bounds.set_origin(origin);
- // Finally, calculate the background image tiling offset.
- origin = browser_view->OffsetPointForToolbarBackgroundImage(origin);
+ gfx::Rect bounds = PaintOffsetToolbarBackground(canvas);
- // First, we draw the background image for the whole dialog (3 images: left,
- // middle and right). Note, that the window region has been set by the
- // controller, so the whitespace in the left and right background images is
- // actually outside the window region and is therefore not drawn. See
- // FindInPageWidgetWin::CreateRoundedWindowEdges() for details.
- ui::ThemeProvider* tp = GetThemeProvider();
- canvas->TileImageInt(*tp->GetBitmapNamed(IDR_THEME_TOOLBAR), origin.x(),
- origin.y(), 0, 0, bounds.width(), bounds.height());
-
// Now flip the canvas for the rest of the graphics if in RTL mode.
canvas->Save();
if (base::i18n::IsRTL()) {
@@ -273,17 +251,8 @@
canvas->ScaleInt(-1, 1);
}
- canvas->DrawBitmapInt(*kDialog_left, 0, 0);
+ PaintDialogBorder(canvas, bounds);
- // Stretch the middle background to cover all of the area between the two
- // other images.
- canvas->TileImageInt(*kDialog_middle, kDialog_left->width(), 0,
- bounds.width() - kDialog_left->width() - kDialog_right->width(),
- kDialog_middle->height());
-
- canvas->DrawBitmapInt(*kDialog_right, bounds.width() - kDialog_right->width(),
- 0);
-
// Then we draw the background image for the Find Textfield. We start by
// calculating the position of background images for the Find text box.
int find_text_x = find_text_->x();
@@ -300,15 +269,7 @@
back_button_origin.x() - find_text_x,
kBackground->height());
- if (animation_offset() > 0) {
- // While animating we draw the curved edges at the point where the
- // controller told us the top of the window is: |animation_offset()|.
- canvas->TileImageInt(*kDialog_left, bounds.x(), animation_offset(),
- kDialog_left->width(), kAnimatingEdgeHeight);
- canvas->TileImageInt(*kDialog_right,
- bounds.width() - kDialog_right->width(), animation_offset(),
- kDialog_right->width(), kAnimatingEdgeHeight);
- }
+ PaintAnimatingEdges(canvas, bounds);
canvas->Restore();
}
« no previous file with comments | « chrome/browser/ui/views/find_bar_host.cc ('k') | chrome/browser/ui/views/frame/browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698