| 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/browser.h" | 5 #include "chrome/browser/browser.h" |
| 6 | 6 |
| 7 #include <commdlg.h> | 7 #include <commdlg.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include "base/file_version_info.h" | 10 #include "base/file_version_info.h" |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 case IDC_ENCODING_ISO885914: | 621 case IDC_ENCODING_ISO885914: |
| 622 case IDC_ENCODING_ISO885916: | 622 case IDC_ENCODING_ISO885916: |
| 623 case IDC_ENCODING_ISO88599: | 623 case IDC_ENCODING_ISO88599: |
| 624 case IDC_ENCODING_WINDOWS1254: | 624 case IDC_ENCODING_WINDOWS1254: |
| 625 case IDC_ENCODING_ISO88596: | 625 case IDC_ENCODING_ISO88596: |
| 626 case IDC_ENCODING_WINDOWS1256: | 626 case IDC_ENCODING_WINDOWS1256: |
| 627 case IDC_ENCODING_ISO88598: | 627 case IDC_ENCODING_ISO88598: |
| 628 case IDC_ENCODING_WINDOWS1255: | 628 case IDC_ENCODING_WINDOWS1255: |
| 629 case IDC_ENCODING_WINDOWS1258: { | 629 case IDC_ENCODING_WINDOWS1258: { |
| 630 UserMetrics::RecordAction(L"OverrideEncoding", profile_); | 630 UserMetrics::RecordAction(L"OverrideEncoding", profile_); |
| 631 const std::wstring cur_encoding_name = | 631 const std::wstring selected_encoding = |
| 632 CharacterEncoding::GetCanonicalEncodingNameByCommandId(id); | 632 CharacterEncoding::GetCanonicalEncodingNameByCommandId(id); |
| 633 TabContents* current_tab = GetSelectedTabContents(); | 633 TabContents* current_tab = GetSelectedTabContents(); |
| 634 if (!cur_encoding_name.empty() && current_tab) | 634 if (!selected_encoding.empty() && current_tab && |
| 635 current_tab->set_encoding(cur_encoding_name); | 635 current_tab->AsWebContents()) |
| 636 // Update user recently selected encoding list. | 636 current_tab->AsWebContents()->override_encoding(selected_encoding); |
| 637 // Update the list of recently selected encodings. |
| 637 std::wstring new_selected_encoding_list; | 638 std::wstring new_selected_encoding_list; |
| 638 if (CharacterEncoding::UpdateRecentlySelectdEncoding( | 639 if (CharacterEncoding::UpdateRecentlySelectdEncoding( |
| 639 profile_->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding), | 640 profile_->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding), |
| 640 id, | 641 id, |
| 641 &new_selected_encoding_list)) | 642 &new_selected_encoding_list)) |
| 642 profile_->GetPrefs()->SetString(prefs::kRecentlySelectedEncoding, | 643 profile_->GetPrefs()->SetString(prefs::kRecentlySelectedEncoding, |
| 643 new_selected_encoding_list); | 644 new_selected_encoding_list); |
| 644 break; | 645 break; |
| 645 } | 646 } |
| 646 | 647 |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 | 1043 |
| 1043 //////////////////////////////////////////////////////////////////////////////// | 1044 //////////////////////////////////////////////////////////////////////////////// |
| 1044 // Browser, SelectFileDialog::Listener implementation: | 1045 // Browser, SelectFileDialog::Listener implementation: |
| 1045 | 1046 |
| 1046 void Browser::FileSelected(const std::wstring& path, void* params) { | 1047 void Browser::FileSelected(const std::wstring& path, void* params) { |
| 1047 GURL file_url = net::FilePathToFileURL(path); | 1048 GURL file_url = net::FilePathToFileURL(path); |
| 1048 if (!file_url.is_empty()) | 1049 if (!file_url.is_empty()) |
| 1049 OpenURL(file_url, CURRENT_TAB, PageTransition::TYPED); | 1050 OpenURL(file_url, CURRENT_TAB, PageTransition::TYPED); |
| 1050 } | 1051 } |
| 1051 | 1052 |
| OLD | NEW |