Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(574)

Side by Side Diff: chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 2 Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_uninstall_dialog.h" 9 #include "chrome/browser/extensions/extension_uninstall_dialog.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 ExtensionUninstallDialogDelegateView* view_; 72 ExtensionUninstallDialogDelegateView* view_;
73 73
74 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialogViews); 74 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialogViews);
75 }; 75 };
76 76
77 // The dialog's view, owned by the views framework. 77 // The dialog's view, owned by the views framework.
78 class ExtensionUninstallDialogDelegateView : public views::DialogDelegateView { 78 class ExtensionUninstallDialogDelegateView : public views::DialogDelegateView {
79 public: 79 public:
80 ExtensionUninstallDialogDelegateView( 80 ExtensionUninstallDialogDelegateView(
81 ExtensionUninstallDialogViews* dialog_view, 81 ExtensionUninstallDialogViews* dialog_view,
82 const Extension* extension, 82 const extensions::Extension* extension,
83 SkBitmap* icon); 83 SkBitmap* icon);
84 virtual ~ExtensionUninstallDialogDelegateView(); 84 virtual ~ExtensionUninstallDialogDelegateView();
85 85
86 // Called when the ExtensionUninstallDialog has been destroyed to make sure 86 // Called when the ExtensionUninstallDialog has been destroyed to make sure
87 // we invalidate pointers. 87 // we invalidate pointers.
88 void DialogDestroyed() { dialog_ = NULL; } 88 void DialogDestroyed() { dialog_ = NULL; }
89 89
90 private: 90 private:
91 // views::DialogDelegate: 91 // views::DialogDelegate:
92 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; 92 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 148 }
149 149
150 void ExtensionUninstallDialogViews::ExtensionUninstallCanceled() { 150 void ExtensionUninstallDialogViews::ExtensionUninstallCanceled() {
151 // The widget gets destroyed when the dialog is canceled. 151 // The widget gets destroyed when the dialog is canceled.
152 view_ = NULL; 152 view_ = NULL;
153 delegate_->ExtensionUninstallCanceled(); 153 delegate_->ExtensionUninstallCanceled();
154 } 154 }
155 155
156 ExtensionUninstallDialogDelegateView::ExtensionUninstallDialogDelegateView( 156 ExtensionUninstallDialogDelegateView::ExtensionUninstallDialogDelegateView(
157 ExtensionUninstallDialogViews* dialog_view, 157 ExtensionUninstallDialogViews* dialog_view,
158 const Extension* extension, 158 const extensions::Extension* extension,
159 SkBitmap* icon) 159 SkBitmap* icon)
160 : dialog_(dialog_view) { 160 : dialog_(dialog_view) {
161 // Scale down to icon size, but allow smaller icons (don't scale up). 161 // Scale down to icon size, but allow smaller icons (don't scale up).
162 gfx::Size size(icon->width(), icon->height()); 162 gfx::Size size(icon->width(), icon->height());
163 if (size.width() > kIconSize || size.height() > kIconSize) 163 if (size.width() > kIconSize || size.height() > kIconSize)
164 size = gfx::Size(kIconSize, kIconSize); 164 size = gfx::Size(kIconSize, kIconSize);
165 icon_ = new views::ImageView(); 165 icon_ = new views::ImageView();
166 icon_->SetImageSize(size); 166 icon_->SetImageSize(size);
167 icon_->SetImage(*icon); 167 icon_->SetImage(*icon);
168 AddChildView(icon_); 168 AddChildView(icon_);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } 238 }
239 } 239 }
240 240
241 } // namespace 241 } // namespace
242 242
243 // static 243 // static
244 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( 244 ExtensionUninstallDialog* ExtensionUninstallDialog::Create(
245 Profile* profile, Delegate* delegate) { 245 Profile* profile, Delegate* delegate) {
246 return new ExtensionUninstallDialogViews(profile, delegate); 246 return new ExtensionUninstallDialogViews(profile, delegate);
247 } 247 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698