OLD | NEW |
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // | 188 // |
189 // This is a Button subclass that causes middle clicks to be forwarded to the | 189 // This is a Button subclass that causes middle clicks to be forwarded to the |
190 // parent View by explicitly not handling them in OnMousePressed. | 190 // parent View by explicitly not handling them in OnMousePressed. |
191 class Tab::TabCloseButton : public views::ImageButton, | 191 class Tab::TabCloseButton : public views::ImageButton, |
192 public views::MaskedTargeterDelegate { | 192 public views::MaskedTargeterDelegate { |
193 public: | 193 public: |
194 explicit TabCloseButton(Tab* tab) | 194 explicit TabCloseButton(Tab* tab) |
195 : views::ImageButton(tab), | 195 : views::ImageButton(tab), |
196 tab_(tab) { | 196 tab_(tab) { |
197 SetEventTargeter( | 197 SetEventTargeter( |
198 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); | 198 std::unique_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); |
199 } | 199 } |
200 | 200 |
201 ~TabCloseButton() override {} | 201 ~TabCloseButton() override {} |
202 | 202 |
203 // views::View: | 203 // views::View: |
204 View* GetTooltipHandlerForPoint(const gfx::Point& point) override { | 204 View* GetTooltipHandlerForPoint(const gfx::Point& point) override { |
205 // Tab close button has no children, so tooltip handler should be the same | 205 // Tab close button has no children, so tooltip handler should be the same |
206 // as the event handler. | 206 // as the event handler. |
207 // In addition, a hit test has to be performed for the point (as | 207 // In addition, a hit test has to be performed for the point (as |
208 // GetTooltipHandlerForPoint() is responsible for it). | 208 // GetTooltipHandlerForPoint() is responsible for it). |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 SetBorder(views::Border::CreateEmptyBorder(GetLayoutInsets(TAB))); | 515 SetBorder(views::Border::CreateEmptyBorder(GetLayoutInsets(TAB))); |
516 | 516 |
517 title_->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD); | 517 title_->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD); |
518 title_->SetElideBehavior(gfx::FADE_TAIL); | 518 title_->SetElideBehavior(gfx::FADE_TAIL); |
519 title_->SetHandlesTooltips(false); | 519 title_->SetHandlesTooltips(false); |
520 title_->SetAutoColorReadabilityEnabled(false); | 520 title_->SetAutoColorReadabilityEnabled(false); |
521 title_->SetText(CoreTabHelper::GetDefaultTitle()); | 521 title_->SetText(CoreTabHelper::GetDefaultTitle()); |
522 AddChildView(title_); | 522 AddChildView(title_); |
523 | 523 |
524 SetEventTargeter( | 524 SetEventTargeter( |
525 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); | 525 std::unique_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); |
526 | 526 |
527 throbber_ = new ThrobberView(this); | 527 throbber_ = new ThrobberView(this); |
528 throbber_->SetVisible(false); | 528 throbber_->SetVisible(false); |
529 AddChildView(throbber_); | 529 AddChildView(throbber_); |
530 | 530 |
531 alert_indicator_button_ = new AlertIndicatorButton(this); | 531 alert_indicator_button_ = new AlertIndicatorButton(this); |
532 AddChildView(alert_indicator_button_); | 532 AddChildView(alert_indicator_button_); |
533 | 533 |
534 close_button_ = new TabCloseButton(this); | 534 close_button_ = new TabCloseButton(this); |
535 close_button_->SetAccessibleName( | 535 close_button_->SetAccessibleName( |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1763 inactive_images_.image_c = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_CENTER); | 1763 inactive_images_.image_c = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_CENTER); |
1764 inactive_images_.image_r = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_RIGHT); | 1764 inactive_images_.image_r = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_RIGHT); |
1765 inactive_images_.l_width = inactive_images_.image_l->width(); | 1765 inactive_images_.l_width = inactive_images_.image_l->width(); |
1766 inactive_images_.r_width = inactive_images_.image_r->width(); | 1766 inactive_images_.r_width = inactive_images_.image_r->width(); |
1767 | 1767 |
1768 mask_images_.image_l = rb.GetImageSkiaNamed(IDR_TAB_ALPHA_LEFT); | 1768 mask_images_.image_l = rb.GetImageSkiaNamed(IDR_TAB_ALPHA_LEFT); |
1769 mask_images_.image_r = rb.GetImageSkiaNamed(IDR_TAB_ALPHA_RIGHT); | 1769 mask_images_.image_r = rb.GetImageSkiaNamed(IDR_TAB_ALPHA_RIGHT); |
1770 mask_images_.l_width = mask_images_.image_l->width(); | 1770 mask_images_.l_width = mask_images_.image_l->width(); |
1771 mask_images_.r_width = mask_images_.image_r->width(); | 1771 mask_images_.r_width = mask_images_.image_r->width(); |
1772 } | 1772 } |
OLD | NEW |