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/permission_bubble/permission_prompt_impl.h" | 5 #include "chrome/browser/ui/views/permission_bubble/permission_prompt_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 PermissionsBubbleDialogDelegateView( | 52 PermissionsBubbleDialogDelegateView( |
53 PermissionPromptImpl* owner, | 53 PermissionPromptImpl* owner, |
54 const std::vector<PermissionRequest*>& requests); | 54 const std::vector<PermissionRequest*>& requests); |
55 ~PermissionsBubbleDialogDelegateView() override; | 55 ~PermissionsBubbleDialogDelegateView() override; |
56 | 56 |
57 void CloseBubble(); | 57 void CloseBubble(); |
58 void SizeToContents(); | 58 void SizeToContents(); |
59 | 59 |
60 // BubbleDialogDelegateView: | 60 // BubbleDialogDelegateView: |
61 bool ShouldShowCloseButton() const override; | 61 bool ShouldShowCloseButton() const override; |
62 const gfx::FontList& GetTitleFontList() const override; | |
63 base::string16 GetWindowTitle() const override; | 62 base::string16 GetWindowTitle() const override; |
| 63 views::View* CreateTitleView(const base::string16& title_text) override; |
64 void OnWidgetDestroying(views::Widget* widget) override; | 64 void OnWidgetDestroying(views::Widget* widget) override; |
65 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 65 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
66 bool Cancel() override; | 66 bool Cancel() override; |
67 bool Accept() override; | 67 bool Accept() override; |
68 bool Close() override; | 68 bool Close() override; |
69 int GetDefaultDialogButton() const override; | 69 int GetDefaultDialogButton() const override; |
70 int GetDialogButtons() const override; | 70 int GetDialogButtons() const override; |
71 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 71 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
72 | 72 |
73 // Updates the anchor's arrow and view. Also repositions the bubble so it's | 73 // Updates the anchor's arrow and view. Also repositions the bubble so it's |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 void PermissionsBubbleDialogDelegateView::CloseBubble() { | 144 void PermissionsBubbleDialogDelegateView::CloseBubble() { |
145 owner_ = nullptr; | 145 owner_ = nullptr; |
146 GetWidget()->Close(); | 146 GetWidget()->Close(); |
147 } | 147 } |
148 | 148 |
149 bool PermissionsBubbleDialogDelegateView::ShouldShowCloseButton() const { | 149 bool PermissionsBubbleDialogDelegateView::ShouldShowCloseButton() const { |
150 return true; | 150 return true; |
151 } | 151 } |
152 | 152 |
153 const gfx::FontList& PermissionsBubbleDialogDelegateView::GetTitleFontList() | |
154 const { | |
155 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | |
156 return rb.GetFontList(ui::ResourceBundle::BaseFont); | |
157 } | |
158 | |
159 base::string16 PermissionsBubbleDialogDelegateView::GetWindowTitle() const { | 153 base::string16 PermissionsBubbleDialogDelegateView::GetWindowTitle() const { |
160 return l10n_util::GetStringFUTF16(IDS_PERMISSIONS_BUBBLE_PROMPT, | 154 return l10n_util::GetStringFUTF16(IDS_PERMISSIONS_BUBBLE_PROMPT, |
161 display_origin_); | 155 display_origin_); |
162 } | 156 } |
163 | 157 |
| 158 views::View* PermissionsBubbleDialogDelegateView::CreateTitleView( |
| 159 const base::string16& title_text) { |
| 160 views::Label* title = |
| 161 views::BubbleFrameView::CreateDefaultTitleLabel(title_text); |
| 162 title->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
| 163 ui::ResourceBundle::BaseFont)); |
| 164 return title; |
| 165 } |
| 166 |
164 void PermissionsBubbleDialogDelegateView::SizeToContents() { | 167 void PermissionsBubbleDialogDelegateView::SizeToContents() { |
165 BubbleDialogDelegateView::SizeToContents(); | 168 BubbleDialogDelegateView::SizeToContents(); |
166 } | 169 } |
167 | 170 |
168 void PermissionsBubbleDialogDelegateView::OnWidgetDestroying( | 171 void PermissionsBubbleDialogDelegateView::OnWidgetDestroying( |
169 views::Widget* widget) { | 172 views::Widget* widget) { |
170 views::BubbleDialogDelegateView::OnWidgetDestroying(widget); | 173 views::BubbleDialogDelegateView::OnWidgetDestroying(widget); |
171 if (owner_) { | 174 if (owner_) { |
172 owner_->Closing(); | 175 owner_->Closing(); |
173 owner_ = nullptr; | 176 owner_ = nullptr; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 | 337 |
335 void PermissionPromptImpl::Accept() { | 338 void PermissionPromptImpl::Accept() { |
336 if (delegate_) | 339 if (delegate_) |
337 delegate_->Accept(); | 340 delegate_->Accept(); |
338 } | 341 } |
339 | 342 |
340 void PermissionPromptImpl::Deny() { | 343 void PermissionPromptImpl::Deny() { |
341 if (delegate_) | 344 if (delegate_) |
342 delegate_->Deny(); | 345 delegate_->Deny(); |
343 } | 346 } |
OLD | NEW |