| 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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 | 1043 |
| 1044 if (height() > 0) { | 1044 if (height() > 0) { |
| 1045 // We only layout while parented. When we become parented, if our bounds | 1045 // We only layout while parented. When we become parented, if our bounds |
| 1046 // haven't changed, OnBoundsChanged() won't get invoked and we won't | 1046 // haven't changed, OnBoundsChanged() won't get invoked and we won't |
| 1047 // layout. Therefore we always force a layout when added. | 1047 // layout. Therefore we always force a layout when added. |
| 1048 Layout(); | 1048 Layout(); |
| 1049 } | 1049 } |
| 1050 } | 1050 } |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 void BookmarkBarView::PaintChildren(const ui::PaintContext& context) { | 1053 void BookmarkBarView::PaintChildren(const views::PaintInfo& paint_info) { |
| 1054 View::PaintChildren(context); | 1054 View::PaintChildren(paint_info); |
| 1055 | 1055 |
| 1056 if (drop_info_.get() && drop_info_->valid && | 1056 if (drop_info_.get() && drop_info_->valid && |
| 1057 drop_info_->location.operation != 0 && drop_info_->location.index != -1 && | 1057 drop_info_->location.operation != 0 && drop_info_->location.index != -1 && |
| 1058 drop_info_->location.button_type != DROP_OVERFLOW && | 1058 drop_info_->location.button_type != DROP_OVERFLOW && |
| 1059 !drop_info_->location.on) { | 1059 !drop_info_->location.on) { |
| 1060 int index = drop_info_->location.index; | 1060 int index = drop_info_->location.index; |
| 1061 DCHECK(index <= GetBookmarkButtonCount()); | 1061 DCHECK(index <= GetBookmarkButtonCount()); |
| 1062 int x = 0; | 1062 int x = 0; |
| 1063 int y = 0; | 1063 int y = 0; |
| 1064 int h = height(); | 1064 int h = height(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1075 if (GetBookmarkButtonCount() > 0 && GetBookmarkButton(0)->visible()) { | 1075 if (GetBookmarkButtonCount() > 0 && GetBookmarkButton(0)->visible()) { |
| 1076 y = GetBookmarkButton(0)->y(); | 1076 y = GetBookmarkButton(0)->y(); |
| 1077 h = GetBookmarkButton(0)->height(); | 1077 h = GetBookmarkButton(0)->height(); |
| 1078 } | 1078 } |
| 1079 | 1079 |
| 1080 // Since the drop indicator is painted directly onto the canvas, we must | 1080 // Since the drop indicator is painted directly onto the canvas, we must |
| 1081 // make sure it is painted in the right location if the locale is RTL. | 1081 // make sure it is painted in the right location if the locale is RTL. |
| 1082 gfx::Rect indicator_bounds = GetMirroredRect( | 1082 gfx::Rect indicator_bounds = GetMirroredRect( |
| 1083 gfx::Rect(x - kDropIndicatorWidth / 2, y, kDropIndicatorWidth, h)); | 1083 gfx::Rect(x - kDropIndicatorWidth / 2, y, kDropIndicatorWidth, h)); |
| 1084 | 1084 |
| 1085 ui::PaintRecorder recorder(context, size()); | 1085 ui::PaintRecorder recorder(paint_info.context(), size()); |
| 1086 // TODO(sky/glen): make me pretty! | 1086 // TODO(sky/glen): make me pretty! |
| 1087 recorder.canvas()->FillRect( | 1087 recorder.canvas()->FillRect( |
| 1088 indicator_bounds, | 1088 indicator_bounds, |
| 1089 GetThemeProvider()->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT)); | 1089 GetThemeProvider()->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT)); |
| 1090 } | 1090 } |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 bool BookmarkBarView::GetDropFormats( | 1093 bool BookmarkBarView::GetDropFormats( |
| 1094 int* formats, | 1094 int* formats, |
| 1095 std::set<ui::Clipboard::FormatType>* format_types) { | 1095 std::set<ui::Clipboard::FormatType>* format_types) { |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2162 return; | 2162 return; |
| 2163 apps_page_shortcut_->SetVisible(visible); | 2163 apps_page_shortcut_->SetVisible(visible); |
| 2164 UpdateBookmarksSeparatorVisibility(); | 2164 UpdateBookmarksSeparatorVisibility(); |
| 2165 LayoutAndPaint(); | 2165 LayoutAndPaint(); |
| 2166 } | 2166 } |
| 2167 | 2167 |
| 2168 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2168 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
| 2169 if (UpdateOtherAndManagedButtonsVisibility()) | 2169 if (UpdateOtherAndManagedButtonsVisibility()) |
| 2170 LayoutAndPaint(); | 2170 LayoutAndPaint(); |
| 2171 } | 2171 } |
| OLD | NEW |