Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 2254273003: Remove text encoding UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 20 matching lines...) Expand all
31 #include "build/build_config.h" 31 #include "build/build_config.h"
32 #include "chrome/app/chrome_command_ids.h" 32 #include "chrome/app/chrome_command_ids.h"
33 #include "chrome/browser/app_mode/app_mode_utils.h" 33 #include "chrome/browser/app_mode/app_mode_utils.h"
34 #include "chrome/browser/autofill/personal_data_manager_factory.h" 34 #include "chrome/browser/autofill/personal_data_manager_factory.h"
35 #include "chrome/browser/background/background_contents.h" 35 #include "chrome/browser/background/background_contents.h"
36 #include "chrome/browser/background/background_contents_service.h" 36 #include "chrome/browser/background/background_contents_service.h"
37 #include "chrome/browser/background/background_contents_service_factory.h" 37 #include "chrome/browser/background/background_contents_service_factory.h"
38 #include "chrome/browser/banners/app_banner_manager_desktop.h" 38 #include "chrome/browser/banners/app_banner_manager_desktop.h"
39 #include "chrome/browser/browser_process.h" 39 #include "chrome/browser/browser_process.h"
40 #include "chrome/browser/browser_shutdown.h" 40 #include "chrome/browser/browser_shutdown.h"
41 #include "chrome/browser/character_encoding.h"
42 #include "chrome/browser/chrome_notification_types.h" 41 #include "chrome/browser/chrome_notification_types.h"
43 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 42 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
44 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 43 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
45 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 44 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
46 #include "chrome/browser/custom_handlers/register_protocol_handler_permission_re quest.h" 45 #include "chrome/browser/custom_handlers/register_protocol_handler_permission_re quest.h"
47 #include "chrome/browser/defaults.h" 46 #include "chrome/browser/defaults.h"
48 #include "chrome/browser/devtools/devtools_toggle_action.h" 47 #include "chrome/browser/devtools/devtools_toggle_action.h"
49 #include "chrome/browser/devtools/devtools_window.h" 48 #include "chrome/browser/devtools/devtools_window.h"
50 #include "chrome/browser/download/download_service.h" 49 #include "chrome/browser/download/download_service.h"
51 #include "chrome/browser/download/download_service_factory.h" 50 #include "chrome/browser/download/download_service_factory.h"
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 } 820 }
822 821
823 bool Browser::SupportsWindowFeature(WindowFeature feature) const { 822 bool Browser::SupportsWindowFeature(WindowFeature feature) const {
824 return SupportsWindowFeatureImpl(feature, true); 823 return SupportsWindowFeatureImpl(feature, true);
825 } 824 }
826 825
827 bool Browser::CanSupportWindowFeature(WindowFeature feature) const { 826 bool Browser::CanSupportWindowFeature(WindowFeature feature) const {
828 return SupportsWindowFeatureImpl(feature, false); 827 return SupportsWindowFeatureImpl(feature, false);
829 } 828 }
830 829
831 void Browser::ToggleEncodingAutoDetect() {
832 content::RecordAction(UserMetricsAction("AutoDetectChange"));
833 encoding_auto_detect_.SetValue(!encoding_auto_detect_.GetValue());
msw 2016/08/22 21:59:53 q: Can we remove Browser::encoding_auto_detect_?
Jinsuk Kim 2016/08/23 07:09:22 Yes. Removed.
834 // If "auto detect" is turned on, then any current override encoding
835 // is cleared. This also implicitly performs a reload.
836 // OTOH, if "auto detect" is turned off, we don't change the currently
837 // active encoding.
838 if (encoding_auto_detect_.GetValue()) {
839 WebContents* contents = tab_strip_model_->GetActiveWebContents();
840 if (contents)
841 contents->ResetOverrideEncoding();
842 }
843 }
844
845 void Browser::OverrideEncoding(int encoding_id) {
846 content::RecordAction(UserMetricsAction("OverrideEncoding"));
msw 2016/08/22 21:59:53 Please mark this action obsolete in tools/metrics/
Jinsuk Kim 2016/08/23 07:09:22 Done.
847 const std::string selected_encoding =
848 CharacterEncoding::GetCanonicalEncodingNameByCommandId(encoding_id);
849 WebContents* contents = tab_strip_model_->GetActiveWebContents();
850 if (!selected_encoding.empty() && contents)
851 contents->SetOverrideEncoding(selected_encoding);
852 // Update the list of recently selected encodings.
853 std::string new_selected_encoding_list;
854 if (CharacterEncoding::UpdateRecentlySelectedEncoding(
855 profile_->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding),
msw 2016/08/22 21:59:53 If this isn't used, clear this pref for users and
Jinsuk Kim 2016/08/23 07:09:22 Done.
856 encoding_id,
857 &new_selected_encoding_list)) {
858 profile_->GetPrefs()->SetString(prefs::kRecentlySelectedEncoding,
859 new_selected_encoding_list);
860 }
861 }
862
863 void Browser::OpenFile() { 830 void Browser::OpenFile() {
864 content::RecordAction(UserMetricsAction("OpenFile")); 831 content::RecordAction(UserMetricsAction("OpenFile"));
865 select_file_dialog_ = ui::SelectFileDialog::Create( 832 select_file_dialog_ = ui::SelectFileDialog::Create(
866 this, new ChromeSelectFilePolicy( 833 this, new ChromeSelectFilePolicy(
867 tab_strip_model_->GetActiveWebContents())); 834 tab_strip_model_->GetActiveWebContents()));
868 835
869 const base::FilePath directory = profile_->last_selected_directory(); 836 const base::FilePath directory = profile_->last_selected_directory();
870 837
871 // TODO(beng): figure out how to juggle this. 838 // TODO(beng): figure out how to juggle this.
872 gfx::NativeWindow parent_window = window_->GetNativeWindow(); 839 gfx::NativeWindow parent_window = window_->GetNativeWindow();
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 if (contents && !allow_js_access) { 2567 if (contents && !allow_js_access) {
2601 contents->web_contents()->GetController().LoadURL( 2568 contents->web_contents()->GetController().LoadURL(
2602 target_url, 2569 target_url,
2603 content::Referrer(), 2570 content::Referrer(),
2604 ui::PAGE_TRANSITION_LINK, 2571 ui::PAGE_TRANSITION_LINK,
2605 std::string()); // No extra headers. 2572 std::string()); // No extra headers.
2606 } 2573 }
2607 2574
2608 return contents != NULL; 2575 return contents != NULL;
2609 } 2576 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698