OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import "chrome/browser/cocoa/extensions/extension_action_context_menu.h" | 5 #import "chrome/browser/cocoa/extensions/extension_action_context_menu.h" |
6 | 6 |
7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "chrome/browser/browser_list.h" | 10 #include "chrome/browser/browser_list.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 66 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
67 // If |extension_| is NULL, then the action was cancelled. Bail. | 67 // If |extension_| is NULL, then the action was cancelled. Bail. |
68 if (!extension_) | 68 if (!extension_) |
69 return; | 69 return; |
70 | 70 |
71 Browser* browser = BrowserList::GetLastActive(); | 71 Browser* browser = BrowserList::GetLastActive(); |
72 // GetLastActive() returns NULL during testing. | 72 // GetLastActive() returns NULL during testing. |
73 if (!browser) | 73 if (!browser) |
74 return; | 74 return; |
75 | 75 |
76 ExtensionInstallUI client(browser->profile()); | 76 install_ui_.reset(new ExtensionInstallUI(browser->profile())); |
77 client.ConfirmUninstall(this, extension_, uninstall_icon->get()); | 77 install_ui_->ConfirmUninstall(this, extension_); |
78 } | 78 } |
79 | 79 |
80 // The extension that we're loading the icon for. Weak. | 80 // The extension that we're loading the icon for. Weak. |
81 Extension* extension_; | 81 Extension* extension_; |
82 | 82 |
83 // The uninstall icon shown by the confirmation dialog. | 83 // The uninstall icon shown by the confirmation dialog. |
84 scoped_ptr<SkBitmap> uninstall_icon_; | 84 scoped_ptr<SkBitmap> uninstall_icon_; |
85 | 85 |
| 86 scoped_ptr<ExtensionInstallUI> install_ui_; |
| 87 |
86 DISALLOW_COPY_AND_ASSIGN(AsyncUninstaller); | 88 DISALLOW_COPY_AND_ASSIGN(AsyncUninstaller); |
87 }; | 89 }; |
88 | 90 |
89 @interface ExtensionActionContextMenu(Private) | 91 @interface ExtensionActionContextMenu(Private) |
90 // Callback for the context menu items. | 92 // Callback for the context menu items. |
91 - (void)dispatch:(id)menuItem; | 93 - (void)dispatch:(id)menuItem; |
92 @end | 94 @end |
93 | 95 |
94 @implementation ExtensionActionContextMenu | 96 @implementation ExtensionActionContextMenu |
95 | 97 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 NEW_FOREGROUND_TAB, PageTransition::LINK); | 189 NEW_FOREGROUND_TAB, PageTransition::LINK); |
188 break; | 190 break; |
189 } | 191 } |
190 default: | 192 default: |
191 NOTREACHED(); | 193 NOTREACHED(); |
192 break; | 194 break; |
193 } | 195 } |
194 } | 196 } |
195 | 197 |
196 @end | 198 @end |
OLD | NEW |