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/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
13 #include "chrome/common/extensions/extension.h" | 14 #include "chrome/common/extensions/extension.h" |
14 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
16 #include "ui/compositor/compositor.h" | 17 #include "ui/compositor/compositor.h" |
17 #include "ui/compositor/layer.h" | 18 #include "ui/compositor/layer.h" |
18 #include "ui/views/controls/image_view.h" | 19 #include "ui/views/controls/image_view.h" |
19 #include "ui/views/controls/label.h" | 20 #include "ui/views/controls/label.h" |
20 #include "ui/views/layout/layout_constants.h" | 21 #include "ui/views/layout/layout_constants.h" |
(...skipping 12 matching lines...) Expand all Loading... |
33 | 34 |
34 class ExtensionUninstallDialogDelegateView; | 35 class ExtensionUninstallDialogDelegateView; |
35 | 36 |
36 // TODO(estade): remove this when UseNewStyle() is the default. | 37 // TODO(estade): remove this when UseNewStyle() is the default. |
37 int HorizontalMargin() { | 38 int HorizontalMargin() { |
38 return views::DialogDelegate::UseNewStyle() ? views::kButtonHEdgeMarginNew : | 39 return views::DialogDelegate::UseNewStyle() ? views::kButtonHEdgeMarginNew : |
39 views::kPanelHorizMargin; | 40 views::kPanelHorizMargin; |
40 } | 41 } |
41 | 42 |
42 // Returns parent window for extension uninstall dialog. | 43 // Returns parent window for extension uninstall dialog. |
43 // For ash, use app list window if it is visible. | 44 // For platforms with an app list, use the app list window if it is visible. |
44 // For other platforms or when app list is not visible on ash, | 45 // For other platforms or when app list is not visible, use the given browser |
45 // use the given browser window. | 46 // window. |
46 // Note this function could return NULL if ash app list is not visible and | 47 // Note this function could return NULL if the app list is not visible and |
47 // there is no browser window. | 48 // there is no browser window. |
48 gfx::NativeWindow GetParent(Browser* browser) { | 49 gfx::NativeWindow GetParent(Browser* browser) { |
49 #if defined(USE_ASH) | 50 gfx::NativeWindow window = AppListService::Get()->GetAppListWindow(); |
50 if (ash::Shell::HasInstance()) { | 51 if (window) |
51 gfx::NativeWindow app_list = ash::Shell::GetInstance()->GetAppListWindow(); | 52 return window; |
52 if (app_list) | |
53 return app_list; | |
54 } | |
55 #endif | |
56 | 53 |
57 if (browser && browser->window()) | 54 if (browser && browser->window()) |
58 return browser->window()->GetNativeWindow(); | 55 return browser->window()->GetNativeWindow(); |
59 | 56 |
60 return NULL; | 57 return NULL; |
61 } | 58 } |
62 | 59 |
63 // Views implementation of the uninstall dialog. | 60 // Views implementation of the uninstall dialog. |
64 class ExtensionUninstallDialogViews : public ExtensionUninstallDialog { | 61 class ExtensionUninstallDialogViews : public ExtensionUninstallDialog { |
65 public: | 62 public: |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 246 |
250 } // namespace | 247 } // namespace |
251 | 248 |
252 // static | 249 // static |
253 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( | 250 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( |
254 Profile* profile, | 251 Profile* profile, |
255 Browser* browser, | 252 Browser* browser, |
256 Delegate* delegate) { | 253 Delegate* delegate) { |
257 return new ExtensionUninstallDialogViews(profile, browser, delegate); | 254 return new ExtensionUninstallDialogViews(profile, browser, delegate); |
258 } | 255 } |
OLD | NEW |