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

Side by Side Diff: chrome/browser/ui/views/tabs/tab.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 (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/tabs/tab.h" 5 #include "chrome/browser/ui/views/tabs/tab.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 23 matching lines...) Expand all
34 #include "components/strings/grit/components_strings.h" 34 #include "components/strings/grit/components_strings.h"
35 #include "content/public/browser/user_metrics.h" 35 #include "content/public/browser/user_metrics.h"
36 #include "content/public/common/url_constants.h" 36 #include "content/public/common/url_constants.h"
37 #include "third_party/skia/include/effects/SkGradientShader.h" 37 #include "third_party/skia/include/effects/SkGradientShader.h"
38 #include "third_party/skia/include/pathops/SkPathOps.h" 38 #include "third_party/skia/include/pathops/SkPathOps.h"
39 #include "ui/accessibility/ax_node_data.h" 39 #include "ui/accessibility/ax_node_data.h"
40 #include "ui/base/l10n/l10n_util.h" 40 #include "ui/base/l10n/l10n_util.h"
41 #include "ui/base/models/list_selection_model.h" 41 #include "ui/base/models/list_selection_model.h"
42 #include "ui/base/resource/resource_bundle.h" 42 #include "ui/base/resource/resource_bundle.h"
43 #include "ui/base/theme_provider.h" 43 #include "ui/base/theme_provider.h"
44 #include "ui/compositor/layer_type.h"
44 #include "ui/gfx/animation/animation_container.h" 45 #include "ui/gfx/animation/animation_container.h"
45 #include "ui/gfx/animation/throb_animation.h" 46 #include "ui/gfx/animation/throb_animation.h"
46 #include "ui/gfx/canvas.h" 47 #include "ui/gfx/canvas.h"
47 #include "ui/gfx/color_analysis.h" 48 #include "ui/gfx/color_analysis.h"
48 #include "ui/gfx/favicon_size.h" 49 #include "ui/gfx/favicon_size.h"
49 #include "ui/gfx/geometry/rect_conversions.h" 50 #include "ui/gfx/geometry/rect_conversions.h"
50 #include "ui/gfx/image/image_skia_operations.h" 51 #include "ui/gfx/image/image_skia_operations.h"
51 #include "ui/gfx/paint_vector_icon.h" 52 #include "ui/gfx/paint_vector_icon.h"
52 #include "ui/gfx/path.h" 53 #include "ui/gfx/path.h"
53 #include "ui/gfx/scoped_canvas.h" 54 #include "ui/gfx/scoped_canvas.h"
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 throbber_->ResetStartTimes(); 1452 throbber_->ResetStartTimes();
1452 throbber_->SetVisible(false); 1453 throbber_->SetVisible(false);
1453 ScheduleIconPaint(); 1454 ScheduleIconPaint();
1454 return; 1455 return;
1455 } 1456 }
1456 1457
1457 // Since the throbber can animate for a long time, paint to a separate layer 1458 // Since the throbber can animate for a long time, paint to a separate layer
1458 // when possible to reduce repaint overhead. 1459 // when possible to reduce repaint overhead.
1459 const bool paint_to_layer = controller_->CanPaintThrobberToLayer(); 1460 const bool paint_to_layer = controller_->CanPaintThrobberToLayer();
1460 if (paint_to_layer != !!throbber_->layer()) { 1461 if (paint_to_layer != !!throbber_->layer()) {
1461 throbber_->SetPaintToLayer(paint_to_layer); 1462 throbber_->SetPaintToLayer(paint_to_layer ? ui::LAYER_TEXTURED
1463 : ui::LAYER_NOT_DRAWN);
1462 if (paint_to_layer) { 1464 if (paint_to_layer) {
1463 throbber_->layer()->SetFillsBoundsOpaquely(false); 1465 throbber_->layer()->SetFillsBoundsOpaquely(false);
1464 ScheduleIconPaint(); // Ensure the non-layered throbber goes away. 1466 ScheduleIconPaint(); // Ensure the non-layered throbber goes away.
1465 } 1467 }
1466 } 1468 }
1467 if (!throbber_->visible()) { 1469 if (!throbber_->visible()) {
1468 ScheduleIconPaint(); // Repaint the icon area to hide the favicon. 1470 ScheduleIconPaint(); // Repaint the icon area to hide the favicon.
1469 throbber_->SetVisible(true); 1471 throbber_->SetVisible(true);
1470 } 1472 }
1471 throbber_->SchedulePaint(); 1473 throbber_->SchedulePaint();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 SchedulePaintInRect(bounds); 1584 SchedulePaintInRect(bounds);
1583 } 1585 }
1584 1586
1585 gfx::Rect Tab::GetImmersiveBarRect() const { 1587 gfx::Rect Tab::GetImmersiveBarRect() const {
1586 // The main bar is as wide as the normal tab's horizontal top line. 1588 // The main bar is as wide as the normal tab's horizontal top line.
1587 gfx::Rect contents = GetContentsBounds(); 1589 gfx::Rect contents = GetContentsBounds();
1588 contents.set_y(0); 1590 contents.set_y(0);
1589 contents.set_height(kImmersiveBarHeight); 1591 contents.set_height(kImmersiveBarHeight);
1590 return contents; 1592 return contents;
1591 } 1593 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698