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

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

Issue 11365075: alternate ntp: tweaks and fixes for bookmark bar in ntp (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
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/detachable_toolbar_view.h" 5 #include "chrome/browser/ui/views/detachable_toolbar_view.h"
6 6
7 #include "chrome/browser/themes/theme_service.h" 7 #include "chrome/browser/themes/theme_service.h"
8 #include "grit/theme_resources.h" 8 #include "grit/theme_resources.h"
9 #include "third_party/skia/include/core/SkShader.h" 9 #include "third_party/skia/include/core/SkShader.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 SkDoubleToScalar(vertical_padding - 0.5), 58 SkDoubleToScalar(vertical_padding - 0.5),
59 SkDoubleToScalar(view->width() - horizontal_padding - 0.5), 59 SkDoubleToScalar(view->width() - horizontal_padding - 0.5),
60 SkDoubleToScalar(view->height() - vertical_padding - 0.5)); 60 SkDoubleToScalar(view->height() - vertical_padding - 0.5));
61 61
62 *roundness = static_cast<double>(kNewtabBarRoundness) * animation_state; 62 *roundness = static_cast<double>(kNewtabBarRoundness) * animation_state;
63 } 63 }
64 64
65 // static 65 // static
66 void DetachableToolbarView::PaintHorizontalBorder(gfx::Canvas* canvas, 66 void DetachableToolbarView::PaintHorizontalBorder(gfx::Canvas* canvas,
67 DetachableToolbarView* view) { 67 DetachableToolbarView* view) {
68 PaintHorizontalBorderWithColor(canvas, view,
69 ThemeService::GetDefaultColor(ThemeService::COLOR_TOOLBAR_SEPARATOR));
70 }
71
72 // static
73 void DetachableToolbarView::PaintHorizontalBorderWithColor(
74 gfx::Canvas* canvas,
75 DetachableToolbarView* view,
76 SkColor border_color) {
68 // Border can be at the top or at the bottom of the view depending on whether 77 // Border can be at the top or at the bottom of the view depending on whether
69 // the view (bar/shelf) is attached or detached. 78 // the view (bar/shelf) is attached or detached.
70 int thickness = views::NonClientFrameView::kClientEdgeThickness; 79 int thickness = views::NonClientFrameView::kClientEdgeThickness;
71 int y = view->IsDetached() ? 0 : (view->height() - thickness); 80 int y = view->IsDetached() ? 0 : (view->height() - thickness);
72 canvas->FillRect(gfx::Rect(0, y, view->width(), thickness), 81 canvas->FillRect(gfx::Rect(0, y, view->width(), thickness), border_color);
73 ThemeService::GetDefaultColor(ThemeService::COLOR_TOOLBAR_SEPARATOR));
74 } 82 }
75 83
76 // static 84 // static
77 void DetachableToolbarView::PaintContentAreaBackground( 85 void DetachableToolbarView::PaintContentAreaBackground(
78 gfx::Canvas* canvas, 86 gfx::Canvas* canvas,
79 ui::ThemeProvider* theme_provider, 87 ui::ThemeProvider* theme_provider,
80 const SkRect& rect, 88 const SkRect& rect,
81 double roundness) { 89 double roundness) {
82 SkPaint paint; 90 SkPaint paint;
83 paint.setAntiAlias(true); 91 paint.setAntiAlias(true);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Draw the lower half of the divider. 134 // Draw the lower half of the divider.
127 SkPaint paint_down; 135 SkPaint paint_down;
128 SkSafeUnref(paint_down.setShader(gfx::CreateGradientShader( 136 SkSafeUnref(paint_down.setShader(gfx::CreateGradientShader(
129 height / 2, height - vertical_padding, middle_color, bottom_color))); 137 height / 2, height - vertical_padding, middle_color, bottom_color)));
130 SkRect rc_down = { SkIntToScalar(x), 138 SkRect rc_down = { SkIntToScalar(x),
131 SkIntToScalar(height / 2), 139 SkIntToScalar(height / 2),
132 SkIntToScalar(x + 1), 140 SkIntToScalar(x + 1),
133 SkIntToScalar(height - vertical_padding) }; 141 SkIntToScalar(height - vertical_padding) };
134 canvas->sk_canvas()->drawRect(rc_down, paint_down); 142 canvas->sk_canvas()->drawRect(rc_down, paint_down);
135 } 143 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/detachable_toolbar_view.h ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698