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

Side by Side Diff: chrome/browser/ui/views/tabs/tab.cc

Issue 2623693003: Move more vector icons into respective directories. (Closed)
Patch Set: 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
« no previous file with comments | « chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc ('k') | ui/gfx/vector_icons/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/debug/alias.h" 12 #include "base/debug/alias.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "chrome/app/vector_icons/vector_icons.h"
16 #include "chrome/browser/themes/theme_properties.h" 17 #include "chrome/browser/themes/theme_properties.h"
17 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/layout_constants.h" 19 #include "chrome/browser/ui/layout_constants.h"
19 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 20 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
20 #include "chrome/browser/ui/tabs/tab_utils.h" 21 #include "chrome/browser/ui/tabs/tab_utils.h"
21 #include "chrome/browser/ui/view_ids.h" 22 #include "chrome/browser/ui/view_ids.h"
22 #include "chrome/browser/ui/views/frame/browser_view.h" 23 #include "chrome/browser/ui/views/frame/browser_view.h"
23 #include "chrome/browser/ui/views/tabs/alert_indicator_button.h" 24 #include "chrome/browser/ui/views/tabs/alert_indicator_button.h"
24 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" 25 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h"
25 #include "chrome/browser/ui/views/tabs/tab_controller.h" 26 #include "chrome/browser/ui/views/tabs/tab_controller.h"
(...skipping 18 matching lines...) Expand all
44 #include "ui/gfx/animation/throb_animation.h" 45 #include "ui/gfx/animation/throb_animation.h"
45 #include "ui/gfx/canvas.h" 46 #include "ui/gfx/canvas.h"
46 #include "ui/gfx/color_analysis.h" 47 #include "ui/gfx/color_analysis.h"
47 #include "ui/gfx/favicon_size.h" 48 #include "ui/gfx/favicon_size.h"
48 #include "ui/gfx/geometry/rect_conversions.h" 49 #include "ui/gfx/geometry/rect_conversions.h"
49 #include "ui/gfx/image/image_skia_operations.h" 50 #include "ui/gfx/image/image_skia_operations.h"
50 #include "ui/gfx/paint_vector_icon.h" 51 #include "ui/gfx/paint_vector_icon.h"
51 #include "ui/gfx/path.h" 52 #include "ui/gfx/path.h"
52 #include "ui/gfx/scoped_canvas.h" 53 #include "ui/gfx/scoped_canvas.h"
53 #include "ui/gfx/skia_util.h" 54 #include "ui/gfx/skia_util.h"
54 #include "ui/gfx/vector_icons_public.h"
55 #include "ui/resources/grit/ui_resources.h" 55 #include "ui/resources/grit/ui_resources.h"
56 #include "ui/views/border.h" 56 #include "ui/views/border.h"
57 #include "ui/views/controls/button/image_button.h" 57 #include "ui/views/controls/button/image_button.h"
58 #include "ui/views/controls/label.h" 58 #include "ui/views/controls/label.h"
59 #include "ui/views/rect_based_targeting_utils.h" 59 #include "ui/views/rect_based_targeting_utils.h"
60 #include "ui/views/view_targeter.h" 60 #include "ui/views/view_targeter.h"
61 #include "ui/views/widget/tooltip_manager.h" 61 #include "ui/views/widget/tooltip_manager.h"
62 #include "ui/views/widget/widget.h" 62 #include "ui/views/widget/widget.h"
63 #include "ui/views/window/non_client_view.h" 63 #include "ui/views/window/non_client_view.h"
64 64
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 alert_indicator_button_ = new AlertIndicatorButton(this); 580 alert_indicator_button_ = new AlertIndicatorButton(this);
581 AddChildView(alert_indicator_button_); 581 AddChildView(alert_indicator_button_);
582 582
583 close_button_ = new TabCloseButton(this); 583 close_button_ = new TabCloseButton(this);
584 close_button_->SetAccessibleName( 584 close_button_->SetAccessibleName(
585 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); 585 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE));
586 // The normal image is set by OnButtonColorMaybeChanged() because it depends 586 // The normal image is set by OnButtonColorMaybeChanged() because it depends
587 // on the current theme and active state. The hovered and pressed images 587 // on the current theme and active state. The hovered and pressed images
588 // don't depend on the these, so we can set them here. 588 // don't depend on the these, so we can set them here.
589 const gfx::ImageSkia& hovered = gfx::CreateVectorIcon( 589 const gfx::ImageSkia& hovered = gfx::CreateVectorIcon(
590 gfx::VectorIconId::TAB_CLOSE_HOVERED_PRESSED, 590 kTabCloseHoveredPressedIcon, SkColorSetRGB(0xDB, 0x44, 0x37));
591 SkColorSetRGB(0xDB, 0x44, 0x37));
592 const gfx::ImageSkia& pressed = gfx::CreateVectorIcon( 591 const gfx::ImageSkia& pressed = gfx::CreateVectorIcon(
593 gfx::VectorIconId::TAB_CLOSE_HOVERED_PRESSED, 592 kTabCloseHoveredPressedIcon, SkColorSetRGB(0xA8, 0x35, 0x2A));
594 SkColorSetRGB(0xA8, 0x35, 0x2A));
595 close_button_->SetImage(views::CustomButton::STATE_HOVERED, &hovered); 593 close_button_->SetImage(views::CustomButton::STATE_HOVERED, &hovered);
596 close_button_->SetImage(views::CustomButton::STATE_PRESSED, &pressed); 594 close_button_->SetImage(views::CustomButton::STATE_PRESSED, &pressed);
597 595
598 // Disable animation so that the red danger sign shows up immediately 596 // Disable animation so that the red danger sign shows up immediately
599 // to help avoid mis-clicks. 597 // to help avoid mis-clicks.
600 close_button_->SetAnimationDuration(0); 598 close_button_->SetAnimationDuration(0);
601 AddChildView(close_button_); 599 AddChildView(close_button_);
602 600
603 set_context_menu_controller(this); 601 set_context_menu_controller(this);
604 602
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 return; 1556 return;
1559 1557
1560 const SkColor title_color = theme_provider->GetColor(IsActive() ? 1558 const SkColor title_color = theme_provider->GetColor(IsActive() ?
1561 ThemeProperties::COLOR_TAB_TEXT : 1559 ThemeProperties::COLOR_TAB_TEXT :
1562 ThemeProperties::COLOR_BACKGROUND_TAB_TEXT); 1560 ThemeProperties::COLOR_BACKGROUND_TAB_TEXT);
1563 const SkColor new_button_color = SkColorSetA(title_color, 0xA0); 1561 const SkColor new_button_color = SkColorSetA(title_color, 0xA0);
1564 if (button_color_ != new_button_color) { 1562 if (button_color_ != new_button_color) {
1565 button_color_ = new_button_color; 1563 button_color_ = new_button_color;
1566 title_->SetEnabledColor(title_color); 1564 title_->SetEnabledColor(title_color);
1567 alert_indicator_button_->OnParentTabButtonColorChanged(); 1565 alert_indicator_button_->OnParentTabButtonColorChanged();
1568 const gfx::ImageSkia& close_button_normal_image = gfx::CreateVectorIcon( 1566 const gfx::ImageSkia& close_button_normal_image =
1569 gfx::VectorIconId::TAB_CLOSE_NORMAL, button_color_); 1567 gfx::CreateVectorIcon(kTabCloseNormalIcon, button_color_);
1570 close_button_->SetImage(views::CustomButton::STATE_NORMAL, 1568 close_button_->SetImage(views::CustomButton::STATE_NORMAL,
1571 &close_button_normal_image); 1569 &close_button_normal_image);
1572 } 1570 }
1573 } 1571 }
1574 1572
1575 void Tab::ScheduleIconPaint() { 1573 void Tab::ScheduleIconPaint() {
1576 gfx::Rect bounds = favicon_bounds_; 1574 gfx::Rect bounds = favicon_bounds_;
1577 if (bounds.IsEmpty()) 1575 if (bounds.IsEmpty())
1578 return; 1576 return;
1579 1577
1580 // Extends the area to the bottom when the crash animation is in progress. 1578 // Extends the area to the bottom when the crash animation is in progress.
1581 if (crash_icon_animation_->is_animating()) 1579 if (crash_icon_animation_->is_animating())
1582 bounds.set_height(height() - bounds.y()); 1580 bounds.set_height(height() - bounds.y());
1583 bounds.set_x(GetMirroredXForRect(bounds)); 1581 bounds.set_x(GetMirroredXForRect(bounds));
1584 SchedulePaintInRect(bounds); 1582 SchedulePaintInRect(bounds);
1585 } 1583 }
1586 1584
1587 gfx::Rect Tab::GetImmersiveBarRect() const { 1585 gfx::Rect Tab::GetImmersiveBarRect() const {
1588 // The main bar is as wide as the normal tab's horizontal top line. 1586 // The main bar is as wide as the normal tab's horizontal top line.
1589 gfx::Rect contents = GetContentsBounds(); 1587 gfx::Rect contents = GetContentsBounds();
1590 contents.set_y(0); 1588 contents.set_y(0);
1591 contents.set_height(kImmersiveBarHeight); 1589 contents.set_height(kImmersiveBarHeight);
1592 return contents; 1590 return contents;
1593 } 1591 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc ('k') | ui/gfx/vector_icons/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698