| 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/permissions_bubble_view.h" | 5 #include "chrome/browser/ui/views/website_settings/permissions_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" | 11 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
| 12 #include "chrome/browser/ui/views/frame/browser_view.h" | 12 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 13 #include "chrome/browser/ui/views/frame/top_container_view.h" | 13 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 14 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 14 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 15 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 15 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 16 #include "chrome/browser/ui/views/website_settings/permission_selector_view.h" | 16 #include "chrome/browser/ui/views/website_settings/permission_selector_view.h" |
| 17 #include "chrome/browser/ui/views/website_settings/permission_selector_view_obse
rver.h" | 17 #include "chrome/browser/ui/views/website_settings/permission_selector_view_obse
rver.h" |
| 18 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" | 18 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" |
| 19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| 20 #include "chrome/grit/generated_resources.h" | 20 #include "chrome/grit/generated_resources.h" |
| 21 #include "net/base/net_util.h" | 21 #include "components/url_formatter/url_formatter.h" |
| 22 #include "ui/accessibility/ax_view_state.h" | 22 #include "ui/accessibility/ax_view_state.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/models/combobox_model.h" | 24 #include "ui/base/models/combobox_model.h" |
| 25 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
| 26 #include "ui/gfx/paint_vector_icon.h" | 26 #include "ui/gfx/paint_vector_icon.h" |
| 27 #include "ui/gfx/text_constants.h" | 27 #include "ui/gfx/text_constants.h" |
| 28 #include "ui/views/bubble/bubble_delegate.h" | 28 #include "ui/views/bubble/bubble_delegate.h" |
| 29 #include "ui/views/bubble/bubble_frame_view.h" | 29 #include "ui/views/bubble/bubble_frame_view.h" |
| 30 #include "ui/views/controls/button/checkbox.h" | 30 #include "ui/views/controls/button/checkbox.h" |
| 31 #include "ui/views/controls/button/label_button.h" | 31 #include "ui/views/controls/button/label_button.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 DCHECK(!requests.empty()); | 206 DCHECK(!requests.empty()); |
| 207 | 207 |
| 208 RemoveAllChildViews(true); | 208 RemoveAllChildViews(true); |
| 209 customize_comboboxes_.clear(); | 209 customize_comboboxes_.clear(); |
| 210 set_close_on_esc(true); | 210 set_close_on_esc(true); |
| 211 set_close_on_deactivate(false); | 211 set_close_on_deactivate(false); |
| 212 | 212 |
| 213 SetLayoutManager(new views::BoxLayout( | 213 SetLayoutManager(new views::BoxLayout( |
| 214 views::BoxLayout::kVertical, kBubbleOuterMargin, 0, kItemMajorSpacing)); | 214 views::BoxLayout::kVertical, kBubbleOuterMargin, 0, kItemMajorSpacing)); |
| 215 | 215 |
| 216 hostname_ = net::FormatUrl(requests[0]->GetRequestingHostname(), | 216 hostname_ = url_formatter::FormatUrl( |
| 217 languages, | 217 requests[0]->GetRequestingHostname(), languages, |
| 218 net::kFormatUrlOmitUsernamePassword | | 218 url_formatter::kFormatUrlOmitUsernamePassword | |
| 219 net::kFormatUrlOmitTrailingSlashOnBareHostname, | 219 url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, |
| 220 net::UnescapeRule::SPACES, | 220 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); |
| 221 nullptr, nullptr, nullptr); | |
| 222 | 221 |
| 223 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 222 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 224 for (size_t index = 0; index < requests.size(); index++) { | 223 for (size_t index = 0; index < requests.size(); index++) { |
| 225 DCHECK(index < accept_state.size()); | 224 DCHECK(index < accept_state.size()); |
| 226 // The row is laid out containing a leading-aligned label area and a | 225 // The row is laid out containing a leading-aligned label area and a |
| 227 // trailing column which will be filled if there are multiple permission | 226 // trailing column which will be filled if there are multiple permission |
| 228 // requests. | 227 // requests. |
| 229 views::View* row = new views::View(); | 228 views::View* row = new views::View(); |
| 230 views::GridLayout* row_layout = new views::GridLayout(row); | 229 views::GridLayout* row_layout = new views::GridLayout(row); |
| 231 row->SetLayoutManager(row_layout); | 230 row->SetLayoutManager(row_layout); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 | 501 |
| 503 void PermissionBubbleViewViews::Accept() { | 502 void PermissionBubbleViewViews::Accept() { |
| 504 if (delegate_) | 503 if (delegate_) |
| 505 delegate_->Accept(); | 504 delegate_->Accept(); |
| 506 } | 505 } |
| 507 | 506 |
| 508 void PermissionBubbleViewViews::Deny() { | 507 void PermissionBubbleViewViews::Deny() { |
| 509 if (delegate_) | 508 if (delegate_) |
| 510 delegate_->Deny(); | 509 delegate_->Deny(); |
| 511 } | 510 } |
| OLD | NEW |