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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 #include "extensions/browser/extension_registry.h" | 67 #include "extensions/browser/extension_registry.h" |
68 #include "extensions/common/extension.h" | 68 #include "extensions/common/extension.h" |
69 #include "extensions/common/extension_set.h" | 69 #include "extensions/common/extension_set.h" |
70 #include "ui/accessibility/ax_node_data.h" | 70 #include "ui/accessibility/ax_node_data.h" |
71 #include "ui/base/dragdrop/os_exchange_data.h" | 71 #include "ui/base/dragdrop/os_exchange_data.h" |
72 #include "ui/base/l10n/l10n_util.h" | 72 #include "ui/base/l10n/l10n_util.h" |
73 #include "ui/base/page_transition_types.h" | 73 #include "ui/base/page_transition_types.h" |
74 #include "ui/base/resource/resource_bundle.h" | 74 #include "ui/base/resource/resource_bundle.h" |
75 #include "ui/base/theme_provider.h" | 75 #include "ui/base/theme_provider.h" |
76 #include "ui/base/window_open_disposition.h" | 76 #include "ui/base/window_open_disposition.h" |
| 77 #include "ui/compositor/paint_context.h" |
77 #include "ui/compositor/paint_recorder.h" | 78 #include "ui/compositor/paint_recorder.h" |
78 #include "ui/gfx/animation/slide_animation.h" | 79 #include "ui/gfx/animation/slide_animation.h" |
79 #include "ui/gfx/canvas.h" | 80 #include "ui/gfx/canvas.h" |
80 #include "ui/gfx/color_utils.h" | 81 #include "ui/gfx/color_utils.h" |
81 #include "ui/gfx/favicon_size.h" | 82 #include "ui/gfx/favicon_size.h" |
82 #include "ui/gfx/geometry/insets.h" | 83 #include "ui/gfx/geometry/insets.h" |
83 #include "ui/gfx/geometry/rect.h" | 84 #include "ui/gfx/geometry/rect.h" |
84 #include "ui/gfx/image/image_skia_operations.h" | 85 #include "ui/gfx/image/image_skia_operations.h" |
85 #include "ui/gfx/paint_vector_icon.h" | 86 #include "ui/gfx/paint_vector_icon.h" |
86 #include "ui/gfx/scoped_canvas.h" | 87 #include "ui/gfx/scoped_canvas.h" |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 } | 1079 } |
1079 | 1080 |
1080 // Since the drop indicator is painted directly onto the canvas, we must | 1081 // 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. | 1082 // make sure it is painted in the right location if the locale is RTL. |
1082 gfx::Rect indicator_bounds(x - kDropIndicatorWidth / 2, | 1083 gfx::Rect indicator_bounds(x - kDropIndicatorWidth / 2, |
1083 y, | 1084 y, |
1084 kDropIndicatorWidth, | 1085 kDropIndicatorWidth, |
1085 h); | 1086 h); |
1086 indicator_bounds.set_x(GetMirroredXForRect(indicator_bounds)); | 1087 indicator_bounds.set_x(GetMirroredXForRect(indicator_bounds)); |
1087 | 1088 |
1088 ui::PaintRecorder recorder(context, size()); | 1089 ui::PaintRecorder recorder(context, context.pixel_size(), nullptr, true); |
1089 // TODO(sky/glen): make me pretty! | 1090 // TODO(sky/glen): make me pretty! |
1090 recorder.canvas()->FillRect( | 1091 recorder.canvas()->FillRect( |
1091 indicator_bounds, | 1092 indicator_bounds, |
1092 GetThemeProvider()->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT)); | 1093 GetThemeProvider()->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT)); |
1093 } | 1094 } |
1094 } | 1095 } |
1095 | 1096 |
1096 bool BookmarkBarView::GetDropFormats( | 1097 bool BookmarkBarView::GetDropFormats( |
1097 int* formats, | 1098 int* formats, |
1098 std::set<ui::Clipboard::FormatType>* format_types) { | 1099 std::set<ui::Clipboard::FormatType>* format_types) { |
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2165 return; | 2166 return; |
2166 apps_page_shortcut_->SetVisible(visible); | 2167 apps_page_shortcut_->SetVisible(visible); |
2167 UpdateBookmarksSeparatorVisibility(); | 2168 UpdateBookmarksSeparatorVisibility(); |
2168 LayoutAndPaint(); | 2169 LayoutAndPaint(); |
2169 } | 2170 } |
2170 | 2171 |
2171 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2172 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
2172 if (UpdateOtherAndManagedButtonsVisibility()) | 2173 if (UpdateOtherAndManagedButtonsVisibility()) |
2173 LayoutAndPaint(); | 2174 LayoutAndPaint(); |
2174 } | 2175 } |
OLD | NEW |