| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 case IDC_BACK: { | 223 case IDC_BACK: { |
| 224 NavigationController* nc = GetSelectedNavigationController(); | 224 NavigationController* nc = GetSelectedNavigationController(); |
| 225 return nc ? nc->CanGoBack() : false; | 225 return nc ? nc->CanGoBack() : false; |
| 226 } | 226 } |
| 227 case IDC_FORWARD: { | 227 case IDC_FORWARD: { |
| 228 NavigationController* nc = GetSelectedNavigationController(); | 228 NavigationController* nc = GetSelectedNavigationController(); |
| 229 return nc ? nc->CanGoForward() : false; | 229 return nc ? nc->CanGoForward() : false; |
| 230 } | 230 } |
| 231 case IDC_STOP: { | 231 case IDC_STOP: { |
| 232 TabContents* current_tab = GetSelectedTabContents(); | 232 TabContents* current_tab = GetSelectedTabContents(); |
| 233 return (current_tab && current_tab->IsLoading()); | 233 return (current_tab && current_tab->is_loading()); |
| 234 } | 234 } |
| 235 case IDC_CLOSETAB: { | 235 case IDC_CLOSETAB: { |
| 236 return !IsApplication(); | 236 return !IsApplication(); |
| 237 } | 237 } |
| 238 default: | 238 default: |
| 239 return controller_.IsCommandEnabled(id); | 239 return controller_.IsCommandEnabled(id); |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 | 242 |
| 243 void Browser::ExecuteCommand(int id) { | 243 void Browser::ExecuteCommand(int id) { |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 507 |
| 508 case IDC_EDIT_SEARCH_ENGINES: { | 508 case IDC_EDIT_SEARCH_ENGINES: { |
| 509 UserMetrics::RecordAction(L"EditSearchEngines", profile_); | 509 UserMetrics::RecordAction(L"EditSearchEngines", profile_); |
| 510 OpenKeywordEditor(); | 510 OpenKeywordEditor(); |
| 511 break; | 511 break; |
| 512 } | 512 } |
| 513 | 513 |
| 514 case IDC_ZOOM_PLUS: { | 514 case IDC_ZOOM_PLUS: { |
| 515 UserMetrics::RecordAction(L"ZoomPlus", profile_); | 515 UserMetrics::RecordAction(L"ZoomPlus", profile_); |
| 516 TabContents* current_tab = GetSelectedTabContents(); | 516 TabContents* current_tab = GetSelectedTabContents(); |
| 517 DCHECK(current_tab); | 517 if (current_tab->AsWebContents()) { |
| 518 current_tab->AlterTextSize(text_zoom::TEXT_LARGER); | 518 current_tab->AsWebContents()->render_view_host()->AlterTextSize( |
| 519 text_zoom::TEXT_LARGER); |
| 520 } |
| 519 break; | 521 break; |
| 520 } | 522 } |
| 521 | 523 |
| 522 case IDC_ZOOM_MINUS: { | 524 case IDC_ZOOM_MINUS: { |
| 523 UserMetrics::RecordAction(L"ZoomMinus", profile_); | 525 UserMetrics::RecordAction(L"ZoomMinus", profile_); |
| 524 TabContents* current_tab = GetSelectedTabContents(); | 526 TabContents* current_tab = GetSelectedTabContents(); |
| 525 DCHECK(current_tab); | 527 if (current_tab->AsWebContents()) { |
| 526 current_tab->AlterTextSize(text_zoom::TEXT_SMALLER); | 528 current_tab->AsWebContents()->render_view_host()->AlterTextSize( |
| 529 text_zoom::TEXT_SMALLER); |
| 530 } |
| 527 break; | 531 break; |
| 528 } | 532 } |
| 529 | 533 |
| 530 case IDC_ZOOM_NORMAL: { | 534 case IDC_ZOOM_NORMAL: { |
| 531 UserMetrics::RecordAction(L"ZoomNormal", profile_); | 535 UserMetrics::RecordAction(L"ZoomNormal", profile_); |
| 532 TabContents* current_tab = GetSelectedTabContents(); | 536 TabContents* current_tab = GetSelectedTabContents(); |
| 533 DCHECK(current_tab); | 537 if (current_tab->AsWebContents()) { |
| 534 current_tab->AlterTextSize(text_zoom::TEXT_STANDARD); | 538 current_tab->AsWebContents()->render_view_host()->AlterTextSize( |
| 539 text_zoom::TEXT_STANDARD); |
| 540 } |
| 535 break; | 541 break; |
| 536 } | 542 } |
| 537 | 543 |
| 538 case IDC_OPENFILE: { | 544 case IDC_OPENFILE: { |
| 539 UserMetrics::RecordAction(L"OpenFile", profile_); | 545 UserMetrics::RecordAction(L"OpenFile", profile_); |
| 540 if (!select_file_dialog_.get()) | 546 if (!select_file_dialog_.get()) |
| 541 select_file_dialog_ = SelectFileDialog::Create(this); | 547 select_file_dialog_ = SelectFileDialog::Create(this); |
| 542 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, | 548 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, |
| 543 L"", L"", GetTopLevelHWND(), NULL); | 549 L"", L"", GetTopLevelHWND(), NULL); |
| 544 break; | 550 break; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 case IDC_ENCODING_ISO88596: | 628 case IDC_ENCODING_ISO88596: |
| 623 case IDC_ENCODING_WINDOWS1256: | 629 case IDC_ENCODING_WINDOWS1256: |
| 624 case IDC_ENCODING_ISO88598: | 630 case IDC_ENCODING_ISO88598: |
| 625 case IDC_ENCODING_WINDOWS1255: | 631 case IDC_ENCODING_WINDOWS1255: |
| 626 case IDC_ENCODING_WINDOWS1258: { | 632 case IDC_ENCODING_WINDOWS1258: { |
| 627 UserMetrics::RecordAction(L"OverrideEncoding", profile_); | 633 UserMetrics::RecordAction(L"OverrideEncoding", profile_); |
| 628 const std::wstring cur_encoding_name = | 634 const std::wstring cur_encoding_name = |
| 629 CharacterEncoding::GetCanonicalEncodingNameByCommandId(id); | 635 CharacterEncoding::GetCanonicalEncodingNameByCommandId(id); |
| 630 TabContents* current_tab = GetSelectedTabContents(); | 636 TabContents* current_tab = GetSelectedTabContents(); |
| 631 if (!cur_encoding_name.empty() && current_tab) | 637 if (!cur_encoding_name.empty() && current_tab) |
| 632 current_tab->SetPageEncoding(cur_encoding_name); | 638 current_tab->set_encoding(cur_encoding_name); |
| 633 // Update user recently selected encoding list. | 639 // Update user recently selected encoding list. |
| 634 std::wstring new_selected_encoding_list; | 640 std::wstring new_selected_encoding_list; |
| 635 if (CharacterEncoding::UpdateRecentlySelectdEncoding( | 641 if (CharacterEncoding::UpdateRecentlySelectdEncoding( |
| 636 profile_->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding), | 642 profile_->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding), |
| 637 id, | 643 id, |
| 638 &new_selected_encoding_list)) | 644 &new_selected_encoding_list)) |
| 639 profile_->GetPrefs()->SetString(prefs::kRecentlySelectedEncoding, | 645 profile_->GetPrefs()->SetString(prefs::kRecentlySelectedEncoding, |
| 640 new_selected_encoding_list); | 646 new_selected_encoding_list); |
| 641 break; | 647 break; |
| 642 } | 648 } |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 | 1076 |
| 1071 //////////////////////////////////////////////////////////////////////////////// | 1077 //////////////////////////////////////////////////////////////////////////////// |
| 1072 // Browser, SelectFileDialog::Listener implementation: | 1078 // Browser, SelectFileDialog::Listener implementation: |
| 1073 | 1079 |
| 1074 void Browser::FileSelected(const std::wstring& path, void* params) { | 1080 void Browser::FileSelected(const std::wstring& path, void* params) { |
| 1075 GURL file_url = net::FilePathToFileURL(path); | 1081 GURL file_url = net::FilePathToFileURL(path); |
| 1076 if (!file_url.is_empty()) | 1082 if (!file_url.is_empty()) |
| 1077 OpenURL(file_url, CURRENT_TAB, PageTransition::TYPED); | 1083 OpenURL(file_url, CURRENT_TAB, PageTransition::TYPED); |
| 1078 } | 1084 } |
| 1079 | 1085 |
| OLD | NEW |