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/tab_contents/render_view_context_menu.h" | 5 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/clipboard.h" | 8 #include "base/clipboard.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 source_tab_contents_->render_view_host()->SelectAll(); | 526 source_tab_contents_->render_view_host()->SelectAll(); |
527 break; | 527 break; |
528 | 528 |
529 case IDS_CONTENT_CONTEXT_SEARCHWEBFOR: { | 529 case IDS_CONTENT_CONTEXT_SEARCHWEBFOR: { |
530 const TemplateURL* const default_provider = | 530 const TemplateURL* const default_provider = |
531 profile_->GetTemplateURLModel()->GetDefaultSearchProvider(); | 531 profile_->GetTemplateURLModel()->GetDefaultSearchProvider(); |
532 DCHECK(default_provider); // The context menu should not contain this | 532 DCHECK(default_provider); // The context menu should not contain this |
533 // item when there is no provider. | 533 // item when there is no provider. |
534 const TemplateURLRef* const search_url = default_provider->url(); | 534 const TemplateURLRef* const search_url = default_provider->url(); |
535 DCHECK(search_url->SupportsReplacement()); | 535 DCHECK(search_url->SupportsReplacement()); |
536 OpenURL(GURL(search_url->ReplaceSearchTerms(*default_provider, | 536 OpenURL(GURL(WideToUTF8(search_url->ReplaceSearchTerms(*default_provider, |
537 params_.selection_text, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, | 537 params_.selection_text, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, |
538 std::wstring())), NEW_FOREGROUND_TAB, PageTransition::GENERATED); | 538 std::wstring()))), NEW_FOREGROUND_TAB, PageTransition::GENERATED); |
539 break; | 539 break; |
540 } | 540 } |
541 | 541 |
542 case IDC_SPELLCHECK_SUGGESTION_0: | 542 case IDC_SPELLCHECK_SUGGESTION_0: |
543 case IDC_SPELLCHECK_SUGGESTION_1: | 543 case IDC_SPELLCHECK_SUGGESTION_1: |
544 case IDC_SPELLCHECK_SUGGESTION_2: | 544 case IDC_SPELLCHECK_SUGGESTION_2: |
545 case IDC_SPELLCHECK_SUGGESTION_3: | 545 case IDC_SPELLCHECK_SUGGESTION_3: |
546 case IDC_SPELLCHECK_SUGGESTION_4: | 546 case IDC_SPELLCHECK_SUGGESTION_4: |
547 source_tab_contents_->render_view_host()->Replace( | 547 source_tab_contents_->render_view_host()->Replace( |
548 params_.dictionary_suggestions[id - IDC_SPELLCHECK_SUGGESTION_0]); | 548 params_.dictionary_suggestions[id - IDC_SPELLCHECK_SUGGESTION_0]); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 // applications may not enocode non-ASCII characters in UTF-8. | 653 // applications may not enocode non-ASCII characters in UTF-8. |
654 // So the 4th parameter of net::FormatUrl() should be false. | 654 // So the 4th parameter of net::FormatUrl() should be false. |
655 // See crbug.com/2820. | 655 // See crbug.com/2820. |
656 WideToUTF8(net::FormatUrl( | 656 WideToUTF8(net::FormatUrl( |
657 url, profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), | 657 url, profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), |
658 false, UnescapeRule::NONE, NULL, NULL)); | 658 false, UnescapeRule::NONE, NULL, NULL)); |
659 | 659 |
660 WriteTextToClipboard(UTF8ToUTF16(utf8_text)); | 660 WriteTextToClipboard(UTF8ToUTF16(utf8_text)); |
661 DidWriteURLToClipboard(utf8_text); | 661 DidWriteURLToClipboard(utf8_text); |
662 } | 662 } |
OLD | NEW |