Chromium Code Reviews| 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_context_menu_model.h" | 5 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/extensions/active_script_controller.h" | 10 #include "chrome/browser/extensions/active_script_controller.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 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 "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
| 29 #include "content/public/common/context_menu_params.h" | 29 #include "content/public/common/context_menu_params.h" |
| 30 #include "extensions/browser/extension_prefs.h" | 30 #include "extensions/browser/extension_prefs.h" |
| 31 #include "extensions/browser/extension_registry.h" | 31 #include "extensions/browser/extension_registry.h" |
| 32 #include "extensions/browser/extension_system.h" | 32 #include "extensions/browser/extension_system.h" |
| 33 #include "extensions/browser/management_policy.h" | 33 #include "extensions/browser/management_policy.h" |
| 34 #include "extensions/browser/uninstall_reason.h" | 34 #include "extensions/browser/uninstall_reason.h" |
| 35 #include "extensions/common/extension.h" | 35 #include "extensions/common/extension.h" |
| 36 #include "extensions/common/feature_switch.h" | |
| 36 #include "grit/chromium_strings.h" | 37 #include "grit/chromium_strings.h" |
| 37 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
| 38 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
| 39 | 40 |
| 40 using content::OpenURLParams; | 41 using content::OpenURLParams; |
| 41 using content::Referrer; | 42 using content::Referrer; |
| 42 using content::WebContents; | 43 using content::WebContents; |
| 43 using extensions::Extension; | 44 using extensions::Extension; |
| 44 using extensions::MenuItem; | 45 using extensions::MenuItem; |
| 45 using extensions::MenuManager; | 46 using extensions::MenuManager; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 case ALWAYS_RUN: { | 169 case ALWAYS_RUN: { |
| 169 WebContents* web_contents = GetActiveWebContents(); | 170 WebContents* web_contents = GetActiveWebContents(); |
| 170 if (web_contents) { | 171 if (web_contents) { |
| 171 extensions::ActiveScriptController::GetForWebContents(web_contents) | 172 extensions::ActiveScriptController::GetForWebContents(web_contents) |
| 172 ->AlwaysRunOnVisibleOrigin(extension); | 173 ->AlwaysRunOnVisibleOrigin(extension); |
| 173 } | 174 } |
| 174 break; | 175 break; |
| 175 } | 176 } |
| 176 case CONFIGURE: | 177 case CONFIGURE: |
| 177 DCHECK(!extensions::ManifestURL::GetOptionsPage(extension).is_empty()); | 178 DCHECK(!extensions::ManifestURL::GetOptionsPage(extension).is_empty()); |
| 178 extensions::ExtensionTabUtil::OpenOptionsPage(extension, browser_); | 179 if (extensions::FeatureSwitch::embedded_extension_options()->IsEnabled()) |
| 180 chrome::ShowExtensionOptions(browser_, extension->id()); | |
|
Devlin
2014/08/19 17:39:07
will look at this more later, but first off, why n
ericzeng
2014/08/19 18:25:39
That's a good idea; I just did it this way because
| |
| 181 else | |
| 182 extensions::ExtensionTabUtil::OpenOptionsPage(extension, browser_); | |
| 179 break; | 183 break; |
| 180 case HIDE: { | 184 case HIDE: { |
| 181 extensions::ExtensionActionAPI::SetBrowserActionVisibility( | 185 extensions::ExtensionActionAPI::SetBrowserActionVisibility( |
| 182 extensions::ExtensionPrefs::Get(profile_), extension->id(), false); | 186 extensions::ExtensionPrefs::Get(profile_), extension->id(), false); |
| 183 break; | 187 break; |
| 184 } | 188 } |
| 185 case UNINSTALL: { | 189 case UNINSTALL: { |
| 186 AddRef(); // Balanced in Accepted() and Canceled() | 190 AddRef(); // Balanced in Accepted() and Canceled() |
| 187 extension_uninstall_dialog_.reset( | 191 extension_uninstall_dialog_.reset( |
| 188 extensions::ExtensionUninstallDialog::Create( | 192 extensions::ExtensionUninstallDialog::Create( |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 extension_items_count_ = 0; | 289 extension_items_count_ = 0; |
| 286 extension_items_->AppendExtensionItems(MenuItem::ExtensionKey(extension_id_), | 290 extension_items_->AppendExtensionItems(MenuItem::ExtensionKey(extension_id_), |
| 287 base::string16(), | 291 base::string16(), |
| 288 &extension_items_count_, | 292 &extension_items_count_, |
| 289 true); // is_action_menu | 293 true); // is_action_menu |
| 290 } | 294 } |
| 291 | 295 |
| 292 content::WebContents* ExtensionContextMenuModel::GetActiveWebContents() const { | 296 content::WebContents* ExtensionContextMenuModel::GetActiveWebContents() const { |
| 293 return browser_->tab_strip_model()->GetActiveWebContents(); | 297 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 294 } | 298 } |
| OLD | NEW |