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

Side by Side Diff: ash/common/shelf/shelf_button.cc

Issue 2639203007: Update SetPaintToLayer to accept LayerType (Closed)
Patch Set: Refactor Created 3 years, 11 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 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 "ash/common/shelf/shelf_button.h" 5 #include "ash/common/shelf/shelf_button.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/common/ash_constants.h" 9 #include "ash/common/ash_constants.h"
10 #include "ash/common/material_design/material_design_controller.h" 10 #include "ash/common/material_design/material_design_controller.h"
11 #include "ash/common/shelf/ink_drop_button_listener.h" 11 #include "ash/common/shelf/ink_drop_button_listener.h"
12 #include "ash/common/shelf/shelf_constants.h" 12 #include "ash/common/shelf/shelf_constants.h"
13 #include "ash/common/shelf/shelf_view.h" 13 #include "ash/common/shelf/shelf_view.h"
14 #include "ash/common/shelf/wm_shelf.h" 14 #include "ash/common/shelf/wm_shelf.h"
15 #include "ash/common/shelf/wm_shelf_util.h" 15 #include "ash/common/shelf/wm_shelf_util.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "grit/ash_resources.h" 18 #include "grit/ash_resources.h"
19 #include "skia/ext/image_operations.h" 19 #include "skia/ext/image_operations.h"
20 #include "third_party/skia/include/core/SkPaint.h" 20 #include "third_party/skia/include/core/SkPaint.h"
21 #include "ui/accessibility/ax_node_data.h" 21 #include "ui/accessibility/ax_node_data.h"
22 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/compositor/layer.h" 23 #include "ui/compositor/layer.h"
24 #include "ui/compositor/layer_type.h"
24 #include "ui/compositor/scoped_layer_animation_settings.h" 25 #include "ui/compositor/scoped_layer_animation_settings.h"
25 #include "ui/events/event_constants.h" 26 #include "ui/events/event_constants.h"
26 #include "ui/gfx/animation/animation_delegate.h" 27 #include "ui/gfx/animation/animation_delegate.h"
27 #include "ui/gfx/animation/throb_animation.h" 28 #include "ui/gfx/animation/throb_animation.h"
28 #include "ui/gfx/canvas.h" 29 #include "ui/gfx/canvas.h"
29 #include "ui/gfx/geometry/vector2d.h" 30 #include "ui/gfx/geometry/vector2d.h"
30 #include "ui/gfx/image/image.h" 31 #include "ui/gfx/image/image.h"
31 #include "ui/gfx/image/image_skia_operations.h" 32 #include "ui/gfx/image/image_skia_operations.h"
32 #include "ui/gfx/skbitmap_operations.h" 33 #include "ui/gfx/skbitmap_operations.h"
33 #include "ui/views/animation/ink_drop_impl.h" 34 #include "ui/views/animation/ink_drop_impl.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 267 }
267 268
268 const gfx::ShadowValue kShadows[] = { 269 const gfx::ShadowValue kShadows[] = {
269 gfx::ShadowValue(gfx::Vector2d(0, 2), 0, SkColorSetARGB(0x1A, 0, 0, 0)), 270 gfx::ShadowValue(gfx::Vector2d(0, 2), 0, SkColorSetARGB(0x1A, 0, 0, 0)),
270 gfx::ShadowValue(gfx::Vector2d(0, 3), 1, SkColorSetARGB(0x1A, 0, 0, 0)), 271 gfx::ShadowValue(gfx::Vector2d(0, 3), 1, SkColorSetARGB(0x1A, 0, 0, 0)),
271 gfx::ShadowValue(gfx::Vector2d(0, 0), 1, SkColorSetARGB(0x54, 0, 0, 0)), 272 gfx::ShadowValue(gfx::Vector2d(0, 0), 1, SkColorSetARGB(0x54, 0, 0, 0)),
272 }; 273 };
273 icon_shadows_.assign(kShadows, kShadows + arraysize(kShadows)); 274 icon_shadows_.assign(kShadows, kShadows + arraysize(kShadows));
274 275
275 // TODO: refactor the layers so each button doesn't require 2. 276 // TODO: refactor the layers so each button doesn't require 2.
276 icon_view_->SetPaintToLayer(true); 277 icon_view_->SetPaintToLayer(ui::LAYER_TEXTURED);
277 icon_view_->layer()->SetFillsBoundsOpaquely(false); 278 icon_view_->layer()->SetFillsBoundsOpaquely(false);
278 icon_view_->SetHorizontalAlignment(views::ImageView::CENTER); 279 icon_view_->SetHorizontalAlignment(views::ImageView::CENTER);
279 icon_view_->SetVerticalAlignment(views::ImageView::LEADING); 280 icon_view_->SetVerticalAlignment(views::ImageView::LEADING);
280 // Do not make this interactive, so that events are sent to ShelfView. 281 // Do not make this interactive, so that events are sent to ShelfView.
281 icon_view_->set_interactive(false); 282 icon_view_->set_interactive(false);
282 283
283 AddChildView(bar_); 284 AddChildView(bar_);
284 AddChildView(icon_view_); 285 AddChildView(icon_view_);
285 } 286 }
286 287
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 bar_->SetHorizontalAlignment(views::ImageView::TRAILING); 599 bar_->SetHorizontalAlignment(views::ImageView::TRAILING);
599 bar_->SetVerticalAlignment(views::ImageView::CENTER); 600 bar_->SetVerticalAlignment(views::ImageView::CENTER);
600 break; 601 break;
601 } 602 }
602 bar_->SchedulePaint(); 603 bar_->SchedulePaint();
603 } 604 }
604 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); 605 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL);
605 } 606 }
606 607
607 } // namespace ash 608 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698