diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-14 17:10:41 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-14 17:10:41 +0000 |
commit | f14159cb6385f271bec21d4ddf04c353a869fb70 (patch) | |
tree | 2fc1ab6633333d1a7292f5e9acd21a8bd7d833b6 /chrome | |
parent | d680c5c189ec40b97cee8c201de88dfe5256153f (diff) | |
download | chromium_src-f14159cb6385f271bec21d4ddf04c353a869fb70.zip chromium_src-f14159cb6385f271bec21d4ddf04c353a869fb70.tar.gz chromium_src-f14159cb6385f271bec21d4ddf04c353a869fb70.tar.bz2 |
Implement OS X Encoding Menu.
Also refactor Windows Encoding menu a bit to make the moving parts x-platform.
Add a unit test for the menu encoding logic.
In a followup CL I'll add some UI tests around this.
Review URL: http://codereview.chromium.org/113315
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16061 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/chrome_dll_resource.h | 4 | ||||
-rw-r--r-- | chrome/app/nibs/en.lproj/MainMenu.xib | 34 | ||||
-rw-r--r-- | chrome/browser/app_controller_mac.mm | 8 | ||||
-rw-r--r-- | chrome/browser/browser.vcproj | 2691 | ||||
-rw-r--r-- | chrome/browser/cocoa/browser_window_controller.mm | 22 | ||||
-rw-r--r-- | chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h | 22 | ||||
-rw-r--r-- | chrome/browser/cocoa/encoding_menu_controller_delegate_mac.mm | 63 | ||||
-rw-r--r-- | chrome/browser/encoding_menu_controller.cc | 144 | ||||
-rw-r--r-- | chrome/browser/encoding_menu_controller.h | 53 | ||||
-rw-r--r-- | chrome/browser/encoding_menu_controller_delegate.cc | 109 | ||||
-rw-r--r-- | chrome/browser/encoding_menu_controller_delegate.h | 2 | ||||
-rw-r--r-- | chrome/browser/encoding_menu_controller_unittest.cc | 92 | ||||
-rw-r--r-- | chrome/chrome.gyp | 5 | ||||
-rw-r--r-- | chrome/test/unit/unittests.vcproj | 4 |
14 files changed, 3150 insertions, 103 deletions
diff --git a/chrome/app/chrome_dll_resource.h b/chrome/app/chrome_dll_resource.h index f8275e7..0854823 100644 --- a/chrome/app/chrome_dll_resource.h +++ b/chrome/app/chrome_dll_resource.h @@ -90,6 +90,10 @@ #define IDC_PRINT 35003 #define IDC_SAVE_PAGE 35004 #define IDC_ENCODING_MENU 35005 + +// When adding a new encoding to this list, be sure to append it to the +// EncodingMenuController::kValidEncodingIds array in +// encoding_menu_controller.cc. #define IDC_ENCODING_AUTO_DETECT 35006 #define IDC_ENCODING_UTF8 35007 #define IDC_ENCODING_UTF16LE 35008 diff --git a/chrome/app/nibs/en.lproj/MainMenu.xib b/chrome/app/nibs/en.lproj/MainMenu.xib index 0b5b278..fdeec8bb 100644 --- a/chrome/app/nibs/en.lproj/MainMenu.xib +++ b/chrome/app/nibs/en.lproj/MainMenu.xib @@ -8,7 +8,7 @@ <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="502"/> + <integer value="465"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -795,14 +795,6 @@ <string key="NSTitle">Text Encoding</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMenuItem" id="433074134"> - <reference key="NSMenu" ref="466817936"/> - <string type="base64-UTF8" key="NSTitle">VW5pY29kZeKEoiAoVVRGLTgpA</string> - <string key="NSKeyEquiv"/> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="353210768"/> - <reference key="NSMixedImage" ref="549394948"/> - </object> </object> </object> </object> @@ -1580,6 +1572,14 @@ </object> <int key="connectionID">558</int> </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">commandDispatch:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="602502221"/> + </object> + <int key="connectionID">615</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -2234,16 +2234,10 @@ <reference key="object" ref="466817936"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="433074134"/> </object> <reference key="parent" ref="602502221"/> </object> <object class="IBObjectRecord"> - <int key="objectID">467</int> - <reference key="object" ref="433074134"/> - <reference key="parent" ref="466817936"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">473</int> <reference key="object" ref="299901009"/> <object class="NSMutableArray" key="children"> @@ -2598,7 +2592,6 @@ <string>465.IBPluginDependency</string> <string>466.IBEditorWindowLastContentRect</string> <string>466.IBPluginDependency</string> - <string>467.IBPluginDependency</string> <string>473.IBPluginDependency</string> <string>483.IBPluginDependency</string> <string>491.IBPluginDependency</string> @@ -2786,13 +2779,13 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>{{525, 802}, {197, 73}}</string> - <string>{{369, 836}, {535, 20}}</string> + <string>{{455, 721}, {535, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>{74, 862}</string> <string>{{11, 977}, {478, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{561, 623}, {273, 213}}</string> + <string>{{647, 508}, {273, 213}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{475, 832}, {234, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -2825,8 +2818,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{834, 643}, {178, 23}}</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>{{920, 545}, {64, 6}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -2919,7 +2911,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">558</int> + <int key="maxID">615</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index 2261342..7632024 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm @@ -13,6 +13,7 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_shutdown.h" #import "chrome/browser/cocoa/bookmark_menu_bridge.h" +#import "chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h" #import "chrome/browser/cocoa/preferences_window_controller.h" #include "chrome/browser/command_updater.h" #include "chrome/common/pref_names.h" @@ -66,6 +67,13 @@ // Register any Mac-specific preferences. PrefService* prefs = [self defaultProfile]->GetPrefs(); prefs->RegisterBooleanPref(prefs::kShowPageOptionsButtons, false); + + // Build up the encoding menu, the order of the items differs based on the + // current locale (see http://crbug.com/7647 for details). + // We need a valid g_browser_process to get the profile which is why we can't + // call this from awakeFromNib. + EncodingMenuControllerDelegate::BuildEncodingMenu([self defaultProfile]); + } - (void)dealloc { diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj index 6653ca2..3bc6931 100644 --- a/chrome/browser/browser.vcproj +++ b/chrome/browser/browser.vcproj @@ -1,3 +1,4 @@ +<<<<<<< HEAD:chrome/browser/browser.vcproj <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" @@ -2714,3 +2715,2693 @@ <Globals> </Globals> </VisualStudioProject> +======= +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="browser" + ProjectGUID="{5BF908A7-68FB-4A4B-99E3-8C749F1FE4EA}" + RootNamespace="Browser" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + <ToolFile + RelativePath="..\tools\build\win\resource_text_file_copy.rules" + /> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="4" + InheritedPropertySheets=".\browser.vsprops;$(SolutionDir)..\build\debug.vsprops;..\tools\build\win\precompiled_wtl.vsprops" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="Resource text file copy" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="4" + InheritedPropertySheets=".\browser.vsprops;$(SolutionDir)..\build\release.vsprops;$(SolutionDir)\tools\build\win\js_engine.vsprops" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="Resource text file copy" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Autocomplete" + > + <File + RelativePath=".\autocomplete\autocomplete.cc" + > + </File> + <File + RelativePath=".\autocomplete\autocomplete.h" + > + </File> + <File + RelativePath=".\autocomplete\autocomplete_accessibility.cc" + > + </File> + <File + RelativePath=".\autocomplete\autocomplete_accessibility.h" + > + </File> + <File + RelativePath=".\autocomplete\autocomplete_edit.cc" + > + </File> + <File + RelativePath=".\autocomplete\autocomplete_edit.h" + > + </File> + <File + RelativePath=".\autocomplete\autocomplete_edit_view.h" + > + </File> + <File + RelativePath=".\autocomplete\autocomplete_edit_view_win.cc" + > + </File> + <File + RelativePath=".\autocomplete\autocomplete_edit_view_win.h" + > + </File> + <File + RelativePath=".\autocomplete\autocomplete_popup_model.cc" + > + </File> + <File + RelativePath=".\autocomplete\autocomplete_popup_model.h" + > + </File> + <File + RelativePath=".\autocomplete\autocomplete_popup_view.h" + > + </File> + <File + RelativePath=".\autocomplete\autocomplete_popup_view_win.cc" + > + </File> + <File + RelativePath=".\autocomplete\autocomplete_popup_view_win.h" + > + </File> + <File + RelativePath=".\autocomplete\history_contents_provider.cc" + > + </File> + <File + RelativePath=".\autocomplete\history_contents_provider.h" + > + </File> + <File + RelativePath=".\autocomplete\history_url_provider.cc" + > + </File> + <File + RelativePath=".\autocomplete\history_url_provider.h" + > + </File> + <File + RelativePath=".\autocomplete\keyword_provider.cc" + > + </File> + <File + RelativePath=".\autocomplete\keyword_provider.h" + > + </File> + <File + RelativePath=".\autocomplete\search_provider.cc" + > + </File> + <File + RelativePath=".\autocomplete\search_provider.h" + > + </File> + </Filter> + <Filter + Name="Base" + > + <File + RelativePath=".\alternate_nav_url_fetcher.cc" + > + </File> + <File + RelativePath=".\alternate_nav_url_fetcher.h" + > + </File> + <File + RelativePath=".\browser_about_handler.cc" + > + </File> + <File + RelativePath=".\browser_about_handler.h" + > + </File> + <File + RelativePath=".\browser_init.cc" + > + </File> + <File + RelativePath=".\browser_init.h" + > + </File> + <File + RelativePath=".\browser_main.cc" + > + </File> + <File + RelativePath=".\browser_main_win.cc" + > + </File> + <File + RelativePath=".\browser_prefs.cc" + > + </File> + <File + RelativePath=".\browser_prefs.h" + > + </File> + <File + RelativePath=".\browser_process.cc" + > + </File> + <File + RelativePath=".\browser_process.h" + > + </File> + <File + RelativePath=".\browser_process_impl.cc" + > + </File> + <File + RelativePath=".\browser_process_impl.h" + > + </File> + <File + RelativePath=".\browser_shutdown.cc" + > + </File> + <File + RelativePath=".\browser_shutdown.h" + > + </File> + <File + RelativePath=".\browser_theme_provider.cc" + > + </File> + <File + RelativePath=".\browser_theme_provider.h" + > + </File> + <File + RelativePath=".\browser_url_handler.cc" + > + </File> + <File + RelativePath=".\browser_url_handler.h" + > + </File> + <File + RelativePath=".\browsing_data_remover.cc" + > + </File> + <File + RelativePath=".\browsing_data_remover.h" + > + </File> + <File + RelativePath=".\browsing_instance.cc" + > + </File> + <File + RelativePath=".\browsing_instance.h" + > + </File> + <File + RelativePath=".\cancelable_request.cc" + > + </File> + <File + RelativePath=".\cancelable_request.h" + > + </File> + <File + RelativePath=".\character_encoding.cc" + > + </File> + <File + RelativePath=".\character_encoding.h" + > + </File> + <File + RelativePath=".\chrome_thread.cc" + > + </File> + <File + RelativePath=".\chrome_thread.h" + > + </File> + <File + RelativePath=".\cross_site_request_manager.cc" + > + </File> + <File + RelativePath=".\cross_site_request_manager.h" + > + </File> + <File + RelativePath=".\fav_icon_helper.cc" + > + </File> + <File + RelativePath=".\fav_icon_helper.h" + > + </File> + <File + RelativePath=".\first_run.cc" + > + </File> + <File + RelativePath=".\first_run.h" + > + </File> + <File + RelativePath=".\google_url_tracker.cc" + > + </File> + <File + RelativePath=".\google_url_tracker.h" + > + </File> + <File + RelativePath=".\google_util.cc" + > + </File> + <File + RelativePath=".\google_util.h" + > + </File> + <File + RelativePath=".\icon_loader.cc" + > + </File> + <File + RelativePath=".\icon_loader.h" + > + </File> + <File + RelativePath=".\icon_loader_win.cc" + > + </File> + <File + RelativePath=".\icon_manager.cc" + > + </File> + <File + RelativePath=".\icon_manager.h" + > + </File> + <File + RelativePath=".\icon_manager_win.cc" + > + </File> + <File + RelativePath=".\ime_input.cc" + > + </File> + <File + RelativePath=".\ime_input.h" + > + </File> + <File + RelativePath=".\input_window_dialog.h" + > + </File> + <File + RelativePath=".\input_window_dialog_win.cc" + > + </File> + <File + RelativePath=".\jankometer.cc" + > + </File> + <File + RelativePath=".\jankometer.h" + > + </File> + <File + RelativePath=".\memory_details.cc" + > + </File> + <File + RelativePath=".\memory_details.h" + > + </File> + <File + RelativePath=".\meta_table_helper.cc" + > + </File> + <File + RelativePath=".\meta_table_helper.h" + > + </File> + <File + RelativePath=".\plugin_process_host.cc" + > + </File> + <File + RelativePath=".\plugin_process_host.h" + > + </File> + <File + RelativePath=".\plugin_service.cc" + > + </File> + <File + RelativePath=".\plugin_service.h" + > + </File> + <File + RelativePath="..\tools\build\win\precompiled_wtl.cc" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\tools\build\win\precompiled_wtl.h" + > + </File> + <File + RelativePath=".\process_singleton.h" + > + </File> + <File + RelativePath=".\process_singleton_win.cc" + > + </File> + <File + RelativePath=".\profile.cc" + > + </File> + <File + RelativePath=".\profile.h" + > + </File> + <File + RelativePath=".\profile_manager.cc" + > + </File> + <File + RelativePath=".\profile_manager.h" + > + </File> + <File + RelativePath=".\session_startup_pref.cc" + > + </File> + <File + RelativePath=".\session_startup_pref.h" + > + </File> + <File + RelativePath=".\shell_dialogs.h" + > + </File> + <File + RelativePath=".\shell_integration.cc" + > + </File> + <File + RelativePath=".\shell_integration.h" + > + </File> + <File + RelativePath=".\spellcheck_worditerator.cc" + > + </File> + <File + RelativePath=".\spellcheck_worditerator.h" + > + </File> + <File + RelativePath=".\spellchecker.cc" + > + </File> + <File + RelativePath=".\spellchecker.h" + > + </File> + <File + RelativePath=".\user_data_manager.cc" + > + </File> + <File + RelativePath=".\user_data_manager.h" + > + </File> + <File + RelativePath=".\visitedlink_master.cc" + > + </File> + <File + RelativePath=".\visitedlink_master.h" + > + </File> + </Filter> + <Filter + Name="Bookmarks" + > + <File + RelativePath=".\bookmarks\bookmark_codec.cc" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_codec.h" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_context_menu.cc" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_context_menu.h" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_context_menu_win.cc" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_drag_data.cc" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_drag_data.h" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_drop_info.cc" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_drop_info.h" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_editor.h" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_folder_tree_model.cc" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_folder_tree_model.h" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_html_writer.cc" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_html_writer.h" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_menu_controller_win.cc" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_menu_controller_win.h" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_model.cc" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_model.h" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_service.h" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_storage.cc" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_storage.h" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_table_model.cc" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_table_model.h" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_utils.cc" + > + </File> + <File + RelativePath=".\bookmarks\bookmark_utils.h" + > + </File> + </Filter> + <Filter + Name="Browser Window" + > + <File + RelativePath=".\app_modal_dialog.cc" + > + </File> + <File + RelativePath=".\app_modal_dialog.h" + > + </File> + <File + RelativePath=".\app_modal_dialog_queue.cc" + > + </File> + <File + RelativePath=".\app_modal_dialog_queue.h" + > + </File> + <File + RelativePath=".\app_modal_dialog_win.cc" + > + </File> + <File + RelativePath=".\back_forward_menu_model.cc" + > + </File> + <File + RelativePath=".\back_forward_menu_model.h" + > + </File> + <File + RelativePath=".\back_forward_menu_model_win.cc" + > + </File> + <File + RelativePath=".\back_forward_menu_model_win.h" + > + </File> + <File + RelativePath=".\browser.cc" + > + </File> + <File + RelativePath=".\browser.h" + > + </File> + <File + RelativePath=".\browser_list.cc" + > + </File> + <File + RelativePath=".\browser_list.h" + > + </File> + <File + RelativePath=".\browser_window.h" + > + </File> + <File + RelativePath=".\command_updater.cc" + > + </File> + <File + RelativePath=".\command_updater.h" + > + </File> + <File + RelativePath=".\dock_info.cc" + > + </File> + <File + RelativePath=".\dock_info.h" + > + </File> + <File + RelativePath=".\find_bar.h" + > + </File> + <File + RelativePath=".\find_bar_controller.cc" + > + </File> + <File + RelativePath=".\find_bar_controller.h" + > + </File> + <File + RelativePath=".\find_notification_details.h" + > + </File> + <File + RelativePath=".\jsmessage_box_handler.cc" + > + </File> + <File + RelativePath=".\jsmessage_box_handler.h" + > + </File> + <File + RelativePath=".\load_from_memory_cache_details.h" + > + </File> + <File + RelativePath=".\load_notification_details.h" + > + </File> + <File + RelativePath=".\location_bar.h" + > + </File> + <File + RelativePath=".\login_prompt.cc" + > + </File> + <File + RelativePath=".\login_prompt.h" + > + </File> + <File + RelativePath=".\options_window.h" + > + </File> + <File + RelativePath=".\status_bubble.h" + > + </File> + <File + RelativePath=".\task_manager.cc" + > + </File> + <File + RelativePath=".\task_manager.h" + > + </File> + <File + RelativePath=".\task_manager_resource_providers.cc" + > + </File> + <File + RelativePath=".\task_manager_resource_providers.h" + > + </File> + <File + RelativePath=".\window_sizer.cc" + > + </File> + <File + RelativePath=".\window_sizer.h" + > + </File> + </Filter> + <Filter + Name="Automation" + > + <File + RelativePath=".\automation\automation_autocomplete_edit_tracker.h" + > + </File> + <File + RelativePath=".\automation\automation_browser_tracker.h" + > + </File> + <File + RelativePath=".\automation\automation_constrained_window_tracker.h" + > + </File> + <File + RelativePath=".\automation\automation_provider.cc" + > + </File> + <File + RelativePath=".\automation\automation_provider.h" + > + </File> + <File + RelativePath=".\automation\automation_provider_list.cc" + > + </File> + <File + RelativePath=".\automation\automation_provider_list.h" + > + </File> + <File + RelativePath=".\automation\automation_provider_list_generic.cc" + > + </File> + <File + RelativePath=".\automation\automation_resource_tracker.cc" + > + </File> + <File + RelativePath=".\automation\automation_resource_tracker.h" + > + </File> + <File + RelativePath=".\automation\automation_tab_tracker.h" + > + </File> + <File + RelativePath=".\automation\automation_window_tracker.h" + > + </File> + <File + RelativePath=".\automation\ui_controls.cc" + > + </File> + <File + RelativePath=".\automation\ui_controls.h" + > + </File> + <File + RelativePath=".\automation\url_request_failed_dns_job.cc" + > + </File> + <File + RelativePath=".\automation\url_request_failed_dns_job.h" + > + </File> + <File + RelativePath=".\automation\url_request_mock_http_job.cc" + > + </File> + <File + RelativePath=".\automation\url_request_mock_http_job.h" + > + </File> + <File + RelativePath=".\automation\url_request_mock_net_error_job.cc" + > + </File> + <File + RelativePath=".\automation\url_request_mock_net_error_job.h" + > + </File> + <File + RelativePath=".\automation\url_request_slow_download_job.cc" + > + </File> + <File + RelativePath=".\automation\url_request_slow_download_job.h" + > + </File> + <File + RelativePath=".\view_ids.h" + > + </File> + </Filter> + <Filter + Name="History" + > + <File + RelativePath=".\history\archived_database.cc" + > + </File> + <File + RelativePath=".\history\archived_database.h" + > + </File> + <File + RelativePath=".\history\download_database.cc" + > + </File> + <File + RelativePath=".\history\download_database.h" + > + </File> + <File + RelativePath=".\history\download_types.h" + > + </File> + <File + RelativePath=".\history\expire_history_backend.cc" + > + </File> + <File + RelativePath=".\history\expire_history_backend.h" + > + </File> + <File + RelativePath=".\history\history.cc" + > + </File> + <File + RelativePath=".\history\history.h" + > + </File> + <File + RelativePath=".\history\history_backend.cc" + > + </File> + <File + RelativePath=".\history\history_backend.h" + > + </File> + <File + RelativePath=".\history\history_database.cc" + > + </File> + <File + RelativePath=".\history\history_database.h" + > + </File> + <File + RelativePath=".\history\history_indexer.idl" + > + </File> + <File + RelativePath=".\history\history_marshaling.h" + > + </File> + <File + RelativePath=".\history\history_notifications.h" + > + </File> + <File + RelativePath=".\history\history_publisher.cc" + > + </File> + <File + RelativePath=".\history\history_publisher.h" + > + </File> + <File + RelativePath=".\history\history_publisher_win.cc" + > + </File> + <File + RelativePath=".\history\history_types.cc" + > + </File> + <File + RelativePath=".\history\history_types.h" + > + </File> + <File + RelativePath=".\history\in_memory_database.cc" + > + </File> + <File + RelativePath=".\history\in_memory_database.h" + > + </File> + <File + RelativePath=".\history\in_memory_history_backend.cc" + > + </File> + <File + RelativePath=".\history\in_memory_history_backend.h" + > + </File> + <File + RelativePath=".\history\page_usage_data.cc" + > + </File> + <File + RelativePath=".\history\page_usage_data.h" + > + </File> + <File + RelativePath=".\history\query_parser.cc" + > + </File> + <File + RelativePath=".\history\query_parser.h" + > + </File> + <File + RelativePath=".\history\snippet.cc" + > + </File> + <File + RelativePath=".\history\snippet.h" + > + </File> + <File + RelativePath=".\history\starred_url_database.cc" + > + </File> + <File + RelativePath=".\history\starred_url_database.h" + > + </File> + <File + RelativePath=".\history\text_database.cc" + > + </File> + <File + RelativePath=".\history\text_database.h" + > + </File> + <File + RelativePath=".\history\text_database_manager.cc" + > + </File> + <File + RelativePath=".\history\text_database_manager.h" + > + </File> + <File + RelativePath=".\history\thumbnail_database.cc" + > + </File> + <File + RelativePath=".\history\thumbnail_database.h" + > + </File> + <File + RelativePath=".\history\url_database.cc" + > + </File> + <File + RelativePath=".\history\url_database.h" + > + </File> + <File + RelativePath=".\history\visit_database.cc" + > + </File> + <File + RelativePath=".\history\visit_database.h" + > + </File> + <File + RelativePath=".\history\visit_tracker.cc" + > + </File> + <File + RelativePath=".\history\visit_tracker.h" + > + </File> + <File + RelativePath=".\history\visitsegment_database.cc" + > + </File> + <File + RelativePath=".\history\visitsegment_database.h" + > + </File> + <Filter + Name="HangMonitor" + > + <File + RelativePath=".\hang_monitor\hung_plugin_action.cc" + > + </File> + <File + RelativePath=".\hang_monitor\hung_plugin_action.h" + > + </File> + <File + RelativePath=".\hang_monitor\hung_window_detector.cc" + > + </File> + <File + RelativePath=".\hang_monitor\hung_window_detector.h" + > + </File> + </Filter> + </Filter> + <Filter + Name="Sessions and Tab Restore" + > + <File + RelativePath=".\sessions\base_session_service.cc" + > + </File> + <File + RelativePath=".\sessions\base_session_service.h" + > + </File> + <File + RelativePath=".\sessions\session_backend.cc" + > + </File> + <File + RelativePath=".\sessions\session_backend.h" + > + </File> + <File + RelativePath=".\sessions\session_command.cc" + > + </File> + <File + RelativePath=".\sessions\session_command.h" + > + </File> + <File + RelativePath=".\sessions\session_id.cc" + > + </File> + <File + RelativePath=".\sessions\session_id.h" + > + </File> + <File + RelativePath=".\sessions\session_restore.cc" + > + </File> + <File + RelativePath=".\sessions\session_restore.h" + > + </File> + <File + RelativePath=".\sessions\session_service.cc" + > + </File> + <File + RelativePath=".\sessions\session_service.h" + > + </File> + <File + RelativePath=".\sessions\session_types.cc" + > + </File> + <File + RelativePath=".\sessions\session_types.h" + > + </File> + <File + RelativePath=".\sessions\tab_restore_service.cc" + > + </File> + <File + RelativePath=".\sessions\tab_restore_service.h" + > + </File> + </Filter> + <Filter + Name="WebData" + > + <File + RelativePath=".\webdata\web_data_service.cc" + > + </File> + <File + RelativePath=".\webdata\web_data_service.h" + > + </File> + <File + RelativePath=".\webdata\web_data_service_win.cc" + > + </File> + <File + RelativePath=".\webdata\web_database.cc" + > + </File> + <File + RelativePath=".\webdata\web_database.h" + > + </File> + <File + RelativePath=".\webdata\web_database_win.cc" + > + </File> + </Filter> + <Filter + Name="Importer" + > + <File + RelativePath=".\importer\firefox2_importer.cc" + > + </File> + <File + RelativePath=".\importer\firefox2_importer.h" + > + </File> + <File + RelativePath=".\importer\firefox3_importer.cc" + > + </File> + <File + RelativePath=".\importer\firefox3_importer.h" + > + </File> + <File + RelativePath=".\importer\firefox_importer_utils.cc" + > + </File> + <File + RelativePath=".\importer\firefox_importer_utils.h" + > + </File> + <File + RelativePath=".\importer\firefox_profile_lock.cc" + > + </File> + <File + RelativePath=".\importer\firefox_profile_lock.h" + > + </File> + <File + RelativePath=".\importer\firefox_profile_lock_win.cc" + > + </File> + <File + RelativePath=".\importer\ie_importer.cc" + > + </File> + <File + RelativePath=".\importer\ie_importer.h" + > + </File> + <File + RelativePath=".\importer\importer.cc" + > + </File> + <File + RelativePath=".\importer\importer.h" + > + </File> + <File + RelativePath=".\importer\mork_reader.cc" + > + </File> + <File + RelativePath=".\importer\mork_reader.h" + > + </File> + <File + RelativePath=".\importer\toolbar_importer.cc" + > + </File> + <File + RelativePath=".\importer\toolbar_importer.h" + > + </File> + </Filter> + <Filter + Name="Tabs" + > + <File + RelativePath=".\tabs\tab_strip_model.cc" + > + </File> + <File + RelativePath=".\tabs\tab_strip_model.h" + > + </File> + <File + RelativePath=".\tabs\tab_strip_model_order_controller.cc" + > + </File> + <File + RelativePath=".\tabs\tab_strip_model_order_controller.h" + > + </File> + </Filter> + <Filter + Name="Printing" + > + <File + RelativePath=".\printing\page_number.cc" + > + </File> + <File + RelativePath=".\printing\page_number.h" + > + </File> + <File + RelativePath=".\printing\page_overlays.cc" + > + </File> + <File + RelativePath=".\printing\page_overlays.h" + > + </File> + <File + RelativePath=".\printing\page_range.cc" + > + </File> + <File + RelativePath=".\printing\page_range.h" + > + </File> + <File + RelativePath=".\printing\page_setup.cc" + > + </File> + <File + RelativePath=".\printing\page_setup.h" + > + </File> + <File + RelativePath=".\printing\print_job.cc" + > + </File> + <File + RelativePath=".\printing\print_job.h" + > + </File> + <File + RelativePath=".\printing\print_job_manager.cc" + > + </File> + <File + RelativePath=".\printing\print_job_manager.h" + > + </File> + <File + RelativePath=".\printing\print_job_worker.cc" + > + </File> + <File + RelativePath=".\printing\print_job_worker.h" + > + </File> + <File + RelativePath=".\printing\print_job_worker_owner.h" + > + </File> + <File + RelativePath=".\printing\print_settings.cc" + > + </File> + <File + RelativePath=".\printing\print_settings.h" + > + </File> + <File + RelativePath=".\printing\print_view_manager.cc" + > + </File> + <File + RelativePath=".\printing\print_view_manager.h" + > + </File> + <File + RelativePath=".\printing\printed_document.cc" + > + </File> + <File + RelativePath=".\printing\printed_document.h" + > + </File> + <File + RelativePath=".\printing\printed_page.cc" + > + </File> + <File + RelativePath=".\printing\printed_page.h" + > + </File> + <File + RelativePath=".\printing\printed_pages_source.h" + > + </File> + <File + RelativePath=".\printing\printer_query.cc" + > + </File> + <File + RelativePath=".\printing\printer_query.h" + > + </File> + <File + RelativePath=".\printing\win_printing_context.cc" + > + </File> + <File + RelativePath=".\printing\win_printing_context.h" + > + </File> + </Filter> + <Filter + Name="Sandbox" + > + <File + RelativePath=".\sandbox_policy.cc" + > + </File> + <File + RelativePath=".\sandbox_policy.h" + > + </File> + </Filter> + <Filter + Name="Password Manager" + > + <File + RelativePath=".\password_manager\encryptor.h" + > + </File> + <File + RelativePath=".\password_manager\encryptor_win.cc" + > + </File> + <File + RelativePath=".\password_manager\ie7_password.cc" + > + </File> + <File + RelativePath=".\password_manager\ie7_password.h" + > + </File> + <File + RelativePath=".\password_manager\password_form_manager.cc" + > + </File> + <File + RelativePath=".\password_manager\password_form_manager.h" + > + </File> + <File + RelativePath=".\password_manager\password_form_manager_win.cc" + > + </File> + <File + RelativePath=".\password_manager\password_manager.cc" + > + </File> + <File + RelativePath=".\password_manager\password_manager.h" + > + </File> + </Filter> + <Filter + Name="External Tab" + > + <File + RelativePath=".\external_tab_container.cc" + > + </File> + <File + RelativePath=".\external_tab_container.h" + > + </File> + </Filter> + <Filter + Name="DOM UI" + > + <File + RelativePath=".\dom_ui\chrome_url_data_manager.cc" + > + </File> + <File + RelativePath=".\dom_ui\chrome_url_data_manager.h" + > + </File> + <File + RelativePath=".\dom_ui\debugger_ui.cc" + > + </File> + <File + RelativePath=".\dom_ui\debugger_ui.h" + > + </File> + <File + RelativePath=".\dom_ui\devtools_ui.cc" + > + </File> + <File + RelativePath=".\dom_ui\devtools_ui.h" + > + </File> + <File + RelativePath=".\dom_ui\dom_ui.cc" + > + </File> + <File + RelativePath=".\dom_ui\dom_ui.h" + > + </File> + <File + RelativePath=".\dom_ui\dom_ui_factory.cc" + > + </File> + <File + RelativePath=".\dom_ui\dom_ui_factory.h" + > + </File> + <File + RelativePath=".\dom_ui\dom_ui_favicon_source.cc" + > + </File> + <File + RelativePath=".\dom_ui\dom_ui_favicon_source.h" + > + </File> + <File + RelativePath=".\dom_ui\dom_ui_theme_source.cc" + > + </File> + <File + RelativePath=".\dom_ui\dom_ui_theme_source.h" + > + </File> + <File + RelativePath=".\dom_ui\dom_ui_thumbnail_source.cc" + > + </File> + <File + RelativePath=".\dom_ui\dom_ui_thumbnail_source.h" + > + </File> + <File + RelativePath=".\dom_ui\downloads_ui.cc" + > + </File> + <File + RelativePath=".\dom_ui\downloads_ui.h" + > + </File> + <File + RelativePath=".\dom_ui\fileicon_source.cc" + > + </File> + <File + RelativePath=".\dom_ui\fileicon_source.h" + > + </File> + <File + RelativePath=".\dom_ui\history_ui.cc" + > + </File> + <File + RelativePath=".\dom_ui\history_ui.h" + > + </File> + <File + RelativePath=".\dom_ui\html_dialog_ui.cc" + > + </File> + <File + RelativePath=".\dom_ui\html_dialog_ui.h" + > + </File> + <File + RelativePath=".\dom_ui\new_tab_ui.cc" + > + </File> + <File + RelativePath=".\dom_ui\new_tab_ui.h" + > + </File> + </Filter> + <Filter + Name="Net" + > + <File + RelativePath=".\net\chrome_url_request_context.cc" + > + </File> + <File + RelativePath=".\net\chrome_url_request_context.h" + > + </File> + <File + RelativePath=".\net\dns_global.cc" + > + </File> + <File + RelativePath=".\net\dns_global.h" + > + </File> + <File + RelativePath=".\net\dns_host_info.cc" + > + </File> + <File + RelativePath=".\net\dns_host_info.h" + > + </File> + <File + RelativePath=".\net\dns_master.cc" + > + </File> + <File + RelativePath=".\net\dns_master.h" + > + </File> + <File + RelativePath=".\net\referrer.cc" + > + </File> + <File + RelativePath=".\net\referrer.h" + > + </File> + <File + RelativePath=".\net\resolve_proxy_msg_helper.cc" + > + </File> + <File + RelativePath=".\net\resolve_proxy_msg_helper.h" + > + </File> + <File + RelativePath=".\net\sdch_dictionary_fetcher.cc" + > + </File> + <File + RelativePath=".\net\sdch_dictionary_fetcher.h" + > + </File> + <File + RelativePath=".\net\url_fetcher.cc" + > + </File> + <File + RelativePath=".\net\url_fetcher.h" + > + </File> + <File + RelativePath=".\net\url_fetcher_protect.cc" + > + </File> + <File + RelativePath=".\net\url_fetcher_protect.h" + > + </File> + <File + RelativePath=".\net\url_fixer_upper.cc" + > + </File> + <File + RelativePath=".\net\url_fixer_upper.h" + > + </File> + </Filter> + <Filter + Name="RLZ" + > + <File + RelativePath=".\rlz\rlz.cc" + > + </File> + <File + RelativePath=".\rlz\rlz.h" + > + </File> + </Filter> + <Filter + Name="Safe Browsing" + > + <File + RelativePath=".\safe_browsing\bloom_filter.cc" + > + </File> + <File + RelativePath=".\safe_browsing\bloom_filter.h" + > + </File> + <File + RelativePath=".\safe_browsing\chunk_range.cc" + > + </File> + <File + RelativePath=".\safe_browsing\chunk_range.h" + > + </File> + <File + RelativePath=".\safe_browsing\protocol_manager.cc" + > + </File> + <File + RelativePath=".\safe_browsing\protocol_manager.h" + > + </File> + <File + RelativePath=".\safe_browsing\protocol_parser.cc" + > + </File> + <File + RelativePath=".\safe_browsing\protocol_parser.h" + > + </File> + <File + RelativePath=".\safe_browsing\safe_browsing_blocking_page.cc" + > + </File> + <File + RelativePath=".\safe_browsing\safe_browsing_blocking_page.h" + > + </File> + <File + RelativePath=".\safe_browsing\safe_browsing_database.cc" + > + </File> + <File + RelativePath=".\safe_browsing\safe_browsing_database.h" + > + </File> + <File + RelativePath=".\safe_browsing\safe_browsing_database_bloom.cc" + > + </File> + <File + RelativePath=".\safe_browsing\safe_browsing_database_bloom.h" + > + </File> + <File + RelativePath=".\safe_browsing\safe_browsing_service.cc" + > + </File> + <File + RelativePath=".\safe_browsing\safe_browsing_service.h" + > + </File> + <File + RelativePath=".\safe_browsing\safe_browsing_util.cc" + > + </File> + <File + RelativePath=".\safe_browsing\safe_browsing_util.h" + > + </File> + </Filter> + <Filter + Name="Accessibility" + > + <File + RelativePath=".\browser_accessibility.cc" + > + </File> + <File + RelativePath=".\browser_accessibility.h" + > + </File> + <File + RelativePath=".\browser_accessibility_manager.cc" + > + </File> + <File + RelativePath=".\browser_accessibility_manager.h" + > + </File> + </Filter> + <Filter + Name="Download" + > + <File + RelativePath=".\download\download_exe.cc" + > + </File> + <File + RelativePath=".\download\download_file.cc" + > + </File> + <File + RelativePath=".\download\download_file.h" + > + </File> + <File + RelativePath=".\download\download_item_model.cc" + > + </File> + <File + RelativePath=".\download\download_item_model.h" + > + </File> + <File + RelativePath=".\download\download_manager.cc" + > + </File> + <File + RelativePath=".\download\download_manager.h" + > + </File> + <File + RelativePath=".\download\download_request_dialog_delegate.h" + > + </File> + <File + RelativePath=".\download\download_request_dialog_delegate_win.cc" + > + </File> + <File + RelativePath=".\download\download_request_dialog_delegate_win.h" + > + </File> + <File + RelativePath=".\download\download_request_manager.cc" + > + </File> + <File + RelativePath=".\download\download_request_manager.h" + > + </File> + <File + RelativePath=".\download\download_shelf.cc" + > + </File> + <File + RelativePath=".\download\download_shelf.h" + > + </File> + <File + RelativePath=".\download\download_util.cc" + > + </File> + <File + RelativePath=".\download\download_util.h" + > + </File> + </Filter> + <Filter + Name="Save Page" + > + <File + RelativePath=".\download\save_file.cc" + > + </File> + <File + RelativePath=".\download\save_file.h" + > + </File> + <File + RelativePath=".\download\save_file_manager.cc" + > + </File> + <File + RelativePath=".\download\save_file_manager.h" + > + </File> + <File + RelativePath=".\download\save_item.cc" + > + </File> + <File + RelativePath=".\download\save_item.h" + > + </File> + <File + RelativePath=".\download\save_package.cc" + > + </File> + <File + RelativePath=".\download\save_package.h" + > + </File> + <File + RelativePath=".\download\save_types.h" + > + </File> + </Filter> + <Filter + Name="Autofill" + > + <File + RelativePath=".\autofill_manager.cc" + > + </File> + <File + RelativePath=".\autofill_manager.h" + > + </File> + </Filter> + <Filter + Name="Extensions" + > + <File + RelativePath=".\extensions\extension.cc" + > + </File> + <File + RelativePath=".\extensions\extension.h" + > + </File> + <File + RelativePath=".\extensions\extension_bookmarks_module.cc" + > + </File> + <File + RelativePath=".\extensions\extension_bookmarks_module.h" + > + </File> + <File + RelativePath=".\extensions\extension_browser_event_router.cc" + > + </File> + <File + RelativePath=".\extensions\extension_browser_event_router.h" + > + </File> + <File + RelativePath=".\extensions\extension_error_reporter.cc" + > + </File> + <File + RelativePath=".\extensions\extension_error_reporter.h" + > + </File> + <File + RelativePath=".\extensions\extension_error_utils.cc" + > + </File> + <File + RelativePath=".\extensions\extension_error_utils.h" + > + </File> + <File + RelativePath=".\extensions\extension_function.cc" + > + </File> + <File + RelativePath=".\extensions\extension_function.h" + > + </File> + <File + RelativePath=".\extensions\extension_function_dispatcher.cc" + > + </File> + <File + RelativePath=".\extensions\extension_function_dispatcher.h" + > + </File> + <File + RelativePath=".\extensions\extension_host.cc" + > + </File> + <File + RelativePath=".\extensions\extension_host.h" + > + </File> + <File + RelativePath=".\extensions\extension_message_service.cc" + > + </File> + <File + RelativePath=".\extensions\extension_message_service.h" + > + </File> + <File + RelativePath=".\extensions\extension_page_actions_module.cc" + > + </File> + <File + RelativePath=".\extensions\extension_page_actions_module.h" + > + </File> + <File + RelativePath=".\extensions\extension_process_manager.cc" + > + </File> + <File + RelativePath=".\extensions\extension_process_manager.h" + > + </File> + <File + RelativePath=".\extensions\extension_protocols.cc" + > + </File> + <File + RelativePath=".\extensions\extension_protocols.h" + > + </File> + <File + RelativePath=".\extensions\extension_shelf.cc" + > + </File> + <File + RelativePath=".\extensions\extension_shelf.h" + > + </File> + <File + RelativePath=".\extensions\extension_tabs_module.cc" + > + </File> + <File + RelativePath=".\extensions\extension_tabs_module.h" + > + </File> + <File + RelativePath=".\extensions\extension_view.cc" + > + </File> + <File + RelativePath=".\extensions\extension_view.h" + > + </File> + <File + RelativePath=".\extensions\extensions_service.cc" + > + </File> + <File + RelativePath=".\extensions\extensions_service.h" + > + </File> + <File + RelativePath=".\extensions\extensions_ui.cc" + > + </File> + <File + RelativePath=".\extensions\extensions_ui.h" + > + </File> + <File + RelativePath=".\extensions\user_script_master.cc" + > + </File> + <File + RelativePath=".\extensions\user_script_master.h" + > + </File> + </Filter> + <Filter + Name="Renderer Host" + > + <File + RelativePath=".\renderer_host\async_resource_handler.cc" + > + </File> + <File + RelativePath=".\renderer_host\async_resource_handler.h" + > + </File> + <File + RelativePath=".\renderer_host\audio_renderer_host.cc" + > + </File> + <File + RelativePath=".\renderer_host\audio_renderer_host.h" + > + </File> + <File + RelativePath=".\renderer_host\backing_store.cc" + > + </File> + <File + RelativePath=".\renderer_host\backing_store.h" + > + </File> + <File + RelativePath=".\renderer_host\backing_store_win.cc" + > + </File> + <File + RelativePath=".\renderer_host\browser_render_process_host.cc" + > + </File> + <File + RelativePath=".\renderer_host\browser_render_process_host.h" + > + </File> + <File + RelativePath=".\renderer_host\buffered_resource_handler.cc" + > + </File> + <File + RelativePath=".\renderer_host\buffered_resource_handler.h" + > + </File> + <File + RelativePath=".\renderer_host\cross_site_resource_handler.cc" + > + </File> + <File + RelativePath=".\renderer_host\cross_site_resource_handler.h" + > + </File> + <File + RelativePath=".\renderer_host\download_resource_handler.cc" + > + </File> + <File + RelativePath=".\renderer_host\download_resource_handler.h" + > + </File> + <File + RelativePath=".\renderer_host\download_throttling_resource_handler.cc" + > + </File> + <File + RelativePath=".\renderer_host\download_throttling_resource_handler.h" + > + </File> + <File + RelativePath=".\renderer_host\media_resource_handler.cc" + > + </File> + <File + RelativePath=".\renderer_host\media_resource_handler.h" + > + </File> + <File + RelativePath=".\renderer_host\render_process_host.cc" + > + </File> + <File + RelativePath=".\renderer_host\render_process_host.h" + > + </File> + <File + RelativePath=".\renderer_host\render_view_host.cc" + > + </File> + <File + RelativePath=".\renderer_host\render_view_host.h" + > + </File> + <File + RelativePath=".\renderer_host\render_view_host_delegate.h" + > + </File> + <File + RelativePath=".\renderer_host\render_view_host_factory.cc" + > + </File> + <File + RelativePath=".\renderer_host\render_view_host_factory.h" + > + </File> + <File + RelativePath=".\renderer_host\render_widget_helper.cc" + > + </File> + <File + RelativePath=".\renderer_host\render_widget_helper.h" + > + </File> + <File + RelativePath=".\renderer_host\render_widget_host.cc" + > + </File> + <File + RelativePath=".\renderer_host\render_widget_host.h" + > + </File> + <File + RelativePath=".\renderer_host\render_widget_host_view.h" + > + </File> + <File + RelativePath=".\renderer_host\render_widget_host_view_win.cc" + > + </File> + <File + RelativePath=".\renderer_host\render_widget_host_view_win.h" + > + </File> + <File + RelativePath=".\renderer_host\renderer_security_policy.cc" + > + </File> + <File + RelativePath=".\renderer_host\renderer_security_policy.h" + > + </File> + <File + RelativePath=".\renderer_host\resource_dispatcher_host.cc" + > + </File> + <File + RelativePath=".\renderer_host\resource_dispatcher_host.h" + > + </File> + <File + RelativePath=".\renderer_host\resource_handler.h" + > + </File> + <File + RelativePath=".\renderer_host\resource_message_filter.cc" + > + </File> + <File + RelativePath=".\renderer_host\resource_message_filter.h" + > + </File> + <File + RelativePath=".\renderer_host\resource_message_filter_win.cc" + > + </File> + <File + RelativePath=".\renderer_host\resource_request_details.h" + > + </File> + <File + RelativePath=".\renderer_host\safe_browsing_resource_handler.cc" + > + </File> + <File + RelativePath=".\renderer_host\safe_browsing_resource_handler.h" + > + </File> + <File + RelativePath=".\renderer_host\save_file_resource_handler.cc" + > + </File> + <File + RelativePath=".\renderer_host\save_file_resource_handler.h" + > + </File> + <File + RelativePath=".\renderer_host\sync_resource_handler.cc" + > + </File> + <File + RelativePath=".\renderer_host\sync_resource_handler.h" + > + </File> + <File + RelativePath=".\renderer_host\web_cache_manager.cc" + > + </File> + <File + RelativePath=".\renderer_host\web_cache_manager.h" + > + </File> + </Filter> + <Filter + Name="Tab Contents" + > + <File + RelativePath=".\tab_contents\constrained_window.h" + > + </File> + <File + RelativePath=".\tab_contents\infobar_delegate.cc" + > + </File> + <File + RelativePath=".\tab_contents\infobar_delegate.h" + > + </File> + <File + RelativePath=".\tab_contents\interstitial_page.cc" + > + </File> + <File + RelativePath=".\tab_contents\interstitial_page.h" + > + </File> + <File + RelativePath=".\tab_contents\navigation_controller.cc" + > + </File> + <File + RelativePath=".\tab_contents\navigation_controller.h" + > + </File> + <File + RelativePath=".\tab_contents\navigation_entry.cc" + > + </File> + <File + RelativePath=".\tab_contents\navigation_entry.h" + > + </File> + <File + RelativePath=".\tab_contents\page_navigator.h" + > + </File> + <File + RelativePath=".\tab_contents\provisional_load_details.cc" + > + </File> + <File + RelativePath=".\tab_contents\provisional_load_details.h" + > + </File> + <File + RelativePath=".\tab_contents\render_view_context_menu.cc" + > + </File> + <File + RelativePath=".\tab_contents\render_view_context_menu.h" + > + </File> + <File + RelativePath=".\tab_contents\render_view_context_menu_win.cc" + > + </File> + <File + RelativePath=".\tab_contents\render_view_context_menu_win.h" + > + </File> + <File + RelativePath=".\tab_contents\render_view_host_delegate_helper.cc" + > + </File> + <File + RelativePath=".\tab_contents\render_view_host_delegate_helper.h" + > + </File> + <File + RelativePath=".\tab_contents\render_view_host_manager.cc" + > + </File> + <File + RelativePath=".\tab_contents\render_view_host_manager.h" + > + </File> + <File + RelativePath=".\tab_contents\repost_form_warning.h" + > + </File> + <File + RelativePath=".\tab_contents\security_style.h" + > + </File> + <File + RelativePath=".\tab_contents\site_instance.cc" + > + </File> + <File + RelativePath=".\tab_contents\site_instance.h" + > + </File> + <File + RelativePath=".\tab_contents\tab_contents.cc" + > + </File> + <File + RelativePath=".\tab_contents\tab_contents.h" + > + </File> + <File + RelativePath=".\tab_contents\tab_contents_delegate.h" + > + </File> + <File + RelativePath=".\tab_contents\tab_contents_view.cc" + > + </File> + <File + RelativePath=".\tab_contents\tab_contents_view.h" + > + </File> + <File + RelativePath=".\tab_contents\tab_contents_view_win.cc" + > + </File> + <File + RelativePath=".\tab_contents\tab_contents_view_win.h" + > + </File> + <File + RelativePath=".\tab_contents\tab_util.cc" + > + </File> + <File + RelativePath=".\tab_contents\tab_util.h" + > + </File> + <File + RelativePath=".\tab_contents\web_drag_source.cc" + > + </File> + <File + RelativePath=".\tab_contents\web_drag_source.h" + > + </File> + <File + RelativePath=".\tab_contents\web_drop_target.cc" + > + </File> + <File + RelativePath=".\tab_contents\web_drop_target.h" + > + </File> + </Filter> + <Filter + Name="Search Engines" + > + <File + RelativePath=".\search_engines\template_url.cc" + > + </File> + <File + RelativePath=".\search_engines\template_url.h" + > + </File> + <File + RelativePath=".\search_engines\template_url_fetcher.cc" + > + </File> + <File + RelativePath=".\search_engines\template_url_fetcher.h" + > + </File> + <File + RelativePath=".\search_engines\template_url_model.cc" + > + </File> + <File + RelativePath=".\search_engines\template_url_model.h" + > + </File> + <File + RelativePath=".\search_engines\template_url_parser.cc" + > + </File> + <File + RelativePath=".\search_engines\template_url_parser.h" + > + </File> + <File + RelativePath=".\search_engines\template_url_prepopulate_data.cc" + > + </File> + <File + RelativePath=".\search_engines\template_url_prepopulate_data.h" + > + </File> + </Filter> + <Filter + Name="Metrics" + > + <File + RelativePath=".\metrics\metrics_log.cc" + > + </File> + <File + RelativePath=".\metrics\metrics_log.h" + > + </File> + <File + RelativePath=".\metrics\metrics_response.cc" + > + </File> + <File + RelativePath=".\metrics\metrics_response.h" + > + </File> + <File + RelativePath=".\metrics\metrics_service.cc" + > + </File> + <File + RelativePath=".\metrics\metrics_service.h" + > + </File> + <File + RelativePath=".\metrics\user_metrics.cc" + > + </File> + <File + RelativePath=".\metrics\user_metrics.h" + > + </File> + </Filter> + <Filter + Name="SSL" + > + <File + RelativePath=".\ssl\ssl_blocking_page.cc" + > + </File> + <File + RelativePath=".\ssl\ssl_blocking_page.h" + > + </File> + <File + RelativePath=".\ssl\ssl_error_info.cc" + > + </File> + <File + RelativePath=".\ssl\ssl_error_info.h" + > + </File> + <File + RelativePath=".\ssl\ssl_host_state.cc" + > + </File> + <File + RelativePath=".\ssl\ssl_host_state.h" + > + </File> + <File + RelativePath=".\ssl\ssl_manager.cc" + > + </File> + <File + RelativePath=".\ssl\ssl_manager.h" + > + </File> + <File + RelativePath=".\ssl\ssl_policy.cc" + > + </File> + <File + RelativePath=".\ssl\ssl_policy.h" + > + </File> + </Filter> + <Filter + Name="Worker Host" + > + <File + RelativePath=".\worker_host\worker_process_host.cc" + > + </File> + <File + RelativePath=".\worker_host\worker_process_host.h" + > + </File> + <File + RelativePath=".\worker_host\worker_service.cc" + > + </File> + <File + RelativePath=".\worker_host\worker_service.h" + > + </File> + </Filter> + <File + RelativePath=".\browser_trial.cc" + > + </File> + <File + RelativePath=".\browser_trial.h" + > + </File> + <File + RelativePath=".\cert_store.cc" + > + </File> + <File + RelativePath=".\cert_store.h" + > + </File> + <File + RelativePath=".\chrome_plugin_browsing_context.cc" + > + </File> + <File + RelativePath=".\chrome_plugin_browsing_context.h" + > + </File> + <File + RelativePath=".\chrome_plugin_host.cc" + > + </File> + <File + RelativePath=".\encoding_menu_controller.cc" + > + </File> + <File + RelativePath=".\encoding_menu_controller.h" + > + </File> + <File + RelativePath=".\encoding_menu_controller_delegate.cc" + > + </File> + <File + RelativePath=".\encoding_menu_controller_delegate.h" + > + </File> + <File + RelativePath=".\external_protocol_handler.cc" + > + </File> + <File + RelativePath=".\external_protocol_handler.h" + > + </File> + <File + RelativePath=".\gears_integration.cc" + > + </File> + <File + RelativePath=".\gears_integration.h" + > + </File> + <File + RelativePath=".\google_update.cc" + > + </File> + <File + RelativePath=".\google_update.h" + > + </File> + <File + RelativePath=".\hung_renderer_dialog.h" + > + </File> + <File + RelativePath=".\modal_html_dialog_delegate.cc" + > + </File> + <File + RelativePath=".\modal_html_dialog_delegate.h" + > + </File> + <File + RelativePath=".\page_state.cc" + > + </File> + <File + RelativePath=".\page_state.h" + > + </File> + <File + RelativePath=".\plugin_installer.cc" + > + </File> + <File + RelativePath=".\plugin_installer.h" + > + </File> + <File + RelativePath="$(OutDir)\grit_derived_sources\grit\theme_resources_map.cc" + > + </File> + <File + RelativePath=".\theme_resources_util.cc" + > + </File> + <File + RelativePath=".\theme_resources_util.h" + > + </File> + <File + RelativePath=".\toolbar_model.cc" + > + </File> + <File + RelativePath=".\toolbar_model.h" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> +>>>>>>> Cocoa Encoding Menu.:chrome/browser/browser.vcproj diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index 283eb1e..92f3527 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -8,6 +8,7 @@ #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/encoding_menu_controller.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/browser/tabs/tab_strip_model.h" @@ -263,6 +264,27 @@ willPositionSheet:(NSWindow *)sheet if (oldState != newState) [item setState:newState]; } + + // Update the checked/Unchecked state of items in the encoding menu. + // On Windows this logic is part of encoding_menu_controller_delegate.cc + EncodingMenuController encoding_controller; + if (encoding_controller.DoesCommandBelongToEncodingMenu(tag)) { + DCHECK(browser_.get()); + Profile *profile = browser_->profile(); + DCHECK(profile); + TabContents* current_tab = browser_->GetSelectedTabContents(); + if (!current_tab) { + return; + } + const std::wstring encoding = current_tab->encoding(); + + bool toggled = encoding_controller.IsItemChecked(profile, encoding, tag); + NSInteger oldState = [item state]; + NSInteger newState = toggled ? NSOnState : NSOffState; + if (oldState != newState) + [item setState:newState]; + } + } // Called to validate menu and toolbar items when this window is key. All the diff --git a/chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h b/chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h new file mode 100644 index 0000000..a23b1aa --- /dev/null +++ b/chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h @@ -0,0 +1,22 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_COCOA_ENCODING_MENU_CONTROLLER_DELEGATE_MAC_H_ +#define CHROME_BROWSER_COCOA_ENCODING_MENU_CONTROLLER_DELEGATE_MAC_H_ + +#include "base/basictypes.h" // For DISALLOW_IMPLICIT_CONSTRUCTORS + +class Profile; + +// The Windows version of this class manages the Encoding Menu, but since Cocoa +// does that for us automagically, the only thing left to do is construct +// the encoding menu. +class EncodingMenuControllerDelegate { + public: + static void BuildEncodingMenu(Profile *profile); + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(EncodingMenuControllerDelegate); +}; + +#endif // CHROME_BROWSER_COCOA_ENCODING_MENU_CONTROLLER_DELEGATE_MAC_H_ diff --git a/chrome/browser/cocoa/encoding_menu_controller_delegate_mac.mm b/chrome/browser/cocoa/encoding_menu_controller_delegate_mac.mm new file mode 100644 index 0000000..4f9468f --- /dev/null +++ b/chrome/browser/cocoa/encoding_menu_controller_delegate_mac.mm @@ -0,0 +1,63 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h" + +#import <Cocoa/Cocoa.h> + +#include "base/sys_string_conversions.h" +#include "chrome/app/chrome_dll_resource.h" +#include "chrome/browser/browser.h" +#include "chrome/browser/encoding_menu_controller.h" +#include "chrome/browser/profile.h" + +namespace { + +void AddSeparatorToMenu(NSMenu *parent_menu) { + NSMenuItem* separator = [NSMenuItem separatorItem]; + [parent_menu addItem:separator]; +} + +void AppendMenuItem(NSMenu *parent_menu, int tag, NSString *title) { + + NSMenuItem* item = [[[NSMenuItem alloc] initWithTitle:title + action:nil + keyEquivalent:@""] autorelease]; + [parent_menu addItem:item]; + [item setAction:@selector(commandDispatch:)]; + [item setTag:tag]; +} + +} // namespace + +// static +void EncodingMenuControllerDelegate::BuildEncodingMenu(Profile *profile) { + DCHECK(profile); + + // Get hold of the Cocoa encoding menu. + NSMenu* view_menu = [[[NSApp mainMenu] itemWithTag:IDC_VIEW_MENU] submenu]; + NSMenuItem* encoding_menu_item = [view_menu itemWithTag:IDC_ENCODING_MENU]; + NSMenu *encoding_menu = [encoding_menu_item submenu]; + + typedef EncodingMenuController::EncodingMenuItemList EncodingMenuItemList; + EncodingMenuItemList menuItems; + EncodingMenuController controller; + controller.GetEncodingMenuItems(profile, &menuItems); + + for (EncodingMenuItemList::iterator it = menuItems.begin(); + it != menuItems.end(); + ++it) { + int item_id = it->first; + std::wstring &localized_title_wstring = it->second; + + if (item_id == 0) { + AddSeparatorToMenu(encoding_menu); + } else { + using base::SysWideToNSString; + NSString *localized_title = SysWideToNSString(localized_title_wstring); + AppendMenuItem(encoding_menu, item_id, localized_title); + } + } + +} diff --git a/chrome/browser/encoding_menu_controller.cc b/chrome/browser/encoding_menu_controller.cc new file mode 100644 index 0000000..ca8c964 --- /dev/null +++ b/chrome/browser/encoding_menu_controller.cc @@ -0,0 +1,144 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/encoding_menu_controller.h" + +#include "app/l10n_util.h" +#include "chrome/app/chrome_dll_resource.h" +#include "chrome/browser/browser.h" +#include "chrome/browser/character_encoding.h" +#include "chrome/browser/profile.h" +#include "chrome/common/pref_names.h" +#include "chrome/common/pref_service.h" +#include "grit/generated_resources.h" + +const int EncodingMenuController::kValidEncodingIds[] = { + IDC_ENCODING_UTF8, + IDC_ENCODING_UTF16LE, + IDC_ENCODING_ISO88591, + IDC_ENCODING_WINDOWS1252, + IDC_ENCODING_GBK, + IDC_ENCODING_GB18030, + IDC_ENCODING_BIG5, + IDC_ENCODING_BIG5HKSCS, + IDC_ENCODING_KOREAN, + IDC_ENCODING_SHIFTJIS, + IDC_ENCODING_ISO2022JP, + IDC_ENCODING_EUCJP, + IDC_ENCODING_THAI, + IDC_ENCODING_ISO885915, + IDC_ENCODING_MACINTOSH, + IDC_ENCODING_ISO88592, + IDC_ENCODING_WINDOWS1250, + IDC_ENCODING_ISO88595, + IDC_ENCODING_WINDOWS1251, + IDC_ENCODING_KOI8R, + IDC_ENCODING_KOI8U, + IDC_ENCODING_ISO88597, + IDC_ENCODING_WINDOWS1253, + IDC_ENCODING_ISO88594, + IDC_ENCODING_ISO885913, + IDC_ENCODING_WINDOWS1257, + IDC_ENCODING_ISO88593, + IDC_ENCODING_ISO885910, + IDC_ENCODING_ISO885914, + IDC_ENCODING_ISO885916, + IDC_ENCODING_WINDOWS1254, + IDC_ENCODING_ISO88596, + IDC_ENCODING_WINDOWS1256, + IDC_ENCODING_ISO88598, + IDC_ENCODING_WINDOWS1255, + IDC_ENCODING_WINDOWS1258, + IDC_ENCODING_ISO88598I, +}; + +bool EncodingMenuController::DoesCommandBelongToEncodingMenu(int id) { + if (id == IDC_ENCODING_AUTO_DETECT) { + return true; + } + + for (size_t i = 0; i < arraysize(kValidEncodingIds); ++i) { + if (id == kValidEncodingIds[i]) { + return true; + } + } + + return false; +} + +const int* EncodingMenuController::ValidGUIEncodingIDs() { + return kValidEncodingIds; +} + +int EncodingMenuController::NumValidGUIEncodingIDs() { + return arraysize(kValidEncodingIds); +} + +bool EncodingMenuController::IsItemChecked( + Profile* browser_profile, + const std::wstring& current_tab_encoding, + int item_id) { + if (!DoesCommandBelongToEncodingMenu(item_id)) { + return false; + } + + std::wstring encoding = current_tab_encoding; + if (encoding.empty()) { + encoding = browser_profile->GetPrefs()->GetString(prefs::kDefaultCharset); + } + + if (item_id == IDC_ENCODING_AUTO_DETECT) { + return browser_profile->GetPrefs()->GetBoolean( + prefs::kWebKitUsesUniversalDetector); + } + + if (!encoding.empty()) { + return encoding == + CharacterEncoding::GetCanonicalEncodingNameByCommandId(item_id); + } + + return false; +} + +void EncodingMenuController::GetEncodingMenuItems(Profile* profile, + EncodingMenuItemList* menuItems) { + + DCHECK(menuItems); + EncodingMenuItem separator(0, L""); + + menuItems->clear(); + menuItems->push_back( + EncodingMenuItem(IDC_ENCODING_AUTO_DETECT, + l10n_util::GetString(IDS_ENCODING_AUTO_DETECT))); + menuItems->push_back(separator); + + // Create current display encoding list. + const std::vector<CharacterEncoding::EncodingInfo>* encodings; + + // Build the list of encoding ids : It is made of the + // locale-dependent short list, the cache of recently selected + // encodings and other encodings. + encodings = CharacterEncoding::GetCurrentDisplayEncodings( + g_browser_process->GetApplicationLocale(), + profile->GetPrefs()->GetString(prefs::kStaticEncodings), + profile->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding)); + DCHECK(encodings); + DCHECK(!encodings->empty()); + + // Build up output list for menu. + std::vector<CharacterEncoding::EncodingInfo>::const_iterator it; + for (it = encodings->begin(); it != encodings->end(); ++it) { + if (it->encoding_id) { + std::wstring encoding = it->encoding_display_name; + std::wstring bidi_safe_encoding; + if (l10n_util::AdjustStringForLocaleDirection(encoding, + &bidi_safe_encoding)) + encoding.swap(bidi_safe_encoding); + menuItems->push_back(EncodingMenuItem(it->encoding_id, encoding)); + } else { + menuItems->push_back(separator); + } + } + +} diff --git a/chrome/browser/encoding_menu_controller.h b/chrome/browser/encoding_menu_controller.h new file mode 100644 index 0000000..9134b54 --- /dev/null +++ b/chrome/browser/encoding_menu_controller.h @@ -0,0 +1,53 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHORME_BROWSER_ENCODING_MENU_CONTROLLER_H_ +#define CHORME_BROWSER_ENCODING_MENU_CONTROLLER_H_ + +#include <vector> + +#include "base/basictypes.h" // For DISALLOW_IMPLICIT_CONSTRUCTORS +#include "testing/gtest/include/gtest/gtest_prod.h" // For FRIEND_TEST + +class Browser; +class Profile; + +// Cross-platform logic needed for the encoding menu. +// For now, we don't need to track state so all methods are static. +class EncodingMenuController { + FRIEND_TEST(EncodingMenuControllerTest, EncodingIDsBelongTest); + FRIEND_TEST(EncodingMenuControllerTest, IsItemChecked); + + public: + typedef std::pair<int, std::wstring> EncodingMenuItem; + typedef std::vector<EncodingMenuItem> EncodingMenuItemList; + + public: + EncodingMenuController() {} + + // Given a command ID, does this command belong to the encoding menu? + bool DoesCommandBelongToEncodingMenu(int id); + + // Returns true if the given encoding menu item (specified by item_id) + // is checked. Note that this header is included from objc, where the name + // "id" is reserved. + bool IsItemChecked(Profile* browser_profile, + const std::wstring& current_tab_encoding, + int item_id); + + // Fills in a list of menu items in the order they should appear in the menu. + // Items whose ids are 0 are separators. + void GetEncodingMenuItems(Profile* profile, + EncodingMenuItemList* menuItems); + + private: + // List of all valid encoding GUI IDs. + static const int kValidEncodingIds[]; + const int* ValidGUIEncodingIDs(); + int NumValidGUIEncodingIDs(); + private: + DISALLOW_COPY_AND_ASSIGN(EncodingMenuController); +}; + +#endif // CHORME_BROWSER_ENCODING_MENU_CONTROLLER_H_ diff --git a/chrome/browser/encoding_menu_controller_delegate.cc b/chrome/browser/encoding_menu_controller_delegate.cc index a7a925a..6faac2d 100644 --- a/chrome/browser/encoding_menu_controller_delegate.cc +++ b/chrome/browser/encoding_menu_controller_delegate.cc @@ -4,77 +4,34 @@ #include "chrome/browser/encoding_menu_controller_delegate.h" -#include "app/l10n_util.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/character_encoding.h" +#include "chrome/browser/encoding_menu_controller.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "grit/generated_resources.h" EncodingMenuControllerDelegate::EncodingMenuControllerDelegate(Browser* browser) : browser_(browser) { } bool EncodingMenuControllerDelegate::IsItemChecked(int id) const { - Profile* profile = browser_->profile(); + if (!browser_) + return false; + Profile *profile = browser_->profile(); if (!profile) return false; TabContents* current_tab = browser_->GetSelectedTabContents(); - if (!current_tab) + if (!current_tab) { return false; - std::wstring encoding = current_tab->encoding(); - if (encoding.empty()) - encoding = profile->GetPrefs()->GetString(prefs::kDefaultCharset); - switch (id) { - case IDC_ENCODING_AUTO_DETECT: - return profile->GetPrefs()->GetBoolean( - prefs::kWebKitUsesUniversalDetector); - case IDC_ENCODING_UTF8: - case IDC_ENCODING_UTF16LE: - case IDC_ENCODING_ISO88591: - case IDC_ENCODING_WINDOWS1252: - case IDC_ENCODING_GBK: - case IDC_ENCODING_GB18030: - case IDC_ENCODING_BIG5: - case IDC_ENCODING_BIG5HKSCS: - case IDC_ENCODING_KOREAN: - case IDC_ENCODING_SHIFTJIS: - case IDC_ENCODING_ISO2022JP: - case IDC_ENCODING_EUCJP: - case IDC_ENCODING_THAI: - case IDC_ENCODING_ISO885915: - case IDC_ENCODING_MACINTOSH: - case IDC_ENCODING_ISO88592: - case IDC_ENCODING_WINDOWS1250: - case IDC_ENCODING_ISO88595: - case IDC_ENCODING_WINDOWS1251: - case IDC_ENCODING_KOI8R: - case IDC_ENCODING_KOI8U: - case IDC_ENCODING_ISO88597: - case IDC_ENCODING_WINDOWS1253: - case IDC_ENCODING_ISO88594: - case IDC_ENCODING_ISO885913: - case IDC_ENCODING_WINDOWS1257: - case IDC_ENCODING_ISO88593: - case IDC_ENCODING_ISO885910: - case IDC_ENCODING_ISO885914: - case IDC_ENCODING_ISO885916: - case IDC_ENCODING_WINDOWS1254: - case IDC_ENCODING_ISO88596: - case IDC_ENCODING_WINDOWS1256: - case IDC_ENCODING_ISO88598: - case IDC_ENCODING_ISO88598I: - case IDC_ENCODING_WINDOWS1255: - case IDC_ENCODING_WINDOWS1258: - return (!encoding.empty() && encoding == - CharacterEncoding::GetCanonicalEncodingNameByCommandId(id)); - default: - return false; } + const std::wstring encoding = current_tab->encoding(); + + EncodingMenuController controller; + return controller.IsItemChecked(profile, encoding, id); } bool EncodingMenuControllerDelegate::SupportsCommand(int id) const { @@ -97,38 +54,26 @@ void EncodingMenuControllerDelegate::ExecuteCommand(int id) { void EncodingMenuControllerDelegate::BuildEncodingMenu( Profile* profile, Menu* encoding_menu) { - // Append auto-detection item. - encoding_menu->AppendMenuItem(IDC_ENCODING_AUTO_DETECT, - l10n_util::GetString(IDS_ENCODING_AUTO_DETECT), - Menu::CHECKBOX); + typedef EncodingMenuController::EncodingMenuItemList EncodingMenuItemList; + EncodingMenuItemList menuItems; + EncodingMenuController controller; + controller.GetEncodingMenuItems(profile, &menuItems); - // Append encoding item. - encoding_menu->AppendSeparator(); - // Create current display encoding list. - std::wstring cur_locale = g_browser_process->GetApplicationLocale(); - const std::vector<CharacterEncoding::EncodingInfo>* encodings; - // Build the list of encoding ids : It is made of the - // locale-dependent short list, the cache of recently selected - // encodings and other encodings. - encodings = CharacterEncoding::GetCurrentDisplayEncodings( - cur_locale, - profile->GetPrefs()->GetString(prefs::kStaticEncodings), - profile->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding)); - DCHECK(encodings); - DCHECK(!encodings->empty()); - unsigned len = static_cast<unsigned>(encodings->size()); - // Add encoding menus. - std::vector<CharacterEncoding::EncodingInfo>::const_iterator it; - for (it = encodings->begin(); it != encodings->end(); ++it) { - if (it->encoding_id) { - std::wstring encoding = it->encoding_display_name; - std::wstring bidi_safe_encoding; - if (l10n_util::AdjustStringForLocaleDirection(encoding, - &bidi_safe_encoding)) - encoding.swap(bidi_safe_encoding); - encoding_menu->AppendMenuItem(it->encoding_id, encoding, Menu::RADIO); - } else { + for (EncodingMenuItemList::iterator it = menuItems.begin(); + it != menuItems.end(); + ++it) { + Menu::MenuItemType type = Menu::RADIO; + int id = it->first; + std::wstring &localized_title = it->second; + + if (id == 0) { encoding_menu->AppendSeparator(); + } else { + if (id == IDC_ENCODING_AUTO_DETECT) { + type = Menu::CHECKBOX; + } + + encoding_menu->AppendMenuItem(id, localized_title, type); } } } diff --git a/chrome/browser/encoding_menu_controller_delegate.h b/chrome/browser/encoding_menu_controller_delegate.h index 83d42ec..f35a5e4 100644 --- a/chrome/browser/encoding_menu_controller_delegate.h +++ b/chrome/browser/encoding_menu_controller_delegate.h @@ -5,6 +5,7 @@ #ifndef CHORME_BROWSER_ENCODING_MENU_CONTROLLER_DELEGATE_H__ #define CHORME_BROWSER_ENCODING_MENU_CONTROLLER_DELEGATE_H__ +#include "base/basictypes.h" // For DISALLOW_IMPLICIT_CONSTRUCTORS #include "views/controls/menu/menu.h" class Browser; @@ -32,6 +33,7 @@ class EncodingMenuControllerDelegate : public Menu::Delegate { private: Browser* browser_; + DISALLOW_IMPLICIT_CONSTRUCTORS(EncodingMenuControllerDelegate); }; #endif // CHORME_BROWSER_ENCODING_MENU_CONTROLLER_DELEGATE_H__ diff --git a/chrome/browser/encoding_menu_controller_unittest.cc b/chrome/browser/encoding_menu_controller_unittest.cc new file mode 100644 index 0000000..a8258bd6 --- /dev/null +++ b/chrome/browser/encoding_menu_controller_unittest.cc @@ -0,0 +1,92 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/encoding_menu_controller.h" + +#include <string> + +#include "base/basictypes.h" +#include "chrome/app/chrome_dll_resource.h" +#include "chrome/browser/profile.h" +#include "chrome/common/pref_names.h" +#include "chrome/test/testing_profile.h" +#include "testing/gtest/include/gtest/gtest.h" + + +class EncodingMenuControllerTest : public testing::Test { +}; + +TEST_F(EncodingMenuControllerTest, EncodingIDsBelongTest) { + EncodingMenuController controller; + + // Check some bogus ids to make sure they're never valid. + ASSERT_FALSE(controller.DoesCommandBelongToEncodingMenu(0)); + ASSERT_FALSE(controller.DoesCommandBelongToEncodingMenu(-1)); + + int num_valid_encoding_ids = controller.NumValidGUIEncodingIDs(); + const int* valid_encodings = controller.ValidGUIEncodingIDs(); + ASSERT_TRUE(controller.DoesCommandBelongToEncodingMenu( + IDC_ENCODING_AUTO_DETECT)); + // Check that all valid encodings are accepted. + for (int i = 0; i < num_valid_encoding_ids; ++i) { + ASSERT_TRUE(controller.DoesCommandBelongToEncodingMenu(valid_encodings[i])); + } + + // This test asserts that we haven't added a new valid ID without including it + // in the kValidEncodingIds test list above. + // The premise is that new encodings will be added directly after the current + // ones so we'll catch such cases. + int one_past_largest_id = valid_encodings[num_valid_encoding_ids - 1] + 1; + ASSERT_FALSE(controller.DoesCommandBelongToEncodingMenu(one_past_largest_id)); +} + +TEST_F(EncodingMenuControllerTest, ListEncodingMenuItems) { + typedef EncodingMenuController::EncodingMenuItemList EncodingMenuItemList; + EncodingMenuController controller; + + EncodingMenuItemList english_items; + TestingProfile profile_en; + + controller.GetEncodingMenuItems(&profile_en, &english_items); + + // Make sure there are items in the lists. + ASSERT_TRUE(english_items.size() > 0); + // Make sure that autodetect is the first item on both menus + ASSERT_EQ(english_items[0].first, IDC_ENCODING_AUTO_DETECT); +} + +TEST_F(EncodingMenuControllerTest, IsItemChecked) { + TestingProfile profile_en; + std::wstring encoding(L"UTF-8"); + + // Check that enabling and disabling autodetect works. + bool autodetect_enabed[] = {true, false}; + PrefService* prefs = profile_en.GetPrefs(); + EncodingMenuController controller; + for (size_t i = 0; i < arraysize(autodetect_enabed); ++i) { + bool enabled = autodetect_enabed[i]; + prefs->SetBoolean(prefs::kWebKitUsesUniversalDetector, enabled); + ASSERT_TRUE(controller.IsItemChecked(&profile_en, + encoding, + IDC_ENCODING_AUTO_DETECT) == enabled); + } + + // Check all valid encodings, make sure only one is enabled when autodetection + // is turned off. + prefs->SetBoolean(prefs::kWebKitUsesUniversalDetector, false); + bool encoding_is_enabled = false; + size_t num_valid_encoding_ids = controller.NumValidGUIEncodingIDs(); + const int* valid_encodings = controller.ValidGUIEncodingIDs(); + for (size_t i = 0; i < num_valid_encoding_ids; ++i) { + bool on = controller.IsItemChecked(&profile_en, + encoding, + valid_encodings[i]); + // Only one item in the encoding menu can be selected at a time. + ASSERT_FALSE(on && encoding_is_enabled); + encoding_is_enabled |= on; + } + + // Make sure at least one encoding is enabled. + ASSERT_TRUE(encoding_is_enabled); +} diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 5e4e07b..8b47380 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -728,6 +728,8 @@ 'browser/cocoa/cocoa_test_helper.h', 'browser/cocoa/command_observer_bridge.h', 'browser/cocoa/command_observer_bridge.mm', + 'browser/cocoa/encoding_menu_controller_delegate_mac.h', + 'browser/cocoa/encoding_menu_controller_delegate_mac.mm', 'browser/cocoa/find_bar_bridge.h', 'browser/cocoa/find_bar_bridge.mm', 'browser/cocoa/find_bar_cocoa_controller.h', @@ -864,6 +866,8 @@ 'browser/download/save_package.cc', 'browser/download/save_package.h', 'browser/download/save_types.h', + 'browser/encoding_menu_controller.cc', + 'browser/encoding_menu_controller.h', 'browser/encoding_menu_controller_delegate.cc', 'browser/encoding_menu_controller_delegate.h', 'browser/extensions/extension.cc', @@ -2694,6 +2698,7 @@ 'browser/cocoa/browser_window_cocoa_unittest.mm', 'browser/cocoa/browser_window_controller_unittest.mm', 'browser/cocoa/command_observer_bridge_unittest.mm', + 'browser/encoding_menu_controller_unittest.cc', 'browser/cocoa/find_bar_bridge_unittest.mm', 'browser/cocoa/find_bar_cocoa_controller_unittest.mm', 'browser/cocoa/find_bar_view_unittest.mm', diff --git a/chrome/test/unit/unittests.vcproj b/chrome/test/unit/unittests.vcproj index f18b051..6c8ddc5 100644 --- a/chrome/test/unit/unittests.vcproj +++ b/chrome/test/unit/unittests.vcproj @@ -516,6 +516,10 @@ > </File> <File + RelativePath="..\..\browser\encoding_menu_controller_unittest.cc" + > + </File> + <File RelativePath="..\..\browser\extensions\extension_messages_unittest.cc" > </File> |