| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "chrome/browser/download/download_danger_prompt.h" | 6 #include "chrome/browser/download/download_danger_prompt.h" |
| 7 #include "chrome/browser/download/download_stats.h" | 7 #include "chrome/browser/download/download_stats.h" |
| 8 #include "chrome/browser/ui/views/constrained_window_views.h" | 8 #include "chrome/browser/ui/views/constrained_window_views.h" |
| 9 #include "components/web_modal/web_contents_modal_dialog_host.h" | 9 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 10 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 10 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 11 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 11 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/download_danger_type.h" | 13 #include "content/public/browser/download_danger_type.h" |
| 14 #include "content/public/browser/download_item.h" | 14 #include "content/public/browser/download_item.h" |
| 15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 16 #include "grit/chromium_strings.h" | 16 #include "grit/chromium_strings.h" |
| 17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "ui/views/controls/button/label_button.h" | 20 #include "ui/views/controls/button/label_button.h" |
| 20 #include "ui/views/controls/label.h" | 21 #include "ui/views/controls/label.h" |
| 21 #include "ui/views/layout/grid_layout.h" | 22 #include "ui/views/layout/grid_layout.h" |
| 22 #include "ui/views/view.h" | 23 #include "ui/views/view.h" |
| 23 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
| 24 #include "ui/views/window/dialog_client_view.h" | 25 #include "ui/views/window/dialog_client_view.h" |
| 25 #include "ui/views/window/dialog_delegate.h" | 26 #include "ui/views/window/dialog_delegate.h" |
| 26 | 27 |
| 27 using content::BrowserThread; | 28 using content::BrowserThread; |
| 28 using web_modal::WebContentsModalDialogManager; | 29 using web_modal::WebContentsModalDialogManager; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 views::GridLayout* layout = views::GridLayout::CreatePanel(contents_view_); | 104 views::GridLayout* layout = views::GridLayout::CreatePanel(contents_view_); |
| 104 contents_view_->SetLayoutManager(layout); | 105 contents_view_->SetLayoutManager(layout); |
| 105 | 106 |
| 106 views::ColumnSet* column_set = layout->AddColumnSet(0); | 107 views::ColumnSet* column_set = layout->AddColumnSet(0); |
| 107 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, | 108 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, |
| 108 views::GridLayout::FIXED, kMessageWidth, 0); | 109 views::GridLayout::FIXED, kMessageWidth, 0); |
| 109 | 110 |
| 110 const base::string16 message_lead = GetMessageLead(); | 111 const base::string16 message_lead = GetMessageLead(); |
| 111 | 112 |
| 112 if (!message_lead.empty()) { | 113 if (!message_lead.empty()) { |
| 113 views::Label* message_lead_label = new views::Label(message_lead); | 114 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 115 views::Label* message_lead_label = new views::Label( |
| 116 message_lead, rb->GetFontList(ui::ResourceBundle::BoldFont)); |
| 114 message_lead_label->SetMultiLine(true); | 117 message_lead_label->SetMultiLine(true); |
| 115 message_lead_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 118 message_lead_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 116 message_lead_label->SetAllowCharacterBreak(true); | 119 message_lead_label->SetAllowCharacterBreak(true); |
| 117 | 120 |
| 118 gfx::FontList font_list(gfx::Font().DeriveFont(0, gfx::Font::BOLD)); | |
| 119 message_lead_label->SetFontList(font_list); | |
| 120 | |
| 121 layout->StartRow(0, 0); | 121 layout->StartRow(0, 0); |
| 122 layout->AddView(message_lead_label); | 122 layout->AddView(message_lead_label); |
| 123 | 123 |
| 124 layout->AddPaddingRow(0, kParagraphPadding); | 124 layout->AddPaddingRow(0, kParagraphPadding); |
| 125 } | 125 } |
| 126 | 126 |
| 127 views::Label* message_body_label = new views::Label(GetMessageBody()); | 127 views::Label* message_body_label = new views::Label(GetMessageBody()); |
| 128 message_body_label->SetMultiLine(true); | 128 message_body_label->SetMultiLine(true); |
| 129 message_body_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 129 message_body_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 130 message_body_label->SetAllowCharacterBreak(true); | 130 message_body_label->SetAllowCharacterBreak(true); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 WebContentsModalDialogManagerDelegate* modal_delegate = | 369 WebContentsModalDialogManagerDelegate* modal_delegate = |
| 370 web_contents_modal_dialog_manager->delegate(); | 370 web_contents_modal_dialog_manager->delegate(); |
| 371 CHECK(modal_delegate); | 371 CHECK(modal_delegate); |
| 372 views::Widget* dialog = views::Widget::CreateWindowAsFramelessChild( | 372 views::Widget* dialog = views::Widget::CreateWindowAsFramelessChild( |
| 373 download_danger_prompt, | 373 download_danger_prompt, |
| 374 modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); | 374 modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); |
| 375 web_contents_modal_dialog_manager->ShowDialog(dialog->GetNativeView()); | 375 web_contents_modal_dialog_manager->ShowDialog(dialog->GetNativeView()); |
| 376 | 376 |
| 377 return download_danger_prompt; | 377 return download_danger_prompt; |
| 378 } | 378 } |
| OLD | NEW |