| 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/bookmarks/bookmark_bar_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 // you go further down. | 502 // you go further down. |
| 503 void PaintVerticalDivider(gfx::Canvas* canvas, | 503 void PaintVerticalDivider(gfx::Canvas* canvas, |
| 504 int x, | 504 int x, |
| 505 int height, | 505 int height, |
| 506 int vertical_padding, | 506 int vertical_padding, |
| 507 SkColor top_color, | 507 SkColor top_color, |
| 508 SkColor middle_color, | 508 SkColor middle_color, |
| 509 SkColor bottom_color) { | 509 SkColor bottom_color) { |
| 510 // Draw the upper half of the divider. | 510 // Draw the upper half of the divider. |
| 511 SkPaint paint; | 511 SkPaint paint; |
| 512 skia::RefPtr<SkShader> shader = gfx::CreateGradientShader( | 512 paint.setShader(gfx::CreateGradientShader( |
| 513 vertical_padding + 1, height / 2, top_color, middle_color); | 513 vertical_padding + 1, height / 2, top_color, middle_color)); |
| 514 paint.setShader(shader.get()); | |
| 515 SkRect rc = { SkIntToScalar(x), | 514 SkRect rc = { SkIntToScalar(x), |
| 516 SkIntToScalar(vertical_padding + 1), | 515 SkIntToScalar(vertical_padding + 1), |
| 517 SkIntToScalar(x + 1), | 516 SkIntToScalar(x + 1), |
| 518 SkIntToScalar(height / 2) }; | 517 SkIntToScalar(height / 2) }; |
| 519 canvas->sk_canvas()->drawRect(rc, paint); | 518 canvas->sk_canvas()->drawRect(rc, paint); |
| 520 | 519 |
| 521 // Draw the lower half of the divider. | 520 // Draw the lower half of the divider. |
| 522 SkPaint paint_down; | 521 SkPaint paint_down; |
| 523 shader = gfx::CreateGradientShader( | 522 paint_down.setShader(gfx::CreateGradientShader( |
| 524 height / 2, height - vertical_padding, middle_color, bottom_color); | 523 height / 2, height - vertical_padding, middle_color, bottom_color)); |
| 525 paint_down.setShader(shader.get()); | |
| 526 SkRect rc_down = { SkIntToScalar(x), | 524 SkRect rc_down = { SkIntToScalar(x), |
| 527 SkIntToScalar(height / 2), | 525 SkIntToScalar(height / 2), |
| 528 SkIntToScalar(x + 1), | 526 SkIntToScalar(x + 1), |
| 529 SkIntToScalar(height - vertical_padding) }; | 527 SkIntToScalar(height - vertical_padding) }; |
| 530 canvas->sk_canvas()->drawRect(rc_down, paint_down); | 528 canvas->sk_canvas()->drawRect(rc_down, paint_down); |
| 531 } | 529 } |
| 532 | 530 |
| 533 class BookmarkBarView::ButtonSeparatorView : public views::View { | 531 class BookmarkBarView::ButtonSeparatorView : public views::View { |
| 534 public: | 532 public: |
| 535 ButtonSeparatorView() {} | 533 ButtonSeparatorView() {} |
| (...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2152 return; | 2150 return; |
| 2153 apps_page_shortcut_->SetVisible(visible); | 2151 apps_page_shortcut_->SetVisible(visible); |
| 2154 UpdateBookmarksSeparatorVisibility(); | 2152 UpdateBookmarksSeparatorVisibility(); |
| 2155 LayoutAndPaint(); | 2153 LayoutAndPaint(); |
| 2156 } | 2154 } |
| 2157 | 2155 |
| 2158 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2156 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
| 2159 if (UpdateOtherAndManagedButtonsVisibility()) | 2157 if (UpdateOtherAndManagedButtonsVisibility()) |
| 2160 LayoutAndPaint(); | 2158 LayoutAndPaint(); |
| 2161 } | 2159 } |
| OLD | NEW |