diff options
author | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 18:07:55 +0000 |
---|---|---|
committer | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 18:07:55 +0000 |
commit | 66e2c28c1f940c38f54fc042b625c11d63375b48 (patch) | |
tree | ed56e6e7fbbdd20726f6e0d6b80d869e1464490a | |
parent | 26c2b6d2361d8b407291b0893981c1e1e66e850f (diff) | |
download | chromium_src-66e2c28c1f940c38f54fc042b625c11d63375b48.zip chromium_src-66e2c28c1f940c38f54fc042b625c11d63375b48.tar.gz chromium_src-66e2c28c1f940c38f54fc042b625c11d63375b48.tar.bz2 |
Avoid crash in render view context menu with no browser.
BUG=136809
TEST=See issue
Review URL: https://chromiumcodereview.appspot.com/10805075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148141 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/tab_contents/render_view_context_menu.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 9ff2c16..bd8bf56 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -1151,7 +1151,12 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const { return IsDevCommandEnabled(id); case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: - return source_web_contents_->GetController().GetActiveEntry() != NULL; + if (source_web_contents_->GetController().GetActiveEntry() == NULL) + return false; + // Disabled if no browser is associated (e.g. desktop notifications). + if (browser::FindBrowserWithWebContents(source_web_contents_) == NULL) + return false; + return true; case IDC_CONTENT_CONTEXT_TRANSLATE: { TabContents* tab_contents = @@ -1341,7 +1346,11 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const { case IDC_CONTENT_CONTEXT_GOTOURL: case IDC_SPELLPANEL_TOGGLE: case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS: + return true; case IDC_CONTENT_CONTEXT_VIEWFRAMEINFO: + // Disabled if no browser is associated (e.g. desktop notifications). + if (browser::FindBrowserWithWebContents(source_web_contents_) == NULL) + return false; return true; case IDC_CHECK_SPELLING_WHILE_TYPING: |