| 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" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "chrome/browser/permissions/permission_request.h" | 12 #include "chrome/browser/permissions/permission_request.h" |
| 13 #include "chrome/browser/platform_util.h" | 13 #include "chrome/browser/platform_util.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
| 17 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" | 17 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
| 18 #include "chrome/browser/ui/views/website_settings/permission_selector_row.h" | 18 #include "chrome/browser/ui/views/website_settings/permission_selector_row.h" |
| 19 #include "chrome/browser/ui/views/website_settings/permission_selector_row_obser
ver.h" | 19 #include "chrome/browser/ui/views/website_settings/permission_selector_row_obser
ver.h" |
| 20 #include "chrome/grit/generated_resources.h" | 20 #include "chrome/grit/generated_resources.h" |
| 21 #include "components/strings/grit/components_strings.h" | 21 #include "components/strings/grit/components_strings.h" |
| 22 #include "components/url_formatter/elide_url.h" | 22 #include "components/url_formatter/elide_url.h" |
| 23 #include "components/url_formatter/url_formatter.h" |
| 23 #include "ui/accessibility/ax_view_state.h" | 24 #include "ui/accessibility/ax_view_state.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 25 #include "ui/base/models/combobox_model.h" | 26 #include "ui/base/models/combobox_model.h" |
| 26 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 27 #include "ui/gfx/color_palette.h" | 28 #include "ui/gfx/color_palette.h" |
| 28 #include "ui/gfx/paint_vector_icon.h" | 29 #include "ui/gfx/paint_vector_icon.h" |
| 29 #include "ui/gfx/text_constants.h" | 30 #include "ui/gfx/text_constants.h" |
| 30 #include "ui/gfx/vector_icons_public.h" | 31 #include "ui/gfx/vector_icons_public.h" |
| 31 #include "ui/views/bubble/bubble_dialog_delegate.h" | 32 #include "ui/views/bubble/bubble_dialog_delegate.h" |
| 32 #include "ui/views/bubble/bubble_frame_view.h" | 33 #include "ui/views/bubble/bubble_frame_view.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 DCHECK(!requests.empty()); | 195 DCHECK(!requests.empty()); |
| 195 | 196 |
| 196 set_close_on_deactivate(false); | 197 set_close_on_deactivate(false); |
| 197 | 198 |
| 198 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, | 199 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, |
| 199 kItemMajorSpacing)); | 200 kItemMajorSpacing)); |
| 200 | 201 |
| 201 display_origin_ = url_formatter::FormatUrlForSecurityDisplay( | 202 display_origin_ = url_formatter::FormatUrlForSecurityDisplay( |
| 202 requests[0]->GetOrigin(), | 203 requests[0]->GetOrigin(), |
| 203 url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC); | 204 url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC); |
| 205 if (base::IsStringASCII(display_origin_)) { |
| 206 display_origin_ = url_formatter::IDNToUnicode( |
| 207 base::UTF16ToASCII(display_origin_)); |
| 208 } |
| 204 | 209 |
| 205 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 210 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 206 bool show_persistence_toggle = true; | 211 bool show_persistence_toggle = true; |
| 207 for (size_t index = 0; index < requests.size(); index++) { | 212 for (size_t index = 0; index < requests.size(); index++) { |
| 208 DCHECK(index < accept_state.size()); | 213 DCHECK(index < accept_state.size()); |
| 209 // The row is laid out containing a leading-aligned label area and a | 214 // The row is laid out containing a leading-aligned label area and a |
| 210 // trailing column which will be filled if there are multiple permission | 215 // trailing column which will be filled if there are multiple permission |
| 211 // requests. | 216 // requests. |
| 212 views::View* row = new views::View(); | 217 views::View* row = new views::View(); |
| 213 views::GridLayout* row_layout = new views::GridLayout(row); | 218 views::GridLayout* row_layout = new views::GridLayout(row); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 481 |
| 477 void PermissionPromptImpl::Accept() { | 482 void PermissionPromptImpl::Accept() { |
| 478 if (delegate_) | 483 if (delegate_) |
| 479 delegate_->Accept(); | 484 delegate_->Accept(); |
| 480 } | 485 } |
| 481 | 486 |
| 482 void PermissionPromptImpl::Deny() { | 487 void PermissionPromptImpl::Deny() { |
| 483 if (delegate_) | 488 if (delegate_) |
| 484 delegate_->Deny(); | 489 delegate_->Deny(); |
| 485 } | 490 } |
| OLD | NEW |