| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_contro
ller.h" | 5 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu_contro
ller.h" |
| 6 | 6 |
| 7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
| 8 #include "chrome/browser/extensions/active_script_controller.h" | 8 #include "chrome/browser/extensions/active_script_controller.h" |
| 9 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 9 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| 10 #include "chrome/browser/extensions/extension_action_manager.h" | 10 #include "chrome/browser/extensions/extension_action_manager.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/common/extensions/manifest_url_handler.h" | 25 #include "chrome/common/extensions/manifest_url_handler.h" |
| 26 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
| 27 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
| 28 #include "chrome/grit/chromium_strings.h" | 28 #include "chrome/grit/chromium_strings.h" |
| 29 #include "chrome/grit/generated_resources.h" | 29 #include "chrome/grit/generated_resources.h" |
| 30 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
| 31 #include "extensions/browser/extension_prefs.h" | 31 #include "extensions/browser/extension_prefs.h" |
| 32 #include "extensions/browser/extension_system.h" | 32 #include "extensions/browser/extension_system.h" |
| 33 #include "extensions/browser/uninstall_reason.h" | 33 #include "extensions/browser/uninstall_reason.h" |
| 34 #include "extensions/common/extension.h" | 34 #include "extensions/common/extension.h" |
| 35 #include "extensions/common/manifest_handlers/options_page_info.h" |
| 35 #include "ui/base/l10n/l10n_util_mac.h" | 36 #include "ui/base/l10n/l10n_util_mac.h" |
| 36 | 37 |
| 37 using content::OpenURLParams; | 38 using content::OpenURLParams; |
| 38 using content::Referrer; | 39 using content::Referrer; |
| 39 using content::WebContents; | 40 using content::WebContents; |
| 40 using extensions::Extension; | 41 using extensions::Extension; |
| 41 | 42 |
| 42 // A class that shows a confirmation dialog to uninstall the given extension. | 43 // A class that shows a confirmation dialog to uninstall the given extension. |
| 43 // Also acts as the extension's UI delegate in order to display the dialog. | 44 // Also acts as the extension's UI delegate in order to display the dialog. |
| 44 class AsyncUninstaller : public extensions::ExtensionUninstallDialog::Delegate { | 45 class AsyncUninstaller : public extensions::ExtensionUninstallDialog::Delegate { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 keyEquivalent:@""]; | 128 keyEquivalent:@""]; |
| 128 [item setTarget:self]; | 129 [item setTarget:self]; |
| 129 } | 130 } |
| 130 | 131 |
| 131 // Options. | 132 // Options. |
| 132 item = [menu addItemWithTitle: | 133 item = [menu addItemWithTitle: |
| 133 l10n_util::GetNSStringWithFixup(IDS_EXTENSIONS_OPTIONS_MENU_ITEM) | 134 l10n_util::GetNSStringWithFixup(IDS_EXTENSIONS_OPTIONS_MENU_ITEM) |
| 134 action:@selector(onOptions:) | 135 action:@selector(onOptions:) |
| 135 keyEquivalent:@""]; | 136 keyEquivalent:@""]; |
| 136 [item setTarget:self]; | 137 [item setTarget:self]; |
| 137 [item setEnabled:extensions::ManifestURL::GetOptionsPage( | 138 [item setEnabled:extensions::OptionsPageInfo::GetOptionsPage( |
| 138 extension_).spec().length() > 0]; | 139 extension_).spec().length() > 0]; |
| 139 | 140 |
| 140 | 141 |
| 141 // Uninstall. | 142 // Uninstall. |
| 142 item = [menu addItemWithTitle: | 143 item = [menu addItemWithTitle: |
| 143 l10n_util::GetNSStringWithFixup(IDS_EXTENSIONS_UNINSTALL) | 144 l10n_util::GetNSStringWithFixup(IDS_EXTENSIONS_UNINSTALL) |
| 144 action:@selector(onUninstall:) | 145 action:@selector(onUninstall:) |
| 145 keyEquivalent:@""]; | 146 keyEquivalent:@""]; |
| 146 [item setTarget:self]; | 147 [item setTarget:self]; |
| 147 | 148 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 - (void)onAlwaysRun:(id)sender { | 192 - (void)onAlwaysRun:(id)sender { |
| 192 content::WebContents* activeTab = | 193 content::WebContents* activeTab = |
| 193 browser_->tab_strip_model()->GetActiveWebContents(); | 194 browser_->tab_strip_model()->GetActiveWebContents(); |
| 194 if (activeTab) { | 195 if (activeTab) { |
| 195 extensions::ActiveScriptController::GetForWebContents(activeTab) | 196 extensions::ActiveScriptController::GetForWebContents(activeTab) |
| 196 ->AlwaysRunOnVisibleOrigin(extension_); | 197 ->AlwaysRunOnVisibleOrigin(extension_); |
| 197 } | 198 } |
| 198 } | 199 } |
| 199 | 200 |
| 200 - (void)onOptions:(id)sender { | 201 - (void)onOptions:(id)sender { |
| 201 DCHECK(!extensions::ManifestURL::GetOptionsPage(extension_).is_empty()); | 202 DCHECK(!extensions::OptionsPageInfo::GetOptionsPage(extension_).is_empty()); |
| 202 extensions::ExtensionTabUtil::OpenOptionsPage(extension_, browser_); | 203 extensions::ExtensionTabUtil::OpenOptionsPage(extension_, browser_); |
| 203 } | 204 } |
| 204 | 205 |
| 205 - (void)onUninstall:(id)sender { | 206 - (void)onUninstall:(id)sender { |
| 206 uninstaller_.reset(new AsyncUninstaller(extension_, browser_)); | 207 uninstaller_.reset(new AsyncUninstaller(extension_, browser_)); |
| 207 } | 208 } |
| 208 | 209 |
| 209 - (void)onHide:(id)sender { | 210 - (void)onHide:(id)sender { |
| 210 extensions::ExtensionActionAPI::SetBrowserActionVisibility( | 211 extensions::ExtensionActionAPI::SetBrowserActionVisibility( |
| 211 extensions::ExtensionPrefs::Get(browser_->profile()), | 212 extensions::ExtensionPrefs::Get(browser_->profile()), |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 return; | 250 return; |
| 250 | 251 |
| 251 [ExtensionPopupController showURL:url | 252 [ExtensionPopupController showURL:url |
| 252 inBrowser:browser_ | 253 inBrowser:browser_ |
| 253 anchoredAt:popupPoint | 254 anchoredAt:popupPoint |
| 254 arrowLocation:info_bubble::kTopRight | 255 arrowLocation:info_bubble::kTopRight |
| 255 devMode:YES]; | 256 devMode:YES]; |
| 256 } | 257 } |
| 257 | 258 |
| 258 @end | 259 @end |
| OLD | NEW |