| Index: chrome/browser/ui/views/omnibox/omnibox_view_win.cc
|
| diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
|
| index fb5646fab8f5892f9a716be77f8850187e248b83..c6fb6e250b222612fcf7856788d48130b14e96d6 100644
|
| --- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
|
| +++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
|
| @@ -1015,6 +1015,23 @@ int OmniboxViewWin::OnPerformDropImpl(const ui::DropTargetEvent& event,
|
| return ui::DragDropTypes::DRAG_NONE;
|
| }
|
|
|
| +bool OmniboxViewWin::ShouldAddCopyURL() const {
|
| + return !!CanCopy() &&
|
| + !model()->user_input_in_progress() &&
|
| + toolbar_model()->WouldReplaceSearchURLWithSearchTerms();
|
| +}
|
| +
|
| +void OmniboxViewWin::CopyURL() {
|
| + const string16& text = toolbar_model()->GetText(false);
|
| + const GURL& url = toolbar_model()->GetURL();
|
| +
|
| + ui::ScopedClipboardWriter scw(g_browser_process->clipboard(),
|
| + ui::Clipboard::BUFFER_STANDARD);
|
| + scw.WriteText(text);
|
| + scw.WriteBookmark(text, url.spec());
|
| + scw.WriteHyperlink(net::EscapeForHTML(text), url.spec());
|
| +}
|
| +
|
| bool OmniboxViewWin::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) {
|
| ui::KeyboardCode key = event.key_code();
|
| // We don't process ALT + numpad digit as accelerators, they are used for
|
| @@ -1084,6 +1101,7 @@ bool OmniboxViewWin::IsCommandIdEnabled(int command_id) const {
|
| case IDS_UNDO: return !!CanUndo();
|
| case IDC_CUT: return !!CanCut();
|
| case IDC_COPY: return !!CanCopy();
|
| + case IDC_COPY_URL: return ShouldAddCopyURL();
|
| case IDC_PASTE: return !!CanPaste();
|
| case IDS_PASTE_AND_GO: return model()->CanPasteAndGo(GetClipboardText());
|
| case IDS_SELECT_ALL: return !!CanSelectAll();
|
| @@ -1137,6 +1155,10 @@ void OmniboxViewWin::ExecuteCommand(int command_id) {
|
| Copy();
|
| break;
|
|
|
| + case IDC_COPY_URL:
|
| + CopyURL();
|
| + break;
|
| +
|
| case IDC_PASTE:
|
| Paste();
|
| break;
|
|
|