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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 #include "grit/theme_resources.h" | 66 #include "grit/theme_resources.h" |
67 #include "ui/accessibility/ax_view_state.h" | 67 #include "ui/accessibility/ax_view_state.h" |
68 #include "ui/base/dragdrop/drag_utils.h" | 68 #include "ui/base/dragdrop/drag_utils.h" |
69 #include "ui/base/dragdrop/os_exchange_data.h" | 69 #include "ui/base/dragdrop/os_exchange_data.h" |
70 #include "ui/base/l10n/l10n_util.h" | 70 #include "ui/base/l10n/l10n_util.h" |
71 #include "ui/base/page_transition_types.h" | 71 #include "ui/base/page_transition_types.h" |
72 #include "ui/base/resource/resource_bundle.h" | 72 #include "ui/base/resource/resource_bundle.h" |
73 #include "ui/base/theme_provider.h" | 73 #include "ui/base/theme_provider.h" |
74 #include "ui/base/window_open_disposition.h" | 74 #include "ui/base/window_open_disposition.h" |
75 #include "ui/compositor/paint_context.h" | 75 #include "ui/compositor/paint_context.h" |
| 76 #include "ui/compositor/paint_recorder.h" |
76 #include "ui/gfx/animation/slide_animation.h" | 77 #include "ui/gfx/animation/slide_animation.h" |
77 #include "ui/gfx/canvas.h" | 78 #include "ui/gfx/canvas.h" |
78 #include "ui/gfx/text_constants.h" | 79 #include "ui/gfx/text_constants.h" |
79 #include "ui/gfx/text_elider.h" | 80 #include "ui/gfx/text_elider.h" |
80 #include "ui/resources/grit/ui_resources.h" | 81 #include "ui/resources/grit/ui_resources.h" |
81 #include "ui/views/button_drag_utils.h" | 82 #include "ui/views/button_drag_utils.h" |
82 #include "ui/views/controls/button/label_button.h" | 83 #include "ui/views/controls/button/label_button.h" |
83 #include "ui/views/controls/button/label_button_border.h" | 84 #include "ui/views/controls/button/label_button_border.h" |
84 #include "ui/views/controls/button/menu_button.h" | 85 #include "ui/views/controls/button/menu_button.h" |
85 #include "ui/views/controls/label.h" | 86 #include "ui/views/controls/label.h" |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 } | 1005 } |
1005 | 1006 |
1006 // Since the drop indicator is painted directly onto the canvas, we must | 1007 // Since the drop indicator is painted directly onto the canvas, we must |
1007 // make sure it is painted in the right location if the locale is RTL. | 1008 // make sure it is painted in the right location if the locale is RTL. |
1008 gfx::Rect indicator_bounds(x - kDropIndicatorWidth / 2, | 1009 gfx::Rect indicator_bounds(x - kDropIndicatorWidth / 2, |
1009 y, | 1010 y, |
1010 kDropIndicatorWidth, | 1011 kDropIndicatorWidth, |
1011 h); | 1012 h); |
1012 indicator_bounds.set_x(GetMirroredXForRect(indicator_bounds)); | 1013 indicator_bounds.set_x(GetMirroredXForRect(indicator_bounds)); |
1013 | 1014 |
1014 gfx::Canvas* canvas = context.canvas(); | 1015 ui::PaintRecorder recorder(context); |
1015 // TODO(sky/glen): make me pretty! | 1016 // TODO(sky/glen): make me pretty! |
1016 canvas->FillRect(indicator_bounds, kDropIndicatorColor); | 1017 recorder.canvas()->FillRect(indicator_bounds, kDropIndicatorColor); |
1017 } | 1018 } |
1018 } | 1019 } |
1019 | 1020 |
1020 bool BookmarkBarView::GetDropFormats( | 1021 bool BookmarkBarView::GetDropFormats( |
1021 int* formats, | 1022 int* formats, |
1022 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) { | 1023 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) { |
1023 if (!model_ || !model_->loaded()) | 1024 if (!model_ || !model_->loaded()) |
1024 return false; | 1025 return false; |
1025 *formats = ui::OSExchangeData::URL; | 1026 *formats = ui::OSExchangeData::URL; |
1026 custom_formats->insert(BookmarkNodeData::GetBookmarkCustomFormat()); | 1027 custom_formats->insert(BookmarkNodeData::GetBookmarkCustomFormat()); |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2072 return; | 2073 return; |
2073 apps_page_shortcut_->SetVisible(visible); | 2074 apps_page_shortcut_->SetVisible(visible); |
2074 UpdateBookmarksSeparatorVisibility(); | 2075 UpdateBookmarksSeparatorVisibility(); |
2075 LayoutAndPaint(); | 2076 LayoutAndPaint(); |
2076 } | 2077 } |
2077 | 2078 |
2078 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2079 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
2079 if (UpdateOtherAndManagedButtonsVisibility()) | 2080 if (UpdateOtherAndManagedButtonsVisibility()) |
2080 LayoutAndPaint(); | 2081 LayoutAndPaint(); |
2081 } | 2082 } |
OLD | NEW |