| 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/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/extension_tab_util.h" | 9 #include "chrome/browser/extensions/extension_tab_util.h" |
| 10 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 10 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 kExtensionContextDisable = 3, | 90 kExtensionContextDisable = 3, |
| 91 kExtensionContextUninstall = 4, | 91 kExtensionContextUninstall = 4, |
| 92 kExtensionContextHide = 5, | 92 kExtensionContextHide = 5, |
| 93 kExtensionContextManage = 7, | 93 kExtensionContextManage = 7, |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 int CurrentTabId() { | 96 int CurrentTabId() { |
| 97 Browser* browser = browser::GetLastActiveBrowser(); | 97 Browser* browser = browser::GetLastActiveBrowser(); |
| 98 if(!browser) | 98 if(!browser) |
| 99 return -1; | 99 return -1; |
| 100 WebContents* contents = browser->GetSelectedWebContents(); | 100 WebContents* contents = browser->GetActiveWebContents(); |
| 101 if (!contents) | 101 if (!contents) |
| 102 return -1; | 102 return -1; |
| 103 return ExtensionTabUtil::GetTabId(contents); | 103 return ExtensionTabUtil::GetTabId(contents); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace | 106 } // namespace |
| 107 | 107 |
| 108 - (id)initWithExtension:(const Extension*)extension | 108 - (id)initWithExtension:(const Extension*)extension |
| 109 profile:(Profile*)profile | 109 profile:(Profile*)profile |
| 110 extensionAction:(ExtensionAction*)action{ | 110 extensionAction:(ExtensionAction*)action{ |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 - (BOOL)validateMenuItem:(NSMenuItem*)menuItem { | 205 - (BOOL)validateMenuItem:(NSMenuItem*)menuItem { |
| 206 if ([menuItem tag] == kExtensionContextOptions) { | 206 if ([menuItem tag] == kExtensionContextOptions) { |
| 207 // Disable 'Options' if there are no options to set. | 207 // Disable 'Options' if there are no options to set. |
| 208 return extension_->options_url().spec().length() > 0; | 208 return extension_->options_url().spec().length() > 0; |
| 209 } | 209 } |
| 210 return YES; | 210 return YES; |
| 211 } | 211 } |
| 212 | 212 |
| 213 @end | 213 @end |
| OLD | NEW |