| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/render_view_context_menu_controller.h" | 5 #include "chrome/browser/render_view_context_menu_controller.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/scoped_clipboard_writer.h" | 9 #include "base/scoped_clipboard_writer.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 | 464 |
| 465 // Don't inspect HTML dialogs. | 465 // Don't inspect HTML dialogs. |
| 466 if (source_web_contents_->type() == TAB_CONTENTS_HTML_DIALOG) | 466 if (source_web_contents_->type() == TAB_CONTENTS_HTML_DIALOG) |
| 467 return false; | 467 return false; |
| 468 | 468 |
| 469 // Don't inspect view source. | 469 // Don't inspect view source. |
| 470 if (source_web_contents_->type() == TAB_CONTENTS_VIEW_SOURCE) | 470 if (source_web_contents_->type() == TAB_CONTENTS_VIEW_SOURCE) |
| 471 return false; | 471 return false; |
| 472 | 472 |
| 473 // Don't inspect inspector, new tab UI, etc. | 473 // Don't inspect inspector, new tab UI, etc. |
| 474 if (active_entry->url().SchemeIs("chrome-resource")) | 474 if (active_entry->url().SchemeIs("chrome")) |
| 475 return false; | 475 return false; |
| 476 | 476 |
| 477 // Don't inspect about:network, about:memory, etc. | 477 // Don't inspect about:network, about:memory, etc. |
| 478 // However, we do want to inspect about:blank, which is often | 478 // However, we do want to inspect about:blank, which is often |
| 479 // used by ordinary web pages. | 479 // used by ordinary web pages. |
| 480 if (active_entry->display_url().SchemeIs("about") && | 480 if (active_entry->display_url().SchemeIs("about") && |
| 481 !LowerCaseEqualsASCII(active_entry->display_url().path(), "blank")) | 481 !LowerCaseEqualsASCII(active_entry->display_url().path(), "blank")) |
| 482 return false; | 482 return false; |
| 483 | 483 |
| 484 // Don't enable the web inspector if JavaScript is disabled | 484 // Don't enable the web inspector if JavaScript is disabled |
| 485 if (id == IDS_CONTENT_CONTEXT_INSPECTELEMENT) { | 485 if (id == IDS_CONTENT_CONTEXT_INSPECTELEMENT) { |
| 486 PrefService* prefs = source_web_contents_->profile()->GetPrefs(); | 486 PrefService* prefs = source_web_contents_->profile()->GetPrefs(); |
| 487 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled) || | 487 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled) || |
| 488 command_line.HasSwitch(switches::kDisableJavaScript)) | 488 command_line.HasSwitch(switches::kDisableJavaScript)) |
| 489 return false; | 489 return false; |
| 490 } | 490 } |
| 491 | 491 |
| 492 return true; | 492 return true; |
| 493 } | 493 } |
| 494 | 494 |
| OLD | NEW |