| 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 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" | 5 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" |
| 6 | 6 |
| 7 #include "base/prefs/public/pref_change_registrar.h" | 7 #include "base/prefs/public/pref_change_registrar.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/extensions/extension_action.h" | 9 #include "chrome/browser/extensions/extension_action.h" |
| 10 #include "chrome/browser/extensions/extension_action_manager.h" | 10 #include "chrome/browser/extensions/extension_action_manager.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 profile_(browser->profile()) { | 55 profile_(browser->profile()) { |
| 56 extension_uninstall_dialog_.reset( | 56 extension_uninstall_dialog_.reset( |
| 57 ExtensionUninstallDialog::Create(browser, this)); | 57 ExtensionUninstallDialog::Create(browser, this)); |
| 58 extension_uninstall_dialog_->ConfirmUninstall(extension_); | 58 extension_uninstall_dialog_->ConfirmUninstall(extension_); |
| 59 } | 59 } |
| 60 | 60 |
| 61 ~AsyncUninstaller() {} | 61 ~AsyncUninstaller() {} |
| 62 | 62 |
| 63 // ExtensionUninstallDialog::Delegate: | 63 // ExtensionUninstallDialog::Delegate: |
| 64 virtual void ExtensionUninstallAccepted() { | 64 virtual void ExtensionUninstallAccepted() { |
| 65 profile_->GetExtensionService()-> | 65 extensions::ExtensionSystem::Get(profile_)->extension_service()-> |
| 66 UninstallExtension(extension_->id(), false, NULL); | 66 UninstallExtension(extension_->id(), false, NULL); |
| 67 } | 67 } |
| 68 virtual void ExtensionUninstallCanceled() {} | 68 virtual void ExtensionUninstallCanceled() {} |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 // The extension that we're loading the icon for. Weak. | 71 // The extension that we're loading the icon for. Weak. |
| 72 const Extension* extension_; | 72 const Extension* extension_; |
| 73 | 73 |
| 74 // The current profile. Weak. | 74 // The current profile. Weak. |
| 75 Profile* profile_; | 75 Profile* profile_; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 DCHECK(!extension_->options_url().is_empty()); | 216 DCHECK(!extension_->options_url().is_empty()); |
| 217 extensions::ExtensionSystem::Get(browser_->profile())->process_manager()-> | 217 extensions::ExtensionSystem::Get(browser_->profile())->process_manager()-> |
| 218 OpenOptionsPage(extension_, browser_); | 218 OpenOptionsPage(extension_, browser_); |
| 219 break; | 219 break; |
| 220 } | 220 } |
| 221 case kExtensionContextUninstall: { | 221 case kExtensionContextUninstall: { |
| 222 uninstaller_.reset(new AsyncUninstaller(extension_, browser_)); | 222 uninstaller_.reset(new AsyncUninstaller(extension_, browser_)); |
| 223 break; | 223 break; |
| 224 } | 224 } |
| 225 case kExtensionContextHide: { | 225 case kExtensionContextHide: { |
| 226 ExtensionService* extension_service = | 226 ExtensionService* extension_service = extensions::ExtensionSystem::Get( |
| 227 browser_->profile()->GetExtensionService(); | 227 browser_->profile())->extension_service(); |
| 228 extension_service->extension_prefs()-> | 228 extension_service->extension_prefs()-> |
| 229 SetBrowserActionVisibility(extension_, false); | 229 SetBrowserActionVisibility(extension_, false); |
| 230 break; | 230 break; |
| 231 } | 231 } |
| 232 case kExtensionContextManage: { | 232 case kExtensionContextManage: { |
| 233 chrome::ShowExtensions(browser_); | 233 chrome::ShowExtensions(browser_); |
| 234 break; | 234 break; |
| 235 } | 235 } |
| 236 case kExtensionContextInspect: { | 236 case kExtensionContextInspect: { |
| 237 BrowserWindowCocoa* window = | 237 BrowserWindowCocoa* window = |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 279 |
| 280 - (BOOL)validateMenuItem:(NSMenuItem*)menuItem { | 280 - (BOOL)validateMenuItem:(NSMenuItem*)menuItem { |
| 281 if ([menuItem tag] == kExtensionContextOptions) { | 281 if ([menuItem tag] == kExtensionContextOptions) { |
| 282 // Disable 'Options' if there are no options to set. | 282 // Disable 'Options' if there are no options to set. |
| 283 return extension_->options_url().spec().length() > 0; | 283 return extension_->options_url().spec().length() > 0; |
| 284 } | 284 } |
| 285 return YES; | 285 return YES; |
| 286 } | 286 } |
| 287 | 287 |
| 288 @end | 288 @end |
| OLD | NEW |