| 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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 | 473 |
| 474 // Don't inspect HTML dialogs. | 474 // Don't inspect HTML dialogs. |
| 475 if (source_web_contents_->type() == TAB_CONTENTS_HTML_DIALOG) | 475 if (source_web_contents_->type() == TAB_CONTENTS_HTML_DIALOG) |
| 476 return false; | 476 return false; |
| 477 | 477 |
| 478 // Don't inspect view source. | 478 // Don't inspect view source. |
| 479 if (source_web_contents_->type() == TAB_CONTENTS_VIEW_SOURCE) | 479 if (source_web_contents_->type() == TAB_CONTENTS_VIEW_SOURCE) |
| 480 return false; | 480 return false; |
| 481 | 481 |
| 482 // Don't inspect inspector, new tab UI, etc. | 482 // Don't inspect inspector, new tab UI, etc. |
| 483 if (active_entry->url().SchemeIs("chrome-resource")) | 483 if (active_entry->url().SchemeIs("chrome")) |
| 484 return false; | 484 return false; |
| 485 | 485 |
| 486 // Don't inspect about:network, about:memory, etc. | 486 // Don't inspect about:network, about:memory, etc. |
| 487 // However, we do want to inspect about:blank, which is often | 487 // However, we do want to inspect about:blank, which is often |
| 488 // used by ordinary web pages. | 488 // used by ordinary web pages. |
| 489 if (active_entry->display_url().SchemeIs("about") && | 489 if (active_entry->display_url().SchemeIs("about") && |
| 490 !LowerCaseEqualsASCII(active_entry->display_url().path(), "blank")) | 490 !LowerCaseEqualsASCII(active_entry->display_url().path(), "blank")) |
| 491 return false; | 491 return false; |
| 492 | 492 |
| 493 // Don't enable the web inspector if JavaScript is disabled | 493 // Don't enable the web inspector if JavaScript is disabled |
| 494 if (id == IDS_CONTENT_CONTEXT_INSPECTELEMENT) { | 494 if (id == IDS_CONTENT_CONTEXT_INSPECTELEMENT) { |
| 495 PrefService* prefs = source_web_contents_->profile()->GetPrefs(); | 495 PrefService* prefs = source_web_contents_->profile()->GetPrefs(); |
| 496 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled) || | 496 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled) || |
| 497 command_line.HasSwitch(switches::kDisableJavaScript)) | 497 command_line.HasSwitch(switches::kDisableJavaScript)) |
| 498 return false; | 498 return false; |
| 499 } | 499 } |
| 500 | 500 |
| 501 return true; | 501 return true; |
| 502 } | 502 } |
| 503 | 503 |
| OLD | NEW |