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

Side by Side Diff: chrome/browser/chromeos/ui/focus_ring_layer.cc

Issue 2046563009: Make the focus, caret, and cursor highlights fade out. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move initialization to header, fix compile error Created 4 years, 6 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
« no previous file with comments | « chrome/browser/chromeos/ui/focus_ring_layer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/ui/focus_ring_layer.h" 5 #include "chrome/browser/chromeos/ui/focus_ring_layer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "ui/aura/window.h" 8 #include "ui/aura/window.h"
9 #include "ui/compositor/compositor_animation_observer.h" 9 #include "ui/compositor/compositor_animation_observer.h"
10 #include "ui/compositor/layer.h" 10 #include "ui/compositor/layer.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 gfx::Rect layer_bounds = bounds; 42 gfx::Rect layer_bounds = bounds;
43 int inset = -(kShadowRadius + 2); 43 int inset = -(kShadowRadius + 2);
44 layer_bounds.Inset(inset, inset, inset, inset); 44 layer_bounds.Inset(inset, inset, inset, inset);
45 CreateOrUpdateLayer(root_window, "FocusRing", layer_bounds); 45 CreateOrUpdateLayer(root_window, "FocusRing", layer_bounds);
46 } 46 }
47 47
48 bool FocusRingLayer::CanAnimate() const { 48 bool FocusRingLayer::CanAnimate() const {
49 return compositor_ && compositor_->HasAnimationObserver(this); 49 return compositor_ && compositor_->HasAnimationObserver(this);
50 } 50 }
51 51
52 void FocusRingLayer::SetOpacity(float opacity) {
53 layer()->SetOpacity(opacity);
54 }
55
52 void FocusRingLayer::CreateOrUpdateLayer(aura::Window* root_window, 56 void FocusRingLayer::CreateOrUpdateLayer(aura::Window* root_window,
53 const char* layer_name, 57 const char* layer_name,
54 const gfx::Rect& bounds) { 58 const gfx::Rect& bounds) {
55 if (!layer_ || root_window != root_window_) { 59 if (!layer_ || root_window != root_window_) {
56 root_window_ = root_window; 60 root_window_ = root_window;
57 ui::Layer* root_layer = root_window->layer(); 61 ui::Layer* root_layer = root_window->layer();
58 layer_.reset(new ui::Layer(ui::LAYER_TEXTURED)); 62 layer_.reset(new ui::Layer(ui::LAYER_TEXTURED));
59 layer_->set_name(layer_name); 63 layer_->set_name(layer_name);
60 layer_->set_delegate(this); 64 layer_->set_delegate(this);
61 layer_->SetFillsBoundsOpaquely(false); 65 layer_->SetFillsBoundsOpaquely(false);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 126 }
123 127
124 void FocusRingLayer::OnCompositingShuttingDown(ui::Compositor* compositor) { 128 void FocusRingLayer::OnCompositingShuttingDown(ui::Compositor* compositor) {
125 if (compositor == compositor_) { 129 if (compositor == compositor_) {
126 compositor->RemoveAnimationObserver(this); 130 compositor->RemoveAnimationObserver(this);
127 compositor_ = nullptr; 131 compositor_ = nullptr;
128 } 132 }
129 } 133 }
130 134
131 } // namespace chromeos 135 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/ui/focus_ring_layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698