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

Side by Side Diff: chrome/browser/android/compositor/layer/tab_layer.cc

Issue 2045733002: Replace tab switcher borders with single asset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move var 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
OLDNEW
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 "chrome/browser/android/compositor/layer/tab_layer.h" 5 #include "chrome/browser/android/compositor/layer/tab_layer.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 float border_scale, 127 float border_scale,
128 float saturation, 128 float saturation,
129 float brightness, 129 float brightness,
130 float close_btn_width, 130 float close_btn_width,
131 float static_to_view_blend, 131 float static_to_view_blend,
132 float content_width, 132 float content_width,
133 float content_height, 133 float content_height,
134 float view_width, 134 float view_width,
135 float view_height, 135 float view_height,
136 bool show_toolbar, 136 bool show_toolbar,
137 int default_theme_color,
137 int toolbar_background_color, 138 int toolbar_background_color,
138 bool anonymize_toolbar, 139 bool anonymize_toolbar,
139 int toolbar_textbox_resource_id, 140 int toolbar_textbox_resource_id,
140 int toolbar_textbox_background_color, 141 int toolbar_textbox_background_color,
141 float toolbar_textbox_alpha, 142 float toolbar_textbox_alpha,
142 float toolbar_alpha, 143 float toolbar_alpha,
143 float toolbar_y_offset, 144 float toolbar_y_offset,
144 float side_border_scale, 145 float side_border_scale,
145 bool attach_content, 146 bool attach_content,
146 bool inset_border) { 147 bool inset_border) {
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 contour_shadow_->SetOpacity(contour_alpha); 473 contour_shadow_->SetOpacity(contour_alpha);
473 } 474 }
474 475
475 front_border_->SetHideLayerAndSubtree(!border_visible); 476 front_border_->SetHideLayerAndSubtree(!border_visible);
476 if (border_visible) { 477 if (border_visible) {
477 front_border_->SetPosition(border_position); 478 front_border_->SetPosition(border_position);
478 front_border_->SetBounds(border_size); 479 front_border_->SetBounds(border_size);
479 front_border_->SetOpacity(border_alpha); 480 front_border_->SetOpacity(border_alpha);
480 front_border_->SetNearestNeighbor(toolbar_visible); 481 front_border_->SetNearestNeighbor(toolbar_visible);
481 482
482 // Colorize the tab decoration. 483 int tab_switcher_color = default_theme_color;
483 if (tab_switcher_themes_enabled_ && !incognito_ 484
484 && toolbar_background_color != toolbar_background_color_) { 485 // Colorize the tab decoration if enabled.
486 if (tab_switcher_themes_enabled_) {
487 tab_switcher_color = toolbar_background_color;
488 }
489
490 if (toolbar_background_color != toolbar_background_color_) {
485 toolbar_background_color_ = toolbar_background_color; 491 toolbar_background_color_ = toolbar_background_color;
486 cc::FilterOperations filters; 492 cc::FilterOperations filters;
487 SkScalar colorMatrix[] = { 493 SkScalar colorMatrix[] = {
488 SkColorGetR(toolbar_background_color) / 255.0f, 0, 0, 0, 0, 494 SkColorGetR(tab_switcher_color) / 255.0f, 0, 0, 0, 0,
489 0, SkColorGetG(toolbar_background_color) / 255.0f, 0, 0, 0, 495 0, SkColorGetG(tab_switcher_color) / 255.0f, 0, 0, 0,
490 0, 0, SkColorGetB(toolbar_background_color) / 255.0f, 0, 0, 496 0, 0, SkColorGetB(tab_switcher_color) / 255.0f, 0, 0,
491 0, 0, 0, 1, 0, 497 0, 0, 0, 1, 0,
492 }; 498 };
493 filters.Append(cc::FilterOperation::CreateColorMatrixFilter(colorMatrix)); 499 filters.Append(cc::FilterOperation::CreateColorMatrixFilter(colorMatrix));
494 front_border_->SetFilters(filters); 500 front_border_->SetFilters(filters);
495 } 501 }
496 } 502 }
497 503
498 front_border_inner_shadow_->SetHideLayerAndSubtree( 504 front_border_inner_shadow_->SetHideLayerAndSubtree(
499 !border_inner_shadow_visible); 505 !border_inner_shadow_visible);
500 if (border_inner_shadow_visible) { 506 if (border_inner_shadow_visible) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 title_->AddChild(layer); 705 title_->AddChild(layer);
700 } 706 }
701 } 707 }
702 708
703 if (title) 709 if (title)
704 title->SetUIResourceIds(); 710 title->SetUIResourceIds();
705 } 711 }
706 712
707 } // namespace android 713 } // namespace android
708 } // namespace chrome 714 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698