OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 5 #include <algorithm> |
6 #include <set> | 6 #include <set> |
7 | 7 |
8 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 8 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 | 1579 |
1580 NavigationEntry *active_entry = | 1580 NavigationEntry *active_entry = |
1581 source_tab_contents_->controller().GetActiveEntry(); | 1581 source_tab_contents_->controller().GetActiveEntry(); |
1582 if (!active_entry) | 1582 if (!active_entry) |
1583 return false; | 1583 return false; |
1584 | 1584 |
1585 // Don't inspect view source. | 1585 // Don't inspect view source. |
1586 if (active_entry->IsViewSourceMode()) | 1586 if (active_entry->IsViewSourceMode()) |
1587 return false; | 1587 return false; |
1588 | 1588 |
1589 // Don't inspect about:network, about:memory, etc. | 1589 // Do not inspect Chrome URLs (chrome://network/, chrome://memory/, etc.). |
1590 // However, we do want to inspect about:blank, which is often | 1590 // However, do inspect about:blank, which is often used by ordinary web pages. |
1591 // used by ordinary web pages. | 1591 if (active_entry->virtual_url().SchemeIs(chrome::kChromeUIScheme)) |
1592 if (active_entry->virtual_url().SchemeIs(chrome::kAboutScheme) && | |
1593 !LowerCaseEqualsASCII(active_entry->virtual_url().path(), "blank")) | |
1594 return false; | 1592 return false; |
1595 | 1593 |
1596 if (id == IDC_CONTENT_CONTEXT_INSPECTELEMENT) { | 1594 if (id == IDC_CONTENT_CONTEXT_INSPECTELEMENT) { |
1597 // Don't enable the web inspector if JavaScript is disabled. | 1595 // Don't enable the web inspector if JavaScript is disabled. |
1598 if (!profile_->GetPrefs()->GetBoolean(prefs::kWebKitJavascriptEnabled) || | 1596 if (!profile_->GetPrefs()->GetBoolean(prefs::kWebKitJavascriptEnabled) || |
1599 command_line.HasSwitch(switches::kDisableJavaScript)) | 1597 command_line.HasSwitch(switches::kDisableJavaScript)) |
1600 return false; | 1598 return false; |
1601 // Don't enable the web inspector if the developer tools are disabled via | 1599 // Don't enable the web inspector if the developer tools are disabled via |
1602 // the preference dev-tools-disabled. | 1600 // the preference dev-tools-disabled. |
1603 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) | 1601 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 g_browser_process->clipboard()); | 1637 g_browser_process->clipboard()); |
1640 } | 1638 } |
1641 | 1639 |
1642 void RenderViewContextMenu::MediaPlayerActionAt( | 1640 void RenderViewContextMenu::MediaPlayerActionAt( |
1643 const gfx::Point& location, | 1641 const gfx::Point& location, |
1644 const WebMediaPlayerAction& action) { | 1642 const WebMediaPlayerAction& action) { |
1645 RenderViewHost* rvh = source_tab_contents_->render_view_host(); | 1643 RenderViewHost* rvh = source_tab_contents_->render_view_host(); |
1646 rvh->Send(new ViewMsg_MediaPlayerActionAt( | 1644 rvh->Send(new ViewMsg_MediaPlayerActionAt( |
1647 rvh->routing_id(), location, action)); | 1645 rvh->routing_id(), location, action)); |
1648 } | 1646 } |
OLD | NEW |