| 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/permission_bubble/permission_prompt_impl.h" | 5 #include "chrome/browser/ui/views/permission_bubble/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_dialogs.h" |
| 16 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
| 17 #include "chrome/browser/ui/layout_constants.h" | 18 #include "chrome/browser/ui/layout_constants.h" |
| 18 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" | 19 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
| 19 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | 20 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 20 #include "chrome/browser/ui/views/page_info/permission_selector_row.h" | 21 #include "chrome/browser/ui/views/page_info/permission_selector_row.h" |
| 21 #include "chrome/browser/ui/views/page_info/permission_selector_row_observer.h" | 22 #include "chrome/browser/ui/views/page_info/permission_selector_row_observer.h" |
| 22 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
| 23 #include "components/strings/grit/components_strings.h" | 24 #include "components/strings/grit/components_strings.h" |
| 24 #include "components/url_formatter/elide_url.h" | 25 #include "components/url_formatter/elide_url.h" |
| 25 #include "ui/accessibility/ax_node_data.h" | 26 #include "ui/accessibility/ax_node_data.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 AddChildView(row); | 256 AddChildView(row); |
| 256 } | 257 } |
| 257 | 258 |
| 258 if (show_persistence_toggle) { | 259 if (show_persistence_toggle) { |
| 259 persist_checkbox_ = new views::Checkbox( | 260 persist_checkbox_ = new views::Checkbox( |
| 260 l10n_util::GetStringUTF16(IDS_PERMISSIONS_BUBBLE_PERSIST_TEXT)); | 261 l10n_util::GetStringUTF16(IDS_PERMISSIONS_BUBBLE_PERSIST_TEXT)); |
| 261 persist_checkbox_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 262 persist_checkbox_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 262 persist_checkbox_->SetChecked(true); | 263 persist_checkbox_->SetChecked(true); |
| 263 AddChildView(persist_checkbox_); | 264 AddChildView(persist_checkbox_); |
| 264 } | 265 } |
| 266 chrome::RecordDialogCreation(chrome::DialogIdentifier::PERMISSIONS); |
| 265 } | 267 } |
| 266 | 268 |
| 267 PermissionsBubbleDialogDelegateView::~PermissionsBubbleDialogDelegateView() { | 269 PermissionsBubbleDialogDelegateView::~PermissionsBubbleDialogDelegateView() { |
| 268 if (owner_) | 270 if (owner_) |
| 269 owner_->Closing(); | 271 owner_->Closing(); |
| 270 } | 272 } |
| 271 | 273 |
| 272 void PermissionsBubbleDialogDelegateView::CloseBubble() { | 274 void PermissionsBubbleDialogDelegateView::CloseBubble() { |
| 273 owner_ = nullptr; | 275 owner_ = nullptr; |
| 274 GetWidget()->Close(); | 276 GetWidget()->Close(); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 } | 488 } |
| 487 | 489 |
| 488 void PermissionPromptImpl::Deny() { | 490 void PermissionPromptImpl::Deny() { |
| 489 if (delegate_) | 491 if (delegate_) |
| 490 delegate_->Deny(); | 492 delegate_->Deny(); |
| 491 } | 493 } |
| 492 | 494 |
| 493 Profile* PermissionPromptImpl::GetProfile() { | 495 Profile* PermissionPromptImpl::GetProfile() { |
| 494 return browser_->profile(); | 496 return browser_->profile(); |
| 495 } | 497 } |
| OLD | NEW |