| 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/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 class ExtensionUninstallDialogDelegateView; | 36 class ExtensionUninstallDialogDelegateView; |
| 37 | 37 |
| 38 // Returns parent window for extension uninstall dialog. | 38 // Returns parent window for extension uninstall dialog. |
| 39 gfx::NativeWindow GetParent(Browser* browser) { | 39 gfx::NativeWindow GetParent(Browser* browser) { |
| 40 if (browser && browser->window()) | 40 if (browser && browser->window()) |
| 41 return browser->window()->GetNativeWindow(); | 41 return browser->window()->GetNativeWindow(); |
| 42 return NULL; | 42 return NULL; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // Views implementation of the uninstall dialog. | 45 // Views implementation of the uninstall dialog. |
| 46 class ExtensionUninstallDialogViews : public ExtensionUninstallDialog { | 46 class ExtensionUninstallDialogViews |
| 47 : public extensions::ExtensionUninstallDialog { |
| 47 public: | 48 public: |
| 48 ExtensionUninstallDialogViews(Profile* profile, | 49 ExtensionUninstallDialogViews( |
| 49 Browser* browser, | 50 Profile* profile, |
| 50 ExtensionUninstallDialog::Delegate* delegate); | 51 Browser* browser, |
| 52 extensions::ExtensionUninstallDialog::Delegate* delegate); |
| 51 virtual ~ExtensionUninstallDialogViews(); | 53 virtual ~ExtensionUninstallDialogViews(); |
| 52 | 54 |
| 53 // Forwards the accept and cancels to the delegate. | 55 // Forwards the accept and cancels to the delegate. |
| 54 void ExtensionUninstallAccepted(); | 56 void ExtensionUninstallAccepted(); |
| 55 void ExtensionUninstallCanceled(); | 57 void ExtensionUninstallCanceled(); |
| 56 | 58 |
| 57 ExtensionUninstallDialogDelegateView* view() { return view_; } | 59 ExtensionUninstallDialogDelegateView* view() { return view_; } |
| 58 | 60 |
| 59 private: | 61 private: |
| 60 virtual void Show() OVERRIDE; | 62 virtual void Show() OVERRIDE; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 views::ImageView* icon_; | 109 views::ImageView* icon_; |
| 108 views::Label* heading_; | 110 views::Label* heading_; |
| 109 bool triggered_by_extension_; | 111 bool triggered_by_extension_; |
| 110 | 112 |
| 111 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialogDelegateView); | 113 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialogDelegateView); |
| 112 }; | 114 }; |
| 113 | 115 |
| 114 ExtensionUninstallDialogViews::ExtensionUninstallDialogViews( | 116 ExtensionUninstallDialogViews::ExtensionUninstallDialogViews( |
| 115 Profile* profile, | 117 Profile* profile, |
| 116 Browser* browser, | 118 Browser* browser, |
| 117 ExtensionUninstallDialog::Delegate* delegate) | 119 extensions::ExtensionUninstallDialog::Delegate* delegate) |
| 118 : ExtensionUninstallDialog(profile, browser, delegate), | 120 : extensions::ExtensionUninstallDialog(profile, browser, delegate), |
| 119 view_(NULL), | 121 view_(NULL), |
| 120 show_in_app_list_(!browser) { | 122 show_in_app_list_(!browser) { |
| 121 } | 123 } |
| 122 | 124 |
| 123 ExtensionUninstallDialogViews::~ExtensionUninstallDialogViews() { | 125 ExtensionUninstallDialogViews::~ExtensionUninstallDialogViews() { |
| 124 // Close the widget (the views framework will delete view_). | 126 // Close the widget (the views framework will delete view_). |
| 125 if (view_) { | 127 if (view_) { |
| 126 view_->DialogDestroyed(); | 128 view_->DialogDestroyed(); |
| 127 view_->GetWidget()->CloseNow(); | 129 view_->GetWidget()->CloseNow(); |
| 128 } | 130 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 x += views::kRelatedControlHorizontalSpacing; | 240 x += views::kRelatedControlHorizontalSpacing; |
| 239 | 241 |
| 240 heading_->SetX(x); | 242 heading_->SetX(x); |
| 241 heading_->SetY(y); | 243 heading_->SetY(y); |
| 242 } | 244 } |
| 243 } | 245 } |
| 244 | 246 |
| 245 } // namespace | 247 } // namespace |
| 246 | 248 |
| 247 // static | 249 // static |
| 248 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( | 250 extensions::ExtensionUninstallDialog* |
| 249 Profile* profile, | 251 extensions::ExtensionUninstallDialog::Create(Profile* profile, |
| 250 Browser* browser, | 252 Browser* browser, |
| 251 Delegate* delegate) { | 253 Delegate* delegate) { |
| 252 return new ExtensionUninstallDialogViews(profile, browser, delegate); | 254 return new ExtensionUninstallDialogViews(profile, browser, delegate); |
| 253 } | 255 } |
| OLD | NEW |