Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: chrome/browser/extensions/extension_context_menu_model.cc

Issue 527963003: Uncouple ActiveScriptController from LocationBarController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 AppendExtensionItems(); 276 AppendExtensionItems();
277 AddSeparator(ui::NORMAL_SEPARATOR); 277 AddSeparator(ui::NORMAL_SEPARATOR);
278 278
279 // Add the "Always Allow" item for adding persisted permissions for script 279 // Add the "Always Allow" item for adding persisted permissions for script
280 // injections if there is an active action for this extension. Note that this 280 // injections if there is an active action for this extension. Note that this
281 // will add it to *all* extension action context menus, not just the one 281 // will add it to *all* extension action context menus, not just the one
282 // attached to the script injection request icon, but that's okay. 282 // attached to the script injection request icon, but that's okay.
283 WebContents* web_contents = GetActiveWebContents(); 283 WebContents* web_contents = GetActiveWebContents();
284 if (web_contents && 284 if (web_contents &&
285 extensions::ActiveScriptController::GetForWebContents(web_contents) 285 extensions::ActiveScriptController::GetForWebContents(web_contents)
286 ->HasActiveScriptAction(extension)) { 286 ->WantsToRun(extension)) {
287 AddItemWithStringId(ALWAYS_RUN, IDS_EXTENSIONS_ALWAYS_RUN); 287 AddItemWithStringId(ALWAYS_RUN, IDS_EXTENSIONS_ALWAYS_RUN);
288 } 288 }
289 289
290 AddItemWithStringId(CONFIGURE, IDS_EXTENSIONS_OPTIONS_MENU_ITEM); 290 AddItemWithStringId(CONFIGURE, IDS_EXTENSIONS_OPTIONS_MENU_ITEM);
291 AddItem(UNINSTALL, l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL)); 291 AddItem(UNINSTALL, l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL));
292 292
293 // Add a toggle visibility (show/hide) if the extension icon is shown on the 293 // Add a toggle visibility (show/hide) if the extension icon is shown on the
294 // toolbar. 294 // toolbar.
295 int visibility_string_id = GetVisibilityStringId(profile_, extension); 295 int visibility_string_id = GetVisibilityStringId(profile_, extension);
296 if (visibility_string_id != -1) 296 if (visibility_string_id != -1)
(...skipping 22 matching lines...) Expand all
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698