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

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: 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
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fc46a87e243e3fdebf7492a7ab6460f6f9fc0f97..8430c139f9f517be89ab2a0cb31681d54820dbde 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,19 @@ 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::ExtensionHost* host = profile_->GetExtensionProcessManager()->
+ GetBackgroundHostForExtension(platform_app->id());
+ DCHECK(host);
Marijn Kruisselbrink 2012/09/14 21:15:18 Antony: is this safe, or are there possible situat
asargent_no_longer_on_chrome 2012/09/14 21:57:41 Let's refactor out the C++ code that the chrome://
+
+ DevToolsWindow::OpenDevToolsWindow(host->render_view_host());
+ break;
+ }
+
case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: {
NavigationController* controller = &source_web_contents_->GetController();
NavigationEntry* nav_entry = controller->GetActiveEntry();
@@ -1956,7 +1973,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))
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698