| 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/macros.h" | 7 #include "base/macros.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/context_menu_matcher.h" | 10 #include "chrome/browser/extensions/context_menu_matcher.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 int visibility_string_id = | 341 int visibility_string_id = |
| 342 GetVisibilityStringId(profile_, extension, button_visibility); | 342 GetVisibilityStringId(profile_, extension, button_visibility); |
| 343 if (visibility_string_id != -1) | 343 if (visibility_string_id != -1) |
| 344 AddItemWithStringId(TOGGLE_VISIBILITY, visibility_string_id); | 344 AddItemWithStringId(TOGGLE_VISIBILITY, visibility_string_id); |
| 345 | 345 |
| 346 if (!is_component_) { | 346 if (!is_component_) { |
| 347 AddSeparator(ui::NORMAL_SEPARATOR); | 347 AddSeparator(ui::NORMAL_SEPARATOR); |
| 348 AddItemWithStringId(MANAGE, IDS_MANAGE_EXTENSION); | 348 AddItemWithStringId(MANAGE, IDS_MANAGE_EXTENSION); |
| 349 } | 349 } |
| 350 | 350 |
| 351 const ActionInfo* action_info = ActionInfo::GetPageActionInfo(extension); |
| 352 if (!action_info) |
| 353 action_info = ActionInfo::GetBrowserActionInfo(extension); |
| 351 if (profile_->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode) && | 354 if (profile_->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode) && |
| 352 delegate_ && !is_component_) { | 355 delegate_ && !is_component_ && action_info && !action_info->synthesized) { |
| 353 AddSeparator(ui::NORMAL_SEPARATOR); | 356 AddSeparator(ui::NORMAL_SEPARATOR); |
| 354 AddItemWithStringId(INSPECT_POPUP, IDS_EXTENSION_ACTION_INSPECT_POPUP); | 357 AddItemWithStringId(INSPECT_POPUP, IDS_EXTENSION_ACTION_INSPECT_POPUP); |
| 355 } | 358 } |
| 356 } | 359 } |
| 357 | 360 |
| 358 const Extension* ExtensionContextMenuModel::GetExtension() const { | 361 const Extension* ExtensionContextMenuModel::GetExtension() const { |
| 359 return ExtensionRegistry::Get(profile_)->enabled_extensions().GetByID( | 362 return ExtensionRegistry::Get(profile_)->enabled_extensions().GetByID( |
| 360 extension_id_); | 363 extension_id_); |
| 361 } | 364 } |
| 362 | 365 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 if (runner && runner->WantsToRun(extension)) | 460 if (runner && runner->WantsToRun(extension)) |
| 458 runner->RunBlockedActions(extension); | 461 runner->RunBlockedActions(extension); |
| 459 } | 462 } |
| 460 } | 463 } |
| 461 | 464 |
| 462 content::WebContents* ExtensionContextMenuModel::GetActiveWebContents() const { | 465 content::WebContents* ExtensionContextMenuModel::GetActiveWebContents() const { |
| 463 return browser_->tab_strip_model()->GetActiveWebContents(); | 466 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 464 } | 467 } |
| 465 | 468 |
| 466 } // namespace extensions | 469 } // namespace extensions |
| OLD | NEW |