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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 DCHECK(extension_items_); | 180 DCHECK(extension_items_); |
181 extension_items_->ExecuteCommand( | 181 extension_items_->ExecuteCommand( |
182 command_id, web_contents, content::ContextMenuParams()); | 182 command_id, web_contents, content::ContextMenuParams()); |
183 return; | 183 return; |
184 } | 184 } |
185 | 185 |
186 switch (command_id) { | 186 switch (command_id) { |
187 case NAME: { | 187 case NAME: { |
188 OpenURLParams params(extensions::ManifestURL::GetHomepageURL(extension), | 188 OpenURLParams params(extensions::ManifestURL::GetHomepageURL(extension), |
189 Referrer(), NEW_FOREGROUND_TAB, | 189 Referrer(), NEW_FOREGROUND_TAB, |
190 content::PAGE_TRANSITION_LINK, false); | 190 ui::PAGE_TRANSITION_LINK, false); |
191 browser_->OpenURL(params); | 191 browser_->OpenURL(params); |
192 break; | 192 break; |
193 } | 193 } |
194 case ALWAYS_RUN: { | 194 case ALWAYS_RUN: { |
195 WebContents* web_contents = GetActiveWebContents(); | 195 WebContents* web_contents = GetActiveWebContents(); |
196 if (web_contents) { | 196 if (web_contents) { |
197 extensions::ActiveScriptController::GetForWebContents(web_contents) | 197 extensions::ActiveScriptController::GetForWebContents(web_contents) |
198 ->AlwaysRunOnVisibleOrigin(extension); | 198 ->AlwaysRunOnVisibleOrigin(extension); |
199 } | 199 } |
200 break; | 200 break; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 extension_items_count_ = 0; | 319 extension_items_count_ = 0; |
320 extension_items_->AppendExtensionItems(MenuItem::ExtensionKey(extension_id_), | 320 extension_items_->AppendExtensionItems(MenuItem::ExtensionKey(extension_id_), |
321 base::string16(), | 321 base::string16(), |
322 &extension_items_count_, | 322 &extension_items_count_, |
323 true); // is_action_menu | 323 true); // is_action_menu |
324 } | 324 } |
325 | 325 |
326 content::WebContents* ExtensionContextMenuModel::GetActiveWebContents() const { | 326 content::WebContents* ExtensionContextMenuModel::GetActiveWebContents() const { |
327 return browser_->tab_strip_model()->GetActiveWebContents(); | 327 return browser_->tab_strip_model()->GetActiveWebContents(); |
328 } | 328 } |
OLD | NEW |