| 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 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 27 #include "chrome/grit/generated_resources.h" | 27 #include "chrome/grit/generated_resources.h" |
| 28 #include "chrome/grit/theme_resources.h" | 28 #include "chrome/grit/theme_resources.h" |
| 29 #include "components/grit/components_scaled_resources.h" | 29 #include "components/grit/components_scaled_resources.h" |
| 30 #include "components/strings/grit/components_strings.h" | 30 #include "components/strings/grit/components_strings.h" |
| 31 #include "content/public/browser/user_metrics.h" | 31 #include "content/public/browser/user_metrics.h" |
| 32 #include "content/public/common/url_constants.h" | 32 #include "content/public/common/url_constants.h" |
| 33 #include "third_party/skia/include/effects/SkGradientShader.h" | 33 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 34 #include "third_party/skia/include/pathops/SkPathOps.h" | 34 #include "third_party/skia/include/pathops/SkPathOps.h" |
| 35 #include "ui/accessibility/ax_view_state.h" | 35 #include "ui/accessibility/ax_node_data.h" |
| 36 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
| 37 #include "ui/base/models/list_selection_model.h" | 37 #include "ui/base/models/list_selection_model.h" |
| 38 #include "ui/base/resource/resource_bundle.h" | 38 #include "ui/base/resource/resource_bundle.h" |
| 39 #include "ui/base/theme_provider.h" | 39 #include "ui/base/theme_provider.h" |
| 40 #include "ui/gfx/animation/animation_container.h" | 40 #include "ui/gfx/animation/animation_container.h" |
| 41 #include "ui/gfx/animation/throb_animation.h" | 41 #include "ui/gfx/animation/throb_animation.h" |
| 42 #include "ui/gfx/canvas.h" | 42 #include "ui/gfx/canvas.h" |
| 43 #include "ui/gfx/color_analysis.h" | 43 #include "ui/gfx/color_analysis.h" |
| 44 #include "ui/gfx/favicon_size.h" | 44 #include "ui/gfx/favicon_size.h" |
| 45 #include "ui/gfx/geometry/rect_conversions.h" | 45 #include "ui/gfx/geometry/rect_conversions.h" |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 case ui::ET_GESTURE_SCROLL_UPDATE: | 1091 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 1092 controller_->ContinueDrag(this, *event); | 1092 controller_->ContinueDrag(this, *event); |
| 1093 break; | 1093 break; |
| 1094 | 1094 |
| 1095 default: | 1095 default: |
| 1096 break; | 1096 break; |
| 1097 } | 1097 } |
| 1098 event->SetHandled(); | 1098 event->SetHandled(); |
| 1099 } | 1099 } |
| 1100 | 1100 |
| 1101 void Tab::GetAccessibleState(ui::AXViewState* state) { | 1101 void Tab::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 1102 state->role = ui::AX_ROLE_TAB; | 1102 node_data->role = ui::AX_ROLE_TAB; |
| 1103 state->name = data_.title; | 1103 node_data->SetName(data_.title); |
| 1104 state->AddStateFlag(ui::AX_STATE_MULTISELECTABLE); | 1104 node_data->AddStateFlag(ui::AX_STATE_MULTISELECTABLE); |
| 1105 state->AddStateFlag(ui::AX_STATE_SELECTABLE); | 1105 node_data->AddStateFlag(ui::AX_STATE_SELECTABLE); |
| 1106 controller_->UpdateTabAccessibilityState(this, state); | 1106 controller_->UpdateTabAccessibilityState(this, node_data); |
| 1107 if (IsSelected()) | 1107 if (IsSelected()) |
| 1108 state->AddStateFlag(ui::AX_STATE_SELECTED); | 1108 node_data->AddStateFlag(ui::AX_STATE_SELECTED); |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 //////////////////////////////////////////////////////////////////////////////// | 1111 //////////////////////////////////////////////////////////////////////////////// |
| 1112 // Tab, private | 1112 // Tab, private |
| 1113 | 1113 |
| 1114 void Tab::MaybeAdjustLeftForPinnedTab(gfx::Rect* bounds) const { | 1114 void Tab::MaybeAdjustLeftForPinnedTab(gfx::Rect* bounds) const { |
| 1115 if (ShouldRenderAsNormalTab()) | 1115 if (ShouldRenderAsNormalTab()) |
| 1116 return; | 1116 return; |
| 1117 const int ideal_delta = width() - GetPinnedWidth(); | 1117 const int ideal_delta = width() - GetPinnedWidth(); |
| 1118 const int ideal_x = (GetPinnedWidth() - bounds->width()) / 2; | 1118 const int ideal_x = (GetPinnedWidth() - bounds->width()) / 2; |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1577 SchedulePaintInRect(bounds); | 1577 SchedulePaintInRect(bounds); |
| 1578 } | 1578 } |
| 1579 | 1579 |
| 1580 gfx::Rect Tab::GetImmersiveBarRect() const { | 1580 gfx::Rect Tab::GetImmersiveBarRect() const { |
| 1581 // The main bar is as wide as the normal tab's horizontal top line. | 1581 // The main bar is as wide as the normal tab's horizontal top line. |
| 1582 gfx::Rect contents = GetContentsBounds(); | 1582 gfx::Rect contents = GetContentsBounds(); |
| 1583 contents.set_y(0); | 1583 contents.set_y(0); |
| 1584 contents.set_height(kImmersiveBarHeight); | 1584 contents.set_height(kImmersiveBarHeight); |
| 1585 return contents; | 1585 return contents; |
| 1586 } | 1586 } |
| OLD | NEW |