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

Unified Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 10907243: Add "inspect background page" to platform app right-click menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment in test Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/tab_contents/render_view_context_menu.cc
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index a428f3efe9ec4aa921219b539f44ad4a4553a60c..dd01c21b4a2242ac81d144d662b31b52dff04a70 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/download/download_service.h"
#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/download/download_util.h"
+#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/google/google_util.h"
@@ -674,6 +675,8 @@ void RenderViewContextMenu::AppendPlatformAppItems() {
if (platform_app->location() == Extension::LOAD) {
menu_model_.AddItemWithStringId(IDC_RELOAD, IDS_CONTENT_CONTEXT_RELOAD);
AppendDeveloperItems();
+ menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE,
+ IDS_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE);
}
}
@@ -1163,6 +1166,7 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
return source_web_contents_->GetController().CanViewSource();
case IDC_CONTENT_CONTEXT_INSPECTELEMENT:
+ case IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE:
return IsDevCommandEnabled(id);
case IDC_CONTENT_CONTEXT_VIEWPAGEINFO:
@@ -1732,6 +1736,16 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) {
Inspect(params_.x, params_.y);
break;
+ case IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE: {
+ const Extension* platform_app = GetExtension();
+ DCHECK(platform_app);
+ DCHECK(platform_app->is_platform_app());
+
+ extensions::ExtensionSystem::Get(profile_)->extension_service()->
+ InspectBackgroundPage(platform_app);
+ break;
+ }
+
case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: {
NavigationController* controller = &source_web_contents_->GetController();
NavigationEntry* nav_entry = controller->GetActiveEntry();
@@ -1956,7 +1970,8 @@ void RenderViewContextMenu::MenuClosed(ui::SimpleMenuModel* source) {
}
bool RenderViewContextMenu::IsDevCommandEnabled(int id) const {
- if (id == IDC_CONTENT_CONTEXT_INSPECTELEMENT) {
+ if (id == IDC_CONTENT_CONTEXT_INSPECTELEMENT ||
+ id == IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE) {
const CommandLine* command_line = CommandLine::ForCurrentProcess();
if (!profile_->GetPrefs()->GetBoolean(prefs::kWebKitJavascriptEnabled) ||
command_line->HasSwitch(switches::kDisableJavaScript))

Powered by Google App Engine
This is Rietveld 408576698