OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/web_contents/aura/gesture_nav_simple.h" | 5 #include "content/browser/web_contents/aura/gesture_nav_simple.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
| 11 #include "cc/paint/paint_flags.h" |
11 #include "content/browser/frame_host/navigation_controller_impl.h" | 12 #include "content/browser/frame_host/navigation_controller_impl.h" |
12 #include "content/browser/renderer_host/overscroll_controller.h" | 13 #include "content/browser/renderer_host/overscroll_controller.h" |
13 #include "content/browser/web_contents/web_contents_impl.h" | 14 #include "content/browser/web_contents/web_contents_impl.h" |
14 #include "content/browser/web_contents/web_contents_view.h" | 15 #include "content/browser/web_contents/web_contents_view.h" |
15 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/browser/overscroll_configuration.h" | 17 #include "content/public/browser/overscroll_configuration.h" |
17 #include "content/public/common/content_client.h" | 18 #include "content/public/common/content_client.h" |
18 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
19 #include "ui/compositor/layer.h" | 20 #include "ui/compositor/layer.h" |
20 #include "ui/compositor/layer_animation_observer.h" | 21 #include "ui/compositor/layer_animation_observer.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 CHECK(!image_.IsEmpty()); | 83 CHECK(!image_.IsEmpty()); |
83 } | 84 } |
84 | 85 |
85 ~ArrowLayerDelegate() override {} | 86 ~ArrowLayerDelegate() override {} |
86 | 87 |
87 bool left() const { return left_arrow_; } | 88 bool left() const { return left_arrow_; } |
88 | 89 |
89 private: | 90 private: |
90 // ui::LayerDelegate: | 91 // ui::LayerDelegate: |
91 void OnPaintLayer(const ui::PaintContext& context) override { | 92 void OnPaintLayer(const ui::PaintContext& context) override { |
92 SkPaint paint; | 93 cc::PaintFlags paint; |
93 paint.setColor(SkColorSetARGB(0xa0, 0, 0, 0)); | 94 paint.setColor(SkColorSetARGB(0xa0, 0, 0, 0)); |
94 paint.setStyle(SkPaint::kFill_Style); | 95 paint.setStyle(cc::PaintFlags::kFill_Style); |
95 paint.setAntiAlias(true); | 96 paint.setAntiAlias(true); |
96 | 97 |
97 // Set the recording size to be the size of the |arrow_| layer, and draw a | 98 // Set the recording size to be the size of the |arrow_| layer, and draw a |
98 // half circle (the other half will be clipped), then an arrow image inside | 99 // half circle (the other half will be clipped), then an arrow image inside |
99 // it. | 100 // it. |
100 ui::PaintRecorder recorder(context, gfx::Size(kArrowWidth, kArrowHeight)); | 101 ui::PaintRecorder recorder(context, gfx::Size(kArrowWidth, kArrowHeight)); |
101 recorder.canvas()->DrawCircle( | 102 recorder.canvas()->DrawCircle( |
102 gfx::Point(left_arrow_ ? 0 : kArrowWidth, kArrowHeight / 2), | 103 gfx::Point(left_arrow_ ? 0 : kArrowWidth, kArrowHeight / 2), |
103 kArrowWidth, paint); | 104 kArrowWidth, paint); |
104 recorder.canvas()->DrawImageInt( | 105 recorder.canvas()->DrawImageInt( |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 clip_layer_->SetBounds(window->layer()->bounds()); | 231 clip_layer_->SetBounds(window->layer()->bounds()); |
231 clip_layer_->SetMasksToBounds(true); | 232 clip_layer_->SetMasksToBounds(true); |
232 clip_layer_->Add(arrow_.get()); | 233 clip_layer_->Add(arrow_.get()); |
233 | 234 |
234 ui::Layer* parent = window->layer()->parent(); | 235 ui::Layer* parent = window->layer()->parent(); |
235 parent->Add(clip_layer_.get()); | 236 parent->Add(clip_layer_.get()); |
236 parent->StackAtTop(clip_layer_.get()); | 237 parent->StackAtTop(clip_layer_.get()); |
237 } | 238 } |
238 | 239 |
239 } // namespace content | 240 } // namespace content |
OLD | NEW |