Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1206)

Unified Diff: chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc

Issue 2907983002: Allow dialogs to use a custom View as their title. (Closed)
Patch Set: comments 3 Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc
diff --git a/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc b/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc
index 5fc2333873b28c601d5060b02d6c02505ed8d1d2..7f44ed97cd3983c1cd3087ff9f90719282d06994 100644
--- a/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc
+++ b/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc
@@ -58,8 +58,8 @@ class PermissionsBubbleDialogDelegateView
// BubbleDialogDelegateView:
bool ShouldShowCloseButton() const override;
- const gfx::FontList& GetTitleFontList() const override;
base::string16 GetWindowTitle() const override;
+ void AddedToWidget() override;
void OnWidgetDestroying(views::Widget* widget) override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
bool Cancel() override;
@@ -150,17 +150,20 @@ bool PermissionsBubbleDialogDelegateView::ShouldShowCloseButton() const {
return true;
}
-const gfx::FontList& PermissionsBubbleDialogDelegateView::GetTitleFontList()
- const {
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- return rb.GetFontList(ui::ResourceBundle::BaseFont);
-}
-
base::string16 PermissionsBubbleDialogDelegateView::GetWindowTitle() const {
return l10n_util::GetStringFUTF16(IDS_PERMISSIONS_BUBBLE_PROMPT,
display_origin_);
}
+void PermissionsBubbleDialogDelegateView::AddedToWidget() {
+ views::Label* title =
+ views::BubbleFrameView::CreateDefaultTitleLabel(GetWindowTitle())
+ .release();
+ title->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList(
+ ui::ResourceBundle::BaseFont));
+ GetBubbleFrameView()->SetTitleView(title);
+}
+
void PermissionsBubbleDialogDelegateView::SizeToContents() {
BubbleDialogDelegateView::SizeToContents();
}

Powered by Google App Engine
This is Rietveld 408576698