| 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/extensions/extension_uninstall_dialog.h" | 5 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/ui/app_list/app_list_service.h" | 11 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
| 14 #include "chrome/browser/ui/views/constrained_window_views.h" |
| 14 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
| 15 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/compositor/compositor.h" | 18 #include "ui/compositor/compositor.h" |
| 18 #include "ui/compositor/layer.h" | 19 #include "ui/compositor/layer.h" |
| 19 #include "ui/views/controls/image_view.h" | 20 #include "ui/views/controls/image_view.h" |
| 20 #include "ui/views/controls/label.h" | 21 #include "ui/views/controls/label.h" |
| 21 #include "ui/views/layout/layout_constants.h" | 22 #include "ui/views/layout/layout_constants.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" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 138 } |
| 138 | 139 |
| 139 void ExtensionUninstallDialogViews::Show() { | 140 void ExtensionUninstallDialogViews::Show() { |
| 140 gfx::NativeWindow parent = GetParent(browser_); | 141 gfx::NativeWindow parent = GetParent(browser_); |
| 141 if (browser_ && !parent) { | 142 if (browser_ && !parent) { |
| 142 delegate_->ExtensionUninstallCanceled(); | 143 delegate_->ExtensionUninstallCanceled(); |
| 143 return; | 144 return; |
| 144 } | 145 } |
| 145 | 146 |
| 146 view_ = new ExtensionUninstallDialogDelegateView(this, extension_, &icon_); | 147 view_ = new ExtensionUninstallDialogDelegateView(this, extension_, &icon_); |
| 147 views::DialogDelegate::CreateDialogWidget(view_, NULL, parent)->Show(); | 148 CreateBrowserModalDialogViews(view_, parent)->Show(); |
| 148 } | 149 } |
| 149 | 150 |
| 150 void ExtensionUninstallDialogViews::ExtensionUninstallAccepted() { | 151 void ExtensionUninstallDialogViews::ExtensionUninstallAccepted() { |
| 151 // The widget gets destroyed when the dialog is accepted. | 152 // The widget gets destroyed when the dialog is accepted. |
| 152 view_ = NULL; | 153 view_ = NULL; |
| 153 delegate_->ExtensionUninstallAccepted(); | 154 delegate_->ExtensionUninstallAccepted(); |
| 154 } | 155 } |
| 155 | 156 |
| 156 void ExtensionUninstallDialogViews::ExtensionUninstallCanceled() { | 157 void ExtensionUninstallDialogViews::ExtensionUninstallCanceled() { |
| 157 // The widget gets destroyed when the dialog is canceled. | 158 // The widget gets destroyed when the dialog is canceled. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 247 |
| 247 } // namespace | 248 } // namespace |
| 248 | 249 |
| 249 // static | 250 // static |
| 250 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( | 251 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( |
| 251 Profile* profile, | 252 Profile* profile, |
| 252 Browser* browser, | 253 Browser* browser, |
| 253 Delegate* delegate) { | 254 Delegate* delegate) { |
| 254 return new ExtensionUninstallDialogViews(profile, browser, delegate); | 255 return new ExtensionUninstallDialogViews(profile, browser, delegate); |
| 255 } | 256 } |
| OLD | NEW |