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

Side by Side Diff: chrome/browser/ui/views/infobars/infobar_view.cc

Issue 1470123002: Split ClipTransformRecorder into {Clip,Transform}Recorder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initialize transformed to false. Created 5 years 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/infobars/infobar_view.h" 5 #include "chrome/browser/ui/views/infobars/infobar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/ui/infobar_container_delegate.h" 11 #include "chrome/browser/ui/infobar_container_delegate.h"
12 #include "chrome/browser/ui/views/bar_control_button.h" 12 #include "chrome/browser/ui/views/bar_control_button.h"
13 #include "chrome/browser/ui/views/infobars/infobar_background.h" 13 #include "chrome/browser/ui/views/infobars/infobar_background.h"
14 #include "chrome/grit/generated_resources.h" 14 #include "chrome/grit/generated_resources.h"
15 #include "components/infobars/core/infobar_delegate.h" 15 #include "components/infobars/core/infobar_delegate.h"
16 #include "grit/theme_resources.h" 16 #include "grit/theme_resources.h"
17 #include "third_party/skia/include/effects/SkGradientShader.h" 17 #include "third_party/skia/include/effects/SkGradientShader.h"
18 #include "ui/accessibility/ax_view_state.h" 18 #include "ui/accessibility/ax_view_state.h"
19 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/base/resource/material_design/material_design_controller.h" 20 #include "ui/base/resource/material_design/material_design_controller.h"
21 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
22 #include "ui/compositor/clip_transform_recorder.h" 22 #include "ui/compositor/clip_recorder.h"
23 #include "ui/gfx/canvas.h" 23 #include "ui/gfx/canvas.h"
24 #include "ui/gfx/color_palette.h" 24 #include "ui/gfx/color_palette.h"
25 #include "ui/gfx/image/image.h" 25 #include "ui/gfx/image/image.h"
26 #include "ui/gfx/paint_vector_icon.h" 26 #include "ui/gfx/paint_vector_icon.h"
27 #include "ui/gfx/vector_icons_public.h" 27 #include "ui/gfx/vector_icons_public.h"
28 #include "ui/native_theme/common_theme.h" 28 #include "ui/native_theme/common_theme.h"
29 #include "ui/native_theme/native_theme.h" 29 #include "ui/native_theme/native_theme.h"
30 #include "ui/resources/grit/ui_resources.h" 30 #include "ui/resources/grit/ui_resources.h"
31 #include "ui/views/controls/button/image_button.h" 31 #include "ui/views/controls/button/image_button.h"
32 #include "ui/views/controls/button/label_button.h" 32 #include "ui/views/controls/button/label_button.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 269 }
270 270
271 void InfoBarView::PaintChildren(const ui::PaintContext& context) { 271 void InfoBarView::PaintChildren(const ui::PaintContext& context) {
272 // TODO(scr): This really should be the |fill_path_|, but the clipPath seems 272 // TODO(scr): This really should be the |fill_path_|, but the clipPath seems
273 // broken on non-Windows platforms (crbug.com/75154). For now, just clip to 273 // broken on non-Windows platforms (crbug.com/75154). For now, just clip to
274 // the bar bounds. 274 // the bar bounds.
275 // 275 //
276 // canvas->sk_canvas()->clipPath(fill_path_); 276 // canvas->sk_canvas()->clipPath(fill_path_);
277 DCHECK_EQ(total_height(), height()) 277 DCHECK_EQ(total_height(), height())
278 << "Infobar piecewise heights do not match overall height"; 278 << "Infobar piecewise heights do not match overall height";
279 ui::ClipTransformRecorder clip_transform_recorder(context); 279 ui::ClipRecorder clip_recorder(context);
280 clip_transform_recorder.ClipRect( 280 clip_recorder.ClipRect(gfx::Rect(0, arrow_height(), width(), bar_height()));
281 gfx::Rect(0, arrow_height(), width(), bar_height()));
282 views::View::PaintChildren(context); 281 views::View::PaintChildren(context);
283 } 282 }
284 283
285 void InfoBarView::ButtonPressed(views::Button* sender, 284 void InfoBarView::ButtonPressed(views::Button* sender,
286 const ui::Event& event) { 285 const ui::Event& event) {
287 if (!owner()) 286 if (!owner())
288 return; // We're closing; don't call anything, it might access the owner. 287 return; // We're closing; don't call anything, it might access the owner.
289 if (sender == close_button_) { 288 if (sender == close_button_) {
290 delegate()->InfoBarDismissed(); 289 delegate()->InfoBarDismissed();
291 RemoveSelf(); 290 RemoveSelf();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) { 404 void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) {
406 views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now); 405 views::ExternalFocusTracker::OnWillChangeFocus(focused_before, focused_now);
407 406
408 // This will trigger some screen readers to read the entire contents of this 407 // This will trigger some screen readers to read the entire contents of this
409 // infobar. 408 // infobar.
410 if (focused_before && focused_now && !Contains(focused_before) && 409 if (focused_before && focused_now && !Contains(focused_before) &&
411 Contains(focused_now)) { 410 Contains(focused_now)) {
412 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 411 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
413 } 412 }
414 } 413 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698