| 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 | |
| 9 #include <algorithm> | 8 #include <algorithm> |
| 10 #include <string> | 9 #include <string> |
| 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 IDS_EXTENSION_PERMISSION_LINE, | 100 IDS_EXTENSION_PERMISSION_LINE, |
| 101 message) : message; | 101 message) : message; |
| 102 } | 102 } |
| 103 | 103 |
| 104 void ShowExtensionInstallDialogImpl( | 104 void ShowExtensionInstallDialogImpl( |
| 105 ExtensionInstallPromptShowParams* show_params, | 105 ExtensionInstallPromptShowParams* show_params, |
| 106 ExtensionInstallPrompt::Delegate* delegate, | 106 ExtensionInstallPrompt::Delegate* delegate, |
| 107 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt) { | 107 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt) { |
| 108 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 108 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 109 bool use_tab_modal_dialog = prompt->ShouldUseTabModalDialog(); | 109 bool use_tab_modal_dialog = prompt->ShouldUseTabModalDialog(); |
| 110 ExtensionInstallDialogView* dialog = | 110 ExtensionInstallDialogView* dialog = new ExtensionInstallDialogView( |
| 111 new ExtensionInstallDialogView(show_params->profile(), | 111 show_params->profile(), show_params->GetParentWebContents(), delegate, |
| 112 show_params->GetParentWebContents(), | 112 std::move(prompt)); |
| 113 delegate, | |
| 114 prompt.Pass()); | |
| 115 if (use_tab_modal_dialog) { | 113 if (use_tab_modal_dialog) { |
| 116 content::WebContents* parent_web_contents = | 114 content::WebContents* parent_web_contents = |
| 117 show_params->GetParentWebContents(); | 115 show_params->GetParentWebContents(); |
| 118 if (parent_web_contents) | 116 if (parent_web_contents) |
| 119 constrained_window::ShowWebModalDialogViews(dialog, parent_web_contents); | 117 constrained_window::ShowWebModalDialogViews(dialog, parent_web_contents); |
| 120 } else { | 118 } else { |
| 121 constrained_window::CreateBrowserModalDialogViews( | 119 constrained_window::CreateBrowserModalDialogViews( |
| 122 dialog, show_params->GetParentWindow()) | 120 dialog, show_params->GetParentWindow()) |
| 123 ->Show(); | 121 ->Show(); |
| 124 } | 122 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 196 } |
| 199 | 197 |
| 200 ExtensionInstallDialogView::ExtensionInstallDialogView( | 198 ExtensionInstallDialogView::ExtensionInstallDialogView( |
| 201 Profile* profile, | 199 Profile* profile, |
| 202 content::PageNavigator* navigator, | 200 content::PageNavigator* navigator, |
| 203 ExtensionInstallPrompt::Delegate* delegate, | 201 ExtensionInstallPrompt::Delegate* delegate, |
| 204 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt) | 202 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt) |
| 205 : profile_(profile), | 203 : profile_(profile), |
| 206 navigator_(navigator), | 204 navigator_(navigator), |
| 207 delegate_(delegate), | 205 delegate_(delegate), |
| 208 prompt_(prompt.Pass()), | 206 prompt_(std::move(prompt)), |
| 209 container_(NULL), | 207 container_(NULL), |
| 210 scroll_view_(NULL), | 208 scroll_view_(NULL), |
| 211 handled_result_(false) { | 209 handled_result_(false) { |
| 212 InitView(); | 210 InitView(); |
| 213 } | 211 } |
| 214 | 212 |
| 215 ExtensionInstallDialogView::~ExtensionInstallDialogView() { | 213 ExtensionInstallDialogView::~ExtensionInstallDialogView() { |
| 216 if (!handled_result_) | 214 if (!handled_result_) |
| 217 delegate_->InstallUIAbort(true); | 215 delegate_->InstallUIAbort(true); |
| 218 } | 216 } |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 expanded ? gfx::VectorIconId::FIND_PREV : gfx::VectorIconId::FIND_NEXT, | 830 expanded ? gfx::VectorIconId::FIND_PREV : gfx::VectorIconId::FIND_NEXT, |
| 833 16, gfx::kChromeIconGrey); | 831 16, gfx::kChromeIconGrey); |
| 834 arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon); | 832 arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon); |
| 835 } | 833 } |
| 836 | 834 |
| 837 // static | 835 // static |
| 838 ExtensionInstallPrompt::ShowDialogCallback | 836 ExtensionInstallPrompt::ShowDialogCallback |
| 839 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { | 837 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { |
| 840 return base::Bind(&ShowExtensionInstallDialogImpl); | 838 return base::Bind(&ShowExtensionInstallDialogImpl); |
| 841 } | 839 } |
| OLD | NEW |