OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/extension_install_dialog_view.h" | 5 #include "chrome/browser/ui/views/extensions/extension_install_dialog_view.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 base::string16 PrepareForDisplay(const base::string16& message, | 98 base::string16 PrepareForDisplay(const base::string16& message, |
99 bool bullet_point) { | 99 bool bullet_point) { |
100 return bullet_point ? l10n_util::GetStringFUTF16( | 100 return bullet_point ? l10n_util::GetStringFUTF16( |
101 IDS_EXTENSION_PERMISSION_LINE, | 101 IDS_EXTENSION_PERMISSION_LINE, |
102 message) : message; | 102 message) : message; |
103 } | 103 } |
104 | 104 |
105 void ShowExtensionInstallDialogImpl( | 105 void ShowExtensionInstallDialogImpl( |
106 ExtensionInstallPromptShowParams* show_params, | 106 ExtensionInstallPromptShowParams* show_params, |
107 const ExtensionInstallPrompt::DoneCallback& done_callback, | 107 const ExtensionInstallPrompt::DoneCallback& done_callback, |
108 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt) { | 108 std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt) { |
109 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 109 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
110 bool use_tab_modal_dialog = prompt->ShouldUseTabModalDialog(); | 110 bool use_tab_modal_dialog = prompt->ShouldUseTabModalDialog(); |
111 ExtensionInstallDialogView* dialog = new ExtensionInstallDialogView( | 111 ExtensionInstallDialogView* dialog = new ExtensionInstallDialogView( |
112 show_params->profile(), show_params->GetParentWebContents(), | 112 show_params->profile(), show_params->GetParentWebContents(), |
113 done_callback, std::move(prompt)); | 113 done_callback, std::move(prompt)); |
114 if (use_tab_modal_dialog) { | 114 if (use_tab_modal_dialog) { |
115 content::WebContents* parent_web_contents = | 115 content::WebContents* parent_web_contents = |
116 show_params->GetParentWebContents(); | 116 show_params->GetParentWebContents(); |
117 if (parent_web_contents) | 117 if (parent_web_contents) |
118 constrained_window::ShowWebModalDialogViews(dialog, parent_web_contents); | 118 constrained_window::ShowWebModalDialogViews(dialog, parent_web_contents); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 image_view->SetImageSize(size); | 193 image_view->SetImageSize(size); |
194 | 194 |
195 layout->AddView(image_view); | 195 layout->AddView(image_view); |
196 layout->AddView(view); | 196 layout->AddView(view); |
197 } | 197 } |
198 | 198 |
199 ExtensionInstallDialogView::ExtensionInstallDialogView( | 199 ExtensionInstallDialogView::ExtensionInstallDialogView( |
200 Profile* profile, | 200 Profile* profile, |
201 content::PageNavigator* navigator, | 201 content::PageNavigator* navigator, |
202 const ExtensionInstallPrompt::DoneCallback& done_callback, | 202 const ExtensionInstallPrompt::DoneCallback& done_callback, |
203 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt) | 203 std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt) |
204 : profile_(profile), | 204 : profile_(profile), |
205 navigator_(navigator), | 205 navigator_(navigator), |
206 done_callback_(done_callback), | 206 done_callback_(done_callback), |
207 prompt_(std::move(prompt)), | 207 prompt_(std::move(prompt)), |
208 container_(NULL), | 208 container_(NULL), |
209 scroll_view_(NULL), | 209 scroll_view_(NULL), |
210 handled_result_(false) { | 210 handled_result_(false) { |
211 InitView(); | 211 InitView(); |
212 } | 212 } |
213 | 213 |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 expanded ? gfx::VectorIconId::FIND_PREV : gfx::VectorIconId::FIND_NEXT, | 834 expanded ? gfx::VectorIconId::FIND_PREV : gfx::VectorIconId::FIND_NEXT, |
835 16, gfx::kChromeIconGrey); | 835 16, gfx::kChromeIconGrey); |
836 arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon); | 836 arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon); |
837 } | 837 } |
838 | 838 |
839 // static | 839 // static |
840 ExtensionInstallPrompt::ShowDialogCallback | 840 ExtensionInstallPrompt::ShowDialogCallback |
841 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { | 841 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { |
842 return base::Bind(&ShowExtensionInstallDialogImpl); | 842 return base::Bind(&ShowExtensionInstallDialogImpl); |
843 } | 843 } |
OLD | NEW |