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" |
(...skipping 23 matching lines...) Expand all Loading... |
34 class ExtensionUninstallDialogDelegateView; | 34 class ExtensionUninstallDialogDelegateView; |
35 | 35 |
36 // Returns parent window for extension uninstall dialog. | 36 // Returns parent window for extension uninstall dialog. |
37 // For ash, use app list window if it is visible. | 37 // For ash, use app list window if it is visible. |
38 // For other platforms or when app list is not visible on ash, | 38 // For other platforms or when app list is not visible on ash, |
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 if (ash::Shell::HasInstance()) { |
45 if (app_list) | 45 gfx::NativeWindow app_list = ash::Shell::GetInstance()->GetAppListWindow(); |
46 return app_list; | 46 if (app_list) |
| 47 return app_list; |
| 48 } |
47 #endif | 49 #endif |
48 | 50 |
49 if (browser && browser->window()) | 51 if (browser && browser->window()) |
50 return browser->window()->GetNativeWindow(); | 52 return browser->window()->GetNativeWindow(); |
51 | 53 |
52 return NULL; | 54 return NULL; |
53 } | 55 } |
54 | 56 |
55 // Views implementation of the uninstall dialog. | 57 // Views implementation of the uninstall dialog. |
56 class ExtensionUninstallDialogViews : public ExtensionUninstallDialog { | 58 class ExtensionUninstallDialogViews : public ExtensionUninstallDialog { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 243 |
242 } // namespace | 244 } // namespace |
243 | 245 |
244 // static | 246 // static |
245 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( | 247 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( |
246 Profile* profile, | 248 Profile* profile, |
247 Browser* browser, | 249 Browser* browser, |
248 Delegate* delegate) { | 250 Delegate* delegate) { |
249 return new ExtensionUninstallDialogViews(profile, browser, delegate); | 251 return new ExtensionUninstallDialogViews(profile, browser, delegate); |
250 } | 252 } |
OLD | NEW |