| 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 "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" | 18 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
| 19 #include "chrome/browser/ui/views/frame/browser_view.h" | 19 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 20 #include "chrome/browser/ui/views/frame/top_container_view.h" | 20 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 21 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 21 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 22 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 22 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 23 #include "chrome/browser/ui/website_settings/chooser_bubble_controller.h" | 23 #include "chrome/browser/ui/website_settings/chooser_bubble_controller.h" |
| 24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/grit/generated_resources.h" | 25 #include "chrome/grit/generated_resources.h" |
| 26 #include "components/prefs/pref_service.h" | 26 #include "components/prefs/pref_service.h" |
| 27 #include "components/url_formatter/elide_url.h" |
| 27 #include "ui/accessibility/ax_view_state.h" | 28 #include "ui/accessibility/ax_view_state.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "ui/gfx/paint_vector_icon.h" | 31 #include "ui/gfx/paint_vector_icon.h" |
| 31 #include "ui/gfx/text_constants.h" | 32 #include "ui/gfx/text_constants.h" |
| 32 #include "ui/gfx/vector_icons_public.h" | 33 #include "ui/gfx/vector_icons_public.h" |
| 33 #include "ui/views/bubble/bubble_dialog_delegate.h" | 34 #include "ui/views/bubble/bubble_dialog_delegate.h" |
| 34 #include "ui/views/bubble/bubble_frame_view.h" | 35 #include "ui/views/bubble/bubble_frame_view.h" |
| 35 #include "ui/views/controls/styled_label.h" | 36 #include "ui/views/controls/styled_label.h" |
| 36 #include "ui/views/controls/styled_label_listener.h" | 37 #include "ui/views/controls/styled_label_listener.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 183 |
| 183 ChooserBubbleUiViewDelegate::~ChooserBubbleUiViewDelegate() { | 184 ChooserBubbleUiViewDelegate::~ChooserBubbleUiViewDelegate() { |
| 184 chooser_table_model_->SetObserver(nullptr); | 185 chooser_table_model_->SetObserver(nullptr); |
| 185 } | 186 } |
| 186 | 187 |
| 187 bool ChooserBubbleUiViewDelegate::ShouldShowWindowTitle() const { | 188 bool ChooserBubbleUiViewDelegate::ShouldShowWindowTitle() const { |
| 188 return true; | 189 return true; |
| 189 } | 190 } |
| 190 | 191 |
| 191 base::string16 ChooserBubbleUiViewDelegate::GetWindowTitle() const { | 192 base::string16 ChooserBubbleUiViewDelegate::GetWindowTitle() const { |
| 192 return l10n_util::GetStringUTF16(IDS_CHOOSER_BUBBLE_PROMPT); | 193 return l10n_util::GetStringFUTF16( |
| 194 IDS_CHOOSER_BUBBLE_PROMPT, |
| 195 url_formatter::FormatUrlForSecurityDisplay(controller_->GetOriginUrl())); |
| 193 } | 196 } |
| 194 | 197 |
| 195 base::string16 ChooserBubbleUiViewDelegate::GetDialogButtonLabel( | 198 base::string16 ChooserBubbleUiViewDelegate::GetDialogButtonLabel( |
| 196 ui::DialogButton button) const { | 199 ui::DialogButton button) const { |
| 197 return l10n_util::GetStringUTF16(button == ui::DIALOG_BUTTON_OK | 200 return l10n_util::GetStringUTF16(button == ui::DIALOG_BUTTON_OK |
| 198 ? IDS_CHOOSER_BUBBLE_CONNECT_BUTTON_TEXT | 201 ? IDS_CHOOSER_BUBBLE_CONNECT_BUTTON_TEXT |
| 199 : IDS_CHOOSER_BUBBLE_CANCEL_BUTTON_TEXT); | 202 : IDS_CHOOSER_BUBBLE_CANCEL_BUTTON_TEXT); |
| 200 } | 203 } |
| 201 | 204 |
| 202 bool ChooserBubbleUiViewDelegate::IsDialogButtonEnabled( | 205 bool ChooserBubbleUiViewDelegate::IsDialogButtonEnabled( |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 return browser_view->exclusive_access_bubble()->GetView(); | 380 return browser_view->exclusive_access_bubble()->GetView(); |
| 378 | 381 |
| 379 return browser_view->top_container(); | 382 return browser_view->top_container(); |
| 380 } | 383 } |
| 381 | 384 |
| 382 views::BubbleBorder::Arrow ChooserBubbleUiView::GetAnchorArrow() { | 385 views::BubbleBorder::Arrow ChooserBubbleUiView::GetAnchorArrow() { |
| 383 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) | 386 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) |
| 384 return views::BubbleBorder::TOP_LEFT; | 387 return views::BubbleBorder::TOP_LEFT; |
| 385 return views::BubbleBorder::NONE; | 388 return views::BubbleBorder::NONE; |
| 386 } | 389 } |
| OLD | NEW |