| OLD | NEW |
| 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/ui/views/website_settings/permission_prompt_impl.h" | 5 #include "chrome/browser/ui/views/website_settings/permission_prompt_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 row_layout->StartRow(0, 0); | 225 row_layout->StartRow(0, 0); |
| 226 | 226 |
| 227 views::View* label_container = new views::View(); | 227 views::View* label_container = new views::View(); |
| 228 int indent = layout_delegate->GetMetric( | 228 int indent = layout_delegate->GetMetric( |
| 229 LayoutDelegate::Metric::SUBSECTION_HORIZONTAL_INDENT); | 229 LayoutDelegate::Metric::SUBSECTION_HORIZONTAL_INDENT); |
| 230 label_container->SetLayoutManager(new views::BoxLayout( | 230 label_container->SetLayoutManager(new views::BoxLayout( |
| 231 views::BoxLayout::kHorizontal, indent, 0, | 231 views::BoxLayout::kHorizontal, indent, 0, |
| 232 layout_delegate->GetMetric( | 232 layout_delegate->GetMetric( |
| 233 LayoutDelegate::Metric::RELATED_LABEL_HORIZONTAL_SPACING))); | 233 LayoutDelegate::Metric::RELATED_LABEL_HORIZONTAL_SPACING))); |
| 234 views::ImageView* icon = new views::ImageView(); | 234 views::ImageView* icon = new views::ImageView(); |
| 235 gfx::VectorIconId vector_id = requests[index]->GetIconId(); | 235 const gfx::VectorIcon& vector_id = requests[index]->GetIconId(); |
| 236 if (vector_id != gfx::VectorIconId::VECTOR_ICON_NONE) { | 236 icon->SetImage( |
| 237 icon->SetImage( | 237 gfx::CreateVectorIcon(vector_id, kIconSize, gfx::kChromeIconGrey)); |
| 238 gfx::CreateVectorIcon(vector_id, kIconSize, gfx::kChromeIconGrey)); | |
| 239 } | |
| 240 icon->SetTooltipText(base::string16()); // Redundant with the text fragment | 238 icon->SetTooltipText(base::string16()); // Redundant with the text fragment |
| 241 label_container->AddChildView(icon); | 239 label_container->AddChildView(icon); |
| 242 views::Label* label = | 240 views::Label* label = |
| 243 new views::Label(requests.at(index)->GetMessageTextFragment()); | 241 new views::Label(requests.at(index)->GetMessageTextFragment()); |
| 244 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 242 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 245 label_container->AddChildView(label); | 243 label_container->AddChildView(label); |
| 246 row_layout->AddView(label_container); | 244 row_layout->AddView(label_container); |
| 247 | 245 |
| 248 // Only show the toggle if every request wants to show it. | 246 // Only show the toggle if every request wants to show it. |
| 249 show_persistence_toggle = show_persistence_toggle && | 247 show_persistence_toggle = show_persistence_toggle && |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 } | 486 } |
| 489 | 487 |
| 490 void PermissionPromptImpl::Deny() { | 488 void PermissionPromptImpl::Deny() { |
| 491 if (delegate_) | 489 if (delegate_) |
| 492 delegate_->Deny(); | 490 delegate_->Deny(); |
| 493 } | 491 } |
| 494 | 492 |
| 495 Profile* PermissionPromptImpl::GetProfile() { | 493 Profile* PermissionPromptImpl::GetProfile() { |
| 496 return browser_->profile(); | 494 return browser_->profile(); |
| 497 } | 495 } |
| OLD | NEW |