| 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 break; | 468 break; |
| 469 } | 469 } |
| 470 | 470 |
| 471 case IDS_CONTENT_CONTEXT_ADDSEARCHENGINE: // Not implemented. | 471 case IDS_CONTENT_CONTEXT_ADDSEARCHENGINE: // Not implemented. |
| 472 default: | 472 default: |
| 473 break; | 473 break; |
| 474 } | 474 } |
| 475 } | 475 } |
| 476 | 476 |
| 477 bool RenderViewContextMenuController::IsDevCommandEnabled(int id) const { | 477 bool RenderViewContextMenuController::IsDevCommandEnabled(int id) const { |
| 478 CommandLine command_line; | 478 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 479 if (command_line.HasSwitch(switches::kAlwaysEnableDevTools)) | 479 if (command_line.HasSwitch(switches::kAlwaysEnableDevTools)) |
| 480 return true; | 480 return true; |
| 481 | 481 |
| 482 NavigationEntry *active_entry = | 482 NavigationEntry *active_entry = |
| 483 source_web_contents_->controller()->GetActiveEntry(); | 483 source_web_contents_->controller()->GetActiveEntry(); |
| 484 if (!active_entry) | 484 if (!active_entry) |
| 485 return false; | 485 return false; |
| 486 | 486 |
| 487 // Don't inspect HTML dialogs. | 487 // Don't inspect HTML dialogs. |
| 488 if (source_web_contents_->type() == TAB_CONTENTS_HTML_DIALOG) | 488 if (source_web_contents_->type() == TAB_CONTENTS_HTML_DIALOG) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 507 if (id == IDS_CONTENT_CONTEXT_INSPECTELEMENT) { | 507 if (id == IDS_CONTENT_CONTEXT_INSPECTELEMENT) { |
| 508 PrefService* prefs = source_web_contents_->profile()->GetPrefs(); | 508 PrefService* prefs = source_web_contents_->profile()->GetPrefs(); |
| 509 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled) || | 509 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled) || |
| 510 command_line.HasSwitch(switches::kDisableJavaScript)) | 510 command_line.HasSwitch(switches::kDisableJavaScript)) |
| 511 return false; | 511 return false; |
| 512 } | 512 } |
| 513 | 513 |
| 514 return true; | 514 return true; |
| 515 } | 515 } |
| 516 | 516 |
| OLD | NEW |