Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 1053143002: Make View::Paint use ui::PaintRecorder to access PaintContext's canvas (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: paintrecorder: . Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 #include "content/public/browser/web_contents.h" 67 #include "content/public/browser/web_contents.h"
68 #include "extensions/browser/extension_registry.h" 68 #include "extensions/browser/extension_registry.h"
69 #include "extensions/common/feature_switch.h" 69 #include "extensions/common/feature_switch.h"
70 #include "grit/components_scaled_resources.h" 70 #include "grit/components_scaled_resources.h"
71 #include "grit/theme_resources.h" 71 #include "grit/theme_resources.h"
72 #include "ui/accessibility/ax_view_state.h" 72 #include "ui/accessibility/ax_view_state.h"
73 #include "ui/base/dragdrop/drag_drop_types.h" 73 #include "ui/base/dragdrop/drag_drop_types.h"
74 #include "ui/base/l10n/l10n_util.h" 74 #include "ui/base/l10n/l10n_util.h"
75 #include "ui/base/resource/resource_bundle.h" 75 #include "ui/base/resource/resource_bundle.h"
76 #include "ui/base/theme_provider.h" 76 #include "ui/base/theme_provider.h"
77 #include "ui/compositor/paint_context.h"
77 #include "ui/events/event.h" 78 #include "ui/events/event.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/image/image.h" 82 #include "ui/gfx/image/image.h"
82 #include "ui/gfx/image/image_skia_operations.h" 83 #include "ui/gfx/image/image_skia_operations.h"
83 #include "ui/gfx/scoped_canvas.h" 84 #include "ui/gfx/scoped_canvas.h"
84 #include "ui/gfx/skia_util.h" 85 #include "ui/gfx/skia_util.h"
85 #include "ui/gfx/text_utils.h" 86 #include "ui/gfx/text_utils.h"
86 #include "ui/native_theme/native_theme.h" 87 #include "ui/native_theme/native_theme.h"
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 paint.setStyle(SkPaint::kFill_Style); 1211 paint.setStyle(SkPaint::kFill_Style);
1211 paint.setColor(color); 1212 paint.setColor(color);
1212 const int kBorderCornerRadius = 2; 1213 const int kBorderCornerRadius = 2;
1213 canvas->DrawRoundRect(bounds, kBorderCornerRadius, paint); 1214 canvas->DrawRoundRect(bounds, kBorderCornerRadius, paint);
1214 } 1215 }
1215 1216
1216 // The border itself will be drawn in PaintChildren() since it includes an 1217 // The border itself will be drawn in PaintChildren() since it includes an
1217 // inner shadow which should be drawn over the contents. 1218 // inner shadow which should be drawn over the contents.
1218 } 1219 }
1219 1220
1220 void LocationBarView::PaintChildren(const PaintContext& context) { 1221 void LocationBarView::PaintChildren(const ui::PaintContext& context) {
1221 // Paint all the children except for the omnibox itself, which may need to be 1222 // Paint all the children except for the omnibox itself, which may need to be
1222 // clipped if it's animating in. 1223 // clipped if it's animating in.
1223 for (int i = 0, count = child_count(); i < count; ++i) { 1224 for (int i = 0, count = child_count(); i < count; ++i) {
1224 views::View* child = child_at(i); 1225 views::View* child = child_at(i);
1225 if (!child->layer() && (child != omnibox_view_)) 1226 if (!child->layer() && (child != omnibox_view_))
1226 child->Paint(context); 1227 child->Paint(context);
1227 } 1228 }
1228 1229
1229 gfx::Canvas* canvas = context.canvas(); 1230 gfx::Canvas* canvas = context.canvas();
1230 1231
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 1349
1349 void LocationBarView::ModelChanged(const SearchModel::State& old_state, 1350 void LocationBarView::ModelChanged(const SearchModel::State& old_state,
1350 const SearchModel::State& new_state) { 1351 const SearchModel::State& new_state) {
1351 const bool visible = !GetToolbarModel()->input_in_progress() && 1352 const bool visible = !GetToolbarModel()->input_in_progress() &&
1352 new_state.voice_search_supported; 1353 new_state.voice_search_supported;
1353 if (mic_search_view_->visible() != visible) { 1354 if (mic_search_view_->visible() != visible) {
1354 mic_search_view_->SetVisible(visible); 1355 mic_search_view_->SetVisible(visible);
1355 Layout(); 1356 Layout();
1356 } 1357 }
1357 } 1358 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698