| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "chrome/browser/tab_contents/render_view_context_menu_controller.h" | 7 #include "chrome/browser/tab_contents/render_view_context_menu_controller.h" |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 void RenderViewContextMenuController::CopyImageAt(int x, int y) { | 61 void RenderViewContextMenuController::CopyImageAt(int x, int y) { |
| 62 source_web_contents_->render_view_host()->CopyImageAt(x, y); | 62 source_web_contents_->render_view_host()->CopyImageAt(x, y); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void RenderViewContextMenuController::Inspect(int x, int y) { | 65 void RenderViewContextMenuController::Inspect(int x, int y) { |
| 66 source_web_contents_->render_view_host()->InspectElementAt(x, y); | 66 source_web_contents_->render_view_host()->InspectElementAt(x, y); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void RenderViewContextMenuController::WriteTextToClipboard( | 69 void RenderViewContextMenuController::WriteTextToClipboard( |
| 70 const std::wstring& text) { | 70 const string16& text) { |
| 71 ClipboardService* clipboard = g_browser_process->clipboard_service(); | 71 ClipboardService* clipboard = g_browser_process->clipboard_service(); |
| 72 | 72 |
| 73 if (!clipboard) | 73 if (!clipboard) |
| 74 return; | 74 return; |
| 75 | 75 |
| 76 ScopedClipboardWriter scw(clipboard); | 76 ScopedClipboardWriter scw(clipboard); |
| 77 scw.WriteText(text); | 77 scw.WriteText(text); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void RenderViewContextMenuController::WriteURLToClipboard(const GURL& url) { | 80 void RenderViewContextMenuController::WriteURLToClipboard(const GURL& url) { |
| 81 if (url.SchemeIs(chrome::kMailToScheme)) | 81 if (url.SchemeIs(chrome::kMailToScheme)) |
| 82 WriteTextToClipboard(UTF8ToWide(url.path())); | 82 WriteTextToClipboard(UTF8ToUTF16(url.path())); |
| 83 else | 83 else |
| 84 WriteTextToClipboard(UTF8ToWide(url.spec())); | 84 WriteTextToClipboard(UTF8ToUTF16(url.spec())); |
| 85 } | 85 } |
| 86 | 86 |
| 87 /////////////////////////////////////////////////////////////////////////////// | 87 /////////////////////////////////////////////////////////////////////////////// |
| 88 // Menu::Delegate methods | 88 // Menu::Delegate methods |
| 89 | 89 |
| 90 std::wstring RenderViewContextMenuController::GetLabel(int id) const { | 90 std::wstring RenderViewContextMenuController::GetLabel(int id) const { |
| 91 switch (id) { | 91 switch (id) { |
| 92 case IDS_CONTENT_CONTEXT_SEARCHWEBFOR: { | 92 case IDS_CONTENT_CONTEXT_SEARCHWEBFOR: { |
| 93 const TemplateURL* const default_provider = source_web_contents_-> | 93 const TemplateURL* const default_provider = source_web_contents_-> |
| 94 profile()->GetTemplateURLModel()->GetDefaultSearchProvider(); | 94 profile()->GetTemplateURLModel()->GetDefaultSearchProvider(); |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 // Don't enable the web inspector if JavaScript is disabled | 537 // Don't enable the web inspector if JavaScript is disabled |
| 538 if (id == IDS_CONTENT_CONTEXT_INSPECTELEMENT) { | 538 if (id == IDS_CONTENT_CONTEXT_INSPECTELEMENT) { |
| 539 PrefService* prefs = source_web_contents_->profile()->GetPrefs(); | 539 PrefService* prefs = source_web_contents_->profile()->GetPrefs(); |
| 540 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled) || | 540 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled) || |
| 541 command_line.HasSwitch(switches::kDisableJavaScript)) | 541 command_line.HasSwitch(switches::kDisableJavaScript)) |
| 542 return false; | 542 return false; |
| 543 } | 543 } |
| 544 | 544 |
| 545 return true; | 545 return true; |
| 546 } | 546 } |
| OLD | NEW |