| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 using views::LabelButtonBorder; | 99 using views::LabelButtonBorder; |
| 100 using views::MenuButton; | 100 using views::MenuButton; |
| 101 using views::View; | 101 using views::View; |
| 102 | 102 |
| 103 // How inset the bookmarks bar is when displayed on the new tab page. | 103 // How inset the bookmarks bar is when displayed on the new tab page. |
| 104 static const int kNewTabHorizontalPadding = 2; | 104 static const int kNewTabHorizontalPadding = 2; |
| 105 | 105 |
| 106 // Maximum size of buttons on the bookmark bar. | 106 // Maximum size of buttons on the bookmark bar. |
| 107 static const int kMaxButtonWidth = 150; | 107 static const int kMaxButtonWidth = 150; |
| 108 | 108 |
| 109 // The color gradient start value close to the edge of the divider. |
| 110 static const SkColor kEdgeDividerColor = SkColorSetRGB(222, 234, 248); |
| 111 |
| 112 // The color gradient value for the middle of the divider. |
| 113 static const SkColor kMiddleDividerColor = SkColorSetRGB(194, 205, 212); |
| 114 |
| 109 // Number of pixels the attached bookmark bar overlaps with the toolbar. | 115 // Number of pixels the attached bookmark bar overlaps with the toolbar. |
| 110 static const int kToolbarAttachedBookmarkBarOverlap = 3; | 116 static const int kToolbarAttachedBookmarkBarOverlap = 3; |
| 111 | 117 |
| 112 // Margins around the content. | 118 // Margins around the content. |
| 113 static const int kDetachedTopMargin = 1; // When attached, we use 0 and let the | 119 static const int kDetachedTopMargin = 1; // When attached, we use 0 and let the |
| 114 // toolbar above serve as the margin. | 120 // toolbar above serve as the margin. |
| 115 static const int kBottomMargin = 2; | 121 static const int kBottomMargin = 2; |
| 116 static const int kLeftMargin = 1; | 122 static const int kLeftMargin = 1; |
| 117 static const int kRightMargin = 1; | 123 static const int kRightMargin = 1; |
| 118 | 124 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 420 |
| 415 // ButtonSeparatorView -------------------------------------------------------- | 421 // ButtonSeparatorView -------------------------------------------------------- |
| 416 | 422 |
| 417 class BookmarkBarView::ButtonSeparatorView : public views::View { | 423 class BookmarkBarView::ButtonSeparatorView : public views::View { |
| 418 public: | 424 public: |
| 419 ButtonSeparatorView() {} | 425 ButtonSeparatorView() {} |
| 420 ~ButtonSeparatorView() override {} | 426 ~ButtonSeparatorView() override {} |
| 421 | 427 |
| 422 void OnPaint(gfx::Canvas* canvas) override { | 428 void OnPaint(gfx::Canvas* canvas) override { |
| 423 DetachableToolbarView::PaintVerticalDivider( | 429 DetachableToolbarView::PaintVerticalDivider( |
| 424 canvas, kSeparatorStartX, height(), 1, | 430 canvas, |
| 425 DetachableToolbarView::kEdgeDividerColor, | 431 kSeparatorStartX, |
| 426 DetachableToolbarView::kMiddleDividerColor, | 432 height(), |
| 433 1, |
| 434 kEdgeDividerColor, |
| 435 kMiddleDividerColor, |
| 427 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TOOLBAR)); | 436 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TOOLBAR)); |
| 428 } | 437 } |
| 429 | 438 |
| 430 gfx::Size GetPreferredSize() const override { | 439 gfx::Size GetPreferredSize() const override { |
| 431 // We get the full height of the bookmark bar, so that the height returned | 440 // We get the full height of the bookmark bar, so that the height returned |
| 432 // here doesn't matter. | 441 // here doesn't matter. |
| 433 return gfx::Size(kSeparatorWidth, 1); | 442 return gfx::Size(kSeparatorWidth, 1); |
| 434 } | 443 } |
| 435 | 444 |
| 436 void GetAccessibleState(ui::AXViewState* state) override { | 445 void GetAccessibleState(ui::AXViewState* state) override { |
| (...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1951 return; | 1960 return; |
| 1952 apps_page_shortcut_->SetVisible(visible); | 1961 apps_page_shortcut_->SetVisible(visible); |
| 1953 UpdateBookmarksSeparatorVisibility(); | 1962 UpdateBookmarksSeparatorVisibility(); |
| 1954 LayoutAndPaint(); | 1963 LayoutAndPaint(); |
| 1955 } | 1964 } |
| 1956 | 1965 |
| 1957 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 1966 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
| 1958 if (UpdateOtherAndManagedButtonsVisibility()) | 1967 if (UpdateOtherAndManagedButtonsVisibility()) |
| 1959 LayoutAndPaint(); | 1968 LayoutAndPaint(); |
| 1960 } | 1969 } |
| OLD | NEW |