| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "app/animation.h" | 7 #include "app/animation.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/idle_timer.h" | 10 #include "base/idle_timer.h" |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 #if defined(OS_WIN) || defined(OS_LINUX) | 1002 #if defined(OS_WIN) || defined(OS_LINUX) |
| 1003 GetSelectedTabContents()->PrintPreview(); | 1003 GetSelectedTabContents()->PrintPreview(); |
| 1004 #else | 1004 #else |
| 1005 NOTIMPLEMENTED(); | 1005 NOTIMPLEMENTED(); |
| 1006 #endif | 1006 #endif |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 void Browser::ToggleEncodingAutoDetect() { | 1009 void Browser::ToggleEncodingAutoDetect() { |
| 1010 UserMetrics::RecordAction(L"AutoDetectChange", profile_); | 1010 UserMetrics::RecordAction(L"AutoDetectChange", profile_); |
| 1011 encoding_auto_detect_.SetValue(!encoding_auto_detect_.GetValue()); | 1011 encoding_auto_detect_.SetValue(!encoding_auto_detect_.GetValue()); |
| 1012 // Reload the page so we can try to auto-detect the charset. | 1012 // If "auto detect" is turned on, then any current override encoding |
| 1013 Reload(); | 1013 // is cleared. This also implicitly performs a reload. |
| 1014 // OTOH, if "auto detect" is turned off, we don't change the currently |
| 1015 // active encoding. |
| 1016 if (encoding_auto_detect_.GetValue()) { |
| 1017 TabContents* contents = GetSelectedTabContents(); |
| 1018 if (contents) |
| 1019 contents->reset_override_encoding(); |
| 1020 } |
| 1014 } | 1021 } |
| 1015 | 1022 |
| 1016 void Browser::OverrideEncoding(int encoding_id) { | 1023 void Browser::OverrideEncoding(int encoding_id) { |
| 1017 UserMetrics::RecordAction(L"OverrideEncoding", profile_); | 1024 UserMetrics::RecordAction(L"OverrideEncoding", profile_); |
| 1018 const std::string selected_encoding = | 1025 const std::string selected_encoding = |
| 1019 CharacterEncoding::GetCanonicalEncodingNameByCommandId(encoding_id); | 1026 CharacterEncoding::GetCanonicalEncodingNameByCommandId(encoding_id); |
| 1020 TabContents* contents = GetSelectedTabContents(); | 1027 TabContents* contents = GetSelectedTabContents(); |
| 1021 if (!selected_encoding.empty() && contents) | 1028 if (!selected_encoding.empty() && contents) |
| 1022 contents->override_encoding(selected_encoding); | 1029 contents->override_encoding(selected_encoding); |
| 1023 // Update the list of recently selected encodings. | 1030 // Update the list of recently selected encodings. |
| (...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2891 /////////////////////////////////////////////////////////////////////////////// | 2898 /////////////////////////////////////////////////////////////////////////////// |
| 2892 // BrowserToolbarModel (private): | 2899 // BrowserToolbarModel (private): |
| 2893 | 2900 |
| 2894 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 2901 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
| 2895 // This |current_tab| can be NULL during the initialization of the | 2902 // This |current_tab| can be NULL during the initialization of the |
| 2896 // toolbar during window creation (i.e. before any tabs have been added | 2903 // toolbar during window creation (i.e. before any tabs have been added |
| 2897 // to the window). | 2904 // to the window). |
| 2898 TabContents* current_tab = browser_->GetSelectedTabContents(); | 2905 TabContents* current_tab = browser_->GetSelectedTabContents(); |
| 2899 return current_tab ? ¤t_tab->controller() : NULL; | 2906 return current_tab ? ¤t_tab->controller() : NULL; |
| 2900 } | 2907 } |
| OLD | NEW |