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