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

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

Issue 10831019: Do some null-checks to make sure removing an app on ash works correctly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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"
(...skipping 28 matching lines...) Expand all
39 // use the given browser window. 39 // use the given browser window.
40 // Note this function could return NULL if ash app list is not visible and 40 // Note this function could return NULL if ash app list is not visible and
41 // there is no browser window. 41 // there is no browser window.
42 gfx::NativeWindow GetParent(Browser* browser) { 42 gfx::NativeWindow GetParent(Browser* browser) {
43 #if defined(USE_ASH) 43 #if defined(USE_ASH)
44 gfx::NativeWindow app_list = ash::Shell::GetInstance()->GetAppListWindow(); 44 gfx::NativeWindow app_list = ash::Shell::GetInstance()->GetAppListWindow();
45 if (app_list) 45 if (app_list)
46 return app_list; 46 return app_list;
47 #endif 47 #endif
48 48
49 if (browser->window()) 49 if (browser && browser->window())
50 return browser->window()->GetNativeWindow(); 50 return browser->window()->GetNativeWindow();
51 51
52 return NULL; 52 return NULL;
53 } 53 }
54 54
55 // Views implementation of the uninstall dialog. 55 // Views implementation of the uninstall dialog.
56 class ExtensionUninstallDialogViews : public ExtensionUninstallDialog { 56 class ExtensionUninstallDialogViews : public ExtensionUninstallDialog {
57 public: 57 public:
58 ExtensionUninstallDialogViews(Browser* browser, 58 ExtensionUninstallDialogViews(Browser* browser,
59 ExtensionUninstallDialog::Delegate* delegate); 59 ExtensionUninstallDialog::Delegate* delegate);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 ExtensionUninstallDialogViews::~ExtensionUninstallDialogViews() { 124 ExtensionUninstallDialogViews::~ExtensionUninstallDialogViews() {
125 // Close the widget (the views framework will delete view_). 125 // Close the widget (the views framework will delete view_).
126 if (view_) { 126 if (view_) {
127 view_->DialogDestroyed(); 127 view_->DialogDestroyed();
128 view_->GetWidget()->CloseNow(); 128 view_->GetWidget()->CloseNow();
129 } 129 }
130 } 130 }
131 131
132 void ExtensionUninstallDialogViews::Show() { 132 void ExtensionUninstallDialogViews::Show() {
133 gfx::NativeWindow parent = GetParent(browser_); 133 gfx::NativeWindow parent = GetParent(browser_);
134 if (!parent) { 134 if (browser_ && !parent) {
135 delegate_->ExtensionUninstallCanceled(); 135 delegate_->ExtensionUninstallCanceled();
136 return; 136 return;
137 } 137 }
138 138
139 view_ = new ExtensionUninstallDialogDelegateView(this, extension_, &icon_); 139 view_ = new ExtensionUninstallDialogDelegateView(this, extension_, &icon_);
140 views::Widget::CreateWindowWithParent(view_, parent)->Show(); 140 views::Widget::CreateWindowWithParent(view_, parent)->Show();
141 } 141 }
142 142
143 void ExtensionUninstallDialogViews::ExtensionUninstallAccepted() { 143 void ExtensionUninstallDialogViews::ExtensionUninstallAccepted() {
144 // The widget gets destroyed when the dialog is accepted. 144 // The widget gets destroyed when the dialog is accepted.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 237 }
238 } 238 }
239 239
240 } // namespace 240 } // namespace
241 241
242 // static 242 // static
243 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( 243 ExtensionUninstallDialog* ExtensionUninstallDialog::Create(
244 Browser* browser, Delegate* delegate) { 244 Browser* browser, Delegate* delegate) {
245 return new ExtensionUninstallDialogViews(browser, delegate); 245 return new ExtensionUninstallDialogViews(browser, delegate);
246 } 246 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698