| 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 "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.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/frame/browser_view.h" | 20 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 20 #include "chrome/browser/ui/views/frame/top_container_view.h" | 21 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 21 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 22 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 22 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 23 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 23 #include "chrome/browser/ui/website_settings/chooser_bubble_controller.h" | 24 #include "chrome/browser/ui/website_settings/chooser_bubble_controller.h" |
| 24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/grit/generated_resources.h" | 26 #include "chrome/grit/generated_resources.h" |
| 26 #include "components/prefs/pref_service.h" | 27 #include "components/prefs/pref_service.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" |
| 37 #include "ui/views/controls/table/table_view.h" | 38 #include "ui/views/controls/table/table_view.h" |
| 38 #include "ui/views/controls/table/table_view_observer.h" | 39 #include "ui/views/controls/table/table_view_observer.h" |
| 39 #include "ui/views/layout/grid_layout.h" | 40 #include "ui/views/layout/grid_layout.h" |
| 40 #include "ui/views/window/dialog_client_view.h" | 41 #include "ui/views/window/dialog_client_view.h" |
| 42 #include "url/origin.h" |
| 41 | 43 |
| 42 namespace { | 44 namespace { |
| 43 | 45 |
| 44 // Chooser permission bubble width | 46 // Chooser permission bubble width |
| 45 const int kChooserPermissionBubbleWidth = 300; | 47 const int kChooserPermissionBubbleWidth = 300; |
| 46 | 48 |
| 47 // Chooser permission bubble height | 49 // Chooser permission bubble height |
| 48 const int kChooserPermissionBubbleHeight = 200; | 50 const int kChooserPermissionBubbleHeight = 200; |
| 49 | 51 |
| 50 } // namespace | 52 } // namespace |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 184 |
| 183 ChooserBubbleUiViewDelegate::~ChooserBubbleUiViewDelegate() { | 185 ChooserBubbleUiViewDelegate::~ChooserBubbleUiViewDelegate() { |
| 184 chooser_table_model_->SetObserver(nullptr); | 186 chooser_table_model_->SetObserver(nullptr); |
| 185 } | 187 } |
| 186 | 188 |
| 187 bool ChooserBubbleUiViewDelegate::ShouldShowWindowTitle() const { | 189 bool ChooserBubbleUiViewDelegate::ShouldShowWindowTitle() const { |
| 188 return true; | 190 return true; |
| 189 } | 191 } |
| 190 | 192 |
| 191 base::string16 ChooserBubbleUiViewDelegate::GetWindowTitle() const { | 193 base::string16 ChooserBubbleUiViewDelegate::GetWindowTitle() const { |
| 192 return l10n_util::GetStringUTF16(IDS_CHOOSER_BUBBLE_PROMPT); | 194 return l10n_util::GetStringFUTF16( |
| 195 IDS_CHOOSER_BUBBLE_PROMPT, |
| 196 base::ASCIIToUTF16(controller_->GetOrigin().Serialize())); |
| 193 } | 197 } |
| 194 | 198 |
| 195 base::string16 ChooserBubbleUiViewDelegate::GetDialogButtonLabel( | 199 base::string16 ChooserBubbleUiViewDelegate::GetDialogButtonLabel( |
| 196 ui::DialogButton button) const { | 200 ui::DialogButton button) const { |
| 197 return l10n_util::GetStringUTF16(button == ui::DIALOG_BUTTON_OK | 201 return l10n_util::GetStringUTF16(button == ui::DIALOG_BUTTON_OK |
| 198 ? IDS_CHOOSER_BUBBLE_CONNECT_BUTTON_TEXT | 202 ? IDS_CHOOSER_BUBBLE_CONNECT_BUTTON_TEXT |
| 199 : IDS_CHOOSER_BUBBLE_CANCEL_BUTTON_TEXT); | 203 : IDS_CHOOSER_BUBBLE_CANCEL_BUTTON_TEXT); |
| 200 } | 204 } |
| 201 | 205 |
| 202 bool ChooserBubbleUiViewDelegate::IsDialogButtonEnabled( | 206 bool ChooserBubbleUiViewDelegate::IsDialogButtonEnabled( |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 return browser_view->exclusive_access_bubble()->GetView(); | 381 return browser_view->exclusive_access_bubble()->GetView(); |
| 378 | 382 |
| 379 return browser_view->top_container(); | 383 return browser_view->top_container(); |
| 380 } | 384 } |
| 381 | 385 |
| 382 views::BubbleBorder::Arrow ChooserBubbleUiView::GetAnchorArrow() { | 386 views::BubbleBorder::Arrow ChooserBubbleUiView::GetAnchorArrow() { |
| 383 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) | 387 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) |
| 384 return views::BubbleBorder::TOP_LEFT; | 388 return views::BubbleBorder::TOP_LEFT; |
| 385 return views::BubbleBorder::NONE; | 389 return views::BubbleBorder::NONE; |
| 386 } | 390 } |
| OLD | NEW |