| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/chooser_bubble_ui_view.h" | 5 #include "chrome/browser/ui/views/website_settings/chooser_bubble_ui_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" | 19 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
| 20 #include "chrome/browser/ui/views/frame/browser_view.h" | 20 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 21 #include "chrome/browser/ui/views/frame/top_container_view.h" | 21 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 22 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 22 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 23 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 23 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 24 #include "chrome/browser/ui/website_settings/chooser_bubble_controller.h" | 24 #include "chrome/browser/ui/website_settings/chooser_bubble_controller.h" |
| 25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/grit/generated_resources.h" | 26 #include "chrome/grit/generated_resources.h" |
| 27 #include "components/prefs/pref_service.h" | 27 #include "components/prefs/pref_service.h" |
| 28 #include "components/url_formatter/elide_url.h" |
| 28 #include "ui/accessibility/ax_view_state.h" | 29 #include "ui/accessibility/ax_view_state.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/base/resource/resource_bundle.h" | 31 #include "ui/base/resource/resource_bundle.h" |
| 31 #include "ui/gfx/paint_vector_icon.h" | 32 #include "ui/gfx/paint_vector_icon.h" |
| 32 #include "ui/gfx/text_constants.h" | 33 #include "ui/gfx/text_constants.h" |
| 33 #include "ui/gfx/vector_icons_public.h" | 34 #include "ui/gfx/vector_icons_public.h" |
| 34 #include "ui/views/bubble/bubble_dialog_delegate.h" | 35 #include "ui/views/bubble/bubble_dialog_delegate.h" |
| 35 #include "ui/views/bubble/bubble_frame_view.h" | 36 #include "ui/views/bubble/bubble_frame_view.h" |
| 36 #include "ui/views/controls/styled_label.h" | 37 #include "ui/views/controls/styled_label.h" |
| 37 #include "ui/views/controls/styled_label_listener.h" | 38 #include "ui/views/controls/styled_label_listener.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 chooser_table_model_->SetObserver(nullptr); | 187 chooser_table_model_->SetObserver(nullptr); |
| 187 } | 188 } |
| 188 | 189 |
| 189 bool ChooserBubbleUiViewDelegate::ShouldShowWindowTitle() const { | 190 bool ChooserBubbleUiViewDelegate::ShouldShowWindowTitle() const { |
| 190 return true; | 191 return true; |
| 191 } | 192 } |
| 192 | 193 |
| 193 base::string16 ChooserBubbleUiViewDelegate::GetWindowTitle() const { | 194 base::string16 ChooserBubbleUiViewDelegate::GetWindowTitle() const { |
| 194 return l10n_util::GetStringFUTF16( | 195 return l10n_util::GetStringFUTF16( |
| 195 IDS_CHOOSER_BUBBLE_PROMPT, | 196 IDS_CHOOSER_BUBBLE_PROMPT, |
| 196 base::ASCIIToUTF16(controller_->GetOrigin().Serialize())); | 197 url_formatter::FormatOriginForSecurityDisplay( |
| 198 controller_->GetOrigin(), |
| 199 url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC)); |
| 197 } | 200 } |
| 198 | 201 |
| 199 base::string16 ChooserBubbleUiViewDelegate::GetDialogButtonLabel( | 202 base::string16 ChooserBubbleUiViewDelegate::GetDialogButtonLabel( |
| 200 ui::DialogButton button) const { | 203 ui::DialogButton button) const { |
| 201 return l10n_util::GetStringUTF16(button == ui::DIALOG_BUTTON_OK | 204 return l10n_util::GetStringUTF16(button == ui::DIALOG_BUTTON_OK |
| 202 ? IDS_CHOOSER_BUBBLE_CONNECT_BUTTON_TEXT | 205 ? IDS_CHOOSER_BUBBLE_CONNECT_BUTTON_TEXT |
| 203 : IDS_CHOOSER_BUBBLE_CANCEL_BUTTON_TEXT); | 206 : IDS_CHOOSER_BUBBLE_CANCEL_BUTTON_TEXT); |
| 204 } | 207 } |
| 205 | 208 |
| 206 bool ChooserBubbleUiViewDelegate::IsDialogButtonEnabled( | 209 bool ChooserBubbleUiViewDelegate::IsDialogButtonEnabled( |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 return browser_view->exclusive_access_bubble()->GetView(); | 384 return browser_view->exclusive_access_bubble()->GetView(); |
| 382 | 385 |
| 383 return browser_view->top_container(); | 386 return browser_view->top_container(); |
| 384 } | 387 } |
| 385 | 388 |
| 386 views::BubbleBorder::Arrow ChooserBubbleUiView::GetAnchorArrow() { | 389 views::BubbleBorder::Arrow ChooserBubbleUiView::GetAnchorArrow() { |
| 387 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) | 390 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) |
| 388 return views::BubbleBorder::TOP_LEFT; | 391 return views::BubbleBorder::TOP_LEFT; |
| 389 return views::BubbleBorder::NONE; | 392 return views::BubbleBorder::NONE; |
| 390 } | 393 } |
| OLD | NEW |