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/gfx/vector_icons_public2.h" | 28 #include "ui/gfx/vector_icons_public2.h" |
29 #include "ui/native_theme/common_theme.h" | 29 #include "ui/native_theme/common_theme.h" |
30 #include "ui/native_theme/native_theme.h" | 30 #include "ui/native_theme/native_theme.h" |
31 #include "ui/views/bubble/bubble_delegate.h" | 31 #include "ui/views/bubble/bubble_delegate.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 DCHECK(!requests.empty()); | 209 DCHECK(!requests.empty()); |
210 | 210 |
211 RemoveAllChildViews(true); | 211 RemoveAllChildViews(true); |
212 customize_comboboxes_.clear(); | 212 customize_comboboxes_.clear(); |
213 set_close_on_esc(true); | 213 set_close_on_esc(true); |
214 set_close_on_deactivate(false); | 214 set_close_on_deactivate(false); |
215 | 215 |
216 SetLayoutManager(new views::BoxLayout( | 216 SetLayoutManager(new views::BoxLayout( |
217 views::BoxLayout::kVertical, kBubbleOuterMargin, 0, kItemMajorSpacing)); | 217 views::BoxLayout::kVertical, kBubbleOuterMargin, 0, kItemMajorSpacing)); |
218 | 218 |
219 hostname_ = net::FormatUrl(requests[0]->GetRequestingHostname(), | 219 hostname_ = url_formatter::FormatUrl( |
220 languages, | 220 requests[0]->GetRequestingHostname(), languages, |
221 net::kFormatUrlOmitUsernamePassword | | 221 url_formatter::kFormatUrlOmitUsernamePassword | |
222 net::kFormatUrlOmitTrailingSlashOnBareHostname, | 222 url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, |
223 net::UnescapeRule::SPACES, | 223 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); |
224 nullptr, nullptr, nullptr); | |
225 | 224 |
226 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 225 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
227 for (size_t index = 0; index < requests.size(); index++) { | 226 for (size_t index = 0; index < requests.size(); index++) { |
228 DCHECK(index < accept_state.size()); | 227 DCHECK(index < accept_state.size()); |
229 // The row is laid out containing a leading-aligned label area and a | 228 // The row is laid out containing a leading-aligned label area and a |
230 // trailing column which will be filled if there are multiple permission | 229 // trailing column which will be filled if there are multiple permission |
231 // requests. | 230 // requests. |
232 views::View* row = new views::View(); | 231 views::View* row = new views::View(); |
233 views::GridLayout* row_layout = new views::GridLayout(row); | 232 views::GridLayout* row_layout = new views::GridLayout(row); |
234 row->SetLayoutManager(row_layout); | 233 row->SetLayoutManager(row_layout); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 | 505 |
507 void PermissionBubbleViewViews::Accept() { | 506 void PermissionBubbleViewViews::Accept() { |
508 if (delegate_) | 507 if (delegate_) |
509 delegate_->Accept(); | 508 delegate_->Accept(); |
510 } | 509 } |
511 | 510 |
512 void PermissionBubbleViewViews::Deny() { | 511 void PermissionBubbleViewViews::Deny() { |
513 if (delegate_) | 512 if (delegate_) |
514 delegate_->Deny(); | 513 delegate_->Deny(); |
515 } | 514 } |
OLD | NEW |