summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-05 12:46:38 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-05 12:46:38 +0000
commitf0a51fb571f46531025fa09240bbc3e1af925e84 (patch)
tree558b4f0e737fda4b9ab60f252c9c23b8a4ca523e
parent6390be368205705f49ead3cec40396519f13b889 (diff)
downloadchromium_src-f0a51fb571f46531025fa09240bbc3e1af925e84.zip
chromium_src-f0a51fb571f46531025fa09240bbc3e1af925e84.tar.gz
chromium_src-f0a51fb571f46531025fa09240bbc3e1af925e84.tar.bz2
Fixes CRLF and trailing white spaces.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10982 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/object_watcher_unittest.cc4
-rw-r--r--base/observer_list_threadsafe.h2
-rw-r--r--base/process_util_mac.mm12
-rw-r--r--base/time_posix.cc42
-rw-r--r--base/time_win_unittest.cc2
-rw-r--r--base/trace_event.cc2
-rw-r--r--chrome/app/chrome_dll_main.cc4
-rw-r--r--chrome/app/chrome_exe_main.mm4
-rw-r--r--chrome/browser/app_controller_mac.mm8
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.cc12
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.cc2
-rw-r--r--chrome/browser/autocomplete/search_provider.cc2
-rw-r--r--chrome/browser/bookmarks/bookmark_codec.cc2
-rw-r--r--chrome/browser/bookmarks/bookmark_context_menu.cc2
-rw-r--r--chrome/browser/bookmarks/bookmark_context_menu.h2
-rw-r--r--chrome/browser/bookmarks/bookmark_drop_info.h2
-rw-r--r--chrome/browser/bookmarks/bookmark_html_writer.cc2
-rw-r--r--chrome/browser/bookmarks/bookmark_table_model.cc2
-rw-r--r--chrome/browser/bookmarks/bookmark_utils.cc2
-rw-r--r--chrome/browser/cocoa/base_view.mm2
-rw-r--r--chrome/browser/cocoa/browser_window_cocoa.mm10
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm12
-rw-r--r--chrome/browser/cocoa/grow_box_view.m2
-rw-r--r--chrome/browser/cocoa/sad_tab_view.mm18
-rw-r--r--chrome/browser/cocoa/tab_contents_controller.h2
-rw-r--r--chrome/browser/cocoa/tab_contents_controller.mm16
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.h2
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.mm58
-rw-r--r--chrome/browser/command_updater.h2
-rw-r--r--chrome/browser/command_updater_unittest.cc4
-rw-r--r--chrome/browser/debugger/debugger_contents.cc2
-rw-r--r--chrome/browser/debugger/debugger_host.h2
-rw-r--r--chrome/browser/debugger/debugger_host_impl.cpp6
-rw-r--r--chrome/browser/debugger/debugger_io.h2
-rw-r--r--chrome/browser/debugger/debugger_window.cc2
-rw-r--r--chrome/browser/debugger/debugger_window.h2
-rw-r--r--chrome/browser/dock_info.cc2
-rw-r--r--chrome/browser/dom_ui/chrome_url_data_manager.cc2
-rw-r--r--chrome/browser/dom_ui/dom_ui.cc8
-rw-r--r--chrome/browser/dom_ui/dom_ui.h2
-rw-r--r--chrome/browser/dom_ui/dom_ui_contents.h2
-rw-r--r--chrome/browser/dom_ui/fileicon_source.cc4
-rw-r--r--chrome/browser/dom_ui/history_ui.cc4
-rw-r--r--chrome/browser/dom_ui/history_ui.h6
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.h4
-rw-r--r--chrome/browser/download/download_manager.h6
-rw-r--r--chrome/browser/download/save_package.cc2
-rw-r--r--chrome/browser/extensions/extensions_service.cc14
-rw-r--r--chrome/browser/extensions/extensions_service.h2
-rw-r--r--chrome/browser/extensions/user_script_master.cc2
-rw-r--r--chrome/browser/external_tab_container.cc2
-rw-r--r--chrome/browser/first_run.cc6
-rw-r--r--chrome/browser/gears_integration.cc2
-rw-r--r--chrome/browser/google_update.cc2
-rw-r--r--chrome/browser/history/query_parser.cc2
-rw-r--r--chrome/browser/history/text_database_manager.cc2
-rw-r--r--chrome/browser/history/url_database_unittest.cc2
-rw-r--r--chrome/browser/importer/firefox2_importer.cc2
-rw-r--r--chrome/browser/importer/importer.h4
-rw-r--r--chrome/browser/navigation_controller_unittest.cc10
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc2
-rw-r--r--chrome/browser/net/resolve_proxy_msg_helper_unittest.cc4
-rw-r--r--chrome/browser/password_manager/password_manager.cc6
-rw-r--r--chrome/browser/password_manager/password_manager.h6
-rw-r--r--chrome/browser/printing/page_number_unittest.cc2
-rw-r--r--chrome/browser/profile.cc4
-rw-r--r--chrome/browser/profile.h12
-rw-r--r--chrome/browser/profile_manager_unittest.cc2
-rw-r--r--chrome/browser/renderer_host/audio_renderer_host_unittest.cc2
-rw-r--r--chrome/browser/renderer_host/buffered_resource_handler.cc2
-rw-r--r--chrome/browser/renderer_host/render_view_host_unittest.cc34
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.h6
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.mm16
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.h6
-rw-r--r--chrome/browser/renderer_host/test_render_view_host.h2
-rw-r--r--chrome/browser/rlz/rlz.cc10
-rw-r--r--chrome/browser/safe_browsing/protocol_parser_unittest.cc8
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_database_bloom.cc2
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_database_unittest.cc12
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_service.cc2
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_util_unittest.cc2
-rw-r--r--chrome/browser/search_engines/template_url_prepopulate_data.cc14
-rw-r--r--chrome/browser/sessions/base_session_service.cc2
-rw-r--r--chrome/browser/sessions/session_service.cc2
-rw-r--r--chrome/browser/sessions/tab_restore_service.cc2
-rw-r--r--chrome/browser/sessions/tab_restore_service_unittest.cc2
-rw-r--r--chrome/browser/tab_contents/infobar_delegate.h4
-rw-r--r--chrome/browser/tab_contents/interstitial_page.cc4
-rw-r--r--chrome/browser/tab_contents/interstitial_page.h2
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu_controller.cc8
-rw-r--r--chrome/browser/tab_contents/render_view_host_manager.cc4
-rw-r--r--chrome/browser/tab_contents/repost_form_warning.h34
-rw-r--r--chrome/browser/tab_contents/site_instance.h2
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc4
-rw-r--r--chrome/browser/tab_contents/test_web_contents.cc36
-rw-r--r--chrome/browser/tab_contents/test_web_contents.h110
-rw-r--r--chrome/browser/tab_contents/web_contents.cc2
-rw-r--r--chrome/browser/tab_contents/web_contents_unittest.cc6
-rw-r--r--chrome/browser/tab_contents/web_contents_view_mac.mm8
-rw-r--r--chrome/browser/task_manager.cc8
-rw-r--r--chrome/browser/toolbar_model.cc2
-rw-r--r--chrome/browser/unload_uitest.cc8
-rw-r--r--chrome/browser/views/about_ipc_dialog.cc2
-rw-r--r--chrome/browser/views/bookmark_bar_view_test.cc4
-rw-r--r--chrome/browser/views/bookmark_bubble_view.cc6
-rw-r--r--chrome/browser/views/bookmark_bubble_view.h2
-rw-r--r--chrome/browser/views/bookmark_table_view.cc2
-rw-r--r--chrome/browser/views/download_item_view.cc6
-rw-r--r--chrome/browser/views/edit_keyword_controller.cc2
-rw-r--r--chrome/browser/views/first_run_bubble.cc2
-rw-r--r--chrome/browser/views/frame/glass_browser_frame_view.cc4
-rw-r--r--chrome/browser/views/frame/glass_browser_frame_view.h2
-rw-r--r--chrome/browser/views/frame/opaque_browser_frame_view.cc4
-rw-r--r--chrome/browser/views/frame/opaque_browser_frame_view.h2
-rw-r--r--chrome/browser/views/hung_renderer_view.cc4
-rw-r--r--chrome/browser/views/hwnd_html_view.h2
-rw-r--r--chrome/browser/views/importer_view.cc30
-rw-r--r--chrome/browser/views/importer_view.h10
-rw-r--r--chrome/browser/views/importing_progress_view.cc2
-rw-r--r--chrome/browser/views/infobars/infobar_container.h2
-rw-r--r--chrome/browser/views/infobars/infobars.cc2
-rw-r--r--chrome/browser/views/infobars/infobars.h2
-rw-r--r--chrome/browser/views/keyword_editor_view.cc8
-rw-r--r--chrome/browser/views/location_bar_view.h2
-rw-r--r--chrome/browser/views/options/cookies_view.cc2
-rw-r--r--chrome/browser/views/options/languages_page_view.cc4
-rw-r--r--chrome/browser/views/options/languages_page_view.h4
-rw-r--r--chrome/browser/views/page_info_window.cc14
-rw-r--r--chrome/browser/views/password_manager_view.h2
-rw-r--r--chrome/browser/views/shell_dialogs_win.cc4
-rw-r--r--chrome/browser/views/tabs/tab_dragging_test.cc46
-rw-r--r--chrome/browser/views/toolbar_view.cc2
-rw-r--r--chrome/browser/visitedlink_unittest.cc2
-rw-r--r--chrome/common/child_process.cc2
-rw-r--r--chrome/common/child_process_info.cc2
-rw-r--r--chrome/common/chrome_paths_mac.mm6
-rw-r--r--chrome/common/chrome_paths_win.cc2
-rw-r--r--chrome/common/extensions/url_pattern.cc2
-rw-r--r--chrome/common/gfx/chrome_font.h2
-rw-r--r--chrome/common/gfx/chrome_font_mac.mm10
-rw-r--r--chrome/common/gfx/text_elider.cc4
-rw-r--r--chrome/common/ipc_sync_channel.cc2
-rw-r--r--chrome/common/json_value_serializer.h2
-rw-r--r--chrome/common/l10n_util.h2
-rw-r--r--chrome/common/page_zoom.h2
-rw-r--r--chrome/common/plugin_messages.h2
-rw-r--r--chrome/common/resource_bundle_mac.mm6
-rw-r--r--chrome/common/sandbox_init_wrapper.cc2
-rw-r--r--chrome/common/sandbox_init_wrapper.h4
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc2
-rw-r--r--chrome/common/temp_scaffolding_stubs.h2
-rw-r--r--chrome/installer/gcapi/gcapi.cc888
-rw-r--r--chrome/installer/gcapi/gcapi.h6
-rw-r--r--chrome/installer/gcapi/gcapi_test.cc6
-rw-r--r--chrome/installer/gcapi/resource.h28
-rw-r--r--chrome/installer/mini_installer/mini_installer.cc2
-rw-r--r--chrome/installer/setup/main.cc2
-rw-r--r--chrome/installer/util/copy_tree_work_item.cc2
-rw-r--r--chrome/installer/util/html_dialog.h4
-rw-r--r--chrome/installer/util/html_dialog_impl.cc6
-rwxr-xr-xchrome/installer/util/prebuild/create_string_rc.py4
-rw-r--r--chrome/installer/util/util_constants.h4
-rw-r--r--chrome/plugin/plugin_main.cc2
-rw-r--r--chrome/plugin/plugin_thread.cc2
-rw-r--r--chrome/plugin/webplugin_delegate_stub.cc4
-rw-r--r--chrome/renderer/dom_ui_bindings.h2
-rw-r--r--chrome/renderer/renderer_webkitclient_impl.cc4
-rw-r--r--chrome/renderer/user_script_slave.cc2
-rw-r--r--chrome/renderer/webmediaplayer_delegate_impl.cc6
-rw-r--r--chrome/renderer/webmediaplayer_delegate_impl.h2
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc4
-rw-r--r--chrome/renderer/webworker_proxy.h2
-rw-r--r--chrome/test/automation/automation_messages_internal.h6
-rw-r--r--chrome/test/data/extensions/bad/invalid_manifest/1/manifest.json2
-rw-r--r--chrome/test/data/extensions/bad/missing_content_script/1/manifest.json26
-rw-r--r--chrome/test/data/extensions/good/extension1/1/manifest.json34
-rw-r--r--chrome/test/data/extensions/good/extension2/2/manifest.json14
-rw-r--r--chrome/test/data/pref_service/overlay.json44
-rwxr-xr-xchrome/test/data/safe_browsing/download_update.py2
-rwxr-xr-xchrome/test/debugger/debugger_unittests.py2
-rw-r--r--chrome/test/in_process_browser_test.cc2
-rw-r--r--chrome/test/interactive_ui/npapi_interactive_test.cc8
-rw-r--r--chrome/test/interactive_ui/view_event_test_base.h4
-rw-r--r--chrome/test/plugin/plugin_test.cpp2
-rw-r--r--chrome/test/test_location_bar.h2
-rw-r--r--chrome/test/ui/npapi_test_helper.cc4
-rw-r--r--chrome/test/ui/npapi_uitest.cpp48
-rw-r--r--chrome/test/ui_test_utils.cc2
-rwxr-xr-xchrome/tools/automated_ui_test_tools/auto_ui_test_input_generator.py302
-rwxr-xr-xchrome/tools/build/win/create_installer_archive.py44
-rwxr-xr-xchrome/tools/build/win/dependencies.py6
-rwxr-xr-xchrome/tools/build/win/sln_deps.py2
-rw-r--r--chrome/tools/convert_dict/dic_reader.cc8
-rwxr-xr-xchrome/tools/extensions/chromium_extension.py12
-rwxr-xr-xchrome/tools/extract_actions.py2
-rwxr-xr-xchrome/tools/history-viz.py8
-rwxr-xr-xchrome/tools/test/smoketests.py2
-rw-r--r--chrome/views/accelerator.cc6
-rw-r--r--chrome/views/client_view.h2
-rw-r--r--chrome/views/dialog_client_view.h2
-rw-r--r--chrome/views/focus_manager.cc2
-rw-r--r--chrome/views/focus_manager_unittest.cc2
-rw-r--r--chrome/views/grid_layout.h2
-rw-r--r--chrome/views/hwnd_view.cc6
-rw-r--r--chrome/views/hwnd_view.h2
-rw-r--r--chrome/views/native_button.cc2
-rw-r--r--chrome/views/single_split_view.cc2
-rw-r--r--chrome/views/table_view_unittest.cc2
-rw-r--r--chrome/views/text_button.cc2
-rw-r--r--chrome/views/tree_view.cc2
-rw-r--r--chrome/views/view_unittest.cc6
-rw-r--r--chrome/views/window.cc2
-rw-r--r--chrome/views/window.h2
-rw-r--r--chrome/views/window_delegate.cc6
-rw-r--r--chrome/views/window_delegate.h2
-rw-r--r--chrome/worker/webworkerclient_proxy.cc2
-rw-r--r--media/audio/win/audio_output_win.cc2
-rw-r--r--media/filters/audio_renderer_base.h2
-rw-r--r--net/base/cookie_monster.h2
-rw-r--r--net/base/cookie_monster_unittest.cc2
-rw-r--r--net/base/file_stream.h10
-rw-r--r--net/base/file_stream_posix.cc2
-rw-r--r--net/base/file_stream_unittest.cc30
-rw-r--r--net/base/gzip_filter.cc4
-rw-r--r--net/base/listen_socket.cc6
-rw-r--r--net/base/listen_socket_unittest.cc10
-rw-r--r--net/base/listen_socket_unittest.h4
-rw-r--r--net/base/mime_sniffer.cc6
-rw-r--r--net/base/mime_sniffer_unittest.cc2
-rw-r--r--net/base/nss_memio.c24
-rw-r--r--net/base/nss_memio.h8
-rw-r--r--net/base/sdch_manager.cc10
-rw-r--r--net/base/ssl_client_socket_mac.cc122
-rw-r--r--net/base/ssl_client_socket_mac.h12
-rw-r--r--net/base/telnet_server.cc4
-rw-r--r--net/base/test_completion_callback_unittest.cc6
-rw-r--r--net/base/x509_certificate_mac.cc40
-rw-r--r--net/disk_cache/disk_cache_perftest.cc2
-rw-r--r--net/disk_cache/disk_cache_test_util.cc4
-rw-r--r--net/disk_cache/entry_unittest.cc2
-rw-r--r--net/disk_cache/file.h2
-rw-r--r--net/disk_cache/stress_cache.cc2
-rw-r--r--net/ftp/ftp_request_info.h2
-rw-r--r--net/http/http_auth.h8
-rw-r--r--net/http/http_auth_cache.cc2
-rw-r--r--net/http/http_auth_handler_basic.h2
-rw-r--r--net/http/http_auth_handler_digest_unittest.cc6
-rw-r--r--net/http/http_chunked_decoder.cc2
-rw-r--r--net/http/http_chunked_decoder.h2
-rw-r--r--net/http/http_response_headers.cc4
-rw-r--r--net/http/http_response_headers_unittest.cc2
-rw-r--r--net/http/http_util.h4
-rw-r--r--net/http/http_version.h2
-rw-r--r--net/http/md4.cc8
-rw-r--r--net/http/md4.h2
-rw-r--r--net/proxy/proxy_config_service_fixed.h2
-rw-r--r--net/proxy/proxy_config_service_win.cc2
-rw-r--r--net/proxy/proxy_resolver_mac.cc68
-rw-r--r--net/proxy/proxy_resolver_script.h2
-rw-r--r--net/proxy/proxy_resolver_v8.h4
-rw-r--r--net/proxy/proxy_resolver_v8_unittest.cc2
-rw-r--r--net/proxy/proxy_script_fetcher.cc4
-rw-r--r--net/proxy/proxy_server.cc2
-rw-r--r--net/proxy/proxy_server.h2
-rw-r--r--net/proxy/proxy_service.cc2
-rw-r--r--net/proxy/proxy_service.h2
-rw-r--r--net/tools/crash_cache/crash_cache.cc2
-rw-r--r--net/tools/testserver/testserver.py14
-rw-r--r--net/url_request/url_request_job.h2
-rw-r--r--net/url_request/url_request_job_manager.cc2
-rw-r--r--net/url_request/url_request_job_tracker.h2
-rw-r--r--sandbox/src/interception.cc2
-rw-r--r--sandbox/src/interception_unittest.cc2
-rw-r--r--sandbox/src/sandbox_nt_util.cc2
-rw-r--r--sandbox/src/unload_dll_test.cc2
-rw-r--r--sandbox/src/win2k_threadpool.cc2
-rw-r--r--testing/multiprocess_func_list.cc10
-rw-r--r--testing/multiprocess_func_list.h6
-rw-r--r--testing/platform_test.h2
-rw-r--r--tools/channel_changer/resource.h2
-rw-r--r--tools/code_coverage/coverage.py70
-rw-r--r--tools/code_coverage/process_coverage.py24
-rw-r--r--tools/grit/grit/clique.py116
-rw-r--r--tools/grit/grit/clique_unittest.py38
-rw-r--r--tools/grit/grit/extern/FP.py2
-rw-r--r--tools/grit/grit/extern/tclib.py4
-rwxr-xr-xtools/grit/grit/format/html_inline.py22
-rw-r--r--tools/grit/grit/format/interface.py6
-rw-r--r--tools/grit/grit/format/rc.py78
-rw-r--r--tools/grit/grit/format/rc_header.py34
-rw-r--r--tools/grit/grit/format/rc_header_unittest.py8
-rw-r--r--tools/grit/grit/format/rc_unittest.py24
-rw-r--r--tools/grit/grit/gather/admin_template.py18
-rw-r--r--tools/grit/grit/gather/admin_template_unittest.py16
-rw-r--r--tools/grit/grit/gather/interface.py38
-rw-r--r--tools/grit/grit/gather/muppet_strings.py32
-rw-r--r--tools/grit/grit/gather/muppet_strings_unittest.py4
-rw-r--r--tools/grit/grit/gather/rc.py76
-rw-r--r--tools/grit/grit/gather/rc_unittest.py42
-rw-r--r--tools/grit/grit/gather/regexp.py38
-rw-r--r--tools/grit/grit/gather/tr_html.py148
-rw-r--r--tools/grit/grit/gather/tr_html_unittest.py92
-rw-r--r--tools/grit/grit/gather/txt.py12
-rw-r--r--tools/grit/grit/grd_reader.py38
-rw-r--r--tools/grit/grit/grd_reader_unittest.py6
-rw-r--r--tools/grit/grit/grit_runner.py22
-rw-r--r--tools/grit/grit/grit_runner_unittest.py4
-rw-r--r--tools/grit/grit/node/base.py102
-rw-r--r--tools/grit/grit/node/base_unittest.py26
-rw-r--r--tools/grit/grit/node/custom/__init__.py2
-rw-r--r--tools/grit/grit/node/custom/filename.py8
-rw-r--r--tools/grit/grit/node/custom/filename_unittest.py2
-rw-r--r--tools/grit/grit/node/empty.py2
-rw-r--r--tools/grit/grit/node/include.py14
-rw-r--r--tools/grit/grit/node/io.py30
-rw-r--r--tools/grit/grit/node/io_unittest.py4
-rw-r--r--tools/grit/grit/node/mapping.py4
-rw-r--r--tools/grit/grit/node/message.py48
-rw-r--r--tools/grit/grit/node/message_unittest.py4
-rw-r--r--tools/grit/grit/node/misc.py62
-rw-r--r--tools/grit/grit/node/misc_unittest.py20
-rw-r--r--tools/grit/grit/node/structure.py44
-rw-r--r--tools/grit/grit/node/structure_unittest.py6
-rw-r--r--tools/grit/grit/node/variant.py8
-rw-r--r--tools/grit/grit/pseudo.py12
-rw-r--r--tools/grit/grit/pseudo_unittest.py6
-rw-r--r--tools/grit/grit/shortcuts.py16
-rw-r--r--tools/grit/grit/shortcuts_unittests.py22
-rw-r--r--tools/grit/grit/tclib.py62
-rw-r--r--tools/grit/grit/tclib_unittest.py10
-rw-r--r--tools/grit/grit/test_suite_all.py2
-rw-r--r--tools/grit/grit/tool/build.py24
-rw-r--r--tools/grit/grit/tool/count.py8
-rw-r--r--tools/grit/grit/tool/diff_structures.py18
-rw-r--r--tools/grit/grit/tool/interface.py16
-rw-r--r--tools/grit/grit/tool/menu_from_parts.py16
-rw-r--r--tools/grit/grit/tool/newgrd.py2
-rw-r--r--tools/grit/grit/tool/postprocess_interface.py4
-rw-r--r--tools/grit/grit/tool/postprocess_unittest.py14
-rw-r--r--tools/grit/grit/tool/preprocess_interface.py2
-rw-r--r--tools/grit/grit/tool/preprocess_unittest.py12
-rw-r--r--tools/grit/grit/tool/rc2grd.py72
-rw-r--r--tools/grit/grit/tool/rc2grd_unittest.py10
-rw-r--r--tools/grit/grit/tool/resize.py36
-rw-r--r--tools/grit/grit/tool/test.py4
-rw-r--r--tools/grit/grit/tool/toolbar_postprocess.py10
-rw-r--r--tools/grit/grit/tool/toolbar_preprocess.py12
-rw-r--r--tools/grit/grit/tool/transl2tc.py52
-rw-r--r--tools/grit/grit/tool/transl2tc_unittest.py16
-rw-r--r--tools/grit/grit/tool/unit.py4
-rw-r--r--tools/grit/grit/util.py38
-rw-r--r--tools/grit/grit/util_unittest.py8
-rw-r--r--tools/grit/grit/xtb_reader.py16
-rw-r--r--tools/grit/grit/xtb_reader_unittest.py8
-rw-r--r--tools/measure_page_load_time/ie_bho/MeasurePageLoadTime.cpp2
-rw-r--r--tools/measure_page_load_time/ie_bho/MeasurePageLoadTimeBHO.cpp16
-rw-r--r--tools/measure_page_load_time/ie_bho/MeasurePageLoadTimeBHO.h4
-rw-r--r--tools/measure_page_load_time/ie_bho/resource.h2
-rw-r--r--tools/measure_page_load_time/ie_bho/stdafx.h6
-rw-r--r--tools/memory_watcher/ia32_modrm_map.cc18
-rw-r--r--tools/memory_watcher/ia32_opcode_map.cc60
-rw-r--r--tools/memory_watcher/memory_watcher.cc4
-rw-r--r--tools/memory_watcher/memory_watcher.h2
-rw-r--r--tools/memory_watcher/mini_disassembler.cc50
-rw-r--r--tools/memory_watcher/mini_disassembler.h14
-rw-r--r--tools/memory_watcher/mini_disassembler_types.h14
-rw-r--r--tools/memory_watcher/preamble_patcher.cc52
-rw-r--r--tools/memory_watcher/preamble_patcher.h40
-rw-r--r--tools/memory_watcher/preamble_patcher_with_stub.cc6
-rw-r--r--tools/purify/chrome_tests.py24
-rw-r--r--tools/purify/common.py26
-rw-r--r--tools/purify/purify_analyze.py48
-rw-r--r--tools/purify/purify_coverage.py10
-rw-r--r--tools/purify/purify_inuse.py8
-rw-r--r--tools/purify/purify_message.py16
-rw-r--r--tools/purify/purify_test.py10
-rw-r--r--tools/purify/quantify_test.py12
-rw-r--r--tools/python/google/httpd_utils.py2
-rw-r--r--tools/python/google/logging_utils.py10
-rw-r--r--tools/python/google/path_utils.py4
-rw-r--r--tools/python/google/platform_utils_win.py2
-rw-r--r--tools/site_compare/command_line.py292
-rw-r--r--tools/site_compare/commands/compare2.py38
-rw-r--r--tools/site_compare/commands/maskmaker.py46
-rw-r--r--tools/site_compare/commands/measure.py4
-rw-r--r--tools/site_compare/commands/scrape.py6
-rw-r--r--tools/site_compare/commands/timeload.py38
-rw-r--r--tools/site_compare/drivers/__init__.py2
-rw-r--r--tools/site_compare/drivers/win32/keyboard.py66
-rw-r--r--tools/site_compare/drivers/win32/mouse.py80
-rw-r--r--tools/site_compare/drivers/win32/windowing.py110
-rw-r--r--tools/site_compare/operators/__init__.py10
-rw-r--r--tools/site_compare/operators/equals.py16
-rw-r--r--tools/site_compare/operators/equals_with_mask.py26
-rw-r--r--tools/site_compare/scrapers/__init__.py12
-rw-r--r--tools/site_compare/scrapers/chrome/__init__.py14
-rw-r--r--tools/site_compare/scrapers/chrome/chrome011010.py8
-rw-r--r--tools/site_compare/scrapers/chrome/chrome01970.py12
-rw-r--r--tools/site_compare/scrapers/chrome/chromebase.py70
-rw-r--r--tools/site_compare/scrapers/firefox/__init__.py16
-rw-r--r--tools/site_compare/scrapers/firefox/firefox2.py86
-rw-r--r--tools/site_compare/scrapers/ie/__init__.py12
-rw-r--r--tools/site_compare/scrapers/ie/ie7.py66
-rw-r--r--tools/site_compare/site_compare.py58
-rw-r--r--tools/site_compare/utils/browser_iterate.py22
-rwxr-xr-xtools/traceline/traceline/assembler.h2
-rwxr-xr-xtools/traceline/traceline/main.cc22
-rwxr-xr-xtools/traceline/traceline/sym_resolver.h4
-rw-r--r--webkit/activex_shim/activex_plugin.h2
-rw-r--r--webkit/activex_shim/activex_shared.cc10
-rw-r--r--webkit/activex_shim/activex_util.cc2
-rw-r--r--webkit/activex_shim/web_activex_site.h2
-rw-r--r--webkit/build/JavaScriptCore/pthread.h2
-rw-r--r--webkit/build/precompiled_webkit.cc2
-rw-r--r--webkit/build/precompiled_webkit_c.c2
-rwxr-xr-xwebkit/build/webkit_version.py4
-rw-r--r--webkit/default_plugin/install_dialog.cc2
-rw-r--r--webkit/default_plugin/plugin_database_handler.h2
-rw-r--r--webkit/default_plugin/plugin_impl.h16
-rw-r--r--webkit/glue/alt_404_page_resource_fetcher.cc2
-rw-r--r--webkit/glue/cache_manager.cc2
-rw-r--r--webkit/glue/context_menu_client_impl.cc24
-rw-r--r--webkit/glue/context_menu_unittest.cc8
-rw-r--r--webkit/glue/cpp_binding_example.cc10
-rw-r--r--webkit/glue/cpp_binding_example.h4
-rw-r--r--webkit/glue/cpp_bound_class_unittest.cc16
-rw-r--r--webkit/glue/cpp_variant.cc4
-rw-r--r--webkit/glue/cpp_variant.h6
-rw-r--r--webkit/glue/cpp_variant_unittest.cc12
-rw-r--r--webkit/glue/dom_operations.cc18
-rw-r--r--webkit/glue/dom_serializer.cc2
-rw-r--r--webkit/glue/dragclient_impl.cc2
-rw-r--r--webkit/glue/dragclient_impl.h6
-rw-r--r--webkit/glue/editor_client_impl.cc38
-rw-r--r--webkit/glue/editor_client_impl.h14
-rw-r--r--webkit/glue/event_conversion.cc2
-rw-r--r--webkit/glue/glue_serialize.cc2
-rw-r--r--webkit/glue/localized_strings.cc2
-rw-r--r--webkit/glue/media_player_private_impl.cc10
-rw-r--r--webkit/glue/multipart_response_delegate.cc14
-rw-r--r--webkit/glue/multipart_response_delegate_unittest.cc14
-rw-r--r--webkit/glue/password_autocomplete_listener.cc2
-rw-r--r--webkit/glue/password_autocomplete_listener_unittest.cc6
-rw-r--r--webkit/glue/password_form.h10
-rw-r--r--webkit/glue/password_form_dom_manager.cc36
-rw-r--r--webkit/glue/password_form_dom_manager.h24
-rw-r--r--webkit/glue/plugins/plugin_host.cc2
-rw-r--r--webkit/glue/regular_expression_unittest.cc4
-rw-r--r--webkit/glue/resource_fetcher.cc4
-rw-r--r--webkit/glue/resource_fetcher_unittest.cc6
-rw-r--r--webkit/glue/searchable_form_data.cc34
-rw-r--r--webkit/glue/webcursor_mac.mm6
-rw-r--r--webkit/glue/webcursor_win.cc6
-rw-r--r--webkit/glue/webdatasource.h10
-rw-r--r--webkit/glue/webdatasource_impl.cc2
-rw-r--r--webkit/glue/webdatasource_impl.h4
-rw-r--r--webkit/glue/webdocumentloader_impl.cc6
-rw-r--r--webkit/glue/webdocumentloader_impl.h10
-rw-r--r--webkit/glue/webdropdata.h2
-rw-r--r--webkit/glue/weberror_impl.h2
-rw-r--r--webkit/glue/webframeloaderclient_impl.cc2
-rw-r--r--webkit/glue/webframeloaderclient_impl.h28
-rw-r--r--webkit/glue/webhistoryitem_impl.cc2
-rw-r--r--webkit/glue/webinputevent_mac.mm50
-rw-r--r--webkit/glue/webinputevent_win.cc2
-rw-r--r--webkit/glue/webkit_glue.cc4
-rw-r--r--webkit/glue/webkit_glue_mac.mm2
-rw-r--r--webkit/glue/webkit_glue_win.cc2
-rw-r--r--webkit/glue/webmediaplayer.h2
-rw-r--r--webkit/glue/webmediaplayer_delegate.h2
-rw-r--r--webkit/glue/webmediaplayer_impl.h4
-rw-r--r--webkit/glue/webresponse.h2
-rw-r--r--webkit/glue/webresponse_impl.h2
-rw-r--r--webkit/glue/weburlrequest_impl.h2
-rw-r--r--webkit/glue/webview.h2
-rw-r--r--webkit/glue/webview_impl.cc12
-rw-r--r--webkit/glue/webwidget_delegate.h4
-rw-r--r--webkit/pending/AccessibleBase.cpp4
-rw-r--r--webkit/pending/AccessibleBase.h2
-rw-r--r--webkit/pending/AccessibleDocument.cpp2
-rw-r--r--webkit/pending/AccessibleDocument.h2
-rw-r--r--webkit/port/bindings/v8/JSDOMBinding.cpp6
-rw-r--r--webkit/port/bindings/v8/JSDOMBinding.h6
-rw-r--r--webkit/port/bindings/v8/JSXPathNSResolver.cpp6
-rw-r--r--webkit/port/bindings/v8/RGBColor.cpp6
-rw-r--r--webkit/port/bindings/v8/RGBColor.h2
-rw-r--r--webkit/port/bindings/v8/ScriptController.cpp24
-rw-r--r--webkit/port/bindings/v8/ScriptController.h4
-rw-r--r--webkit/port/bindings/v8/V8CanvasPixelArrayCustom.cpp8
-rw-r--r--webkit/port/bindings/v8/V8MessagePortCustom.cpp8
-rw-r--r--webkit/port/bindings/v8/V8SVGPODTypeWrapper.h122
-rw-r--r--webkit/port/bindings/v8/V8WorkerContextCustom.cpp6
-rw-r--r--webkit/port/bindings/v8/V8WorkerCustom.cpp12
-rw-r--r--webkit/port/bindings/v8/V8XMLHttpRequestCustom.cpp6
-rw-r--r--webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp6
-rw-r--r--webkit/port/bindings/v8/WorkerContextExecutionProxy.h6
-rw-r--r--webkit/port/bindings/v8/WorkerScriptController.cpp6
-rw-r--r--webkit/port/bindings/v8/WorkerScriptController.h2
-rwxr-xr-xwebkit/port/bindings/v8/extensions/Gears.cpp2
-rw-r--r--webkit/port/bindings/v8/extensions/Interval.cpp2
-rw-r--r--webkit/port/bindings/v8/npruntime.cpp2
-rw-r--r--webkit/port/bindings/v8/npruntime_impl.h6
-rw-r--r--webkit/port/bindings/v8/npruntime_priv.h6
-rw-r--r--webkit/port/bindings/v8/v8_binding.h2
-rw-r--r--webkit/port/bindings/v8/v8_custom.cpp12
-rw-r--r--webkit/port/bindings/v8/v8_custom.h4
-rw-r--r--webkit/port/bindings/v8/v8_events.cpp2
-rw-r--r--webkit/port/bindings/v8/v8_events.h6
-rw-r--r--webkit/port/bindings/v8/v8_helpers.cpp6
-rw-r--r--webkit/port/bindings/v8/v8_index.cpp6
-rw-r--r--webkit/port/bindings/v8/v8_index.h6
-rw-r--r--webkit/port/bindings/v8/v8_nodefilter.cpp6
-rw-r--r--webkit/port/bindings/v8/v8_np_utils.cpp8
-rw-r--r--webkit/port/bindings/v8/v8_npobject.cpp14
-rw-r--r--webkit/port/bindings/v8/v8_proxy.cpp40
-rw-r--r--webkit/port/bindings/v8/v8_proxy.h8
-rw-r--r--webkit/tools/layout_tests/layout_package/compare_failures.py22
-rw-r--r--webkit/tools/layout_tests/layout_package/compare_failures_unittest.py22
-rw-r--r--webkit/tools/layout_tests/layout_package/path_utils.py2
-rw-r--r--webkit/tools/layout_tests/layout_package/platform_utils_mac.py10
-rw-r--r--webkit/tools/layout_tests/layout_package/platform_utils_win.py8
-rw-r--r--webkit/tools/layout_tests/layout_package/test_expectations.py60
-rw-r--r--webkit/tools/layout_tests/layout_package/test_types_unittest.py2
-rwxr-xr-xwebkit/tools/layout_tests/run_webkit_tests.py10
-rw-r--r--webkit/tools/layout_tests/test_types/simplified_text_diff.py10
-rw-r--r--webkit/tools/layout_tests/test_types/test_type_base.py18
-rwxr-xr-xwebkit/tools/merge/diff3-wrapper.py20
-rw-r--r--webkit/tools/npapi_layout_test_plugin/PluginObject.cpp28
-rw-r--r--webkit/tools/npapi_layout_test_plugin/PluginObject.h2
-rw-r--r--webkit/tools/npapi_layout_test_plugin/TestObject.cpp22
-rw-r--r--webkit/tools/npapi_layout_test_plugin/TestObject.h2
-rw-r--r--webkit/tools/npapi_layout_test_plugin/main.cpp64
-rw-r--r--webkit/tools/npapi_layout_test_plugin/resource.h2
-rw-r--r--webkit/tools/test_shell/event_sending_controller.h2
-rw-r--r--webkit/tools/test_shell/foreground_helper.h10
-rw-r--r--webkit/tools/test_shell/image_decoder_unittest.cc4
-rw-r--r--webkit/tools/test_shell/mac/DumpRenderTreePasteboard.h6
-rw-r--r--webkit/tools/test_shell/mac/DumpRenderTreePasteboard.m6
-rw-r--r--webkit/tools/test_shell/mac/test_shell_webview.mm14
-rwxr-xr-xwebkit/tools/test_shell/mac/test_webview_delegate.mm8
-rw-r--r--webkit/tools/test_shell/mac/webwidget_host.mm10
-rw-r--r--webkit/tools/test_shell/plugin_tests.cc4
-rw-r--r--webkit/tools/test_shell/resource.h4
-rw-r--r--webkit/tools/test_shell/run_all_tests.cc2
-rw-r--r--webkit/tools/test_shell/simple_resource_loader_bridge.cc2
-rw-r--r--webkit/tools/test_shell/test_navigation_controller.cc2
-rw-r--r--webkit/tools/test_shell/test_navigation_controller.h2
-rw-r--r--webkit/tools/test_shell/test_shell_gtk.cc2
-rw-r--r--webkit/tools/test_shell/test_shell_mac.mm74
-rw-r--r--webkit/tools/test_shell/test_shell_main.cc10
-rw-r--r--webkit/tools/test_shell/test_shell_platform_delegate.h2
-rw-r--r--webkit/tools/test_shell/test_shell_platform_delegate_gtk.cc2
-rw-r--r--webkit/tools/test_shell/test_shell_platform_delegate_mac.mm36
-rw-r--r--webkit/tools/test_shell/test_shell_test.cc4
-rw-r--r--webkit/tools/test_shell/test_shell_test.h4
-rw-r--r--webkit/tools/test_shell/test_shell_webkit_init.h2
-rw-r--r--webkit/tools/test_shell/test_shell_win.cc2
-rwxr-xr-xwebkit/tools/test_shell/test_webview_delegate_gtk.cc4
-rwxr-xr-xwebkit/tools/test_shell/test_webview_delegate_win.cc2
-rw-r--r--webkit/tools/test_shell/webwidget_host_win.cc2
-rw-r--r--webkit/tools/webcore_unit_tests/BMPImageDecoder_unittest.cpp6
-rw-r--r--webkit/tools/webcore_unit_tests/GKURL_unittest.cpp10
-rw-r--r--webkit/tools/webcore_unit_tests/ICOImageDecoder_unittest.cpp6
-rw-r--r--webkit/tools/webcore_unit_tests/TransparencyWin_unittest.cpp14
-rw-r--r--webkit/tools/webcore_unit_tests/UniscribeHelper_unittest.cpp2
-rw-r--r--webkit/tools/webcore_unit_tests/XBMImageDecoder_unittest.cpp6
566 files changed, 4084 insertions, 4084 deletions
diff --git a/base/object_watcher_unittest.cc b/base/object_watcher_unittest.cc
index f6b265e..7b3a3a6 100644
--- a/base/object_watcher_unittest.cc
+++ b/base/object_watcher_unittest.cc
@@ -90,12 +90,12 @@ void RunTest_CancelAfterSet(MessageLoop::Type message_loop_type) {
Sleep(30);
watcher.StopWatching();
-
+
MessageLoop::current()->RunAllPending();
// Our delegate should not have fired.
EXPECT_EQ(1, counter);
-
+
CloseHandle(event);
}
diff --git a/base/observer_list_threadsafe.h b/base/observer_list_threadsafe.h
index dfff061..ce30ce0 100644
--- a/base/observer_list_threadsafe.h
+++ b/base/observer_list_threadsafe.h
@@ -148,7 +148,7 @@ class ObserverListThreadSafe
// ObserverList. This function MUST be called on the thread which owns
// the unsafe ObserverList.
template <class Method, class Params>
- void NotifyWrapper(ObserverList<ObserverType>* list,
+ void NotifyWrapper(ObserverList<ObserverType>* list,
const UnboundMethod<ObserverType, Method, Params>& method) {
// Check that this list still needs notifications.
diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm
index f90070b..ff78c07 100644
--- a/base/process_util_mac.mm
+++ b/base/process_util_mac.mm
@@ -158,7 +158,7 @@ const ProcessEntry* NamedProcessIterator::NextProcessEntry() {
if (result) {
return &entry_;
}
-
+
return NULL;
}
@@ -167,14 +167,14 @@ bool NamedProcessIterator::CheckForNextProcess() {
std::string data;
std::string exec_name;
-
+
for (; index_of_kinfo_proc_ < kinfo_procs_.size(); ++index_of_kinfo_proc_) {
kinfo_proc* kinfo = &kinfo_procs_[index_of_kinfo_proc_];
// Skip processes just awaiting collection
if ((kinfo->kp_proc.p_pid > 0) && (kinfo->kp_proc.p_stat == SZOMB))
continue;
-
+
int mib[] = { CTL_KERN, KERN_PROCARGS, kinfo->kp_proc.p_pid };
// Found out what size buffer we need
@@ -183,13 +183,13 @@ bool NamedProcessIterator::CheckForNextProcess() {
LOG(ERROR) << "failed to figure out the buffer size for a commandline";
continue;
}
-
+
data.resize(data_len);
if (sysctl(mib, arraysize(mib), &data[0], &data_len, NULL, 0) < 0) {
LOG(ERROR) << "failed to fetch a commandline";
continue;
}
-
+
// Data starts w/ the full path null termed, so we have to extract just the
// executable name from the path.
@@ -203,7 +203,7 @@ bool NamedProcessIterator::CheckForNextProcess() {
exec_name = data.substr(0, exec_name_end);
else
exec_name = data.substr(last_slash + 1, exec_name_end - last_slash - 1);
-
+
// Check the name
if (executable_name_utf8 == exec_name) {
entry_.pid = kinfo->kp_proc.p_pid;
diff --git a/base/time_posix.cc b/base/time_posix.cc
index 894d1af..6885cad 100644
--- a/base/time_posix.cc
+++ b/base/time_posix.cc
@@ -129,27 +129,27 @@ TimeTicks TimeTicks::Now() {
static mach_timebase_info_data_t timebase_info;
if (timebase_info.denom == 0) {
// Zero-initialization of statics guarantees that denom will be 0 before
- // calling mach_timebase_info. mach_timebase_info will never set denom to
- // 0 as that would be invalid, so the zero-check can be used to determine
- // whether mach_timebase_info has already been called. This is
- // recommended by Apple's QA1398.
- kern_return_t kr = mach_timebase_info(&timebase_info);
- DCHECK(kr == KERN_SUCCESS);
- }
-
- // mach_absolute_time is it when it comes to ticks on the Mac. Other calls
- // with less precision (such as TickCount) just call through to
- // mach_absolute_time.
-
- // timebase_info converts absolute time tick units into nanoseconds. Convert
- // to microseconds up front to stave off overflows.
- absolute_micro = mach_absolute_time() / Time::kNanosecondsPerMicrosecond *
- timebase_info.numer / timebase_info.denom;
-
- // Don't bother with the rollover handling that the Windows version does.
- // With numer and denom = 1 (the expected case), the 64-bit absolute time
- // reported in nanoseconds is enough to last nearly 585 years.
-
+ // calling mach_timebase_info. mach_timebase_info will never set denom to
+ // 0 as that would be invalid, so the zero-check can be used to determine
+ // whether mach_timebase_info has already been called. This is
+ // recommended by Apple's QA1398.
+ kern_return_t kr = mach_timebase_info(&timebase_info);
+ DCHECK(kr == KERN_SUCCESS);
+ }
+
+ // mach_absolute_time is it when it comes to ticks on the Mac. Other calls
+ // with less precision (such as TickCount) just call through to
+ // mach_absolute_time.
+
+ // timebase_info converts absolute time tick units into nanoseconds. Convert
+ // to microseconds up front to stave off overflows.
+ absolute_micro = mach_absolute_time() / Time::kNanosecondsPerMicrosecond *
+ timebase_info.numer / timebase_info.denom;
+
+ // Don't bother with the rollover handling that the Windows version does.
+ // With numer and denom = 1 (the expected case), the 64-bit absolute time
+ // reported in nanoseconds is enough to last nearly 585 years.
+
#elif defined(OS_POSIX) && \
defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0
diff --git a/base/time_win_unittest.cc b/base/time_win_unittest.cc
index 9244f7a5..1e76a39 100644
--- a/base/time_win_unittest.cc
+++ b/base/time_win_unittest.cc
@@ -109,7 +109,7 @@ TEST(TimeTicks, WinRollover) {
TEST(TimeTicks, SubMillisecondTimers) {
// Loop for a bit getting timers quickly. We want to
- // see at least one case where we get a new sample in
+ // see at least one case where we get a new sample in
// less than one millisecond.
bool saw_submillisecond_timer = false;
int64 min_timer = 1000;
diff --git a/base/trace_event.cc b/base/trace_event.cc
index 400e878..ccac825b 100644
--- a/base/trace_event.cc
+++ b/base/trace_event.cc
@@ -139,7 +139,7 @@ void TraceLog::Trace(const std::string& name,
name.c_str(),
id,
extra.c_str(),
- file,
+ file,
line,
usec);
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc
index 6978e7b..768ace1 100644
--- a/chrome/app/chrome_dll_main.cc
+++ b/chrome/app/chrome_dll_main.cc
@@ -144,7 +144,7 @@ bool IncorrectChromeHtmlArguments(const std::wstring& command_line) {
// The browser is being launched with chromehtml: somewhere on the command
// line. We will not launch unless it's preceded by the -- switch terminator.
if (pos >= kOffset) {
- if (equal(kChromeHtml, kChromeHtml + arraysize(kChromeHtml) - 1,
+ if (equal(kChromeHtml, kChromeHtml + arraysize(kChromeHtml) - 1,
command_line_lower.begin() + pos - kOffset)) {
return false;
}
@@ -239,7 +239,7 @@ int ChromeMain(int argc, const char** argv) {
// The exit manager is in charge of calling the dtors of singleton objects.
base::AtExitManager exit_manager;
- // We need this pool for all the objects created before we get to the
+ // We need this pool for all the objects created before we get to the
// event loop, but we don't want to leave them hanging around until the
// app quits. Each "main" needs to flush this pool right before it goes into
// its main event loop to get rid of the cruft.
diff --git a/chrome/app/chrome_exe_main.mm b/chrome/app/chrome_exe_main.mm
index aea88ef..f6c78e0 100644
--- a/chrome/app/chrome_exe_main.mm
+++ b/chrome/app/chrome_exe_main.mm
@@ -23,9 +23,9 @@ int main(int argc, const char** argv) {
// The exit manager is in charge of calling the dtors of singletons.
// Win has one here, but we assert with multiples from BrowserMain() if we
- // keep it.
+ // keep it.
// base::AtExitManager exit_manager;
-
+
#if defined(GOOGLE_CHROME_BUILD)
// TODO(pinkerton): init crash reporter
#endif
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index d7b0a72..9bd9de2 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -40,12 +40,12 @@
// We can't use the standard terminate: method because it will abruptly exit
// the app and leave things on the stack in an unfinalized state. We need to
// post a quit message to our run loop so the stack can gracefully unwind.
-- (IBAction)quit:(id)sender {
+- (IBAction)quit:(id)sender {
// TODO(pinkerton):
// since we have to roll it ourselves, ask the delegate (ourselves, really)
// if we should terminate. For example, we might not want to if the user
// has ongoing downloads or multiple windows/tabs open. However, this would
- // require posting UI and may require spinning up another run loop to
+ // require posting UI and may require spinning up another run loop to
// handle it. If it says to continue, post the quit message, otherwise
// go back to normal.
@@ -57,7 +57,7 @@
// Close all the windows.
BrowserList::CloseAllBrowsers(true);
-
+
// Release the reference to the browser process. Once all the browsers get
// dealloc'd, it will stop the RunLoop and fall back into main().
g_browser_process->ReleaseModule();
@@ -89,7 +89,7 @@
- (void)commandDispatch:(id)sender {
// How to get the profile created on line 314 of browser_main? Ugh. TODO:FIXME
Profile* default_profile = *g_browser_process->profile_manager()->begin();
-
+
NSInteger tag = [sender tag];
switch (tag) {
case IDC_NEW_WINDOW:
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc
index b420d75..0065f36 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit.cc
@@ -148,7 +148,7 @@ bool AutocompleteEditModel::GetURLForText(const std::wstring& text,
UserTextFromDisplayText(text), std::wstring(), &parts, NULL);
if (type != AutocompleteInput::URL)
return false;
-
+
*url = GURL(URLFixerUpper::FixupURL(WideToUTF8(text), std::string()));
return true;
}
@@ -346,12 +346,12 @@ bool AutocompleteEditModel::OnEscapeKeyPressed() {
return true;
}
- // If the user wasn't editing, but merely had focus in the edit, allow <esc>
- // to be processed as an accelerator, so it can still be used to stop a load.
- // When the permanent text isn't all selected we still fall through to the
- // SelectAll() call below so users can arrow around in the text and then hit
+ // If the user wasn't editing, but merely had focus in the edit, allow <esc>
+ // to be processed as an accelerator, so it can still be used to stop a load.
+ // When the permanent text isn't all selected we still fall through to the
+ // SelectAll() call below so users can arrow around in the text and then hit
// <esc> to quickly replace all the text; this matches IE.
- if (!user_input_in_progress_ && view_->IsSelectAll())
+ if (!user_input_in_progress_ && view_->IsSelectAll())
return false;
view_->RevertAll();
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
index 307f502..6df7ff4 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
@@ -593,7 +593,7 @@ void AutocompleteEditViewWin::Update(
CHARRANGE sel;
GetSelection(sel);
const bool was_reversed = (sel.cpMin > sel.cpMax);
- const bool was_sel_all = (sel.cpMin != sel.cpMax) &&
+ const bool was_sel_all = (sel.cpMin != sel.cpMax) &&
IsSelectAllForRange(sel);
RevertAll();
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index 23d4407c..d462480 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -125,7 +125,7 @@ void SearchProvider::OnURLFetchComplete(const URLFetcher* source,
// TODO(jungshik): Switch to CodePageToUTF8 after it's added.
if (CodepageToWide(data, charset.c_str(),
OnStringUtilConversionError::FAIL, &wide_data))
- json_data = WideToUTF8(wide_data);
+ json_data = WideToUTF8(wide_data);
}
}
diff --git a/chrome/browser/bookmarks/bookmark_codec.cc b/chrome/browser/bookmarks/bookmark_codec.cc
index dd39fc8..8d61d37 100644
--- a/chrome/browser/bookmarks/bookmark_codec.cc
+++ b/chrome/browser/bookmarks/bookmark_codec.cc
@@ -184,7 +184,7 @@ bool BookmarkCodec::DecodeNode(BookmarkModel* model,
if (!DecodeChildren(model, *static_cast<ListValue*>(child_values), node))
return false;
}
-
+
node->SetTitle(title);
node->date_added_ = Time::FromInternalValue(
StringToInt64(WideToUTF16Hack(date_added_string)));
diff --git a/chrome/browser/bookmarks/bookmark_context_menu.cc b/chrome/browser/bookmarks/bookmark_context_menu.cc
index 2c58710..8c06b4e 100644
--- a/chrome/browser/bookmarks/bookmark_context_menu.cc
+++ b/chrome/browser/bookmarks/bookmark_context_menu.cc
@@ -271,7 +271,7 @@ BookmarkContextMenu::BookmarkContextMenu(
menu_->AppendMenuItemWithLabel(
IDS_BOOKMARK_BAR_REMOVE,
l10n_util::GetString(IDS_BOOKMARK_BAR_REMOVE));
-
+
if (configuration == BOOKMARK_MANAGER_TABLE ||
configuration == BOOKMARK_MANAGER_TABLE_OTHER ||
configuration == BOOKMARK_MANAGER_ORGANIZE_MENU ||
diff --git a/chrome/browser/bookmarks/bookmark_context_menu.h b/chrome/browser/bookmarks/bookmark_context_menu.h
index 1d08110..460f01d 100644
--- a/chrome/browser/bookmarks/bookmark_context_menu.h
+++ b/chrome/browser/bookmarks/bookmark_context_menu.h
@@ -22,7 +22,7 @@ class Browser;
class PageNavigator;
// BookmarkContextMenu manages the context menu shown for the
-// bookmark bar, items on the bookmark bar, submenus of the bookmark bar and
+// bookmark bar, items on the bookmark bar, submenus of the bookmark bar and
// the bookmark manager.
class BookmarkContextMenu : public views::MenuDelegate,
public BookmarkModelObserver {
diff --git a/chrome/browser/bookmarks/bookmark_drop_info.h b/chrome/browser/bookmarks/bookmark_drop_info.h
index b7dc643..d5ed4de3 100644
--- a/chrome/browser/bookmarks/bookmark_drop_info.h
+++ b/chrome/browser/bookmarks/bookmark_drop_info.h
@@ -78,7 +78,7 @@ class BookmarkDropInfo {
// Used when autoscrolling.
base::RepeatingTimer<BookmarkDropInfo> scroll_timer_;
-
+
DISALLOW_COPY_AND_ASSIGN(BookmarkDropInfo);
};
diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc
index 5ec7ca0..b3ed5af 100644
--- a/chrome/browser/bookmarks/bookmark_html_writer.cc
+++ b/chrome/browser/bookmarks/bookmark_html_writer.cc
@@ -322,7 +322,7 @@ void WriteBookmarks(MessageLoop* thread,
// for the duration of the write), as such we make a copy of the
// BookmarkModel using BookmarkCodec then write from that.
BookmarkCodec codec;
- scoped_ptr<Writer> writer(new Writer(codec.Encode(model),
+ scoped_ptr<Writer> writer(new Writer(codec.Encode(model),
FilePath::FromWStringHack(path)));
if (thread)
thread->PostTask(FROM_HERE, writer.release());
diff --git a/chrome/browser/bookmarks/bookmark_table_model.cc b/chrome/browser/bookmarks/bookmark_table_model.cc
index 7a50e29..a88bb81 100644
--- a/chrome/browser/bookmarks/bookmark_table_model.cc
+++ b/chrome/browser/bookmarks/bookmark_table_model.cc
@@ -274,7 +274,7 @@ BookmarkTableModel* BookmarkTableModel::CreateBookmarkTableModelForFolder(
BookmarkTableModel* BookmarkTableModel::CreateSearchTableModel(
BookmarkModel* model,
const std::wstring& text) {
- return new BookmarkSearchTableModel(model, text);
+ return new BookmarkSearchTableModel(model, text);
}
BookmarkTableModel::BookmarkTableModel(BookmarkModel* model)
diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc
index 45e7c6d..18a6bc0 100644
--- a/chrome/browser/bookmarks/bookmark_utils.cc
+++ b/chrome/browser/bookmarks/bookmark_utils.cc
@@ -254,7 +254,7 @@ void OpenAll(gfx::NativeWindow parent,
NewBrowserPageNavigator navigator_impl(profile);
if (!navigator) {
- Browser* browser =
+ Browser* browser =
BrowserList::FindBrowserWithType(profile, Browser::TYPE_NORMAL);
if (!browser || !browser->GetSelectedTabContents()) {
navigator = &navigator_impl;
diff --git a/chrome/browser/cocoa/base_view.mm b/chrome/browser/cocoa/base_view.mm
index 9d8e247..9ea74fb 100644
--- a/chrome/browser/cocoa/base_view.mm
+++ b/chrome/browser/cocoa/base_view.mm
@@ -24,7 +24,7 @@
- (void)dealloc {
[self removeTrackingArea:trackingArea_];
[trackingArea_ release];
-
+
[super dealloc];
}
diff --git a/chrome/browser/cocoa/browser_window_cocoa.mm b/chrome/browser/cocoa/browser_window_cocoa.mm
index 9d1ae21..0f611b3 100644
--- a/chrome/browser/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/cocoa/browser_window_cocoa.mm
@@ -7,7 +7,7 @@
#include "chrome/browser/cocoa/browser_window_cocoa.h"
#include "chrome/browser/cocoa/browser_window_controller.h"
-BrowserWindowCocoa::BrowserWindowCocoa(BrowserWindowController* controller,
+BrowserWindowCocoa::BrowserWindowCocoa(BrowserWindowController* controller,
NSWindow* window)
: controller_(controller), window_(window) {
}
@@ -27,7 +27,7 @@ void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) {
bounds.height());
// flip coordinates
NSScreen* screen = [window_ screen];
- cocoa_bounds.origin.y =
+ cocoa_bounds.origin.y =
[screen frame].size.height - bounds.height() - bounds.y();
}
@@ -44,7 +44,7 @@ void BrowserWindowCocoa::Activate() {
}
void BrowserWindowCocoa::FlashFrame() {
- [[NSApplication sharedApplication]
+ [[NSApplication sharedApplication]
requestUserAttention:NSInformationalRequest];
}
@@ -123,7 +123,7 @@ void BrowserWindowCocoa::UpdateStopGoState(bool is_loading) {
void BrowserWindowCocoa::UpdateToolbar(TabContents* contents,
bool should_restore_state) {
- [controller_ updateToolbarWithContents:contents
+ [controller_ updateToolbarWithContents:contents
shouldRestoreState:should_restore_state ? YES : NO];
}
@@ -189,7 +189,7 @@ void BrowserWindowCocoa::ShowHTMLDialog(HtmlDialogContentsDelegate* delegate,
void* parent_window) {
NOTIMPLEMENTED();
}
-
+
void BrowserWindowCocoa::DestroyBrowser() {
[controller_ destroyBrowser];
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 3365812..8779fed 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -38,11 +38,11 @@
- (void)windowDidLoad {
// Create a controller for the tab strip, giving it the model object for
// this window's Browser and the tab strip view. The controller will handle
- // registering for the appropriate tab notifications from the back-end and
+ // registering for the appropriate tab notifications from the back-end and
// managing the creation of new tabs.
- tabStripController_ =
+ tabStripController_ =
[[TabStripController alloc]
- initWithView:tabStripView_
+ initWithView:tabStripView_
tabModel:browser_->tabstrip_model()
toolbarModel:browser_->toolbar_model()
commands:browser_->command_updater()];
@@ -67,7 +67,7 @@
// from this method.
- (void)windowWillClose:(NSNotification *)notification {
DCHECK(!browser_->tabstrip_model()->count());
-
+
// We can't acutally use |-autorelease| here because there's an embedded
// run loop in the |-performClose:| which contains its own autorelease pool.
// Instead we use call it after a zero-length delay, which gets us back
@@ -150,7 +150,7 @@
// in the coordinate system of the content area of the currently selected tab.
// |windowGrowBox| needs to be in the window's coordinate system.
- (NSRect)selectedTabGrowBoxRect {
- return [tabStripController_
+ return [tabStripController_
selectedTabGrowBoxRect];
}
@@ -161,7 +161,7 @@
// Called to start/stop the loading animations.
- (void)updateLoadingAnimations:(BOOL)animate {
if (animate) {
- // TODO(pinkerton): determine what throbber animation is necessary and
+ // TODO(pinkerton): determine what throbber animation is necessary and
// start a timer to periodically update. Windows tells the tab strip to
// do this. It uses a single timer to coalesce the multiple things that
// could be updating. http://crbug.com/8281
diff --git a/chrome/browser/cocoa/grow_box_view.m b/chrome/browser/cocoa/grow_box_view.m
index 79f3ca0..d7ace41 100644
--- a/chrome/browser/cocoa/grow_box_view.m
+++ b/chrome/browser/cocoa/grow_box_view.m
@@ -17,7 +17,7 @@
// Draws the "grow_box" image in our bounds.
- (void)drawRect:(NSRect)dirtyRect {
- [image_ drawInRect:[self bounds] fromRect:NSZeroRect
+ [image_ drawInRect:[self bounds] fromRect:NSZeroRect
operation:NSCompositeSourceOver fraction:1.0];
}
diff --git a/chrome/browser/cocoa/sad_tab_view.mm b/chrome/browser/cocoa/sad_tab_view.mm
index eddb505..c74f297 100644
--- a/chrome/browser/cocoa/sad_tab_view.mm
+++ b/chrome/browser/cocoa/sad_tab_view.mm
@@ -20,17 +20,17 @@ static const int kTitleMessageSpacing = 15;
base::SysWideToNSString(l10n_util::GetString(IDS_SAD_TAB_TITLE));
NSString* message =
base::SysWideToNSString(l10n_util::GetString(IDS_SAD_TAB_MESSAGE));
-
+
NSColor* textColor = [NSColor whiteColor];
NSColor* backgroundColor = [NSColor colorWithCalibratedRed:(35.0f/255.0f)
green:(48.0f/255.0f)
blue:(64.0f/255.0f)
alpha:1.0];
-
+
// Layout
NSFont* titleFont = [NSFont boldSystemFontOfSize:[NSFont systemFontSize]];
NSFont* messageFont = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
-
+
NSDictionary* titleAttrs = [NSDictionary dictionaryWithObjectsAndKeys:
titleFont, NSFontAttributeName,
textColor, NSForegroundColorAttributeName,
@@ -39,23 +39,23 @@ static const int kTitleMessageSpacing = 15;
messageFont, NSFontAttributeName,
textColor, NSForegroundColorAttributeName,
nil];
-
+
NSAttributedString* titleString =
[[[NSAttributedString alloc] initWithString:title
attributes:titleAttrs] autorelease];
NSAttributedString* messageString =
[[[NSAttributedString alloc] initWithString:message
attributes:messageAttrs] autorelease];
-
+
NSRect viewBounds = [self bounds];
-
+
NSSize sadTabImageSize = [sadTabImage size];
CGFloat iconWidth = sadTabImageSize.width;
CGFloat iconHeight = sadTabImageSize.height;
CGFloat iconX = (viewBounds.size.width - iconWidth) / 2;
CGFloat iconY =
((viewBounds.size.height - iconHeight) / 2) - kSadTabOffset;
-
+
NSSize titleSize = [titleString size];
CGFloat titleX = (viewBounds.size.width - titleSize.width) / 2;
CGFloat titleY = iconY - kIconTitleSpacing - titleSize.height;
@@ -63,11 +63,11 @@ static const int kTitleMessageSpacing = 15;
NSSize messageSize = [messageString size];
CGFloat messageX = (viewBounds.size.width - messageSize.width) / 2;
CGFloat messageY = titleY - kTitleMessageSpacing - messageSize.height;
-
+
// Paint
[backgroundColor set];
NSRectFill(viewBounds);
-
+
[sadTabImage drawAtPoint:NSMakePoint(iconX, iconY)
fromRect:NSZeroRect
operation:NSCompositeSourceOver
diff --git a/chrome/browser/cocoa/tab_contents_controller.h b/chrome/browser/cocoa/tab_contents_controller.h
index 2bf021a..bc97e4f 100644
--- a/chrome/browser/cocoa/tab_contents_controller.h
+++ b/chrome/browser/cocoa/tab_contents_controller.h
@@ -46,7 +46,7 @@ class ToolbarModel;
// Create the contents of a tab represented by |contents| and loaded from the
// nib given by |name|. |commands| allows tracking of what's enabled and
// disabled. It may be nil if no updating is desired.
-- (id)initWithNibName:(NSString*)name
+- (id)initWithNibName:(NSString*)name
bundle:(NSBundle*)bundle
contents:(TabContents*)contents
commands:(CommandUpdater*)commands
diff --git a/chrome/browser/cocoa/tab_contents_controller.mm b/chrome/browser/cocoa/tab_contents_controller.mm
index 0700341..f20038e 100644
--- a/chrome/browser/cocoa/tab_contents_controller.mm
+++ b/chrome/browser/cocoa/tab_contents_controller.mm
@@ -58,7 +58,7 @@ class LocationBarBridge : public LocationBar {
virtual std::wstring GetInputString() const;
virtual WindowOpenDisposition GetWindowOpenDisposition() const
{ NOTIMPLEMENTED(); return CURRENT_TAB; }
- virtual PageTransition::Type GetPageTransition() const
+ virtual PageTransition::Type GetPageTransition() const
{ NOTIMPLEMENTED(); return 0; }
virtual void AcceptInput() { NOTIMPLEMENTED(); }
virtual void FocusLocation();
@@ -71,7 +71,7 @@ class LocationBarBridge : public LocationBar {
@implementation TabContentsController
-- (id)initWithNibName:(NSString*)name
+- (id)initWithNibName:(NSString*)name
bundle:(NSBundle*)bundle
contents:(TabContents*)contents
commands:(CommandUpdater*)commands
@@ -97,7 +97,7 @@ class LocationBarBridge : public LocationBar {
- (void)awakeFromNib {
[contentsBox_ setContentView:contents_->GetNativeView()];
-
+
// Provide a starting point since we won't get notifications if the state
// doesn't change between tabs.
[self updateToolbarCommandStatus];
@@ -185,7 +185,7 @@ class LocationBarBridge : public LocationBar {
- (void)updateToolbarWithContents:(TabContents*)tab {
// TODO(pinkerton): there's a lot of ui code in autocomplete_edit.cc
// that we'll want to duplicate. For now, just handle setting the text.
-
+
// TODO(pinkerton): update the security lock icon and background color
NSString* urlString = base::SysWideToNSString(toolbarModel_->GetText());
@@ -217,8 +217,8 @@ class LocationBarBridge : public LocationBar {
localGrowBox = [contentView convertRect:localGrowBox
fromView:[self view]];
// Flip the rect in view coordinates
- localGrowBox.origin.y =
- [contentView frame].size.height - localGrowBox.origin.y -
+ localGrowBox.origin.y =
+ [contentView frame].size.height - localGrowBox.origin.y -
localGrowBox.size.height;
}
return localGrowBox;
@@ -252,9 +252,9 @@ TabContentsCommandObserver::~TabContentsCommandObserver() {
commands_->RemoveCommandObserver(this);
}
-void TabContentsCommandObserver::EnabledStateChangedForCommand(int command,
+void TabContentsCommandObserver::EnabledStateChangedForCommand(int command,
bool enabled) {
- [controller_ enabledStateChangedForCommand:command
+ [controller_ enabledStateChangedForCommand:command
enabled:enabled ? YES : NO];
}
diff --git a/chrome/browser/cocoa/tab_strip_controller.h b/chrome/browser/cocoa/tab_strip_controller.h
index 8a41c08..bc1f8c0 100644
--- a/chrome/browser/cocoa/tab_strip_controller.h
+++ b/chrome/browser/cocoa/tab_strip_controller.h
@@ -44,7 +44,7 @@ class ToolbarModel;
// Initialize the controller with a view, model, and command updater for
// tracking what's enabled and disabled. |commands| may be nil if no updating
// is desired.
-- (id)initWithView:(TabStripView*)view
+- (id)initWithView:(TabStripView*)view
tabModel:(TabStripModel*)tabModel
toolbarModel:(ToolbarModel*)toolbarModel
commands:(CommandUpdater*)commands;
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm
index 9f5e544..26717d1 100644
--- a/chrome/browser/cocoa/tab_strip_controller.mm
+++ b/chrome/browser/cocoa/tab_strip_controller.mm
@@ -20,13 +20,13 @@ const short kTabOverlap = 16;
- (void)insertTabWithContents:(TabContents*)contents
atIndex:(NSInteger)index
inForeground:(bool)inForeground;
-- (void)selectTabWithContents:(TabContents*)newContents
+- (void)selectTabWithContents:(TabContents*)newContents
previousContents:(TabContents*)oldContents
atIndex:(NSInteger)index
userGesture:(bool)wasUserGesture;
- (void)tabDetachedWithContents:(TabContents*)contents
atIndex:(NSInteger)index;
-- (void)tabChangedWithContents:(TabContents*)contents
+- (void)tabChangedWithContents:(TabContents*)contents
atIndex:(NSInteger)index;
@end
@@ -60,7 +60,7 @@ class TabStripBridge : public TabStripModelObserver {
@implementation TabStripController
-- (id)initWithView:(TabStripView*)view
+- (id)initWithView:(TabStripView*)view
tabModel:(TabStripModel*)tabModel
toolbarModel:(ToolbarModel*)toolbarModel
commands:(CommandUpdater*)commands {
@@ -72,7 +72,7 @@ class TabStripBridge : public TabStripModelObserver {
commands_ = commands;
bridge_ = new TabStripBridge(tabModel, self);
tabControllerArray_ = [[NSMutableArray alloc] init];
-
+
// Create the new tab button separate from the nib so we can make sure
// it's always at the end of the subview list.
NSImage* image = [NSImage imageNamed:@"newtab"];
@@ -100,7 +100,7 @@ class TabStripBridge : public TabStripModelObserver {
// out the sole child of the contentArea to display its contents.
- (void)swapInTabAtIndex:(NSInteger)index {
TabContentsController* controller = [tabControllerArray_ objectAtIndex:index];
-
+
// Resize the new view to fit the window
NSView* contentView = [[tabView_ window] contentView];
NSView* newView = [controller view];
@@ -132,7 +132,7 @@ class TabStripBridge : public TabStripModelObserver {
[button setBezelStyle:NSRegularSquareBezelStyle];
[button setTarget:self];
[button setAction:@selector(selectTab:)];
-
+
return button;
}
@@ -162,13 +162,13 @@ class TabStripBridge : public TabStripModelObserver {
tabModel_->SelectTabContentsAt(index, true);
}
-// Return the frame for a new tab that will go to the immediate right of the
+// Return the frame for a new tab that will go to the immediate right of the
// tab at |index|. If |index| is 0, this will be the first tab, indented so
// as to not cover the window controls.
- (NSRect)frameForNewTabAtIndex:(NSInteger)index {
const short kIndentLeavingSpaceForControls = 66;
const short kNewTabWidth = 160;
-
+
short xOffset = kIndentLeavingSpaceForControls;
if (index > 0) {
NSRect previousTab = [[[tabView_ subviews] objectAtIndex:index - 1] frame];
@@ -196,43 +196,43 @@ class TabStripBridge : public TabStripModelObserver {
inForeground:(bool)inForeground {
DCHECK(contents);
DCHECK(index == TabStripModel::kNoTab || tabModel_->ContainsIndex(index));
-
+
// TODO(pinkerton): handle tab dragging in here
// Make a new tab. Load the contents of this tab from the nib and associate
// the new controller with |contents| so it can be looked up later.
TabContentsController* contentsController =
- [[[TabContentsController alloc] initWithNibName:@"TabContents"
+ [[[TabContentsController alloc] initWithNibName:@"TabContents"
bundle:nil
contents:contents
commands:commands_
toolbarModel:toolbarModel_]
autorelease];
[tabControllerArray_ insertObject:contentsController atIndex:index];
-
+
// Remove the new tab button so the only views present are the tabs,
// we'll add it back when we're done
[newTabButton_ removeFromSuperview];
-
+
// Make a new tab view and add it to the strip.
// TODO(pinkerton): move everyone else over and animate. Also will need to
// move the "add tab" button over.
NSRect newTabFrame = [self frameForNewTabAtIndex:index];
NSButton* newView = [self newTabWithFrame:newTabFrame];
[tabView_ addSubview:newView];
-
+
[self setTabTitle:newView withContents:contents];
-
+
// Add the new tab button back in to the right of the last tab.
const NSInteger kNewTabXOffset = 10;
- NSRect lastTab =
+ NSRect lastTab =
[[[tabView_ subviews] objectAtIndex:[[tabView_ subviews] count] - 1] frame];
NSInteger maxRightEdge = NSMaxX(lastTab);
NSRect newTabButtonFrame = [newTabButton_ frame];
newTabButtonFrame.origin.x = maxRightEdge + kNewTabXOffset;
[newTabButton_ setFrame:newTabButtonFrame];
[tabView_ addSubview:newTabButton_];
-
+
// Select the newly created tab if in the foreground
if (inForeground)
[self swapInTabAtIndex:index];
@@ -240,7 +240,7 @@ class TabStripBridge : public TabStripModelObserver {
// Called when a notification is received from the model to select a particular
// tab. Swaps in the toolbar and content area associated with |newContents|.
-- (void)selectTabWithContents:(TabContents*)newContents
+- (void)selectTabWithContents:(TabContents*)newContents
previousContents:(TabContents*)oldContents
atIndex:(NSInteger)index
userGesture:(bool)wasUserGesture {
@@ -250,7 +250,7 @@ class TabStripBridge : public TabStripModelObserver {
NSButton* current = [[tabView_ subviews] objectAtIndex:i];
[current setState:(i == index) ? NSOnState : NSOffState];
}
-
+
// Tell the new tab contents it is about to become the selected tab. Here it
// can do things like make sure the toolbar is up to date.
TabContentsController* newController =
@@ -262,7 +262,7 @@ class TabStripBridge : public TabStripModelObserver {
}
// Called when a notification is received from the model that the given tab
-// has gone away. Remove all knowledge about this tab and it's associated
+// has gone away. Remove all knowledge about this tab and it's associated
// controller and remove the view from the strip.
- (void)tabDetachedWithContents:(TabContents*)contents
atIndex:(NSInteger)index {
@@ -276,7 +276,7 @@ class TabStripBridge : public TabStripModelObserver {
NSView* tab = [[tabView_ subviews] objectAtIndex:index];
NSInteger tabWidth = [tab frame].size.width;
[tab removeFromSuperview];
-
+
// Move all the views to the right the width of the tab that was closed.
// TODO(pinkerton): Animate!
const int numSubviews = [[tabView_ subviews] count];
@@ -290,11 +290,11 @@ class TabStripBridge : public TabStripModelObserver {
// Called when a notification is received from the model that the given tab
// has been updated.
-- (void)tabChangedWithContents:(TabContents*)contents
+- (void)tabChangedWithContents:(TabContents*)contents
atIndex:(NSInteger)index {
NSButton* tab = [[tabView_ subviews] objectAtIndex:index];
[self setTabTitle:tab withContents:contents];
-
+
TabContentsController* updatedController =
[tabControllerArray_ objectAtIndex:index];
[updatedController tabDidChange:contents];
@@ -309,13 +309,13 @@ class TabStripBridge : public TabStripModelObserver {
- (void)updateToolbarWithContents:(TabContents*)tab
shouldRestoreState:(BOOL)shouldRestore {
// TODO(pinkerton): OS_WIN maintains this, but I'm not sure why. It's
- // available by querying the model, which we have available to us.
+ // available by querying the model, which we have available to us.
currentTab_ = tab;
-
+
// tell the appropriate controller to update its state. |shouldRestore| being
// YES means we're going back to this tab and should put back any state
// associated with it.
- TabContentsController* controller =
+ TabContentsController* controller =
[tabControllerArray_ objectAtIndex:tabModel_->GetIndexOfTabContents(tab)];
[controller updateToolbarWithContents:shouldRestore ? tab : nil];
}
@@ -364,7 +364,7 @@ class TabStripBridge : public TabStripModelObserver {
//--------------------------------------------------------------------------
-TabStripBridge::TabStripBridge(TabStripModel* model,
+TabStripBridge::TabStripBridge(TabStripModel* model,
TabStripController* controller)
: controller_(controller), model_(model) {
// Register to be a listener on the model so we can get updates and tell
@@ -380,8 +380,8 @@ TabStripBridge::~TabStripBridge() {
void TabStripBridge::TabInsertedAt(TabContents* contents,
int index,
bool foreground) {
- [controller_ insertTabWithContents:contents
- atIndex:index
+ [controller_ insertTabWithContents:contents
+ atIndex:index
inForeground:foreground];
}
@@ -393,7 +393,7 @@ void TabStripBridge::TabSelectedAt(TabContents* old_contents,
TabContents* new_contents,
int index,
bool user_gesture) {
- [controller_ selectTabWithContents:new_contents
+ [controller_ selectTabWithContents:new_contents
previousContents:old_contents
atIndex:index
userGesture:user_gesture];
diff --git a/chrome/browser/command_updater.h b/chrome/browser/command_updater.h
index cbc14fe..f0303fc 100644
--- a/chrome/browser/command_updater.h
+++ b/chrome/browser/command_updater.h
@@ -61,7 +61,7 @@ class CommandUpdater {
// Removes an observer to the state of a particular command.
void RemoveCommandObserver(int id, CommandObserver* observer);
-
+
// Removes |observer| for all commands on which it's registered.
void RemoveCommandObserver(CommandObserver* observer);
diff --git a/chrome/browser/command_updater_unittest.cc b/chrome/browser/command_updater_unittest.cc
index d090d3d..dc5e031 100644
--- a/chrome/browser/command_updater_unittest.cc
+++ b/chrome/browser/command_updater_unittest.cc
@@ -79,12 +79,12 @@ TEST_F(CommandUpdaterTest, TestObservers) {
TEST_F(CommandUpdaterTest, TestObserverRemovingAllCommands) {
TestingCommandHandlerMock handler;
CommandUpdater command_updater(&handler);
-
+
// Create two observers for the commands 1-3 as true, remove one using the
// single remove command, then set the command to false. Ensure that the
// removed observer still thinks all commands are true and the one left
// observing picked up the change.
-
+
TestingCommandObserverMock observer_remove, observer_keep;
command_updater.AddCommandObserver(1, &observer_remove);
command_updater.AddCommandObserver(2, &observer_remove);
diff --git a/chrome/browser/debugger/debugger_contents.cc b/chrome/browser/debugger/debugger_contents.cc
index 386b5d8..5927caa 100644
--- a/chrome/browser/debugger/debugger_contents.cc
+++ b/chrome/browser/debugger/debugger_contents.cc
@@ -137,7 +137,7 @@ void DebuggerContents::Init() {
// static
bool DebuggerContents::IsDebuggerUrl(const GURL& url) {
- return (url.SchemeIs(DOMUIContents::GetScheme().c_str()) &&
+ return (url.SchemeIs(DOMUIContents::GetScheme().c_str()) &&
url.host() == kDebuggerHost);
}
diff --git a/chrome/browser/debugger/debugger_host.h b/chrome/browser/debugger/debugger_host.h
index bfb2efa..c008c30 100644
--- a/chrome/browser/debugger/debugger_host.h
+++ b/chrome/browser/debugger/debugger_host.h
@@ -27,7 +27,7 @@ class DebuggerHost : public base::RefCountedThreadSafe<DebuggerHost> {
virtual void OnDebugAttach() = 0;
// The renderer we're attached to is gone.
virtual void OnDebugDisconnect() = 0;
-
+
virtual void DidDisconnect() = 0;
virtual void DidConnect() {}
virtual void ProcessCommand(const std::wstring& data) {}
diff --git a/chrome/browser/debugger/debugger_host_impl.cpp b/chrome/browser/debugger/debugger_host_impl.cpp
index beeb398..83795d8 100644
--- a/chrome/browser/debugger/debugger_host_impl.cpp
+++ b/chrome/browser/debugger/debugger_host_impl.cpp
@@ -66,7 +66,7 @@ class TabContentsReference : public NotificationObserver {
DebuggerHostImpl::DebuggerHostImpl(DebuggerInputOutput* io)
- : io_(io),
+ : io_(io),
debugger_ready_(true) {
}
@@ -75,8 +75,8 @@ DebuggerHostImpl::~DebuggerHostImpl() {
io_ = NULL;
}
-void DebuggerHostImpl::Start() {
- io_->Start(this);
+void DebuggerHostImpl::Start() {
+ io_->Start(this);
}
void DebuggerHostImpl::Debug(TabContents* tab) {
diff --git a/chrome/browser/debugger/debugger_io.h b/chrome/browser/debugger/debugger_io.h
index b2ea381..68b04e6 100644
--- a/chrome/browser/debugger/debugger_io.h
+++ b/chrome/browser/debugger/debugger_io.h
@@ -42,7 +42,7 @@ public:
virtual void SetDebuggerBreak(bool brk) {}
// sends message to debugger UI page in order to invoke JS function in it
- virtual void CallFunctionInPage(const std::wstring& name,
+ virtual void CallFunctionInPage(const std::wstring& name,
ListValue* argv) {}
protected:
diff --git a/chrome/browser/debugger/debugger_window.cc b/chrome/browser/debugger/debugger_window.cc
index 1f62d01..aae04e6 100644
--- a/chrome/browser/debugger/debugger_window.cc
+++ b/chrome/browser/debugger/debugger_window.cc
@@ -126,7 +126,7 @@ void DebuggerWindow::SetDebuggerBreak(bool brk) {
#endif
}
-void DebuggerWindow::CallFunctionInPage(const std::wstring& name,
+void DebuggerWindow::CallFunctionInPage(const std::wstring& name,
ListValue* argv) {
if (view_) {
DictionaryValue* body = new DictionaryValue;
diff --git a/chrome/browser/debugger/debugger_window.h b/chrome/browser/debugger/debugger_window.h
index 4b980f3..85f4ff8 100644
--- a/chrome/browser/debugger/debugger_window.h
+++ b/chrome/browser/debugger/debugger_window.h
@@ -37,7 +37,7 @@ class DebuggerWindow : public DebuggerInputOutput,
virtual void SetDebuggerBreak(bool brk);
// Note that this method will take ownership of argv.
- virtual void CallFunctionInPage(const std::wstring& name,
+ virtual void CallFunctionInPage(const std::wstring& name,
ListValue* argv);
// views::WindowDelegate methods:
diff --git a/chrome/browser/dock_info.cc b/chrome/browser/dock_info.cc
index e1c394c..ead6878 100644
--- a/chrome/browser/dock_info.cc
+++ b/chrome/browser/dock_info.cc
@@ -360,7 +360,7 @@ DockInfo DockInfo::GetDockInfoAtPoint(const gfx::Point& screen_point,
int mid_x = (m_bounds.left + m_bounds.right) / 2;
int mid_y = (m_bounds.top + m_bounds.bottom) / 2;
- bool result =
+ bool result =
info.CheckMonitorPoint(monitor, screen_point, mid_x, m_bounds.top,
DockInfo::MAXIMIZE) ||
info.CheckMonitorPoint(monitor, screen_point, mid_x, m_bounds.bottom,
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc
index 89cfe89..532c117 100644
--- a/chrome/browser/dom_ui/chrome_url_data_manager.cc
+++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc
@@ -105,7 +105,7 @@ void RegisterURLRequestChromeJob() {
#ifdef CHROME_PERSONALIZATION
url_util::AddStandardScheme(kPersonalizationScheme);
URLRequest::RegisterProtocolFactory(kPersonalizationScheme,
- &ChromeURLDataManager::Factory);
+ &ChromeURLDataManager::Factory);
#endif
}
diff --git a/chrome/browser/dom_ui/dom_ui.cc b/chrome/browser/dom_ui/dom_ui.cc
index 9b8b069..1f01e7d 100644
--- a/chrome/browser/dom_ui/dom_ui.cc
+++ b/chrome/browser/dom_ui/dom_ui.cc
@@ -27,7 +27,7 @@ DOMUI::~DOMUI() {
void DOMUI::ProcessDOMUIMessage(const std::string& message,
const std::string& content) {
// Look up the callback for this message.
- MessageCallbackMap::const_iterator callback =
+ MessageCallbackMap::const_iterator callback =
message_callbacks_.find(message);
if (callback == message_callbacks_.end())
return;
@@ -74,7 +74,7 @@ void DOMUI::CallJavascriptFunction(
ExecuteJavascript(javascript);
}
-void DOMUI::RegisterMessageCallback(const std::string &message,
+void DOMUI::RegisterMessageCallback(const std::string &message,
MessageCallback *callback) {
message_callbacks_.insert(std::make_pair(message, callback));
}
@@ -99,7 +99,7 @@ void DOMUI::AddMessageHandler(DOMMessageHandler* handler) {
void DOMUI::ExecuteJavascript(const std::wstring& javascript) {
DCHECK(contents_);
- contents_->render_view_host()->ExecuteJavascriptInWebFrame(std::wstring(),
+ contents_->render_view_host()->ExecuteJavascriptInWebFrame(std::wstring(),
javascript);
}
@@ -111,7 +111,7 @@ DOMMessageHandler::DOMMessageHandler(DOMUI *dom_ui) : dom_ui_(dom_ui) {
// DOMMessageHandler, protected: ----------------------------------------------
-void DOMMessageHandler::SetURLAndTitle(DictionaryValue* dictionary,
+void DOMMessageHandler::SetURLAndTitle(DictionaryValue* dictionary,
std::wstring title,
const GURL& gurl) {
std::wstring wstring_url = UTF8ToWide(gurl.spec());
diff --git a/chrome/browser/dom_ui/dom_ui.h b/chrome/browser/dom_ui/dom_ui.h
index 3164d64..35388bd 100644
--- a/chrome/browser/dom_ui/dom_ui.h
+++ b/chrome/browser/dom_ui/dom_ui.h
@@ -91,7 +91,7 @@ class DOMMessageHandler {
protected:
// Adds "url" and "title" keys on incoming dictionary, setting title
// as the url as a fallback on empty title.
- static void SetURLAndTitle(DictionaryValue* dictionary,
+ static void SetURLAndTitle(DictionaryValue* dictionary,
std::wstring title,
const GURL& gurl);
diff --git a/chrome/browser/dom_ui/dom_ui_contents.h b/chrome/browser/dom_ui/dom_ui_contents.h
index 241f97f..42bfe89 100644
--- a/chrome/browser/dom_ui/dom_ui_contents.h
+++ b/chrome/browser/dom_ui/dom_ui_contents.h
@@ -119,7 +119,7 @@ class DOMUIContents : public WebContents {
//
// TabContents overrides
- //
+ //
virtual void UpdateHistoryForNavigation(const GURL& url,
const ViewHostMsg_FrameNavigate_Params& params) { }
virtual bool NavigateToPendingEntry(bool reload);
diff --git a/chrome/browser/dom_ui/fileicon_source.cc b/chrome/browser/dom_ui/fileicon_source.cc
index c2f75c4..d1e507c 100644
--- a/chrome/browser/dom_ui/fileicon_source.cc
+++ b/chrome/browser/dom_ui/fileicon_source.cc
@@ -41,7 +41,7 @@ void FileIconSource::StartDataRequest(const std::string& path,
SendResponse(request_id, icon_data);
} else {
// Icon was not in cache, go fetch it slowly.
- IconManager::Handle h = im->LoadIcon(UTF8ToWide(escaped_path),
+ IconManager::Handle h = im->LoadIcon(UTF8ToWide(escaped_path),
IconLoader::NORMAL,
&cancelable_consumer_,
NewCallback(this, &FileIconSource::OnFileIconDataAvailable));
@@ -66,4 +66,4 @@ void FileIconSource::OnFileIconDataAvailable(IconManager::Handle handle,
// TODO(glen): send a dummy icon.
SendResponse(request_id, NULL);
}
-} \ No newline at end of file
+}
diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc
index 9bc5d61..6e09592 100644
--- a/chrome/browser/dom_ui/history_ui.cc
+++ b/chrome/browser/dom_ui/history_ui.cc
@@ -186,7 +186,7 @@ void BrowsingHistoryHandler::HandleDeleteDay(const Value* value) {
dom_ui_->CallJavascriptFunction(L"deleteFailed");
return;
}
-
+
// Anything in-flight is invalid.
cancelable_consumer_.CancelAllRequests();
@@ -254,7 +254,7 @@ void BrowsingHistoryHandler::QueryComplete(
base::TimeFormatShortDate(page.visit_time()));
page_value->SetString(L"snippet", page.snippet().text());
}
- page_value->SetBoolean(L"starred",
+ page_value->SetBoolean(L"starred",
dom_ui_->get_profile()->GetBookmarkModel()->IsBookmarked(page.url()));
results_value.Append(page_value);
}
diff --git a/chrome/browser/dom_ui/history_ui.h b/chrome/browser/dom_ui/history_ui.h
index cc643b1..0902322 100644
--- a/chrome/browser/dom_ui/history_ui.h
+++ b/chrome/browser/dom_ui/history_ui.h
@@ -60,8 +60,8 @@ class BrowsingHistoryHandler : public DOMMessageHandler,
history::QueryResults* results);
// Extract the arguments from the call to HandleSearchHistory.
- void ExtractSearchHistoryArguments(const Value* value,
- int* month,
+ void ExtractSearchHistoryArguments(const Value* value,
+ int* month,
std::wstring* query);
// Figure out the query options for a month-wide query.
@@ -72,7 +72,7 @@ class BrowsingHistoryHandler : public DOMMessageHandler,
// Browsing history remover
scoped_ptr<BrowsingDataRemover> remover_;
-
+
// Our consumer for the history service.
CancelableRequestConsumerTSimple<PageUsageData*> cancelable_consumer_;
diff --git a/chrome/browser/dom_ui/new_tab_ui.h b/chrome/browser/dom_ui/new_tab_ui.h
index 98b0abe..c5a3c27 100644
--- a/chrome/browser/dom_ui/new_tab_ui.h
+++ b/chrome/browser/dom_ui/new_tab_ui.h
@@ -228,8 +228,8 @@ class HistoryHandler : public DOMMessageHandler {
// Let the page contents record UMA actions. Only use when you can't do it from
// C++. For example, we currently use it to let the NTP log the postion of the
-// Most Visited or Bookmark the user clicked on, as we don't get that
-// information through RequestOpenURL. You will need to update the metrics
+// Most Visited or Bookmark the user clicked on, as we don't get that
+// information through RequestOpenURL. You will need to update the metrics
// dashboard with the action names you use, as our processor won't catch that
// information (treat it as RecordComputedMetrics)
class MetricsHandler : public DOMMessageHandler {
diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h
index 9a94e52..de1f3ab 100644
--- a/chrome/browser/download/download_manager.h
+++ b/chrome/browser/download/download_manager.h
@@ -378,7 +378,7 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>,
return FilePath::FromWStringHack(*download_path_);
}
- // Clears the last download path, used to initialize "save as" dialogs.
+ // Clears the last download path, used to initialize "save as" dialogs.
void ClearLastDownloadPath();
// Registers this file extension for automatic opening upon download
@@ -480,7 +480,7 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>,
// Renames a finished dangerous download from its temporary file name to its
// real file name.
// Invoked on the file thread.
- void ProceedWithFinishedDangerousDownload(int64 download_handle,
+ void ProceedWithFinishedDangerousDownload(int64 download_handle,
const FilePath& path,
const FilePath& original_name);
@@ -512,7 +512,7 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>,
// is the ID assigned by the ResourceDispatcherHost and the map does not own
// the DownloadItems. It is used on shutdown to delete completed downloads
// that have not been approved.
- //
+ //
// When a download is created through a user action, the corresponding
// DownloadItem* is placed in 'in_progress_' and remains there until it has
// received a valid handle from the history system. Once it has a valid
diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc
index d8ceb41..7a1dd02 100644
--- a/chrome/browser/download/save_package.cc
+++ b/chrome/browser/download/save_package.cc
@@ -1051,7 +1051,7 @@ bool SavePackage::GetSaveInfo(const FilePath& suggest_name,
if (param->save_type == SavePackage::SAVE_AS_COMPLETE_HTML) {
// Make new directory for saving complete file.
param->dir = param->dir.Append(
- param->saved_main_file_path.RemoveExtension().BaseName().value() +
+ param->saved_main_file_path.RemoveExtension().BaseName().value() +
FILE_PATH_LITERAL("_files"));
}
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 5611594..32492cc 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -371,7 +371,7 @@ DictionaryValue* ExtensionsServiceBackend::ReadManifest(
}
if (header.header_size > sizeof(ExtensionHeader))
fseek(file.get(), header.header_size - sizeof(ExtensionHeader), SEEK_CUR);
-
+
char buf[1 << 16];
std::string manifest_str;
size_t read_size = std::min(sizeof(buf), header.manifest_size);
@@ -495,7 +495,7 @@ bool ExtensionsServiceBackend::CheckCurrentVersion(
// has actually loaded successfully.
FilePath version_dir = dest_dir.AppendASCII(current_version_str);
if (file_util::PathExists(version_dir)) {
- ReportExtensionInstallError(dest_dir,
+ ReportExtensionInstallError(dest_dir,
"Existing version is already up to date.");
return false;
}
@@ -503,7 +503,7 @@ bool ExtensionsServiceBackend::CheckCurrentVersion(
return true;
}
-bool ExtensionsServiceBackend::InstallDirSafely(const FilePath& source_dir,
+bool ExtensionsServiceBackend::InstallDirSafely(const FilePath& source_dir,
const FilePath& dest_dir) {
if (file_util::PathExists(dest_dir)) {
@@ -564,13 +564,13 @@ bool ExtensionsServiceBackend::SetCurrentVersion(const FilePath& dest_dir,
// Restore the old CurrentVersion.
if (file_util::PathExists(current_version_old)) {
if (!file_util::Move(current_version_old, current_version)) {
- LOG(WARNING) << "couldn't restore " << current_version_old.value() <<
+ LOG(WARNING) << "couldn't restore " << current_version_old.value() <<
" to " << current_version.value();
// TODO(erikkay): This is an ugly state to be in. Try harder?
}
}
- ReportExtensionInstallError(dest_dir,
+ ReportExtensionInstallError(dest_dir,
"Couldn't create CurrentVersion file.");
return false;
}
@@ -616,7 +616,7 @@ bool ExtensionsServiceBackend::InstallOrUpdateExtension(
// If an expected id was provided, make sure it matches.
if (expected_id.length() && expected_id != extension.id()) {
- ReportExtensionInstallError(source_file,
+ ReportExtensionInstallError(source_file,
"ID in new extension manifest does not match expected ID.");
return false;
}
@@ -646,7 +646,7 @@ bool ExtensionsServiceBackend::InstallOrUpdateExtension(
ScopedTempDir scoped_temp;
scoped_temp.Set(temp_dir);
if (!scoped_temp.IsValid()) {
- ReportExtensionInstallError(source_file,
+ ReportExtensionInstallError(source_file,
"Couldn't create temporary directory.");
return false;
}
diff --git a/chrome/browser/extensions/extensions_service.h b/chrome/browser/extensions/extensions_service.h
index be3158c..56e0afa 100644
--- a/chrome/browser/extensions/extensions_service.h
+++ b/chrome/browser/extensions/extensions_service.h
@@ -137,7 +137,7 @@ class ExtensionsServiceBackend
scoped_refptr<ExtensionsServiceFrontendInterface> frontend);
// Check externally updated extensions for updates and install if necessary.
- // Errors are reported through ExtensionErrorReporter.
+ // Errors are reported through ExtensionErrorReporter.
// ReportExtensionInstalled is called on success.
void CheckForExternalUpdates(
scoped_refptr<ExtensionsServiceFrontendInterface> frontend);
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
index c37e1bb..c6ac773 100644
--- a/chrome/browser/extensions/user_script_master.cc
+++ b/chrome/browser/extensions/user_script_master.cc
@@ -155,7 +155,7 @@ base::SharedMemory* UserScriptMaster::ScriptReloader::GetNewScripts(
file = enumerator.Next()) {
all_scripts.push_back(UserScript());
UserScript& info = all_scripts.back();
- info.set_url(GURL(std::string(chrome::kUserScriptScheme) + ":/" +
+ info.set_url(GURL(std::string(chrome::kUserScriptScheme) + ":/" +
net::FilePathToFileURL(file.ToWStringHack()).ExtractFileName()));
info.set_path(file);
}
diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc
index e637a16..416afe2 100644
--- a/chrome/browser/external_tab_container.cc
+++ b/chrome/browser/external_tab_container.cc
@@ -283,7 +283,7 @@ void ExternalTabContainer::Observe(NotificationType type,
const NavigationController::LoadCommittedDetails* commit =
Details<NavigationController::LoadCommittedDetails>(details).ptr();
- if (commit->http_status_code >= kHttpClientErrorStart &&
+ if (commit->http_status_code >= kHttpClientErrorStart &&
commit->http_status_code <= kHttpServerErrorEnd) {
automation_->Send(new AutomationMsg_NavigationFailed(
0, commit->http_status_code, commit->entry->url()));
diff --git a/chrome/browser/first_run.cc b/chrome/browser/first_run.cc
index 34d94e1..66d6d74 100644
--- a/chrome/browser/first_run.cc
+++ b/chrome/browser/first_run.cc
@@ -83,7 +83,7 @@ bool GetBackupChromeFile(std::wstring* path) {
return true;
}
-std::wstring GetDefaultPrefFilePath(bool create_profile_dir,
+std::wstring GetDefaultPrefFilePath(bool create_profile_dir,
const std::wstring& user_data_dir) {
FilePath default_pref_dir = ProfileManager::GetDefaultProfileDir(
FilePath::FromWStringHack(user_data_dir));
@@ -218,7 +218,7 @@ bool FirstRun::ProcessMasterPreferences(
// result determines if we continue or not. We wait here until the user
// dismisses the dialog.
int retcode = 0;
- if (!LaunchSetupWithParam(installer_util::switches::kShowEula, &retcode) ||
+ if (!LaunchSetupWithParam(installer_util::switches::kShowEula, &retcode) ||
(retcode == installer_util::EULA_REJECTED)) {
LOG(WARNING) << "EULA rejected. Fast exit.";
::ExitProcess(1);
@@ -457,7 +457,7 @@ class FirstRunImportObserver : public ImportObserver {
import_result_ = ResultCodes::NORMAL_EXIT;
Finish();
}
-
+
void RunLoop() {
loop_running_ = true;
MessageLoop::current()->Run();
diff --git a/chrome/browser/gears_integration.cc b/chrome/browser/gears_integration.cc
index 4017899..f60148c 100644
--- a/chrome/browser/gears_integration.cc
+++ b/chrome/browser/gears_integration.cc
@@ -134,7 +134,7 @@ static GURL ConvertSkBitmapToDataURL(const SkBitmap& icon) {
class CreateShortcutCommand : public CPCommandInterface {
public:
CreateShortcutCommand(
- const std::string& name, const std::string& orig_name,
+ const std::string& name, const std::string& orig_name,
const std::string& url, const std::string& description,
const std::vector<webkit_glue::WebApplicationInfo::IconInfo> &icons,
const SkBitmap& fallback_icon,
diff --git a/chrome/browser/google_update.cc b/chrome/browser/google_update.cc
index 17f30b3..70ee2ab 100644
--- a/chrome/browser/google_update.cc
+++ b/chrome/browser/google_update.cc
@@ -35,7 +35,7 @@ bool CanUpdateCurrentChrome(const std::wstring& chrome_exe_path) {
user_exe_path.begin(), tolower);
std::transform(machine_exe_path.begin(), machine_exe_path.end(),
machine_exe_path.begin(), tolower);
- if (chrome_exe_path != user_exe_path &&
+ if (chrome_exe_path != user_exe_path &&
chrome_exe_path != machine_exe_path ) {
LOG(ERROR) << L"Google Update cannot update Chrome installed in a "
<< L"non-standard location: " << chrome_exe_path.c_str()
diff --git a/chrome/browser/history/query_parser.cc b/chrome/browser/history/query_parser.cc
index 3ebaad9..cb9cf40 100644
--- a/chrome/browser/history/query_parser.cc
+++ b/chrome/browser/history/query_parser.cc
@@ -291,7 +291,7 @@ void QueryParser::ExtractQueryWords(const std::wstring& query,
QueryNodeList root;
if (!ParseQueryImpl(query, &root))
return;
- root.AppendWords(words);
+ root.AppendWords(words);
}
bool QueryParser::DoesQueryMatch(const std::wstring& text,
diff --git a/chrome/browser/history/text_database_manager.cc b/chrome/browser/history/text_database_manager.cc
index d133d22..2feea81 100644
--- a/chrome/browser/history/text_database_manager.cc
+++ b/chrome/browser/history/text_database_manager.cc
@@ -230,7 +230,7 @@ void TextDatabaseManager::AddPageContents(const GURL& url,
// took more than kExpirationSec to load. Often, this will be the result of
// a very slow iframe or other resource on the page that makes us think its
// still loading.
- //
+ //
// As a fallback, set the most recent visit's contents using the input, and
// use the last set title in the URL table as the title to index.
URLRow url_row;
diff --git a/chrome/browser/history/url_database_unittest.cc b/chrome/browser/history/url_database_unittest.cc
index a33829a..1ee1351 100644
--- a/chrome/browser/history/url_database_unittest.cc
+++ b/chrome/browser/history/url_database_unittest.cc
@@ -28,7 +28,7 @@ bool IsURLRowEqual(const URLRow& a,
a.last_visit() - b.last_visit() <= TimeDelta::FromSeconds(1) &&
a.hidden() == b.hidden();
}
-
+
} // namespace
class URLDatabaseTest : public testing::Test,
diff --git a/chrome/browser/importer/firefox2_importer.cc b/chrome/browser/importer/firefox2_importer.cc
index 8dfddd2..d1dbe05 100644
--- a/chrome/browser/importer/firefox2_importer.cc
+++ b/chrome/browser/importer/firefox2_importer.cc
@@ -140,7 +140,7 @@ void Firefox2Importer::ImportBookmarksFile(
file_util::ReadFileToString(file_path, &content);
std::vector<std::string> lines;
SplitString(content, '\n', &lines);
-
+
std::vector<ProfileWriter::BookmarkEntry> toolbar_bookmarks;
std::wstring last_folder = first_folder_name;
bool last_folder_on_toolbar = false;
diff --git a/chrome/browser/importer/importer.h b/chrome/browser/importer/importer.h
index e9b83c5..f4f4f07 100644
--- a/chrome/browser/importer/importer.h
+++ b/chrome/browser/importer/importer.h
@@ -106,7 +106,7 @@ class ProfileWriter : public base::RefCounted<ProfileWriter> {
#endif
virtual void AddHistoryPage(const std::vector<history::URLRow>& page);
virtual void AddHomepage(const GURL& homepage);
- // Adds the bookmarks to the BookmarkModel.
+ // Adds the bookmarks to the BookmarkModel.
// |options| is a bitmask of BookmarkOptions and dictates how and
// which bookmarks are added. If the bitmask contains FIRST_RUN,
// then any entries with a value of true for in_toolbar are added to
@@ -385,7 +385,7 @@ class Importer : public base::RefCounted<Importer> {
// The importer should know the main thread so that ProfileWriter
// will be invoked in thread instead.
MessageLoop* main_loop_;
-
+
// The message loop in which the importer operates.
MessageLoop* delagate_loop_;
diff --git a/chrome/browser/navigation_controller_unittest.cc b/chrome/browser/navigation_controller_unittest.cc
index 0bdd613..3dd303d 100644
--- a/chrome/browser/navigation_controller_unittest.cc
+++ b/chrome/browser/navigation_controller_unittest.cc
@@ -396,7 +396,7 @@ TEST_F(NavigationControllerTest, LoadURL_NoPending) {
contents->CompleteNavigationAsRenderer(0, kExistingURL1);
EXPECT_TRUE(notifications.Check1AndReset(
NotificationType::NAV_ENTRY_COMMITTED));
-
+
// Do a new navigation without making a pending one.
const GURL kNewURL(scheme1() + ":see");
contents->CompleteNavigationAsRenderer(99, kNewURL);
@@ -708,7 +708,7 @@ TEST_F(NavigationControllerTest, Back_OtherBackPending) {
// Not synthesize a totally new back event to the first page. This will not
// match the pending one.
contents->CompleteNavigationAsRenderer(0, kUrl1);
-
+
// The navigation should not have affected the pending entry.
EXPECT_EQ(1, contents->controller()->GetPendingEntryIndex());
@@ -1172,7 +1172,7 @@ TEST_F(NavigationControllerTest, SwitchTypesCleanup) {
// Now that the tasks have been flushed, the first tab type should be gone.
ASSERT_TRUE(
contents->controller()->GetTabContents(type1()) == NULL);
- ASSERT_EQ(contents,
+ ASSERT_EQ(contents,
contents->controller()->GetTabContents(type2()));
}
@@ -1444,7 +1444,7 @@ TEST_F(NavigationControllerTest, TransientEntry) {
// We should have navigated, transient entry should be gone.
EXPECT_EQ(url2, contents->controller()->GetActiveEntry()->url());
EXPECT_EQ(contents->controller()->GetEntryCount(), 3);
-
+
// Add a transient again, then navigate with no pending entry this time.
transient_entry = new NavigationEntry(TAB_CONTENTS_WEB);
transient_entry->set_url(transient_url);
@@ -1477,7 +1477,7 @@ TEST_F(NavigationControllerTest, TransientEntry) {
EXPECT_EQ(url4, contents->controller()->GetActiveEntry()->url());
EXPECT_EQ(contents->controller()->GetEntryCount(), 5);
contents->CompleteNavigationAsRenderer(3, url3);
-
+
// Add a transient and go to an entry before the current one.
transient_entry = new NavigationEntry(TAB_CONTENTS_WEB);
transient_entry->set_url(transient_url);
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 351107a..a33716e 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -187,7 +187,7 @@ ChromeURLRequestContext::ChromeURLRequestContext(Profile* profile)
user_script_dir_path_ = profile->GetUserScriptMaster()->user_script_dir();
prefs_->AddPrefObserver(prefs::kAcceptLanguages, this);
- prefs_->AddPrefObserver(prefs::kCookieBehavior, this);
+ prefs_->AddPrefObserver(prefs::kCookieBehavior, this);
NotificationService::current()->AddObserver(
this, NotificationType::EXTENSIONS_LOADED,
diff --git a/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc b/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc
index a1b8d70..7dba1db 100644
--- a/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc
+++ b/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc
@@ -36,7 +36,7 @@ class MockProxyResolver : public net::ProxyResolver {
results->UseNamedProxy(query_url.host());
return net::OK;
}
-
+
void Block() {
is_blocked_ = true;
event_.Reset();
@@ -78,7 +78,7 @@ struct ResultFuture {
bool TimedWaitUntilDone(const base::TimeDelta& max_time) {
return completed_.TimedWait(max_time);
}
-
+
// These fields are only valid after returning from WaitUntilDone().
IPC::Message* reply_msg;
int error_code;
diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc
index e961904..ae6e672 100644
--- a/chrome/browser/password_manager/password_manager.cc
+++ b/chrome/browser/password_manager/password_manager.cc
@@ -32,7 +32,7 @@ class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate {
form_to_save_(form_to_save) {
}
- virtual ~SavePasswordInfoBarDelegate() { }
+ virtual ~SavePasswordInfoBarDelegate() { }
// Overridden from ConfirmInfoBarDelegate:
virtual void InfoBarClosed() {
@@ -72,7 +72,7 @@ class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate {
form_to_save_->PermanentlyBlacklist();
return true;
}
-
+
private:
// The PasswordFormManager managing the form we're asking the user about,
// and should update as per her decision.
@@ -172,7 +172,7 @@ void PasswordManager::DidStopLoading() {
if (provisional_save_manager_->IsNewLogin()) {
web_contents_->AddInfoBar(
new SavePasswordInfoBarDelegate(web_contents_,
- provisional_save_manager_.release()));
+ provisional_save_manager_.release()));
} else {
// If the save is not a new username entry, then we just want to save this
// data (since the user already has related data saved), so don't prompt.
diff --git a/chrome/browser/password_manager/password_manager.h b/chrome/browser/password_manager/password_manager.h
index 96171fe..2ded7d2 100644
--- a/chrome/browser/password_manager/password_manager.h
+++ b/chrome/browser/password_manager/password_manager.h
@@ -34,7 +34,7 @@ class PasswordManager : public views::LoginModel {
const PasswordFormMap& best_matches,
const PasswordForm* const preferred_match) const;
- // Notification that the user navigated away from the current page.
+ // Notification that the user navigated away from the current page.
// Unless this is a password form submission, for our purposes this
// means we're done with the current page, so we can clean-up.
void DidNavigate();
@@ -59,10 +59,10 @@ class PasswordManager : public views::LoginModel {
observer_ = observer;
}
- private:
+ private:
// Note about how a PasswordFormManager can transition from
// pending_login_managers_ to provisional_save_manager_ and the infobar.
- //
+ //
// 1. form "seen"
// | new
// | ___ Infobar
diff --git a/chrome/browser/printing/page_number_unittest.cc b/chrome/browser/printing/page_number_unittest.cc
index 2656b86..c25e1bc 100644
--- a/chrome/browser/printing/page_number_unittest.cc
+++ b/chrome/browser/printing/page_number_unittest.cc
@@ -16,7 +16,7 @@ TEST(PageNumberTest, Count) {
++page;
EXPECT_EQ(1, page.ToInt());
EXPECT_NE(printing::PageNumber::npos(), page);
-
+
printing::PageNumber page_copy(page);
EXPECT_EQ(1, page_copy.ToInt());
EXPECT_EQ(1, page.ToInt());
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 979c263..3edd32d 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -373,10 +373,10 @@ void ProfileImpl::InitExtensions() {
const CommandLine* command_line = CommandLine::ForCurrentProcess();
PrefService* prefs = GetPrefs();
bool user_scripts_enabled =
- command_line->HasSwitch(switches::kEnableUserScripts) ||
+ command_line->HasSwitch(switches::kEnableUserScripts) ||
prefs->GetBoolean(prefs::kEnableUserScripts);
bool extensions_enabled =
- command_line->HasSwitch(switches::kEnableExtensions) ||
+ command_line->HasSwitch(switches::kEnableExtensions) ||
prefs->GetBoolean(prefs::kEnableExtensions);
FilePath script_dir;
diff --git a/chrome/browser/profile.h b/chrome/browser/profile.h
index 8c93886..7e48419 100644
--- a/chrome/browser/profile.h
+++ b/chrome/browser/profile.h
@@ -217,7 +217,7 @@ class Profile {
virtual void ResetTabRestoreService() = 0;
- // This reinitializes the spellchecker according to the current dictionary
+ // This reinitializes the spellchecker according to the current dictionary
// language, and enable spell check option, in the prefs.
virtual void ReinitializeSpellChecker() = 0;
@@ -230,7 +230,7 @@ class Profile {
//
// NOTE: this is invoked internally on a normal shutdown, but is public so
// that it can be invoked when the user logs out/powers down (WM_ENDSESSION).
- virtual void MarkAsCleanShutdown() = 0;
+ virtual void MarkAsCleanShutdown() = 0;
virtual void InitExtensions() = 0;
@@ -305,7 +305,7 @@ class ProfileImpl : public Profile,
// NotificationObserver implementation.
virtual void Observe(NotificationType type,
const NotificationSource& source,
- const NotificationDetails& details);
+ const NotificationDetails& details);
private:
friend class Profile;
@@ -316,20 +316,20 @@ class ProfileImpl : public Profile,
FilePath GetPrefFilePath();
void StopCreateSessionServiceTimer();
-
+
void EnsureSessionServiceCreated() {
GetSessionService();
}
// Initializes the spellchecker. If the spellchecker already exsts, then
- // it is released, and initialized again. This model makes sure that
+ // it is released, and initialized again. This model makes sure that
// spellchecker language can be changed without restarting the browser.
// NOTE: This is being currently called in the UI thread, which is OK as long
// as the spellchecker object is USED in the IO thread.
// The |need_to_broadcast| parameter tells it whether to broadcast the new
// spellchecker to the resource message filters.
void InitializeSpellChecker(bool need_to_broadcast);
-
+
FilePath path_;
bool off_the_record_;
scoped_ptr<VisitedLinkMaster> visited_link_master_;
diff --git a/chrome/browser/profile_manager_unittest.cc b/chrome/browser/profile_manager_unittest.cc
index be505d0..ed47ef0 100644
--- a/chrome/browser/profile_manager_unittest.cc
+++ b/chrome/browser/profile_manager_unittest.cc
@@ -28,7 +28,7 @@ protected:
ASSERT_TRUE(file_util::Delete(test_dir_, true));
ASSERT_FALSE(file_util::PathExists(test_dir_));
}
-
+
MessageLoopForUI message_loop_;
// the path to temporary directory used to contain the test operations
diff --git a/chrome/browser/renderer_host/audio_renderer_host_unittest.cc b/chrome/browser/renderer_host/audio_renderer_host_unittest.cc
index 2942dac..8efa3e34 100644
--- a/chrome/browser/renderer_host/audio_renderer_host_unittest.cc
+++ b/chrome/browser/renderer_host/audio_renderer_host_unittest.cc
@@ -20,7 +20,7 @@ class AudioRendererHostTest : public testing::Test {
// This task post a task to message_loop_ to do internal destruction on
// message_loop_.
host_->Destroy();
- // We need to continue running message_loop_ to complete all destructions.
+ // We need to continue running message_loop_ to complete all destructions.
message_loop_->RunAllPending();
}
diff --git a/chrome/browser/renderer_host/buffered_resource_handler.cc b/chrome/browser/renderer_host/buffered_resource_handler.cc
index 6439a14..e1144c2 100644
--- a/chrome/browser/renderer_host/buffered_resource_handler.cc
+++ b/chrome/browser/renderer_host/buffered_resource_handler.cc
@@ -94,7 +94,7 @@ bool BufferedResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf,
bool ret = real_handler_->OnWillRead(request_id, buf, buf_size, min_size);
read_buffer_ = *buf;
read_buffer_size_ = *buf_size;
- DCHECK(read_buffer_size_ >= kMaxBytesToSniff * 2);
+ DCHECK(read_buffer_size_ >= kMaxBytesToSniff * 2);
bytes_read_ = 0;
return ret;
}
diff --git a/chrome/browser/renderer_host/render_view_host_unittest.cc b/chrome/browser/renderer_host/render_view_host_unittest.cc
index 564810c..237b228 100644
--- a/chrome/browser/renderer_host/render_view_host_unittest.cc
+++ b/chrome/browser/renderer_host/render_view_host_unittest.cc
@@ -1,17 +1,17 @@
-// 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/renderer_host/test_render_view_host.h"
-#include "chrome/browser/tab_contents/navigation_entry.h"
-
-class RenderViewHostTest : public RenderViewHostTestHarness {
-};
-
-// All about URLs reported by the renderer should get rewritten to about:blank.
-// See RenderViewHost::OnMsgNavigate for a discussion.
-TEST_F(RenderViewHostTest, FilterAbout) {
- rvh()->SendNavigate(1, GURL("about:cache"));
- ASSERT_TRUE(controller_->GetActiveEntry());
- EXPECT_EQ(GURL("about:blank"), controller_->GetActiveEntry()->url());
-}
+// 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/renderer_host/test_render_view_host.h"
+#include "chrome/browser/tab_contents/navigation_entry.h"
+
+class RenderViewHostTest : public RenderViewHostTestHarness {
+};
+
+// All about URLs reported by the renderer should get rewritten to about:blank.
+// See RenderViewHost::OnMsgNavigate for a discussion.
+TEST_F(RenderViewHostTest, FilterAbout) {
+ rvh()->SendNavigate(1, GURL("about:cache"));
+ ASSERT_TRUE(controller_->GetActiveEntry());
+ EXPECT_EQ(GURL("about:blank"), controller_->GetActiveEntry()->url());
+}
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.h b/chrome/browser/renderer_host/render_widget_host_view_mac.h
index 54819e1..54ff098 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.h
@@ -48,11 +48,11 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView {
// deleted it will delete this out from under the caller.
explicit RenderWidgetHostViewMac(RenderWidgetHost* widget);
virtual ~RenderWidgetHostViewMac();
-
+
RenderWidgetHost* render_widget_host() const { return render_widget_host_; }
-
+
base::TimeTicks& whiteout_start_time() { return whiteout_start_time_; }
-
+
gfx::NativeView native_view() const { return cocoa_view_; }
// Implementation of RenderWidgetHostView:
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
index e8d9c25..85e29cc 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
@@ -142,13 +142,13 @@ void RenderWidgetHostViewMac::UpdateCursorIfOverSelf() {
NSEvent* event = [[cocoa_view_ window] currentEvent];
if ([event window] != [cocoa_view_ window])
return;
-
+
NSPoint event_location = [event locationInWindow];
NSPoint local_point = [cocoa_view_ convertPoint:event_location fromView:nil];
-
+
if (!NSPointInRect(local_point, [cocoa_view_ bounds]))
return;
-
+
NSCursor* ns_cursor = current_cursor_.GetCursor();
[ns_cursor set];
}
@@ -181,7 +181,7 @@ void RenderWidgetHostViewMac::DidScrollRect(
[cocoa_view_ scrollRect:[cocoa_view_ RectToNSRect:rect]
by:NSMakeSize(dx, -dy)];
-
+
gfx::Rect new_rect = rect;
new_rect.Offset(dx, dy);
gfx::Rect dirty_rect = rect.Subtract(new_rect);
@@ -240,7 +240,7 @@ void RenderWidgetHostViewMac::ShutdownHost() {
- (void)dealloc {
delete renderWidgetHostView_;
-
+
[super dealloc];
}
@@ -289,7 +289,7 @@ void RenderWidgetHostViewMac::ShutdownHost() {
canvas->getTopPlatformDevice().DrawToContext(
context, damaged_rect_ns.origin.x, damaged_rect_ns.origin.y,
&damaged_rect_cg);
-
+
[self unlockFocus];
}
}
@@ -341,13 +341,13 @@ void RenderWidgetHostViewMac::ShutdownHost() {
- (BOOL)becomeFirstResponder {
renderWidgetHostView_->render_widget_host()->Focus();
-
+
return YES;
}
- (BOOL)resignFirstResponder {
renderWidgetHostView_->render_widget_host()->Blur();
-
+
return YES;
}
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.h b/chrome/browser/renderer_host/resource_dispatcher_host.h
index 452798e..a64463f 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.h
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.h
@@ -247,7 +247,7 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
int pending_requests() const {
return static_cast<int>(pending_requests_.size());
}
-
+
// Intended for unit-tests only. Returns the memory cost of all the
// outstanding requests (pending and blocked) for |render_process_host_id|.
int GetOutstandingRequestsMemoryCost(int render_process_host_id) const;
@@ -412,7 +412,7 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
// data structures supporting this request (URLRequest object,
// HttpNetworkTransaction, etc...).
// The value of |cost| is added to the running total, and the resulting
- // sum is returned.
+ // sum is returned.
int IncrementOutstandingRequestsMemoryCost(int cost,
int render_process_host_id);
@@ -508,7 +508,7 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
typedef std::map<ProcessRendererIDs, BlockedRequestsList*> BlockedRequestMap;
BlockedRequestMap blocked_requests_map_;
- // Maps the render_process_host_ids to the approximate number of bytes
+ // Maps the render_process_host_ids to the approximate number of bytes
// being used to service its resource requests. No entry implies 0 cost.
typedef std::map<int, int> OutstandingRequestsMemoryCostMap;
OutstandingRequestsMemoryCostMap outstanding_requests_memory_cost_map_;
diff --git a/chrome/browser/renderer_host/test_render_view_host.h b/chrome/browser/renderer_host/test_render_view_host.h
index a925c67..5f558b1 100644
--- a/chrome/browser/renderer_host/test_render_view_host.h
+++ b/chrome/browser/renderer_host/test_render_view_host.h
@@ -69,7 +69,7 @@ class TestRenderWidgetHostView : public RenderWidgetHostView {
virtual void PrepareToDestroy() {}
virtual void SetTooltipText(const std::wstring& tooltip_text) {}
virtual BackingStore* AllocBackingStore(const gfx::Size& size);
-
+
bool is_showing() const { return is_showing_; }
private:
diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc
index 84ba46f..b310d57 100644
--- a/chrome/browser/rlz/rlz.cc
+++ b/chrome/browser/rlz/rlz.cc
@@ -109,11 +109,11 @@ bool LoadRLZLibrary(int directory_key) {
bool SendFinancialPing(const wchar_t* brand, const wchar_t* lang,
const wchar_t* referral, bool exclude_id) {
- RLZTracker::AccessPoint points[] = {RLZTracker::CHROME_OMNIBOX,
+ RLZTracker::AccessPoint points[] = {RLZTracker::CHROME_OMNIBOX,
RLZTracker::CHROME_HOME_PAGE,
RLZTracker::NO_ACCESS_POINT};
if (!send_ping)
- return false;
+ return false;
return send_ping(RLZTracker::CHROME, points, L"chrome", brand, referral, lang,
exclude_id, NULL);
}
@@ -138,7 +138,7 @@ class OmniBoxUsageObserver : public NotificationObserver {
// attempt the ping.
if (!RLZTracker::RecordProductEvent(RLZTracker::CHROME,
RLZTracker::CHROME_OMNIBOX,
- RLZTracker::FIRST_SEARCH))
+ RLZTracker::FIRST_SEARCH))
omnibox_used_ = true;
delete this;
}
@@ -156,7 +156,7 @@ class OmniBoxUsageObserver : public NotificationObserver {
// Dtor is private so the object cannot be created on the stack.
~OmniBoxUsageObserver() {
NotificationService::current()->RemoveObserver(this,
- NotificationType::OMNIBOX_OPENED_URL,
+ NotificationType::OMNIBOX_OPENED_URL,
NotificationService::AllSources());
instance_ = NULL;
}
@@ -249,7 +249,7 @@ class DelayedInitTask : public Task {
if (OmniBoxUsageObserver::used()) {
RLZTracker::RecordProductEvent(RLZTracker::CHROME,
RLZTracker::CHROME_OMNIBOX,
- RLZTracker::FIRST_SEARCH);
+ RLZTracker::FIRST_SEARCH);
}
}
// Schedule the daily RLZ ping.
diff --git a/chrome/browser/safe_browsing/protocol_parser_unittest.cc b/chrome/browser/safe_browsing/protocol_parser_unittest.cc
index 289df72..bc37118 100644
--- a/chrome/browser/safe_browsing/protocol_parser_unittest.cc
+++ b/chrome/browser/safe_browsing/protocol_parser_unittest.cc
@@ -507,7 +507,7 @@ TEST(SafeBrowsingProtocolParsingTest, TestGetHashWithUnknownList) {
&full_hashes));
EXPECT_EQ(full_hashes.size(), static_cast<size_t>(1));
- EXPECT_EQ(memcmp("12345678901234567890123456789012",
+ EXPECT_EQ(memcmp("12345678901234567890123456789012",
&full_hashes[0].hash, sizeof(SBFullHash)), 0);
EXPECT_EQ(full_hashes[0].list_name, "goog-phish-shavar");
EXPECT_EQ(full_hashes[0].add_chunk_id, 1);
@@ -522,11 +522,11 @@ TEST(SafeBrowsingProtocolParsingTest, TestGetHashWithUnknownList) {
&full_hashes));
EXPECT_EQ(full_hashes.size(), static_cast<size_t>(2));
- EXPECT_EQ(memcmp("12345678901234567890123456789012",
+ EXPECT_EQ(memcmp("12345678901234567890123456789012",
&full_hashes[0].hash, sizeof(SBFullHash)), 0);
EXPECT_EQ(full_hashes[0].list_name, "goog-phish-shavar");
EXPECT_EQ(full_hashes[0].add_chunk_id, 1);
- EXPECT_EQ(memcmp("abcdefghijklmnopqrstuvwxyz123457",
+ EXPECT_EQ(memcmp("abcdefghijklmnopqrstuvwxyz123457",
&full_hashes[1].hash, sizeof(SBFullHash)), 0);
EXPECT_EQ(full_hashes[1].list_name, "goog-malware-shavar");
EXPECT_EQ(full_hashes[1].add_chunk_id, 7);
@@ -632,7 +632,7 @@ TEST(SafeBrowsingProtocolParsingTest, TestZeroSizeAddChunk) {
EXPECT_EQ(chunks[1].chunk_number, 2);
EXPECT_EQ(chunks[1].hosts.size(), static_cast<size_t>(0));
-
+
EXPECT_EQ(chunks[2].chunk_number, 3);
EXPECT_EQ(chunks[2].hosts.size(), static_cast<size_t>(1));
EXPECT_EQ(chunks[2].hosts[0].host, 0x65666163);
diff --git a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc
index e69ae04..a05933d 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc
@@ -870,7 +870,7 @@ bool SafeBrowsingDatabaseBloom::BuildAddPrefixList(SBPair* adds) {
}
bool SafeBrowsingDatabaseBloom::RemoveSubs(
- SBPair* adds, std::vector<bool>* adds_removed,
+ SBPair* adds, std::vector<bool>* adds_removed,
HashCache* add_cache, HashCache* sub_cache, int* subs) {
DCHECK(add_cache && sub_cache && subs);
diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
index 4acdf3a..03a372d 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
@@ -943,7 +943,7 @@ TEST(SafeBrowsingDatabase, HashCaching) {
database->UpdateFinished(true);
EXPECT_TRUE(database->ContainsUrl(GURL("http://www.fullevil.com/bad1.html"),
- &listname, &prefixes, &full_hashes,
+ &listname, &prefixes, &full_hashes,
Time::Now()));
EXPECT_EQ(full_hashes.size(), 1U);
EXPECT_EQ(0, memcmp(full_hashes[0].hash.full_hash,
@@ -954,7 +954,7 @@ TEST(SafeBrowsingDatabase, HashCaching) {
full_hashes.clear();
EXPECT_TRUE(database->ContainsUrl(GURL("http://www.fullevil.com/bad2.html"),
- &listname, &prefixes, &full_hashes,
+ &listname, &prefixes, &full_hashes,
Time::Now()));
EXPECT_EQ(full_hashes.size(), 1U);
EXPECT_EQ(0, memcmp(full_hashes[0].hash.full_hash,
@@ -986,13 +986,13 @@ TEST(SafeBrowsingDatabase, HashCaching) {
database->UpdateFinished(true);
EXPECT_FALSE(database->ContainsUrl(GURL("http://www.fullevil.com/bad1.html"),
- &listname, &prefixes, &full_hashes,
+ &listname, &prefixes, &full_hashes,
Time::Now()));
EXPECT_EQ(full_hashes.size(), 0U);
// There should be one remaining full add.
EXPECT_TRUE(database->ContainsUrl(GURL("http://www.fullevil.com/bad2.html"),
- &listname, &prefixes, &full_hashes,
+ &listname, &prefixes, &full_hashes,
Time::Now()));
EXPECT_EQ(full_hashes.size(), 1U);
EXPECT_EQ(0, memcmp(full_hashes[0].hash.full_hash,
@@ -1010,10 +1010,10 @@ TEST(SafeBrowsingDatabase, HashCaching) {
lists.clear();
EXPECT_FALSE(database->ContainsUrl(GURL("http://www.fullevil.com/bad1.html"),
- &listname, &prefixes, &full_hashes,
+ &listname, &prefixes, &full_hashes,
Time::Now()));
EXPECT_FALSE(database->ContainsUrl(GURL("http://www.fullevil.com/bad2.html"),
- &listname, &prefixes, &full_hashes,
+ &listname, &prefixes, &full_hashes,
Time::Now()));
TearDownTestDatabase(database);
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc
index 04fb702..967ebc6 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -224,7 +224,7 @@ bool SafeBrowsingService::CheckUrlNew(const GURL& url, Client* client) {
bool prefix_match = database_->ContainsUrl(url, &list, &prefix_hits,
&full_hits,
protocol_manager_->last_update());
-
+
UMA_HISTOGRAM_TIMES("SB2.FilterCheck", base::Time::Now() - check_start);
if (!prefix_match)
diff --git a/chrome/browser/safe_browsing/safe_browsing_util_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_util_unittest.cc
index 2486117..2c59a66 100644
--- a/chrome/browser/safe_browsing/safe_browsing_util_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_util_unittest.cc
@@ -266,7 +266,7 @@ TEST(SafeBrowsing, HostInfo2) {
// Checks that if we get a sub chunk with one prefix, then get the add chunk
// for that same prefix afterwards, the entry becomes empty.
-TEST(SafeBrowsing, HostInfo3) {
+TEST(SafeBrowsing, HostInfo3) {
SBHostInfo info;
// Add a sub prefix.
diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.cc b/chrome/browser/search_engines/template_url_prepopulate_data.cc
index d4fa96c..cee6160 100644
--- a/chrome/browser/search_engines/template_url_prepopulate_data.cc
+++ b/chrome/browser/search_engines/template_url_prepopulate_data.cc
@@ -32,7 +32,7 @@ struct PrepopulatedEngine {
// someone asks. Only entries which need keywords to auto-track a dynamically
// generated search URL should use this.
// If the empty string, the engine has no keyword.
- const wchar_t* const keyword;
+ const wchar_t* const keyword;
const char* const favicon_url; // If NULL, there is no favicon.
const wchar_t* const search_url;
const char* const encoding;
@@ -1978,7 +1978,7 @@ const PrepopulatedEngine yahoo_hk = {
"UTF-8",
// http://history.hk.search.yahoo.com/ac/ac_msearch.php?query={searchTerms}
// returns a JSON with key-value pairs. Setting parameters (ot, of, output)
- // to fxjson, json, or js doesn't help.
+ // to fxjson, json, or js doesn't help.
NULL,
2,
};
@@ -2694,12 +2694,12 @@ int CountryCharsToCountryIDWithUpdate(char c1, char c2) {
c1 = 'R';
c2 = 'S';
}
-
+
// SPECIAL CASE: Timor-Leste changed from 'TP' to 'TL' in 2002. Windows XP
// predates this; we therefore map this value.
if (c1 == 'T' && c2 == 'P')
c2 = 'L';
-
+
return CountryCharsToCountryID(c1, c2);
}
@@ -2711,7 +2711,7 @@ int GeoIDToCountryID(GEOID geo_id) {
const int kISOBufferSize = 3; // Two plus one for the terminator.
wchar_t isobuf[kISOBufferSize] = { 0 };
int retval = GetGeoInfo(geo_id, GEO_ISO2, isobuf, kISOBufferSize, 0);
-
+
if (retval == kISOBufferSize &&
!(isobuf[0] == L'X' && isobuf[1] == L'X'))
return CountryCharsToCountryIDWithUpdate(static_cast<char>(isobuf[0]),
@@ -2725,7 +2725,7 @@ int GeoIDToCountryID(GEOID geo_id) {
return CountryCharsToCountryID('J', 'E');
case 0x3B16: // Isle of Man
return CountryCharsToCountryID('I', 'M');
-
+
// 'UM' (U.S. Minor Outlying Islands)
case 0x7F: // Johnston Atoll
case 0x102: // Wake Island
@@ -2762,7 +2762,7 @@ int GeoIDToCountryID(GEOID geo_id) {
int GetCurrentCountryID() {
GEOID geo_id = GetUserGeoID(GEOCLASS_NATION);
-
+
return GeoIDToCountryID(geo_id);
}
diff --git a/chrome/browser/sessions/base_session_service.cc b/chrome/browser/sessions/base_session_service.cc
index 29bbf7b..8423478 100644
--- a/chrome/browser/sessions/base_session_service.cc
+++ b/chrome/browser/sessions/base_session_service.cc
@@ -153,7 +153,7 @@ SessionCommand* BaseSessionService::CreateUpdateTabNavigationCommand(
std::numeric_limits<SessionCommand::size_type>::max() - 1024;
int bytes_written = 0;
-
+
WriteStringToPickle(pickle, &bytes_written, max_state_size,
entry.display_url().spec());
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc
index 780f4f1..5edabd9 100644
--- a/chrome/browser/sessions/session_service.cc
+++ b/chrome/browser/sessions/session_service.cc
@@ -812,7 +812,7 @@ bool SessionService::CreateTabsAndWindows(
// Update the selected navigation index.
tab->current_navigation_index =
std::max(-1, tab->current_navigation_index - payload.index);
-
+
// And update the index of existing navigations.
for (std::vector<TabNavigation>::iterator i = tab->navigations.begin();
i != tab->navigations.end();) {
diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc
index 134a898..b49e3f6 100644
--- a/chrome/browser/sessions/tab_restore_service.cc
+++ b/chrome/browser/sessions/tab_restore_service.cc
@@ -34,7 +34,7 @@ const size_t TabRestoreService::kMaxEntries = 10;
// Identifier for commands written to file.
// The ordering in the file is as follows:
-// . When the user closes a tab a command of type
+// . When the user closes a tab a command of type
// kCommandSelectedNavigationInTab is written identifying the tab and
// the selected index. This is followed by any number of
// kCommandUpdateTabNavigation commands (1 per navigation entry).
diff --git a/chrome/browser/sessions/tab_restore_service_unittest.cc b/chrome/browser/sessions/tab_restore_service_unittest.cc
index bc5aefc..4537c8b 100644
--- a/chrome/browser/sessions/tab_restore_service_unittest.cc
+++ b/chrome/browser/sessions/tab_restore_service_unittest.cc
@@ -118,7 +118,7 @@ TEST_F(TabRestoreServiceTest, Basic) {
// There should be two entries now.
ASSERT_EQ(2, service_->entries().size());
- // Make sure the entry matches
+ // Make sure the entry matches
entry = service_->entries().front();
ASSERT_EQ(TabRestoreService::TAB, entry->type);
tab = static_cast<TabRestoreService::Tab*>(entry);
diff --git a/chrome/browser/tab_contents/infobar_delegate.h b/chrome/browser/tab_contents/infobar_delegate.h
index 271ec00..f4dc667 100644
--- a/chrome/browser/tab_contents/infobar_delegate.h
+++ b/chrome/browser/tab_contents/infobar_delegate.h
@@ -36,7 +36,7 @@ class LinkInfoBarDelegate;
// and the delegate is free to clean itself up or reset state, which may have
// fatal consequences for the InfoBar that was in the process of opening (or is
// now fully opened) -- it is referencing a delegate that may not even exist
-// anymore.
+// anymore.
// As such, it is generally much safer to dedicate a delegate instance to
// AddInfoBar!
class InfoBarDelegate {
@@ -149,7 +149,7 @@ class LinkInfoBarDelegate : public InfoBarDelegate {
// closed now or false if it should remain until the user explicitly closes
// it.
virtual bool LinkClicked(WindowOpenDisposition disposition) {
- return true;
+ return true;
}
// Overridden from InfoBarDelegate:
diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc
index e0ebd23..857068f 100644
--- a/chrome/browser/tab_contents/interstitial_page.cc
+++ b/chrome/browser/tab_contents/interstitial_page.cc
@@ -359,7 +359,7 @@ void InterstitialPage::DidNavigate(
// The RenderViewHost has loaded its contents, we can show it now.
render_view_host_->view()->Show();
- tab_->set_interstitial_page(this);
+ tab_->set_interstitial_page(this);
// Notify the tab we are not loading so the throbber is stopped. It also
// causes a NOTIFY_LOAD_STOP notification, that the AutomationProvider (used
@@ -409,7 +409,7 @@ void InterstitialPage::Disable() {
void InterstitialPage::TakeActionOnResourceDispatcher(
ResourceRequestAction action) {
- DCHECK(MessageLoop::current() == ui_loop_) <<
+ DCHECK(MessageLoop::current() == ui_loop_) <<
"TakeActionOnResourceDispatcher should be called on the main thread.";
if (action == CANCEL || action == RESUME) {
diff --git a/chrome/browser/tab_contents/interstitial_page.h b/chrome/browser/tab_contents/interstitial_page.h
index d05d0aa..b77d525 100644
--- a/chrome/browser/tab_contents/interstitial_page.h
+++ b/chrome/browser/tab_contents/interstitial_page.h
@@ -185,4 +185,4 @@ class InterstitialPage : public NotificationObserver,
};
#endif // #ifndef CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_
-
+
diff --git a/chrome/browser/tab_contents/render_view_context_menu_controller.cc b/chrome/browser/tab_contents/render_view_context_menu_controller.cc
index 4afcc86..88ca046 100644
--- a/chrome/browser/tab_contents/render_view_context_menu_controller.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu_controller.cc
@@ -220,7 +220,7 @@ bool RenderViewContextMenuController::IsItemChecked(int id) const {
// Check box for 'Check the Spelling of this field'.
if (id == IDC_CHECK_SPELLING_OF_THIS_FIELD)
return params_.spellcheck_enabled;
-
+
// Don't bother getting the display language vector if this isn't a spellcheck
// language.
if ((id < IDC_SPELLCHECK_LANGUAGES_FIRST) ||
@@ -272,7 +272,7 @@ void RenderViewContextMenuController::ExecuteCommand(int id) {
if (id >= IDC_SPELLCHECK_LANGUAGES_FIRST &&
id < IDC_SPELLCHECK_LANGUAGES_LAST) {
const size_t language_number = id - IDC_SPELLCHECK_LANGUAGES_FIRST;
- SpellChecker::Languages display_languages;
+ SpellChecker::Languages display_languages;
SpellChecker::GetSpellCheckLanguagesToDisplayInContextMenu(
source_web_contents_->profile(), &display_languages);
if (language_number < display_languages.size()) {
@@ -281,7 +281,7 @@ void RenderViewContextMenuController::ExecuteCommand(int id) {
source_web_contents_->profile()->GetPrefs(), NULL);
dictionary_language.SetValue(display_languages[language_number]);
}
-
+
return;
}
@@ -363,7 +363,7 @@ void RenderViewContextMenuController::ExecuteCommand(int id) {
source_web_contents_->profile(),
nav_entry,
source_web_contents_->GetContentNativeView(),
- PageInfoWindow::SECURITY);
+ PageInfoWindow::SECURITY);
break;
}
diff --git a/chrome/browser/tab_contents/render_view_host_manager.cc b/chrome/browser/tab_contents/render_view_host_manager.cc
index b1062bc..1b7b6a5 100644
--- a/chrome/browser/tab_contents/render_view_host_manager.cc
+++ b/chrome/browser/tab_contents/render_view_host_manager.cc
@@ -148,7 +148,7 @@ bool RenderViewHostManager::ShouldCloseTabOnUnresponsiveRenderer() {
// handler later finishes, this call will be ignored because the state in
// CrossSiteResourceHandler will already be cleaned up.)
current_host()->process()->CrossSiteClosePageACK(
- pending_render_view_host_->site_instance()->process_host_id(),
+ pending_render_view_host_->site_instance()->process_host_id(),
pending_request_id);
}
return false;
@@ -194,7 +194,7 @@ void RenderViewHostManager::OnCrossSiteResponse(int new_render_process_host_id,
// means it is not a download or unsafe page, and we are going to perform the
// navigation. Thus, we no longer need to remember that the RenderViewHost
// is part of a pending cross-site request.
- pending_render_view_host_->SetHasPendingCrossSiteRequest(false,
+ pending_render_view_host_->SetHasPendingCrossSiteRequest(false,
new_request_id);
}
diff --git a/chrome/browser/tab_contents/repost_form_warning.h b/chrome/browser/tab_contents/repost_form_warning.h
index 33588dc..9bbbbaa 100644
--- a/chrome/browser/tab_contents/repost_form_warning.h
+++ b/chrome/browser/tab_contents/repost_form_warning.h
@@ -1,17 +1,17 @@
-// 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_TAB_CONTENTS_REPOST_FORM_WARNING_H_
-#define CHROME_BROWSER_TAB_CONTENTS_REPOST_FORM_WARNING_H_
-
-class NavigationController;
-
-// Runs the form repost warning dialog. If the user accepts the action, then
-// it will call Reload on the navigation controller back with check_for_repost
-// set to false.
-//
-// This function is implemented by the platform-specific frontend.
-void RunRepostFormWarningDialog(NavigationController* nav_controller);
-
-#endif // CHROME_BROWSER_TAB_CONTENTS_REPOST_FORM_WARNING_H_
+// 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_TAB_CONTENTS_REPOST_FORM_WARNING_H_
+#define CHROME_BROWSER_TAB_CONTENTS_REPOST_FORM_WARNING_H_
+
+class NavigationController;
+
+// Runs the form repost warning dialog. If the user accepts the action, then
+// it will call Reload on the navigation controller back with check_for_repost
+// set to false.
+//
+// This function is implemented by the platform-specific frontend.
+void RunRepostFormWarningDialog(NavigationController* nav_controller);
+
+#endif // CHROME_BROWSER_TAB_CONTENTS_REPOST_FORM_WARNING_H_
diff --git a/chrome/browser/tab_contents/site_instance.h b/chrome/browser/tab_contents/site_instance.h
index 141f61c..6e25a2b 100644
--- a/chrome/browser/tab_contents/site_instance.h
+++ b/chrome/browser/tab_contents/site_instance.h
@@ -109,7 +109,7 @@ class SiteInstance : public base::RefCounted<SiteInstance> {
// this SiteInstance becomes ref counted, by storing it in a scoped_refptr.
//
// The render process host factory may be NULL. See SiteInstance constructor.
- //
+ //
// TODO(creis): This may be an argument to build a pass_refptr<T> class, as
// Darin suggests.
static SiteInstance* CreateSiteInstance(Profile* profile);
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 1df337c..56db088 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -159,7 +159,7 @@ const string16& TabContents::GetTitle() const {
NavigationEntry* entry = controller_->GetTransientEntry();
if (entry)
return entry->GetTitleForDisplay(controller_);
-
+
entry = controller_->GetLastCommittedEntry();
if (entry)
return entry->GetTitleForDisplay(controller_);
@@ -597,7 +597,7 @@ void TabContents::SetIsLoading(bool is_loading,
NotificationDetails det = details ?
Details<LoadNotificationDetails>(details) :
NotificationService::NoDetails();
- NotificationService::current()->Notify(type,
+ NotificationService::current()->Notify(type,
Source<NavigationController>(this->controller()),
det);
}
diff --git a/chrome/browser/tab_contents/test_web_contents.cc b/chrome/browser/tab_contents/test_web_contents.cc
index 866e28a..2977423 100644
--- a/chrome/browser/tab_contents/test_web_contents.cc
+++ b/chrome/browser/tab_contents/test_web_contents.cc
@@ -1,18 +1,18 @@
-// 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/tab_contents/test_web_contents.h"
-
-#include "chrome/browser/renderer_host/test_render_view_host.h"
-
-TestWebContents::TestWebContents(Profile* profile, SiteInstance* instance,
- RenderViewHostFactory* rvh_factory)
- : WebContents(profile, instance, rvh_factory, MSG_ROUTING_NONE, NULL),
- transition_cross_site(false) {
-}
-
-TestRenderViewHost* TestWebContents::pending_rvh() {
- return static_cast<TestRenderViewHost*>(
- render_manager_.pending_render_view_host_);
-}
+// 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/tab_contents/test_web_contents.h"
+
+#include "chrome/browser/renderer_host/test_render_view_host.h"
+
+TestWebContents::TestWebContents(Profile* profile, SiteInstance* instance,
+ RenderViewHostFactory* rvh_factory)
+ : WebContents(profile, instance, rvh_factory, MSG_ROUTING_NONE, NULL),
+ transition_cross_site(false) {
+}
+
+TestRenderViewHost* TestWebContents::pending_rvh() {
+ return static_cast<TestRenderViewHost*>(
+ render_manager_.pending_render_view_host_);
+}
diff --git a/chrome/browser/tab_contents/test_web_contents.h b/chrome/browser/tab_contents/test_web_contents.h
index ba7fa33..42ba35e 100644
--- a/chrome/browser/tab_contents/test_web_contents.h
+++ b/chrome/browser/tab_contents/test_web_contents.h
@@ -1,55 +1,55 @@
-// 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_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
-#define CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
-
-#include "chrome/browser/tab_contents/web_contents.h"
-
-class RenderViewHostFactory;
-class TestRenderViewHost;
-
-// Subclass WebContents to ensure it creates TestRenderViewHosts and does
-// not do anything involving views.
-class TestWebContents : public WebContents {
- public:
- // The render view host factory will be passed on to the
- TestWebContents(Profile* profile, SiteInstance* instance,
- RenderViewHostFactory* rvh_factory);
-
- TestRenderViewHost* pending_rvh();
-
- // State accessor.
- bool cross_navigation_pending() {
- return render_manager_.cross_navigation_pending_;
- }
-
- // Overrides WebContents::ShouldTransitionCrossSite so that we can test both
- // alternatives without using command-line switches.
- bool ShouldTransitionCrossSite() { return transition_cross_site; }
-
- // Promote DidNavigate to public.
- void TestDidNavigate(RenderViewHost* render_view_host,
- const ViewHostMsg_FrameNavigate_Params& params) {
- DidNavigate(render_view_host, params);
- }
-
- // Promote GetWebkitPrefs to public.
- WebPreferences TestGetWebkitPrefs() {
- return GetWebkitPrefs();
- }
-
- // Prevent interaction with views.
- bool CreateRenderViewForRenderManager(RenderViewHost* render_view_host) {
- // This will go to a TestRenderViewHost.
- render_view_host->CreateRenderView();
- return true;
- }
- void UpdateRenderViewSizeForRenderManager() {}
-
- // Set by individual tests.
- bool transition_cross_site;
-};
-
-#endif // CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
+// 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_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
+#define CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
+
+#include "chrome/browser/tab_contents/web_contents.h"
+
+class RenderViewHostFactory;
+class TestRenderViewHost;
+
+// Subclass WebContents to ensure it creates TestRenderViewHosts and does
+// not do anything involving views.
+class TestWebContents : public WebContents {
+ public:
+ // The render view host factory will be passed on to the
+ TestWebContents(Profile* profile, SiteInstance* instance,
+ RenderViewHostFactory* rvh_factory);
+
+ TestRenderViewHost* pending_rvh();
+
+ // State accessor.
+ bool cross_navigation_pending() {
+ return render_manager_.cross_navigation_pending_;
+ }
+
+ // Overrides WebContents::ShouldTransitionCrossSite so that we can test both
+ // alternatives without using command-line switches.
+ bool ShouldTransitionCrossSite() { return transition_cross_site; }
+
+ // Promote DidNavigate to public.
+ void TestDidNavigate(RenderViewHost* render_view_host,
+ const ViewHostMsg_FrameNavigate_Params& params) {
+ DidNavigate(render_view_host, params);
+ }
+
+ // Promote GetWebkitPrefs to public.
+ WebPreferences TestGetWebkitPrefs() {
+ return GetWebkitPrefs();
+ }
+
+ // Prevent interaction with views.
+ bool CreateRenderViewForRenderManager(RenderViewHost* render_view_host) {
+ // This will go to a TestRenderViewHost.
+ render_view_host->CreateRenderView();
+ return true;
+ }
+ void UpdateRenderViewSizeForRenderManager() {}
+
+ // Set by individual tests.
+ bool transition_cross_site;
+};
+
+#endif // CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc
index dd2820b..6ca0726 100644
--- a/chrome/browser/tab_contents/web_contents.cc
+++ b/chrome/browser/tab_contents/web_contents.cc
@@ -1468,7 +1468,7 @@ WebContents::GetLastCommittedNavigationEntryForRenderManager() {
return NULL;
return controller()->GetLastCommittedEntry();
}
-
+
bool WebContents::CreateRenderViewForRenderManager(
RenderViewHost* render_view_host) {
RenderWidgetHostView* rwh_view = view_->CreateViewForWidget(render_view_host);
diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc
index a25c589..134b43a 100644
--- a/chrome/browser/tab_contents/web_contents_unittest.cc
+++ b/chrome/browser/tab_contents/web_contents_unittest.cc
@@ -149,7 +149,7 @@ class TestInterstitialPage : public InterstitialPage {
SiteInstance::CreateSiteInstance(tab()->profile()),
this, MSG_ROUTING_NONE, NULL);
}
-
+
virtual void CommandReceived(const std::string& command) {
command_received_count_++;
}
@@ -973,10 +973,10 @@ TEST_F(WebContentsTest, ShowInterstitialOnInterstitial) {
// Showing interstitial2 should have caused interstitial1 to go away.
EXPECT_TRUE(deleted1);
EXPECT_EQ(TestInterstitialPage::CANCELED, state1);
-
+
// Let's make sure interstitial2 is working as intended.
ASSERT_FALSE(deleted2);
- EXPECT_EQ(TestInterstitialPage::UNDECIDED, state2);
+ EXPECT_EQ(TestInterstitialPage::UNDECIDED, state2);
interstitial2->Proceed();
GURL landing_url("http://www.thepage.com");
rvh()->SendNavigate(2, landing_url);
diff --git a/chrome/browser/tab_contents/web_contents_view_mac.mm b/chrome/browser/tab_contents/web_contents_view_mac.mm
index a382bca..acdf717 100644
--- a/chrome/browser/tab_contents/web_contents_view_mac.mm
+++ b/chrome/browser/tab_contents/web_contents_view_mac.mm
@@ -47,14 +47,14 @@ RenderWidgetHostView* WebContentsViewMac::CreateViewForWidget(
DCHECK(!render_widget_host->view());
RenderWidgetHostViewMac* view =
new RenderWidgetHostViewMac(render_widget_host);
-
+
// Fancy layout comes later; for now just make it our size and resize it
// with us.
NSView* view_view = view->native_view();
[cocoa_view_.get() addSubview:view_view];
[view_view setFrame:[cocoa_view_.get() bounds]];
[view_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
-
+
return view;
}
@@ -107,7 +107,7 @@ void WebContentsViewMac::ForwardMessageToDevToolsClient(
const IPC::Message& message) {
NOTIMPLEMENTED();
}
-
+
void WebContentsViewMac::FindInPage(const Browser& browser,
bool find_next, bool forward_direction) {
if (!find_bar_.get()) {
@@ -228,7 +228,7 @@ void WebContentsViewMac::Observe(NotificationType type,
CFRetain(view);
[view release];
sad_tab_.reset(view);
-
+
// Set as the dominant child.
[cocoa_view_.get() addSubview:view];
[view setFrame:[cocoa_view_.get() bounds]];
diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc
index ae17dbe..870b461 100644
--- a/chrome/browser/task_manager.cc
+++ b/chrome/browser/task_manager.cc
@@ -154,7 +154,7 @@ std::wstring TaskManagerTableModel::GetText(int row, int col_id) {
if (!first_in_group)
return std::wstring();
return IntToWString(base::GetProcId(resource->GetProcess()));
-
+
case kGoatsTeleportedColumn: // Goats Teleported.
goats_teleported_ += rand();
return FormatNumber(goats_teleported_);
@@ -264,7 +264,7 @@ HANDLE TaskManagerTableModel::GetProcessAt(int index) {
void TaskManagerTableModel::StartUpdating() {
DCHECK_NE(TASK_PENDING, update_state_);
-
+
// If update_state_ is STOPPING, it means a task is still pending. Setting
// it to TASK_PENDING ensures the tasks keep being posted (by Refresh()).
if (update_state_ == IDLE) {
@@ -546,7 +546,7 @@ int TaskManagerTableModel::CompareValues(int row1, int row2, int column_id) {
int proc2_id = base::GetProcId(resources_[row2]->GetProcess());
return ValueCompare<int>(proc1_id, proc2_id);
}
-
+
case kGoatsTeleportedColumn:
return 0; // Don't bother, numbers are random.
@@ -846,7 +846,7 @@ void TaskManagerContents::Layout() {
y() + kPanelVertMargin,
width() - 2 * kPanelHorizMargin,
height() - 2 * kPanelVertMargin - prefered_height);
-
+
// y-coordinate of button top left.
gfx::Rect parent_bounds = GetParent()->GetLocalBounds(false);
int y_buttons = parent_bounds.bottom() - prefered_height - kButtonVEdgeMargin;
diff --git a/chrome/browser/toolbar_model.cc b/chrome/browser/toolbar_model.cc
index 08dc00b..803fa69 100644
--- a/chrome/browser/toolbar_model.cc
+++ b/chrome/browser/toolbar_model.cc
@@ -127,7 +127,7 @@ void ToolbarModel::GetIconHoverText(std::wstring* text, SkColor* text_color) {
NavigationEntry* entry = navigation_controller->GetActiveEntry();
DCHECK(entry);
-
+
const NavigationEntry::SSLStatus& ssl = entry->ssl();
switch (ssl.security_style()) {
case SECURITY_STYLE_AUTHENTICATED: {
diff --git a/chrome/browser/unload_uitest.cc b/chrome/browser/unload_uitest.cc
index 3089e82..74990d3 100644
--- a/chrome/browser/unload_uitest.cc
+++ b/chrome/browser/unload_uitest.cc
@@ -127,7 +127,7 @@ class UnloadTest : public UITest {
CheckTitle(L"Title Of Awesomeness");
}
-
+
void LoadUrlAndQuitBrowser(const std::string& html_content,
const std::wstring& expected_title = L"") {
scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
@@ -164,7 +164,7 @@ TEST_F(UnloadTest, CrossSiteInfiniteUnloadAsync) {
// Navigate to a page with an infinite unload handler.
// Then two two sync crosssite requests to ensure
-// we correctly nav to each one.
+// we correctly nav to each one.
TEST_F(UnloadTest, CrossSiteInfiniteUnloadSync) {
// Tests makes no sense in single-process mode since the renderer is hung.
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess))
@@ -192,7 +192,7 @@ TEST_F(UnloadTest, CrossSiteInfiniteBeforeUnloadAsync) {
// Navigate to a page with an infinite beforeunload handler.
// Then two two sync crosssite requests to ensure
-// we correctly nav to each one.
+// we correctly nav to each one.
TEST_F(UnloadTest, CrossSiteInfiniteBeforeUnloadSync) {
// Tests makes no sense in single-process mode since the renderer is hung.
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess))
@@ -288,4 +288,4 @@ TEST_F(UnloadTest, BrowserCloseTwoSecondBeforeUnloadAlert) {
}
// TODO(ojan): Add tests for unload/beforeunload that have multiple tabs
-// and multiple windows. \ No newline at end of file
+// and multiple windows.
diff --git a/chrome/browser/views/about_ipc_dialog.cc b/chrome/browser/views/about_ipc_dialog.cc
index 6c60840..4abc588 100644
--- a/chrome/browser/views/about_ipc_dialog.cc
+++ b/chrome/browser/views/about_ipc_dialog.cc
@@ -436,4 +436,4 @@ void AboutIPCDialog::ButtonPressed(views::BaseButton* button) {
}
}
-#endif // IPC_MESSAGE_LOG_ENABLED \ No newline at end of file
+#endif // IPC_MESSAGE_LOG_ENABLED
diff --git a/chrome/browser/views/bookmark_bar_view_test.cc b/chrome/browser/views/bookmark_bar_view_test.cc
index c62b175..2a4740f 100644
--- a/chrome/browser/views/bookmark_bar_view_test.cc
+++ b/chrome/browser/views/bookmark_bar_view_test.cc
@@ -36,7 +36,7 @@ class TestingPageNavigator : public PageNavigator {
// Base class for event generating bookmark view tests. These test are intended
// to exercise ChromeMenus, but that's easier done with BookmarkBarView rather
// than ChromeMenu itself.
-//
+//
// SetUp creates a bookmark model with the following structure.
// All folders are in upper case, all URLs in lower case.
// F1
@@ -939,7 +939,7 @@ class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase {
ASSERT_TRUE(child_menu != NULL);
ui_controls::MoveMouseToCenterAndPress(child_menu, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP, NULL);
-
+
// Delay until we send tab, otherwise the message box doesn't appear
// correctly.
MessageLoop::current()->PostDelayedTask(FROM_HERE,
diff --git a/chrome/browser/views/bookmark_bubble_view.cc b/chrome/browser/views/bookmark_bubble_view.cc
index c0fe27a..dc4bf29 100644
--- a/chrome/browser/views/bookmark_bubble_view.cc
+++ b/chrome/browser/views/bookmark_bubble_view.cc
@@ -233,7 +233,7 @@ void BookmarkBubbleView::Init() {
cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0, GridLayout::USE_PREF,
0, 0);
cs->AddPaddingColumn(1, kUnrelatedControlHorizontalSpacing);
- cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0, GridLayout::USE_PREF,
+ cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0, GridLayout::USE_PREF,
0, 0);
// Middle (input field) rows.
@@ -291,7 +291,7 @@ std::wstring BookmarkBubbleView::GetTitle() {
return std::wstring();
}
-void BookmarkBubbleView::ButtonPressed(views::NativeButton* sender) {
+void BookmarkBubbleView::ButtonPressed(views::NativeButton* sender) {
if (sender == edit_button_) {
UserMetrics::RecordAction(L"BookmarkBubble_Edit", profile_);
ShowEditor();
@@ -299,7 +299,7 @@ void BookmarkBubbleView::ButtonPressed(views::NativeButton* sender) {
DCHECK(sender == close_button_);
Close();
}
- // WARNING: we've most likely been deleted when CloseWindow returns.
+ // WARNING: we've most likely been deleted when CloseWindow returns.
}
void BookmarkBubbleView::LinkActivated(Link* source, int event_flags) {
diff --git a/chrome/browser/views/bookmark_bubble_view.h b/chrome/browser/views/bookmark_bubble_view.h
index 2f0f7c1..31c8c8c 100644
--- a/chrome/browser/views/bookmark_bubble_view.h
+++ b/chrome/browser/views/bookmark_bubble_view.h
@@ -101,7 +101,7 @@ class BookmarkBubbleView : public views::View,
// editor (depending upon which link was clicked).
virtual void LinkActivated(views::Link* source, int event_flags);
- // ButtonListener method, closes the bubble or opens the edit dialog.
+ // ButtonListener method, closes the bubble or opens the edit dialog.
virtual void ButtonPressed(views::NativeButton* sender);
// ComboBox::Listener method. Changes the parent of the bookmark.
diff --git a/chrome/browser/views/bookmark_table_view.cc b/chrome/browser/views/bookmark_table_view.cc
index 6e5bada..bbd0731 100644
--- a/chrome/browser/views/bookmark_table_view.cc
+++ b/chrome/browser/views/bookmark_table_view.cc
@@ -433,7 +433,7 @@ void BookmarkTableView::PaintAltText() {
1, bounds.width() - 2, bounds.height() - 2,
ChromeCanvas::TEXT_ALIGN_LEFT);
canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL);
- ReleaseDC(GetNativeControlHWND(), dc);
+ ReleaseDC(GetNativeControlHWND(), dc);
}
gfx::Rect BookmarkTableView::GetAltTextBounds() {
diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc
index 350e5f6..8b08a3f 100644
--- a/chrome/browser/views/download_item_view.cc
+++ b/chrome/browser/views/download_item_view.cc
@@ -207,7 +207,7 @@ DownloadItemView::DownloadItemView(DownloadItem* download,
// Extract the file extension (if any).
std::wstring extension = file_util::GetFileExtensionFromPath(file_name);
- std::wstring rootname =
+ std::wstring rootname =
file_util::GetFilenameWithoutExtensionFromPath(file_name);
// Elide giant extensions (this shouldn't currently be hit, but might
@@ -217,7 +217,7 @@ DownloadItemView::DownloadItemView(DownloadItem* download,
ElideString(rootname, kFileNameMaxLength - extension.length(), &rootname);
dangerous_download_label_ = new views::Label(
- l10n_util::GetStringF(IDS_PROMPT_DANGEROUS_DOWNLOAD,
+ l10n_util::GetStringF(IDS_PROMPT_DANGEROUS_DOWNLOAD,
rootname + L"." + extension));
dangerous_download_label_->SetMultiLine(true);
dangerous_download_label_->SetHorizontalAlignment(
@@ -456,7 +456,7 @@ void DownloadItemView::Paint(ChromeCanvas* canvas) {
// Last value of x was the end of the right image, just before the button.
// Note that in dangerous mode we use a label (as the text is multi-line).
if (!IsDangerousMode()) {
- std::wstring filename =
+ std::wstring filename =
gfx::ElideFilename(download_->GetFileName().ToWStringHack(),
font_,
kTextWidth);
diff --git a/chrome/browser/views/edit_keyword_controller.cc b/chrome/browser/views/edit_keyword_controller.cc
index 11d7571..7e01074 100644
--- a/chrome/browser/views/edit_keyword_controller.cc
+++ b/chrome/browser/views/edit_keyword_controller.cc
@@ -53,7 +53,7 @@ void EditKeywordController::Show() {
// Window interprets an empty rectangle as needing to query the content for
// the size as well as centering relative to the parent.
views::Window::CreateChromeWindow(::IsWindow(parent_) ? parent_ : NULL,
- gfx::Rect(), this);
+ gfx::Rect(), this);
window()->Show();
GetDialogClientView()->UpdateDialogButtons();
title_tf_->SelectAll();
diff --git a/chrome/browser/views/first_run_bubble.cc b/chrome/browser/views/first_run_bubble.cc
index 79fa9c0..1ed7916 100644
--- a/chrome/browser/views/first_run_bubble.cc
+++ b/chrome/browser/views/first_run_bubble.cc
@@ -120,7 +120,7 @@ class FirstRunBubbleView : public views::View,
gfx::Size pref_size = label1_->GetPreferredSize();
label1_->SetMultiLine(true);
label1_->SizeToFit(canvas.width() - kBubblePadding * 2);
- label1_->SetBounds(kBubblePadding, kBubblePadding,
+ label1_->SetBounds(kBubblePadding, kBubblePadding,
canvas.width() - kBubblePadding * 2,
pref_size.height());
diff --git a/chrome/browser/views/frame/glass_browser_frame_view.cc b/chrome/browser/views/frame/glass_browser_frame_view.cc
index 274f561..55e8d5b 100644
--- a/chrome/browser/views/frame/glass_browser_frame_view.cc
+++ b/chrome/browser/views/frame/glass_browser_frame_view.cc
@@ -164,7 +164,7 @@ gfx::Rect GlassBrowserFrameView::GetWindowBoundsForClientBounds(
RECT rect = client_bounds.ToRECT();
AdjustWindowRectEx(&rect, frame_->window_style(), FALSE,
frame_->window_ex_style());
- return gfx::Rect(rect);
+ return gfx::Rect(rect);
}
int top_height = NonClientTopBorderHeight();
@@ -296,7 +296,7 @@ void GlassBrowserFrameView::PaintOTRAvatar(ChromeCanvas* canvas) {
SkBitmap otr_avatar_icon = browser_view_->GetOTRAvatarIcon();
canvas->DrawBitmapInt(otr_avatar_icon, 0,
(otr_avatar_icon.height() - otr_avatar_bounds_.height()) / 2,
- otr_avatar_bounds_.width(), otr_avatar_bounds_.height(),
+ otr_avatar_bounds_.width(), otr_avatar_bounds_.height(),
MirroredLeftPointForRect(otr_avatar_bounds_), otr_avatar_bounds_.y(),
otr_avatar_bounds_.width(), otr_avatar_bounds_.height(), false);
}
diff --git a/chrome/browser/views/frame/glass_browser_frame_view.h b/chrome/browser/views/frame/glass_browser_frame_view.h
index edaed89..f6e3aff 100644
--- a/chrome/browser/views/frame/glass_browser_frame_view.h
+++ b/chrome/browser/views/frame/glass_browser_frame_view.h
@@ -63,7 +63,7 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView {
// Returns the bounds of the client area for the specified view size.
gfx::Rect CalculateClientAreaBounds(int width, int height) const;
-
+
// Starts/Stops the window throbber running.
void StartThrobber();
void StopThrobber();
diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.cc b/chrome/browser/views/frame/opaque_browser_frame_view.cc
index 39ba2d0..8452a37 100644
--- a/chrome/browser/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/views/frame/opaque_browser_frame_view.cc
@@ -167,7 +167,7 @@ class OTRActiveWindowResources : public views::WindowResources {
virtual SkBitmap* GetPartBitmap(views::FramePartBitmap part) const {
return standard_frame_bitmaps_[part];
}
-
+
private:
static void InitClass() {
static bool initialized = false;
@@ -842,7 +842,7 @@ void OpaqueBrowserFrameView::PaintOTRAvatar(ChromeCanvas* canvas) {
SkBitmap otr_avatar_icon = browser_view_->GetOTRAvatarIcon();
canvas->DrawBitmapInt(otr_avatar_icon, 0,
(otr_avatar_icon.height() - otr_avatar_bounds_.height()) / 2,
- otr_avatar_bounds_.width(), otr_avatar_bounds_.height(),
+ otr_avatar_bounds_.width(), otr_avatar_bounds_.height(),
MirroredLeftPointForRect(otr_avatar_bounds_), otr_avatar_bounds_.y(),
otr_avatar_bounds_.width(), otr_avatar_bounds_.height(), false);
}
diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.h b/chrome/browser/views/frame/opaque_browser_frame_view.h
index f25e4f4..e21ff3d 100644
--- a/chrome/browser/views/frame/opaque_browser_frame_view.h
+++ b/chrome/browser/views/frame/opaque_browser_frame_view.h
@@ -115,7 +115,7 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
return frame_->is_active() || paint_as_active() ?
current_active_resources_ : current_inactive_resources_;
}
-
+
// The layout rect of the title, if visible.
gfx::Rect title_bounds_;
diff --git a/chrome/browser/views/hung_renderer_view.cc b/chrome/browser/views/hung_renderer_view.cc
index 590e8a8..72179ea 100644
--- a/chrome/browser/views/hung_renderer_view.cc
+++ b/chrome/browser/views/hung_renderer_view.cc
@@ -130,7 +130,7 @@ class HungRendererWarningView : public views::View,
virtual views::View* GetExtraView();
virtual bool Accept(bool window_closing);
virtual views::View* GetContentsView();
-
+
// views::NativeButton::Listener overrides:
virtual void ButtonPressed(views::NativeButton* sender);
@@ -379,7 +379,7 @@ void HungRendererWarningView::CreateKillButtonView() {
kill_button_->SetListener(this);
kill_button_container_ = new ButtonContainer;
-
+
using views::GridLayout;
using views::ColumnSet;
diff --git a/chrome/browser/views/hwnd_html_view.h b/chrome/browser/views/hwnd_html_view.h
index 67952a2..6f57ea3 100644
--- a/chrome/browser/views/hwnd_html_view.h
+++ b/chrome/browser/views/hwnd_html_view.h
@@ -49,7 +49,7 @@ class HWNDHtmlView : public views::HWNDView {
// Our HTML rendering component.
RenderViewHost* render_view_host_;
-
+
// Whether or not the rendered content is permitted to send messages back to
// the view, through |delegate_| via ProcessDOMUIMessage.
bool allow_dom_ui_bindings_;
diff --git a/chrome/browser/views/importer_view.cc b/chrome/browser/views/importer_view.cc
index e7bd61c..def2826 100644
--- a/chrome/browser/views/importer_view.cc
+++ b/chrome/browser/views/importer_view.cc
@@ -154,27 +154,27 @@ std::wstring ImporterView::GetItemAt(views::ComboBox* source, int index) {
return importer_host_->GetSourceProfileNameAt(index);
}
-void ImporterView::ItemChanged(views::ComboBox* combo_box,
+void ImporterView::ItemChanged(views::ComboBox* combo_box,
int prev_index, int new_index) {
DCHECK(combo_box);
- DCHECK(checkbox_items_.size() >=
- static_cast<size_t>(importer_host_->GetAvailableProfileCount()));
-
- if (prev_index == new_index)
+ DCHECK(checkbox_items_.size() >=
+ static_cast<size_t>(importer_host_->GetAvailableProfileCount()));
+
+ if (prev_index == new_index)
return;
-
+
// Save the current state
uint16 prev_items = GetCheckedItems();
checkbox_items_[prev_index] = prev_items;
-
+
// Enable/Disable the checkboxes for this Item
uint16 new_enabled_items = importer_host_->GetSourceProfileInfoAt(
new_index).services_supported;
- SetCheckedItemsState(new_enabled_items);
-
- // Set the checked items for this Item
+ SetCheckedItemsState(new_enabled_items);
+
+ // Set the checked items for this Item
uint16 new_items = checkbox_items_[new_index];
- SetCheckedItems(new_items);
+ SetCheckedItems(new_items);
}
void ImporterView::ImportCanceled() {
@@ -204,7 +204,7 @@ uint16 ImporterView::GetCheckedItems() {
if (search_engines_checkbox_->IsEnabled() &&
search_engines_checkbox_->IsSelected())
items |= SEARCH_ENGINES;
- return items;
+ return items;
}
void ImporterView::SetCheckedItemsState(uint16 items) {
@@ -242,7 +242,7 @@ void ImporterView::SetCheckedItems(uint16 items) {
history_checkbox_->SetIsSelected(false);
}
}
-
+
if (favorites_checkbox_->IsEnabled()) {
if (items & FAVORITES) {
favorites_checkbox_->SetIsSelected(true);
@@ -250,7 +250,7 @@ void ImporterView::SetCheckedItems(uint16 items) {
favorites_checkbox_->SetIsSelected(false);
}
}
-
+
if (passwords_checkbox_->IsEnabled()) {
if (items & PASSWORDS) {
passwords_checkbox_->SetIsSelected(true);
@@ -258,7 +258,7 @@ void ImporterView::SetCheckedItems(uint16 items) {
passwords_checkbox_->SetIsSelected(false);
}
}
-
+
if (search_engines_checkbox_->IsEnabled()) {
if (items & SEARCH_ENGINES) {
search_engines_checkbox_->SetIsSelected(true);
diff --git a/chrome/browser/views/importer_view.h b/chrome/browser/views/importer_view.h
index fa97e99..4f6efec 100644
--- a/chrome/browser/views/importer_view.h
+++ b/chrome/browser/views/importer_view.h
@@ -48,8 +48,8 @@ class ImporterView : public views::View,
virtual std::wstring GetItemAt(views::ComboBox* source, int index);
// Overridden from ChromeViews::ComboBox::Listener
- virtual void ItemChanged(views::ComboBox* combo_box,
- int prev_index,
+ virtual void ItemChanged(views::ComboBox* combo_box,
+ int prev_index,
int new_index);
// Overridden from ImportObserver:
@@ -65,10 +65,10 @@ class ImporterView : public views::View,
// Create a bitmap from the checkboxes of the view.
uint16 GetCheckedItems();
-
+
// Enables/Disables all the checked items for the given state
void SetCheckedItemsState(uint16 items);
-
+
// Sets all checked items in the given state
void SetCheckedItems(uint16 items);
@@ -82,7 +82,7 @@ class ImporterView : public views::View,
scoped_refptr<ImporterHost> importer_host_;
- // Stores the state of the checked items associated with the position of the
+ // Stores the state of the checked items associated with the position of the
// selected item in the combo-box.
std::vector<uint16> checkbox_items_;
diff --git a/chrome/browser/views/importing_progress_view.cc b/chrome/browser/views/importing_progress_view.cc
index b87819a..82c8047 100644
--- a/chrome/browser/views/importing_progress_view.cc
+++ b/chrome/browser/views/importing_progress_view.cc
@@ -307,7 +307,7 @@ void StartImportingWithUI(HWND parent_window,
// still need it to exist. No user interaction will be required.
if (!coordinator->is_headless())
window->Show();
-
+
coordinator->StartImportSettings(source_profile, items,
new ProfileWriter(target_profile),
first_run);
diff --git a/chrome/browser/views/infobars/infobar_container.h b/chrome/browser/views/infobars/infobar_container.h
index 181d95e..dba3149 100644
--- a/chrome/browser/views/infobars/infobar_container.h
+++ b/chrome/browser/views/infobars/infobar_container.h
@@ -40,7 +40,7 @@ class InfoBarContainer : public views::View,
virtual void ViewHierarchyChanged(bool is_add,
views::View* parent,
views::View* child);
-
+
private:
// Overridden from NotificationObserver:
virtual void Observe(NotificationType type,
diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc
index aa60a6b..da3af20 100644
--- a/chrome/browser/views/infobars/infobars.cc
+++ b/chrome/browser/views/infobars/infobars.cc
@@ -214,7 +214,7 @@ void InfoBar::DestroyFocusTracker(bool restore_focus) {
focus_tracker_->FocusLastFocusedExternalView();
focus_tracker_->SetFocusManager(NULL);
focus_tracker_.reset(NULL);
- }
+ }
}
void InfoBar::DeleteSelf() {
diff --git a/chrome/browser/views/infobars/infobars.h b/chrome/browser/views/infobars/infobars.h
index 56f140b..15885ce 100644
--- a/chrome/browser/views/infobars/infobars.h
+++ b/chrome/browser/views/infobars/infobars.h
@@ -45,7 +45,7 @@ class InfoBar : public views::View,
// Starts animating the InfoBar closed. It will not be closed until the
// animation has completed, when |Close| will be called.
void AnimateClose();
-
+
// Closes the InfoBar immediately and removes it from its container. Notifies
// the delegate that it has closed. The InfoBar is deleted after this function
// is called.
diff --git a/chrome/browser/views/keyword_editor_view.cc b/chrome/browser/views/keyword_editor_view.cc
index c1442f0..f103e0a 100644
--- a/chrome/browser/views/keyword_editor_view.cc
+++ b/chrome/browser/views/keyword_editor_view.cc
@@ -437,18 +437,18 @@ gfx::Size KeywordEditorView::GetPreferredSize() {
bool KeywordEditorView::CanResize() const {
return true;
}
-
+
std::wstring KeywordEditorView::GetWindowTitle() const {
return l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_WINDOW_TITLE);
-}
+}
int KeywordEditorView::GetDialogButtons() const {
return DIALOGBUTTON_CANCEL;
}
-
+
bool KeywordEditorView::Accept() {
open_window = NULL;
- return true;
+ return true;
}
bool KeywordEditorView::Cancel() {
diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h
index 4323454..e6b1764 100644
--- a/chrome/browser/views/location_bar_view.h
+++ b/chrome/browser/views/location_bar_view.h
@@ -205,7 +205,7 @@ class LocationBarView : public LocationBar,
// The minimum size is just big enough to show the tab.
virtual gfx::Size GetMinimumSize();
virtual void Layout();
-
+
void set_profile(Profile* profile) { profile_ = profile; }
private:
diff --git a/chrome/browser/views/options/cookies_view.cc b/chrome/browser/views/options/cookies_view.cc
index e4380a1f5..594e5e2 100644
--- a/chrome/browser/views/options/cookies_view.cc
+++ b/chrome/browser/views/options/cookies_view.cc
@@ -302,7 +302,7 @@ void CookiesTableView::RemoveSelectedCookies() {
// Select the next row after the last row deleted (unless removing last row).
DCHECK(RowCount() > 0 && last_selected_view_row != -1);
- Select(view_to_model(std::min(RowCount() - 1,
+ Select(view_to_model(std::min(RowCount() - 1,
last_selected_view_row - remove_count + 1)));
}
diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc
index be7e81f..f0ac54c 100644
--- a/chrome/browser/views/options/languages_page_view.cc
+++ b/chrome/browser/views/options/languages_page_view.cc
@@ -464,7 +464,7 @@ LanguagesPageView::LanguagesPageView(Profile* profile)
starting_ui_language_index_(-1) {
accept_languages_.Init(prefs::kAcceptLanguages,
profile->GetPrefs(), NULL);
- enable_spellcheck_.Init(prefs::kEnableSpellCheck,
+ enable_spellcheck_.Init(prefs::kEnableSpellCheck,
profile->GetPrefs(), NULL);
}
@@ -607,7 +607,7 @@ void LanguagesPageView::InitControlLayout() {
dictionary_language_label_ = new views::Label(
l10n_util::GetString(IDS_OPTIONS_CHROME_DICTIONARY_LANGUAGE));
dictionary_language_label_->SetHorizontalAlignment(
- views::Label::ALIGN_LEFT);
+ views::Label::ALIGN_LEFT);
enable_spellchecking_checkbox_ = new views::CheckBox(
l10n_util::GetString(IDS_OPTIONS_ENABLE_SPELLCHECK));
enable_spellchecking_checkbox_->SetListener(this);
diff --git a/chrome/browser/views/options/languages_page_view.h b/chrome/browser/views/options/languages_page_view.h
index d22a945..e79a4ab 100644
--- a/chrome/browser/views/options/languages_page_view.h
+++ b/chrome/browser/views/options/languages_page_view.h
@@ -93,10 +93,10 @@ class LanguagesPageView : public OptionsPageView,
// The contents of the "dictionary language" combobox.
scoped_ptr<LanguageComboboxModel> dictionary_language_model_;
StringPrefMember dictionary_language_;
-
+
// SpellChecker enable pref.
BooleanPrefMember enable_spellcheck_;
-
+
// This is assigned the new index of spellcheck language if the language
// is changed. Otherwise, it remains -1, and pref members are not updated.
int spellcheck_language_index_selected_;
diff --git a/chrome/browser/views/page_info_window.cc b/chrome/browser/views/page_info_window.cc
index 418d31e..510784f 100644
--- a/chrome/browser/views/page_info_window.cc
+++ b/chrome/browser/views/page_info_window.cc
@@ -565,7 +565,7 @@ void PageInfoWindow::Init(Profile* profile,
views::Window::CreateChromeWindow(parent, gfx::Rect(), this);
// TODO(beng): (Cleanup) - cert viewer button should use GetExtraView.
-
+
if (cert_id_) {
scoped_refptr<net::X509Certificate> cert;
CertStore::GetSharedInstance()->RetrieveCert(cert_id_, &cert);
@@ -663,13 +663,13 @@ void PageInfoWindow::ShowCertDialog(int cert_id) {
if (!cert.get()) {
// The certificate was not found. Could be that the renderer crashed before
// we displayed the page info.
- return;
- }
+ return;
+ }
- CRYPTUI_VIEWCERTIFICATE_STRUCT view_info = { 0 };
- view_info.dwSize = sizeof(view_info);
- // We set our parent to the tab window. This makes the cert dialog created
- // in CryptUIDlgViewCertificate modal to the browser.
+ CRYPTUI_VIEWCERTIFICATE_STRUCT view_info = { 0 };
+ view_info.dwSize = sizeof(view_info);
+ // We set our parent to the tab window. This makes the cert dialog created
+ // in CryptUIDlgViewCertificate modal to the browser.
view_info.hwndParent = window()->owning_window();
view_info.dwFlags = CRYPTUI_DISABLE_EDITPROPERTIES |
CRYPTUI_DISABLE_ADDTOSTORE;
diff --git a/chrome/browser/views/password_manager_view.h b/chrome/browser/views/password_manager_view.h
index a43b9f3..a5e5950 100644
--- a/chrome/browser/views/password_manager_view.h
+++ b/chrome/browser/views/password_manager_view.h
@@ -57,7 +57,7 @@ class PasswordManagerTableModel : public views::TableModel,
: display_url(url), form(password_form) {
}
- // Contains the URL that is displayed along with the
+ // Contains the URL that is displayed along with the
gfx::SortedDisplayURL display_url;
// The underlying PasswordForm. We own this.
diff --git a/chrome/browser/views/shell_dialogs_win.cc b/chrome/browser/views/shell_dialogs_win.cc
index ed50ca7..a883ad5 100644
--- a/chrome/browser/views/shell_dialogs_win.cc
+++ b/chrome/browser/views/shell_dialogs_win.cc
@@ -375,13 +375,13 @@ bool SelectFileDialogImpl::RunSelectFolderDialog(const std::wstring& title,
browse_info.lpszTitle = title.c_str();
browse_info.pszDisplayName = dir_buffer;
browse_info.ulFlags = BIF_USENEWUI | BIF_RETURNONLYFSDIRS;
-
+
if (path->length()) {
// Highlight the current value.
browse_info.lParam = (LPARAM)path->c_str();
browse_info.lpfn = &BrowseCallbackProc;
}
-
+
LPITEMIDLIST list = SHBrowseForFolder(&browse_info);
DisableOwner(owner);
if (list) {
diff --git a/chrome/browser/views/tabs/tab_dragging_test.cc b/chrome/browser/views/tabs/tab_dragging_test.cc
index a136046..76a6574b 100644
--- a/chrome/browser/views/tabs/tab_dragging_test.cc
+++ b/chrome/browser/views/tabs/tab_dragging_test.cc
@@ -50,7 +50,7 @@ TEST_F(TabDraggingTest, Tab1Tab2) {
ASSERT_TRUE(browser->AppendTab(tab2_url));
scoped_ptr<TabProxy> tab2(browser->GetTab(1));
ASSERT_TRUE(tab2.get());
-
+
// Add Tab_3.
GURL tab3_url("about:plugins");
ASSERT_TRUE(browser->AppendTab(tab3_url));
@@ -100,8 +100,8 @@ TEST_F(TabDraggingTest, Tab1Tab2) {
// | Tab_1 | Tab_2 | Tab_3 |
// ---- ---- ---- ---- ---- ---- ---- ---- ----
// x---- ---->
- // ____________
- // / X \
+ // ____________
+ // / X \
// | Tab_1 |
// ---- ---- ----
@@ -130,7 +130,7 @@ TEST_F(TabDraggingTest, Tab1Tab2) {
EXPECT_EQ(tab2_url.spec(), tab1_new_url.spec());
}
-// Drag Tab_1 into the position of Tab_3.
+// Drag Tab_1 into the position of Tab_3.
TEST_F(TabDraggingTest, Tab1Tab3) {
scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
@@ -153,7 +153,7 @@ TEST_F(TabDraggingTest, Tab1Tab3) {
ASSERT_TRUE(browser->AppendTab(tab2_url));
scoped_ptr<TabProxy> tab2(browser->GetTab(1));
ASSERT_TRUE(tab2.get());
-
+
// Add Tab_3.
GURL tab3_url("about:plugins");
ASSERT_TRUE(browser->AppendTab(tab3_url));
@@ -203,13 +203,13 @@ TEST_F(TabDraggingTest, Tab1Tab3) {
// | Tab_1 | Tab_2 | Tab_3 |
// ---- ---- ---- ---- ---- ---- ---- ---- ----
// x---- ---- ---- ---- ---- ---->
- // ____________
- // / X \
+ // ____________
+ // / X \
// | Tab_1 |
// ---- ---- ----
POINT start;
- POINT end;
+ POINT end;
start.x = bounds1.x() + bounds1.width()/2;
start.y = bounds1.y() + bounds1.height()/2;
end.x = start.x + bounds1.width()/2 + bounds2.width() + bounds3.width()/2;
@@ -263,7 +263,7 @@ TEST_F(TabDraggingTest, Tab1Tab3Escape) {
ASSERT_TRUE(browser->AppendTab(tab2_url));
scoped_ptr<TabProxy> tab2(browser->GetTab(1));
ASSERT_TRUE(tab2.get());
-
+
// Add Tab_3.
GURL tab3_url("about:plugins");
ASSERT_TRUE(browser->AppendTab(tab3_url));
@@ -313,19 +313,19 @@ TEST_F(TabDraggingTest, Tab1Tab3Escape) {
// | Tab_1 | Tab_2 | Tab_3 |
// ---- ---- ---- ---- ---- ---- ---- ---- ----
// x---- ---- ---- ---- ---- ----> + ESCAPE
- // ____________
- // / X \
+ // ____________
+ // / X \
// | Tab_1 |
// ---- ---- ----
POINT start;
- POINT end;
+ POINT end;
start.x = bounds1.x() + bounds1.width()/2;
start.y = bounds1.y() + bounds1.height()/2;
end.x = start.x + bounds1.width()/2 + bounds2.width() + bounds3.width()/2;
end.y = start.y;
- // Simulate drag with 'true' as the last parameter. This will interrupt
+ // Simulate drag with 'true' as the last parameter. This will interrupt
// in-flight with Escape.
ASSERT_TRUE(browser->SimulateDrag(start, end,
views::Event::EF_LEFT_BUTTON_DOWN,
@@ -346,7 +346,7 @@ TEST_F(TabDraggingTest, Tab1Tab3Escape) {
ASSERT_TRUE(tab3.get());
GURL tab3_new_url;
ASSERT_TRUE(tab3->GetCurrentURL(&tab3_new_url));
-
+
// The tabs should be in their original positions.
EXPECT_EQ(tab1_new_url.spec(), tab1_url.spec());
EXPECT_EQ(tab2_new_url.spec(), tab2_url.spec());
@@ -376,7 +376,7 @@ TEST_F(TabDraggingTest, Tab2OutOfTabStrip) {
ASSERT_TRUE(browser->AppendTab(tab2_url));
scoped_ptr<TabProxy> tab2(browser->GetTab(1));
ASSERT_TRUE(tab2.get());
-
+
// Add Tab_3.
GURL tab3_url("about:plugins");
ASSERT_TRUE(browser->AppendTab(tab3_url));
@@ -435,17 +435,17 @@ TEST_F(TabDraggingTest, Tab2OutOfTabStrip) {
// / \ / \ / \
// | Tab_1 | Tab_2 | Tab_3 |
// ---- ---- ---- ---- ---- ---- ---- ---- ----
- // x
- // |
+ // x
+ // |
// | (Drag this below, out of tab strip)
- // V
- // ____________
- // / X \
+ // V
+ // ____________
+ // / X \
// | Tab_2 | (New Window)
// ---- ---- ---- ---- ---- ---- ----
POINT start;
- POINT end;
+ POINT end;
start.x = bounds2.x() + bounds2.width()/2;
start.y = bounds2.y() + bounds2.height()/2;
end.x = start.x;
@@ -471,8 +471,8 @@ TEST_F(TabDraggingTest, Tab2OutOfTabStrip) {
ASSERT_TRUE(tab2.get());
GURL tab2_new_url;
ASSERT_TRUE(tab2->GetCurrentURL(&tab2_new_url));
-
- // Now check for proper shifting of tabs; i.e., Tab_3 in window 1 should
+
+ // Now check for proper shifting of tabs; i.e., Tab_3 in window 1 should
// shift left to the position of Tab_2; Tab_1 should stay where it was.
EXPECT_EQ(tab1_new_url.spec(), tab1_url.spec());
EXPECT_EQ(tab2_new_url.spec(), tab3_url.spec());
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index f060135..c5e16b4 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -808,7 +808,7 @@ void BrowserToolbarView::ButtonPressed(views::BaseButton* sender) {
// static
int BrowserToolbarView::PopupTopSpacing() {
- return GetWidget()->AsWindow()->UseNativeFrame() ? 0
+ return GetWidget()->AsWindow()->UseNativeFrame() ? 0
: kPopupTopSpacingNonGlass;
}
diff --git a/chrome/browser/visitedlink_unittest.cc b/chrome/browser/visitedlink_unittest.cc
index 5b3928a..c3cbd0a 100644
--- a/chrome/browser/visitedlink_unittest.cc
+++ b/chrome/browser/visitedlink_unittest.cc
@@ -144,7 +144,7 @@ class VisitedLinkTest : public testing::Test {
ClearDB();
file_util::Delete(history_dir_, true);
}
-
+
MessageLoop message_loop_;
// Filenames for the services;
diff --git a/chrome/common/child_process.cc b/chrome/common/child_process.cc
index 934583a..27b55b7 100644
--- a/chrome/common/child_process.cc
+++ b/chrome/common/child_process.cc
@@ -13,7 +13,7 @@ ChildProcess* ChildProcess::child_process_;
ChildProcess::ChildProcess(ChildThread* child_thread)
: child_thread_(child_thread),
ref_count_(0),
- shutdown_event_(true, false) {
+ shutdown_event_(true, false) {
DCHECK(!child_process_);
child_process_ = this;
if (child_thread_.get()) // null in unittests.
diff --git a/chrome/common/child_process_info.cc b/chrome/common/child_process_info.cc
index f1c91c7..1521dab 100644
--- a/chrome/common/child_process_info.cc
+++ b/chrome/common/child_process_info.cc
@@ -71,7 +71,7 @@ std::wstring ChildProcessInfo::GenerateRandomChannelID(void* instance) {
// child processes determine the pid of the parent.
// Build the channel ID. This is composed of a unique identifier for the
// parent browser process, an identifier for the child instance, and a random
- // component. We use a random component so that a hacked child process can't
+ // component. We use a random component so that a hacked child process can't
// cause denial of service by causing future named pipe creation to fail.
return StringPrintf(L"%d.%x.%d",
base::GetCurrentProcId(), instance,
diff --git a/chrome/common/chrome_paths_mac.mm b/chrome/common/chrome_paths_mac.mm
index 1e00bf9..e8e8f92 100644
--- a/chrome/common/chrome_paths_mac.mm
+++ b/chrome/common/chrome_paths_mac.mm
@@ -21,7 +21,7 @@ bool GetDefaultUserDataDirectory(FilePath* result) {
bool GetUserDocumentsDirectory(FilePath* result) {
bool success = false;
- NSArray* docArray =
+ NSArray* docArray =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask,
YES);
@@ -34,7 +34,7 @@ bool GetUserDocumentsDirectory(FilePath* result) {
bool GetUserDownloadsDirectory(FilePath* result) {
bool success = false;
- NSArray* docArray =
+ NSArray* docArray =
NSSearchPathForDirectoriesInDomains(NSDownloadsDirectory,
NSUserDomainMask,
YES);
@@ -47,7 +47,7 @@ bool GetUserDownloadsDirectory(FilePath* result) {
bool GetUserDesktop(FilePath* result) {
bool success = false;
- NSArray* docArray =
+ NSArray* docArray =
NSSearchPathForDirectoriesInDomains(NSDesktopDirectory,
NSUserDomainMask,
YES);
diff --git a/chrome/common/chrome_paths_win.cc b/chrome/common/chrome_paths_win.cc
index 52e8712..257d5bb 100644
--- a/chrome/common/chrome_paths_win.cc
+++ b/chrome/common/chrome_paths_win.cc
@@ -39,7 +39,7 @@ bool GetUserDocumentsDirectory(FilePath* result) {
// but it can be set to Desktop, which is dangerous. Instead,
// we just use 'Downloads' under DIR_USER_DOCUMENTS. Localizing
// 'downloads' is not a good idea because Chrome's UI language
-// can be changed.
+// can be changed.
bool GetUserDownloadsDirectory(FilePath* result) {
if (!GetUserDocumentsDirectory(result))
return false;
diff --git a/chrome/common/extensions/url_pattern.cc b/chrome/common/extensions/url_pattern.cc
index 7f705f2..b6aff22 100644
--- a/chrome/common/extensions/url_pattern.cc
+++ b/chrome/common/extensions/url_pattern.cc
@@ -75,7 +75,7 @@ bool URLPattern::Parse(const std::string& pattern) {
path_start_pos = host_end_pos;
}
-
+
path_ = pattern.substr(path_start_pos);
return true;
}
diff --git a/chrome/common/gfx/chrome_font.h b/chrome/common/gfx/chrome_font.h
index 8ac225c..7c25a9b 100644
--- a/chrome/common/gfx/chrome_font.h
+++ b/chrome/common/gfx/chrome_font.h
@@ -215,7 +215,7 @@ class ChromeFont {
int avg_width_;
#elif defined(OS_MACOSX)
explicit ChromeFont(const std::wstring& font_name, int font_size, int style);
-
+
// Calculate and cache the font metrics.
void calculateMetrics();
diff --git a/chrome/common/gfx/chrome_font_mac.mm b/chrome/common/gfx/chrome_font_mac.mm
index a553be6..590c54e 100644
--- a/chrome/common/gfx/chrome_font_mac.mm
+++ b/chrome/common/gfx/chrome_font_mac.mm
@@ -9,8 +9,8 @@
#include "base/logging.h"
#include "base/sys_string_conversions.h"
-// static
-ChromeFont ChromeFont::CreateFont(const std::wstring& font_name,
+// static
+ChromeFont ChromeFont::CreateFont(const std::wstring& font_name,
int font_size) {
return ChromeFont(font_name, font_size, NORMAL);
}
@@ -22,7 +22,7 @@ ChromeFont::ChromeFont(const std::wstring& font_name, int font_size, int style)
calculateMetrics();
}
-ChromeFont::ChromeFont()
+ChromeFont::ChromeFont()
: font_size_([NSFont systemFontSize]),
style_(NORMAL) {
NSFont* system_font = [NSFont systemFontOfSize:font_size_];
@@ -56,7 +56,7 @@ int ChromeFont::ave_char_width() const {
int ChromeFont::GetStringWidth(const std::wstring& text) const {
NSFont* font = nativeFont();
NSString* ns_string = base::SysWideToNSString(text);
- NSDictionary* attributes =
+ NSDictionary* attributes =
[NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
NSSize string_size = [ns_string sizeWithAttributes:attributes];
return string_size.width;
@@ -82,6 +82,6 @@ NativeFont ChromeFont::nativeFont() const {
// TODO(pinkerton): apply |style_| to font.
// We could cache this, but then we'd have to conditionally change the
// dtor just for MacOS. Not sure if we want to/need to do that.
- return [NSFont fontWithName:base::SysWideToNSString(font_name_)
+ return [NSFont fontWithName:base::SysWideToNSString(font_name_)
size:font_size_];
}
diff --git a/chrome/common/gfx/text_elider.cc b/chrome/common/gfx/text_elider.cc
index f7405a2..f4a6d4e 100644
--- a/chrome/common/gfx/text_elider.cc
+++ b/chrome/common/gfx/text_elider.cc
@@ -168,9 +168,9 @@ std::wstring ElideUrl(const GURL& url,
}
const int kMaxNumberOfUrlPathElementsAllowed = 1024;
- if (url_path_number_of_elements <= 1 ||
+ if (url_path_number_of_elements <= 1 ||
url_path_number_of_elements > kMaxNumberOfUrlPathElementsAllowed) {
- // No path to elide, or too long of a path (could overflow in loop below)
+ // No path to elide, or too long of a path (could overflow in loop below)
// Just elide this as a text string.
return ElideText(url_subdomain + url_domain + url_path_query_etc, font,
available_pixel_width);
diff --git a/chrome/common/ipc_sync_channel.cc b/chrome/common/ipc_sync_channel.cc
index 0de4a86..4abef3a4 100644
--- a/chrome/common/ipc_sync_channel.cc
+++ b/chrome/common/ipc_sync_channel.cc
@@ -400,7 +400,7 @@ bool SyncChannel::SendWithTimeout(Message* message, int timeout_ms) {
// We use the sync message id so that when a message times out, we don't
// confuse it with another send that is either above/below this Send in
// the call stack.
- context->ipc_message_loop()->PostDelayedTask(FROM_HERE,
+ context->ipc_message_loop()->PostDelayedTask(FROM_HERE,
NewRunnableMethod(context.get(),
&SyncContext::OnSendTimeout, message_id), timeout_ms);
}
diff --git a/chrome/common/json_value_serializer.h b/chrome/common/json_value_serializer.h
index 71038fe..47e4584 100644
--- a/chrome/common/json_value_serializer.h
+++ b/chrome/common/json_value_serializer.h
@@ -55,7 +55,7 @@ class JSONStringValueSerializer : public ValueSerializer {
bool initialized_with_const_string_;
bool pretty_print_; // If true, serialization will span multiple lines.
// If true, deserialization will allow trailing commas.
- bool allow_trailing_comma_;
+ bool allow_trailing_comma_;
DISALLOW_EVIL_CONSTRUCTORS(JSONStringValueSerializer);
};
diff --git a/chrome/common/l10n_util.h b/chrome/common/l10n_util.h
index 480c1bd..6d7166e 100644
--- a/chrome/common/l10n_util.h
+++ b/chrome/common/l10n_util.h
@@ -239,7 +239,7 @@ void SortStringsUsingMethod(const std::wstring& locale,
StringMethodComparator<T,Method>(method));
return;
}
-
+
std::sort(elements->begin(), elements->end(),
StringMethodComparatorWithCollator<T,Method>(collator.get(), method));
}
diff --git a/chrome/common/page_zoom.h b/chrome/common/page_zoom.h
index 17743b7..daf5b9b 100644
--- a/chrome/common/page_zoom.h
+++ b/chrome/common/page_zoom.h
@@ -14,7 +14,7 @@ class PageZoom {
STANDARD = 0,
LARGER = 1,
};
-
+
private:
PageZoom() {} // For scoping only.
};
diff --git a/chrome/common/plugin_messages.h b/chrome/common/plugin_messages.h
index 8a6a63a..c0c5a46 100644
--- a/chrome/common/plugin_messages.h
+++ b/chrome/common/plugin_messages.h
@@ -204,7 +204,7 @@ struct ParamTraits<PluginMsg_URLRequestReply_Params> {
ReadParam(m, iter, &p->resource_id) &&
ReadParam(m, iter, &p->url) &&
ReadParam(m, iter, &p->notify_needed) &&
- ReadParam(m, iter, &p->notify_data) &&
+ ReadParam(m, iter, &p->notify_data) &&
ReadParam(m, iter, &p->stream);
}
static void Log(const param_type& p, std::wstring* l) {
diff --git a/chrome/common/resource_bundle_mac.mm b/chrome/common/resource_bundle_mac.mm
index 5949572..3059d62 100644
--- a/chrome/common/resource_bundle_mac.mm
+++ b/chrome/common/resource_bundle_mac.mm
@@ -35,7 +35,7 @@ namespace {
base::DataPack *LoadResourceDataPack(NSString *name) {
base::DataPack *resource_pack = NULL;
-
+
NSString *resource_path = [mac_util::MainAppBundle() pathForResource:name
ofType:@"pak"];
if (resource_path) {
@@ -47,7 +47,7 @@ base::DataPack *LoadResourceDataPack(NSString *name) {
resource_pack = NULL;
}
}
-
+
return resource_pack;
}
@@ -56,7 +56,7 @@ base::DataPack *LoadResourceDataPack(NSString *name) {
void ResourceBundle::LoadResources(const std::wstring& pref_locale) {
DLOG_IF(WARNING, pref_locale.size() != 0)
<< "ignoring requested locale in favor of NSBundle's selection";
-
+
DCHECK(resources_data_ == NULL) << "resource data already loaded!";
resources_data_ = LoadResourceDataPack(@"chrome");
DCHECK(resources_data_) << "failed to load chrome.pak";
diff --git a/chrome/common/sandbox_init_wrapper.cc b/chrome/common/sandbox_init_wrapper.cc
index 6fcf664..5eb45cb 100644
--- a/chrome/common/sandbox_init_wrapper.cc
+++ b/chrome/common/sandbox_init_wrapper.cc
@@ -18,7 +18,7 @@ void SandboxInitWrapper::SetServices(sandbox::SandboxInterfaceInfo* info) {
#endif
-void SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line,
+void SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line,
const std::wstring& process_type) {
#if defined(OS_WIN)
if (!target_services_)
diff --git a/chrome/common/sandbox_init_wrapper.h b/chrome/common/sandbox_init_wrapper.h
index e9a718a..c8893a3 100644
--- a/chrome/common/sandbox_init_wrapper.h
+++ b/chrome/common/sandbox_init_wrapper.h
@@ -33,7 +33,7 @@ class SandboxInitWrapper {
// Initialize the sandbox for renderer and plug-in processes, depending on
// the command line flags. The browser process is not sandboxed.
- void InitializeSandbox(const CommandLine& parsed_command_line,
+ void InitializeSandbox(const CommandLine& parsed_command_line,
const std::wstring& process_type);
private:
sandbox::BrokerServices* broker_services_;
@@ -50,7 +50,7 @@ class SandboxInitWrapper {
// Initialize the sandbox for renderer and plug-in processes, depending on
// the command line flags. The browser process is not sandboxed.
- void InitializeSandbox(const CommandLine& parsed_command_line,
+ void InitializeSandbox(const CommandLine& parsed_command_line,
const std::wstring& process_type);
#if defined(OS_MACOSX)
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index 5cd4428..96a7bed 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -336,7 +336,7 @@ void TabContents::SetIsLoading(bool is_loading,
NotificationDetails det = NotificationService::NoDetails();;
if (details)
det = Details<LoadNotificationDetails>(details);
- NotificationService::current()->Notify(type,
+ NotificationService::current()->Notify(type,
Source<NavigationController>(this->controller()),
det);
}
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
index ca7cf64..1b7d1e2 100644
--- a/chrome/common/temp_scaffolding_stubs.h
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -417,7 +417,7 @@ class TabContents : public PageNavigator, public NotificationObserver {
};
TabContents(TabContentsType type)
: type_(type), is_crashed_(false), is_active_(true), is_loading_(false),
- is_being_destroyed_(false), waiting_for_response_(false),
+ is_being_destroyed_(false), waiting_for_response_(false),
shelf_visible_(false), controller_(), delegate_(), max_page_id_(-1) { }
virtual ~TabContents() { }
NavigationController* controller() const { return controller_; }
diff --git a/chrome/installer/gcapi/gcapi.cc b/chrome/installer/gcapi/gcapi.cc
index b3c12a5..3f4a226 100644
--- a/chrome/installer/gcapi/gcapi.cc
+++ b/chrome/installer/gcapi/gcapi.cc
@@ -1,444 +1,444 @@
-// Copyright (c) 2006-2008 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/installer/gcapi/gcapi.h"
-
-#include <atlbase.h>
-#include <atlcom.h>
-#include <windows.h>
-#include <sddl.h>
-#include <stdlib.h>
-#include <strsafe.h>
-#include <tlhelp32.h>
-
-#include "google_update_idl.h"
-
-namespace {
-
-const wchar_t kChromeRegClientsKey[] = L"Software\\Google\\Update\\Clients\\{8A69D345-D564-463c-AFF1-A69D9E530F96}";
-const wchar_t kChromeRegClientStateKey[] = L"Software\\Google\\Update\\ClientState\\{8A69D345-D564-463c-AFF1-A69D9E530F96}";
-const wchar_t kChromeRegLaunchCmd[] = L"InstallerSuccessLaunchCmdLine";
-const wchar_t kChromeRegLastLaunchCmd[] = L"LastInstallerSuccessLaunchCmdLine";
-const wchar_t kChromeRegVersion[] = L"pv";
-const wchar_t kNoChromeOfferUntil[] = L"SOFTWARE\\Google\\No Chrome Offer Until";
-
-// Remove any registry key with non-numeric value or with the numeric value
-// equal or less than today's date represented in YYYYMMDD form.
-void CleanUpRegistryValues() {
- HKEY key = NULL;
- if (::RegOpenKeyEx(HKEY_LOCAL_MACHINE, kNoChromeOfferUntil,
- 0, KEY_ALL_ACCESS, &key) != ERROR_SUCCESS)
- return;
-
- DWORD index = 0;
- wchar_t value_name[260];
- DWORD value_name_len = _countof(value_name);
- DWORD value_type = REG_DWORD;
- DWORD value_data = 0;
- DWORD value_len = sizeof(DWORD);
-
- // First, remove any value whose type is not DWORD.
- while (::RegEnumValue(key, index, value_name, &value_name_len, NULL,
- &value_type, NULL, &value_len) == ERROR_SUCCESS) {
- if (value_type == REG_DWORD)
- index++;
- else
- ::RegDeleteValue(key, value_name);
-
- value_name_len = _countof(value_name);
- value_type = REG_DWORD;
- value_len = sizeof(DWORD);
- }
-
- // Get today's date, and format it as YYYYMMDD numeric value.
- SYSTEMTIME now;
- ::GetLocalTime(&now);
- DWORD expiration_date = now.wYear * 10000 + now.wMonth * 100 + now.wDay;
-
- // Remove any DWORD value smaller than the number represent the
- // expiration date (YYYYMMDD).
- index = 0;
- while (::RegEnumValue(key, index, value_name, &value_name_len, NULL,
- &value_type, (LPBYTE) &value_data,
- &value_len) == ERROR_SUCCESS) {
- if (value_type == REG_DWORD && value_data > expiration_date)
- index++; // move on to next value.
- else
- ::RegDeleteValue(key, value_name); // delete this value.
-
- value_name_len = _countof(value_name);
- value_type = REG_DWORD;
- value_data = 0;
- value_len = sizeof(DWORD);
- }
-
- ::RegCloseKey(key);
-}
-
-// Return the company name specified in the file version info resource.
-bool GetCompanyName(const wchar_t* filename, wchar_t* buffer, DWORD out_len) {
- wchar_t file_version_info[8192];
- DWORD handle = 0;
- DWORD buffer_size = 0;
-
- buffer_size = ::GetFileVersionInfoSize(filename, &handle);
- // Cannot stats the file or our buffer size is too small (very unlikely).
- if (buffer_size == 0 || buffer_size > _countof(file_version_info))
- return false;
-
- buffer_size = _countof(file_version_info);
- memset(file_version_info, 0, buffer_size);
- if (!::GetFileVersionInfo(filename, handle, buffer_size, file_version_info))
- return false;
-
- DWORD data_len = 0;
- LPVOID data = NULL;
- // Retrieve the language and codepage code if exists.
- buffer_size = 0;
- if (!::VerQueryValue(file_version_info, TEXT("\\VarFileInfo\\Translation"),
- reinterpret_cast<LPVOID *>(&data), reinterpret_cast<UINT *>(&data_len)))
- return false;
- if (data_len != 4)
- return false;
-
- wchar_t info_name[256];
- DWORD lang = 0;
- // Formulate the string to retrieve the company name of the specific
- // language codepage.
- memcpy(&lang, data, 4);
- ::StringCchPrintf(info_name, _countof(info_name),
- L"\\StringFileInfo\\%02X%02X%02X%02X\\CompanyName",
- (lang & 0xff00)>>8, (lang & 0xff), (lang & 0xff000000)>>24,
- (lang & 0xff0000)>>16);
-
- data_len = 0;
- if (!::VerQueryValue(file_version_info, info_name,
- reinterpret_cast<LPVOID *>(&data), reinterpret_cast<UINT *>(&data_len)))
- return false;
- if (data_len <= 0 || data_len >= out_len)
- return false;
-
- memset(buffer, 0, out_len);
- ::StringCchCopyN(buffer, out_len, (const wchar_t*)data, data_len);
- return true;
-}
-
-// Return true if we can re-offer Chrome; false, otherwise.
-// Each partner can only offer Chrome once every six months.
-bool CanReOfferChrome(BOOL set_flag) {
- wchar_t filename[MAX_PATH+1];
- wchar_t company[MAX_PATH];
-
- // If we cannot retrieve the version info of the executable or company
- // name, we allow the Chrome to be offered because there is no past
- // history to be found.
- if (::GetModuleFileName(NULL, filename, MAX_PATH) == 0)
- return true;
- if (!GetCompanyName(filename, company, sizeof(company)))
- return true;
-
- bool can_re_offer = true;
- DWORD disposition = 0;
- HKEY key = NULL;
- if (::RegCreateKeyEx(HKEY_LOCAL_MACHINE, kNoChromeOfferUntil,
- 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE,
- NULL, &key, &disposition) == ERROR_SUCCESS) {
- // Cannot re-offer, if the timer already exists and is not expired yet.
- if (::RegQueryValueEx(key, company, 0, 0, 0, 0) == ERROR_SUCCESS) {
- // The expired timers were already removed in CleanUpRegistryValues.
- // So if the key is not found, we can offer the Chrome.
- can_re_offer = false;
- } else if (set_flag) {
- // Set expiration date for offer as six months from today,
- // represented as a YYYYMMDD numeric value.
- SYSTEMTIME timer;
- ::GetLocalTime(&timer);
- timer.wMonth = timer.wMonth + 6;
- if (timer.wMonth > 12) {
- timer.wMonth = timer.wMonth - 12;
- timer.wYear = timer.wYear + 1;
- }
- DWORD value = timer.wYear * 10000 + timer.wMonth * 100 + timer.wDay;
- ::RegSetValueEx(key, company, 0, REG_DWORD, (LPBYTE)&value, sizeof(DWORD));
- }
-
- ::RegCloseKey(key);
- }
-
- return can_re_offer;
-}
-
-// Helper function to read a value from registry. Returns true if value
-// is read successfully and stored in parameter value. Returns false otherwise.
-bool ReadValueFromRegistry(HKEY root_key, const wchar_t *sub_key,
- const wchar_t *value_name, wchar_t *value,
- size_t *size) {
- HKEY key;
- if ((::RegOpenKeyEx(root_key, sub_key, NULL,
- KEY_READ, &key) == ERROR_SUCCESS) &&
- (::RegQueryValueEx(key, value_name, NULL, NULL,
- reinterpret_cast<LPBYTE>(value),
- reinterpret_cast<LPDWORD>(size)) == ERROR_SUCCESS)) {
- ::RegCloseKey(key);
- return true;
- }
- return false;
-}
-
-bool IsChromeInstalled(HKEY root_key) {
- wchar_t version[64];
- size_t size = _countof(version);
- if (ReadValueFromRegistry(root_key, kChromeRegClientsKey, kChromeRegVersion,
- version, &size))
- return true;
- return false;
-}
-
-bool IsWinXPSp1OrLater(bool* is_vista_or_later) {
- OSVERSIONINFOEX osviex = { sizeof(OSVERSIONINFOEX) };
- int r = ::GetVersionEx((LPOSVERSIONINFO)&osviex);
- // If this failed we're on Win9X or a pre NT4SP6 OS.
- if (!r)
- return false;
-
- if (osviex.dwMajorVersion < 5)
- return false;
-
- if (osviex.dwMajorVersion > 5) {
- *is_vista_or_later = true;
- return true; // way beyond Windows XP;
- }
-
- if (osviex.dwMinorVersion >= 1 && osviex.wServicePackMajor >= 1)
- return true; // Windows XP SP1 or better.
-
- return false; // Windows 2000, WinXP no Service Pack.
-}
-
-// Note this function should not be called on old Windows versions where these
-// Windows API are not available. We always invoke this function after checking
-// that current OS is Vista or later.
-bool VerifyAdminGroup() {
- SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
- PSID Group;
- BOOL check = ::AllocateAndInitializeSid(&NtAuthority, 2,
- SECURITY_BUILTIN_DOMAIN_RID,
- DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0,
- 0, 0, 0,
- &Group);
- if (check) {
- if (!::CheckTokenMembership(NULL, Group, &check))
- check = FALSE;
- }
- ::FreeSid(Group);
- return (check == TRUE);
-}
-
-bool VerifyHKLMAccess(const wchar_t* sub_key) {
- HKEY root = HKEY_LOCAL_MACHINE;
- wchar_t str[] = L"test";
- bool result = false;
- DWORD disposition = 0;
- HKEY key = NULL;
-
- if (::RegCreateKeyEx(root, sub_key, 0, NULL,
- REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL,
- &key, &disposition) == ERROR_SUCCESS) {
- if (::RegSetValueEx(key, str, 0, REG_SZ, (LPBYTE)str,
- (DWORD)lstrlen(str)) == ERROR_SUCCESS) {
- result = true;
- RegDeleteValue(key, str);
- }
-
- // If we create the main key, delete the entire key.
- if (disposition == REG_CREATED_NEW_KEY)
- RegDeleteKey(key, NULL);
-
- RegCloseKey(key);
- }
-
- return result;
-}
-
-bool IsRunningElevated() {
- // This method should be called only for Vista or later.
- bool is_vista_or_later = false;
- IsWinXPSp1OrLater(&is_vista_or_later);
- if (!is_vista_or_later || !VerifyAdminGroup())
- return false;
-
- HANDLE process_token;
- if (!::OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &process_token))
- return false;
-
- TOKEN_ELEVATION_TYPE elevation_type = TokenElevationTypeDefault;
- DWORD size_returned = 0;
- if (!::GetTokenInformation(process_token, TokenElevationType,
- &elevation_type, sizeof(elevation_type),
- &size_returned)) {
- ::CloseHandle(process_token);
- return false;
- }
-
- ::CloseHandle(process_token);
- return (elevation_type == TokenElevationTypeFull);
-}
-
-bool GetUserIdForProcess(size_t pid, wchar_t** user_sid) {
- HANDLE process_handle = ::OpenProcess(PROCESS_QUERY_INFORMATION, TRUE, pid);
- if (process_handle == NULL)
- return false;
-
- HANDLE process_token;
- bool result = false;
- if (::OpenProcessToken(process_handle, TOKEN_QUERY, &process_token)) {
- DWORD size = 0;
- ::GetTokenInformation(process_token, TokenUser, NULL, 0, &size);
- if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
- ::GetLastError() == ERROR_SUCCESS) {
- DWORD actual_size = 0;
- BYTE* token_user = new BYTE[size];
- if ((::GetTokenInformation(process_token, TokenUser, token_user, size,
- &actual_size)) &&
- (actual_size <= size)) {
- PSID sid = reinterpret_cast<TOKEN_USER*>(token_user)->User.Sid;
- if (::ConvertSidToStringSid(sid, user_sid))
- result = true;
- }
- delete[] token_user;
- }
- ::CloseHandle(process_token);
- }
- ::CloseHandle(process_handle);
- return result;
-}
-} // namespace
-
-#pragma comment(linker, "/EXPORT:GoogleChromeCompatibilityCheck=_GoogleChromeCompatibilityCheck@8,PRIVATE")
-DLLEXPORT BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag, DWORD *reasons) {
- DWORD local_reasons = 0;
-
- bool is_vista_or_later = false;
- // System requirements?
- if (!IsWinXPSp1OrLater(&is_vista_or_later))
- local_reasons |= GCCC_ERROR_OSNOTSUPPORTED;
-
- if (IsChromeInstalled(HKEY_LOCAL_MACHINE))
- local_reasons |= GCCC_ERROR_SYSTEMLEVELALREADYPRESENT;
-
- if (IsChromeInstalled(HKEY_CURRENT_USER))
- local_reasons |= GCCC_ERROR_USERLEVELALREADYPRESENT;
-
- if (!VerifyHKLMAccess(kChromeRegClientsKey)) {
- local_reasons |= GCCC_ERROR_ACCESSDENIED;
- } else if (is_vista_or_later && !VerifyAdminGroup()) {
- // For Vista or later check for elevation since even for admin user we could
- // be running in non-elevated mode. We require integrity level High.
- local_reasons |= GCCC_ERROR_INTEGRITYLEVEL;
- }
-
- // First clean up the registry keys left over previously.
- // Then only check whether we can re-offer, if everything else is OK.
- CleanUpRegistryValues();
- if (local_reasons == 0 && !CanReOfferChrome(set_flag))
- local_reasons |= GCCC_ERROR_ALREADYOFFERED;
-
- // Done. Copy/return results.
- if (reasons != NULL)
- *reasons = local_reasons;
-
- return (*reasons == 0);
-}
-
-#pragma comment(linker, "/EXPORT:LaunchGoogleChrome=_LaunchGoogleChrome@0,PRIVATE")
-DLLEXPORT BOOL __stdcall LaunchGoogleChrome() {
- wchar_t launch_cmd[MAX_PATH];
- size_t size = _countof(launch_cmd);
- if (!ReadValueFromRegistry(HKEY_LOCAL_MACHINE, kChromeRegClientStateKey,
- kChromeRegLastLaunchCmd, launch_cmd, &size)) {
- size = _countof(launch_cmd);
- if (!ReadValueFromRegistry(HKEY_LOCAL_MACHINE, kChromeRegClientStateKey,
- kChromeRegLaunchCmd, launch_cmd, &size)) {
- return false;
- }
- }
-
- HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
- if (hr != S_OK) {
- if (hr == S_FALSE)
- ::CoUninitialize();
- return false;
- }
-
- if (::CoInitializeSecurity(NULL, -1, NULL, NULL,
- RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
- RPC_C_IMP_LEVEL_IDENTIFY, NULL,
- EOAC_DYNAMIC_CLOAKING, NULL) != S_OK) {
- ::CoUninitialize();
- return false;
- }
-
- bool impersonation_success = false;
- if (IsRunningElevated()) {
- wchar_t* curr_proc_sid;
- if (!GetUserIdForProcess(GetCurrentProcessId(), &curr_proc_sid)) {
- ::CoUninitialize();
- return false;
- }
-
- DWORD pid = 0;
- ::GetWindowThreadProcessId(::GetShellWindow(), &pid);
- if (pid <= 0) {
- ::LocalFree(curr_proc_sid);
- ::CoUninitialize();
- return false;
- }
-
- wchar_t* exp_proc_sid;
- if (GetUserIdForProcess(pid, &exp_proc_sid)) {
- if (_wcsicmp(curr_proc_sid, exp_proc_sid) == 0) {
- HANDLE process_handle = ::OpenProcess(
- PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION, TRUE, pid);
- if (process_handle != NULL) {
- HANDLE process_token;
- HANDLE user_token;
- if (::OpenProcessToken(process_handle, TOKEN_DUPLICATE | TOKEN_QUERY,
- &process_token) &&
- ::DuplicateTokenEx(process_token,
- TOKEN_IMPERSONATE | TOKEN_QUERY |
- TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE,
- NULL, SecurityImpersonation,
- TokenPrimary, &user_token) &&
- (::ImpersonateLoggedOnUser(user_token) != 0)) {
- impersonation_success = true;
- }
- ::CloseHandle(user_token);
- ::CloseHandle(process_token);
- ::CloseHandle(process_handle);
- }
- }
- ::LocalFree(exp_proc_sid);
- }
-
- ::LocalFree(curr_proc_sid);
- if (!impersonation_success) {
- ::CoUninitialize();
- return false;
- }
- }
-
- bool ret = false;
- CComPtr<IProcessLauncher> ipl;
- if (!FAILED(ipl.CoCreateInstance(__uuidof(ProcessLauncherClass), NULL,
- CLSCTX_LOCAL_SERVER))) {
- if (!FAILED(ipl->LaunchCmdLine(launch_cmd)))
- ret = true;
- ipl.Release();
- }
-
- if (impersonation_success)
- ::RevertToSelf();
- ::CoUninitialize();
- return ret;
-}
+// Copyright (c) 2006-2008 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/installer/gcapi/gcapi.h"
+
+#include <atlbase.h>
+#include <atlcom.h>
+#include <windows.h>
+#include <sddl.h>
+#include <stdlib.h>
+#include <strsafe.h>
+#include <tlhelp32.h>
+
+#include "google_update_idl.h"
+
+namespace {
+
+const wchar_t kChromeRegClientsKey[] = L"Software\\Google\\Update\\Clients\\{8A69D345-D564-463c-AFF1-A69D9E530F96}";
+const wchar_t kChromeRegClientStateKey[] = L"Software\\Google\\Update\\ClientState\\{8A69D345-D564-463c-AFF1-A69D9E530F96}";
+const wchar_t kChromeRegLaunchCmd[] = L"InstallerSuccessLaunchCmdLine";
+const wchar_t kChromeRegLastLaunchCmd[] = L"LastInstallerSuccessLaunchCmdLine";
+const wchar_t kChromeRegVersion[] = L"pv";
+const wchar_t kNoChromeOfferUntil[] = L"SOFTWARE\\Google\\No Chrome Offer Until";
+
+// Remove any registry key with non-numeric value or with the numeric value
+// equal or less than today's date represented in YYYYMMDD form.
+void CleanUpRegistryValues() {
+ HKEY key = NULL;
+ if (::RegOpenKeyEx(HKEY_LOCAL_MACHINE, kNoChromeOfferUntil,
+ 0, KEY_ALL_ACCESS, &key) != ERROR_SUCCESS)
+ return;
+
+ DWORD index = 0;
+ wchar_t value_name[260];
+ DWORD value_name_len = _countof(value_name);
+ DWORD value_type = REG_DWORD;
+ DWORD value_data = 0;
+ DWORD value_len = sizeof(DWORD);
+
+ // First, remove any value whose type is not DWORD.
+ while (::RegEnumValue(key, index, value_name, &value_name_len, NULL,
+ &value_type, NULL, &value_len) == ERROR_SUCCESS) {
+ if (value_type == REG_DWORD)
+ index++;
+ else
+ ::RegDeleteValue(key, value_name);
+
+ value_name_len = _countof(value_name);
+ value_type = REG_DWORD;
+ value_len = sizeof(DWORD);
+ }
+
+ // Get today's date, and format it as YYYYMMDD numeric value.
+ SYSTEMTIME now;
+ ::GetLocalTime(&now);
+ DWORD expiration_date = now.wYear * 10000 + now.wMonth * 100 + now.wDay;
+
+ // Remove any DWORD value smaller than the number represent the
+ // expiration date (YYYYMMDD).
+ index = 0;
+ while (::RegEnumValue(key, index, value_name, &value_name_len, NULL,
+ &value_type, (LPBYTE) &value_data,
+ &value_len) == ERROR_SUCCESS) {
+ if (value_type == REG_DWORD && value_data > expiration_date)
+ index++; // move on to next value.
+ else
+ ::RegDeleteValue(key, value_name); // delete this value.
+
+ value_name_len = _countof(value_name);
+ value_type = REG_DWORD;
+ value_data = 0;
+ value_len = sizeof(DWORD);
+ }
+
+ ::RegCloseKey(key);
+}
+
+// Return the company name specified in the file version info resource.
+bool GetCompanyName(const wchar_t* filename, wchar_t* buffer, DWORD out_len) {
+ wchar_t file_version_info[8192];
+ DWORD handle = 0;
+ DWORD buffer_size = 0;
+
+ buffer_size = ::GetFileVersionInfoSize(filename, &handle);
+ // Cannot stats the file or our buffer size is too small (very unlikely).
+ if (buffer_size == 0 || buffer_size > _countof(file_version_info))
+ return false;
+
+ buffer_size = _countof(file_version_info);
+ memset(file_version_info, 0, buffer_size);
+ if (!::GetFileVersionInfo(filename, handle, buffer_size, file_version_info))
+ return false;
+
+ DWORD data_len = 0;
+ LPVOID data = NULL;
+ // Retrieve the language and codepage code if exists.
+ buffer_size = 0;
+ if (!::VerQueryValue(file_version_info, TEXT("\\VarFileInfo\\Translation"),
+ reinterpret_cast<LPVOID *>(&data), reinterpret_cast<UINT *>(&data_len)))
+ return false;
+ if (data_len != 4)
+ return false;
+
+ wchar_t info_name[256];
+ DWORD lang = 0;
+ // Formulate the string to retrieve the company name of the specific
+ // language codepage.
+ memcpy(&lang, data, 4);
+ ::StringCchPrintf(info_name, _countof(info_name),
+ L"\\StringFileInfo\\%02X%02X%02X%02X\\CompanyName",
+ (lang & 0xff00)>>8, (lang & 0xff), (lang & 0xff000000)>>24,
+ (lang & 0xff0000)>>16);
+
+ data_len = 0;
+ if (!::VerQueryValue(file_version_info, info_name,
+ reinterpret_cast<LPVOID *>(&data), reinterpret_cast<UINT *>(&data_len)))
+ return false;
+ if (data_len <= 0 || data_len >= out_len)
+ return false;
+
+ memset(buffer, 0, out_len);
+ ::StringCchCopyN(buffer, out_len, (const wchar_t*)data, data_len);
+ return true;
+}
+
+// Return true if we can re-offer Chrome; false, otherwise.
+// Each partner can only offer Chrome once every six months.
+bool CanReOfferChrome(BOOL set_flag) {
+ wchar_t filename[MAX_PATH+1];
+ wchar_t company[MAX_PATH];
+
+ // If we cannot retrieve the version info of the executable or company
+ // name, we allow the Chrome to be offered because there is no past
+ // history to be found.
+ if (::GetModuleFileName(NULL, filename, MAX_PATH) == 0)
+ return true;
+ if (!GetCompanyName(filename, company, sizeof(company)))
+ return true;
+
+ bool can_re_offer = true;
+ DWORD disposition = 0;
+ HKEY key = NULL;
+ if (::RegCreateKeyEx(HKEY_LOCAL_MACHINE, kNoChromeOfferUntil,
+ 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE,
+ NULL, &key, &disposition) == ERROR_SUCCESS) {
+ // Cannot re-offer, if the timer already exists and is not expired yet.
+ if (::RegQueryValueEx(key, company, 0, 0, 0, 0) == ERROR_SUCCESS) {
+ // The expired timers were already removed in CleanUpRegistryValues.
+ // So if the key is not found, we can offer the Chrome.
+ can_re_offer = false;
+ } else if (set_flag) {
+ // Set expiration date for offer as six months from today,
+ // represented as a YYYYMMDD numeric value.
+ SYSTEMTIME timer;
+ ::GetLocalTime(&timer);
+ timer.wMonth = timer.wMonth + 6;
+ if (timer.wMonth > 12) {
+ timer.wMonth = timer.wMonth - 12;
+ timer.wYear = timer.wYear + 1;
+ }
+ DWORD value = timer.wYear * 10000 + timer.wMonth * 100 + timer.wDay;
+ ::RegSetValueEx(key, company, 0, REG_DWORD, (LPBYTE)&value, sizeof(DWORD));
+ }
+
+ ::RegCloseKey(key);
+ }
+
+ return can_re_offer;
+}
+
+// Helper function to read a value from registry. Returns true if value
+// is read successfully and stored in parameter value. Returns false otherwise.
+bool ReadValueFromRegistry(HKEY root_key, const wchar_t *sub_key,
+ const wchar_t *value_name, wchar_t *value,
+ size_t *size) {
+ HKEY key;
+ if ((::RegOpenKeyEx(root_key, sub_key, NULL,
+ KEY_READ, &key) == ERROR_SUCCESS) &&
+ (::RegQueryValueEx(key, value_name, NULL, NULL,
+ reinterpret_cast<LPBYTE>(value),
+ reinterpret_cast<LPDWORD>(size)) == ERROR_SUCCESS)) {
+ ::RegCloseKey(key);
+ return true;
+ }
+ return false;
+}
+
+bool IsChromeInstalled(HKEY root_key) {
+ wchar_t version[64];
+ size_t size = _countof(version);
+ if (ReadValueFromRegistry(root_key, kChromeRegClientsKey, kChromeRegVersion,
+ version, &size))
+ return true;
+ return false;
+}
+
+bool IsWinXPSp1OrLater(bool* is_vista_or_later) {
+ OSVERSIONINFOEX osviex = { sizeof(OSVERSIONINFOEX) };
+ int r = ::GetVersionEx((LPOSVERSIONINFO)&osviex);
+ // If this failed we're on Win9X or a pre NT4SP6 OS.
+ if (!r)
+ return false;
+
+ if (osviex.dwMajorVersion < 5)
+ return false;
+
+ if (osviex.dwMajorVersion > 5) {
+ *is_vista_or_later = true;
+ return true; // way beyond Windows XP;
+ }
+
+ if (osviex.dwMinorVersion >= 1 && osviex.wServicePackMajor >= 1)
+ return true; // Windows XP SP1 or better.
+
+ return false; // Windows 2000, WinXP no Service Pack.
+}
+
+// Note this function should not be called on old Windows versions where these
+// Windows API are not available. We always invoke this function after checking
+// that current OS is Vista or later.
+bool VerifyAdminGroup() {
+ SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
+ PSID Group;
+ BOOL check = ::AllocateAndInitializeSid(&NtAuthority, 2,
+ SECURITY_BUILTIN_DOMAIN_RID,
+ DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0,
+ 0, 0, 0,
+ &Group);
+ if (check) {
+ if (!::CheckTokenMembership(NULL, Group, &check))
+ check = FALSE;
+ }
+ ::FreeSid(Group);
+ return (check == TRUE);
+}
+
+bool VerifyHKLMAccess(const wchar_t* sub_key) {
+ HKEY root = HKEY_LOCAL_MACHINE;
+ wchar_t str[] = L"test";
+ bool result = false;
+ DWORD disposition = 0;
+ HKEY key = NULL;
+
+ if (::RegCreateKeyEx(root, sub_key, 0, NULL,
+ REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL,
+ &key, &disposition) == ERROR_SUCCESS) {
+ if (::RegSetValueEx(key, str, 0, REG_SZ, (LPBYTE)str,
+ (DWORD)lstrlen(str)) == ERROR_SUCCESS) {
+ result = true;
+ RegDeleteValue(key, str);
+ }
+
+ // If we create the main key, delete the entire key.
+ if (disposition == REG_CREATED_NEW_KEY)
+ RegDeleteKey(key, NULL);
+
+ RegCloseKey(key);
+ }
+
+ return result;
+}
+
+bool IsRunningElevated() {
+ // This method should be called only for Vista or later.
+ bool is_vista_or_later = false;
+ IsWinXPSp1OrLater(&is_vista_or_later);
+ if (!is_vista_or_later || !VerifyAdminGroup())
+ return false;
+
+ HANDLE process_token;
+ if (!::OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &process_token))
+ return false;
+
+ TOKEN_ELEVATION_TYPE elevation_type = TokenElevationTypeDefault;
+ DWORD size_returned = 0;
+ if (!::GetTokenInformation(process_token, TokenElevationType,
+ &elevation_type, sizeof(elevation_type),
+ &size_returned)) {
+ ::CloseHandle(process_token);
+ return false;
+ }
+
+ ::CloseHandle(process_token);
+ return (elevation_type == TokenElevationTypeFull);
+}
+
+bool GetUserIdForProcess(size_t pid, wchar_t** user_sid) {
+ HANDLE process_handle = ::OpenProcess(PROCESS_QUERY_INFORMATION, TRUE, pid);
+ if (process_handle == NULL)
+ return false;
+
+ HANDLE process_token;
+ bool result = false;
+ if (::OpenProcessToken(process_handle, TOKEN_QUERY, &process_token)) {
+ DWORD size = 0;
+ ::GetTokenInformation(process_token, TokenUser, NULL, 0, &size);
+ if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
+ ::GetLastError() == ERROR_SUCCESS) {
+ DWORD actual_size = 0;
+ BYTE* token_user = new BYTE[size];
+ if ((::GetTokenInformation(process_token, TokenUser, token_user, size,
+ &actual_size)) &&
+ (actual_size <= size)) {
+ PSID sid = reinterpret_cast<TOKEN_USER*>(token_user)->User.Sid;
+ if (::ConvertSidToStringSid(sid, user_sid))
+ result = true;
+ }
+ delete[] token_user;
+ }
+ ::CloseHandle(process_token);
+ }
+ ::CloseHandle(process_handle);
+ return result;
+}
+} // namespace
+
+#pragma comment(linker, "/EXPORT:GoogleChromeCompatibilityCheck=_GoogleChromeCompatibilityCheck@8,PRIVATE")
+DLLEXPORT BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag, DWORD *reasons) {
+ DWORD local_reasons = 0;
+
+ bool is_vista_or_later = false;
+ // System requirements?
+ if (!IsWinXPSp1OrLater(&is_vista_or_later))
+ local_reasons |= GCCC_ERROR_OSNOTSUPPORTED;
+
+ if (IsChromeInstalled(HKEY_LOCAL_MACHINE))
+ local_reasons |= GCCC_ERROR_SYSTEMLEVELALREADYPRESENT;
+
+ if (IsChromeInstalled(HKEY_CURRENT_USER))
+ local_reasons |= GCCC_ERROR_USERLEVELALREADYPRESENT;
+
+ if (!VerifyHKLMAccess(kChromeRegClientsKey)) {
+ local_reasons |= GCCC_ERROR_ACCESSDENIED;
+ } else if (is_vista_or_later && !VerifyAdminGroup()) {
+ // For Vista or later check for elevation since even for admin user we could
+ // be running in non-elevated mode. We require integrity level High.
+ local_reasons |= GCCC_ERROR_INTEGRITYLEVEL;
+ }
+
+ // First clean up the registry keys left over previously.
+ // Then only check whether we can re-offer, if everything else is OK.
+ CleanUpRegistryValues();
+ if (local_reasons == 0 && !CanReOfferChrome(set_flag))
+ local_reasons |= GCCC_ERROR_ALREADYOFFERED;
+
+ // Done. Copy/return results.
+ if (reasons != NULL)
+ *reasons = local_reasons;
+
+ return (*reasons == 0);
+}
+
+#pragma comment(linker, "/EXPORT:LaunchGoogleChrome=_LaunchGoogleChrome@0,PRIVATE")
+DLLEXPORT BOOL __stdcall LaunchGoogleChrome() {
+ wchar_t launch_cmd[MAX_PATH];
+ size_t size = _countof(launch_cmd);
+ if (!ReadValueFromRegistry(HKEY_LOCAL_MACHINE, kChromeRegClientStateKey,
+ kChromeRegLastLaunchCmd, launch_cmd, &size)) {
+ size = _countof(launch_cmd);
+ if (!ReadValueFromRegistry(HKEY_LOCAL_MACHINE, kChromeRegClientStateKey,
+ kChromeRegLaunchCmd, launch_cmd, &size)) {
+ return false;
+ }
+ }
+
+ HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+ if (hr != S_OK) {
+ if (hr == S_FALSE)
+ ::CoUninitialize();
+ return false;
+ }
+
+ if (::CoInitializeSecurity(NULL, -1, NULL, NULL,
+ RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
+ RPC_C_IMP_LEVEL_IDENTIFY, NULL,
+ EOAC_DYNAMIC_CLOAKING, NULL) != S_OK) {
+ ::CoUninitialize();
+ return false;
+ }
+
+ bool impersonation_success = false;
+ if (IsRunningElevated()) {
+ wchar_t* curr_proc_sid;
+ if (!GetUserIdForProcess(GetCurrentProcessId(), &curr_proc_sid)) {
+ ::CoUninitialize();
+ return false;
+ }
+
+ DWORD pid = 0;
+ ::GetWindowThreadProcessId(::GetShellWindow(), &pid);
+ if (pid <= 0) {
+ ::LocalFree(curr_proc_sid);
+ ::CoUninitialize();
+ return false;
+ }
+
+ wchar_t* exp_proc_sid;
+ if (GetUserIdForProcess(pid, &exp_proc_sid)) {
+ if (_wcsicmp(curr_proc_sid, exp_proc_sid) == 0) {
+ HANDLE process_handle = ::OpenProcess(
+ PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION, TRUE, pid);
+ if (process_handle != NULL) {
+ HANDLE process_token;
+ HANDLE user_token;
+ if (::OpenProcessToken(process_handle, TOKEN_DUPLICATE | TOKEN_QUERY,
+ &process_token) &&
+ ::DuplicateTokenEx(process_token,
+ TOKEN_IMPERSONATE | TOKEN_QUERY |
+ TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE,
+ NULL, SecurityImpersonation,
+ TokenPrimary, &user_token) &&
+ (::ImpersonateLoggedOnUser(user_token) != 0)) {
+ impersonation_success = true;
+ }
+ ::CloseHandle(user_token);
+ ::CloseHandle(process_token);
+ ::CloseHandle(process_handle);
+ }
+ }
+ ::LocalFree(exp_proc_sid);
+ }
+
+ ::LocalFree(curr_proc_sid);
+ if (!impersonation_success) {
+ ::CoUninitialize();
+ return false;
+ }
+ }
+
+ bool ret = false;
+ CComPtr<IProcessLauncher> ipl;
+ if (!FAILED(ipl.CoCreateInstance(__uuidof(ProcessLauncherClass), NULL,
+ CLSCTX_LOCAL_SERVER))) {
+ if (!FAILED(ipl->LaunchCmdLine(launch_cmd)))
+ ret = true;
+ ipl.Release();
+ }
+
+ if (impersonation_success)
+ ::RevertToSelf();
+ ::CoUninitialize();
+ return ret;
+}
diff --git a/chrome/installer/gcapi/gcapi.h b/chrome/installer/gcapi/gcapi.h
index 6ee4557..4d45d30 100644
--- a/chrome/installer/gcapi/gcapi.h
+++ b/chrome/installer/gcapi/gcapi.h
@@ -23,9 +23,9 @@ extern "C" {
// for the reason, you can pass NULL for reasons.
// set_flag indicates whether a flag should be set indicating that Chrome was
// offered within the last six months; if passed FALSE, this method will not
-// set the flag even if Chrome can be offered. If passed TRUE, this method
+// set the flag even if Chrome can be offered. If passed TRUE, this method
// will set the flag only if Chrome can be offered.
-DLLEXPORT BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag,
+DLLEXPORT BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag,
DWORD *reasons);
// This function launches Google Chrome after a successful install. Make
@@ -36,6 +36,6 @@ DLLEXPORT BOOL __stdcall LaunchGoogleChrome();
// Funtion pointer type declarations to use with GetProcAddress.
typedef BOOL (__stdcall * GCCC_CompatibilityCheck)(BOOL, DWORD *);
typedef BOOL (__stdcall * GCCC_LaunchGC)(HANDLE *);
-} // extern "C"
+} // extern "C"
#endif // # CHROME_INSTALLER_GCAPI_GCAPI_H_
diff --git a/chrome/installer/gcapi/gcapi_test.cc b/chrome/installer/gcapi/gcapi_test.cc
index 268033d..838397cd 100644
--- a/chrome/installer/gcapi/gcapi_test.cc
+++ b/chrome/installer/gcapi/gcapi_test.cc
@@ -14,9 +14,9 @@ void call_statically() {
// running this twice verifies that the first call does not set
// a flag that would make the second fail. Thus, the results
// of the two calls should be the same (no state should have changed)
- result_flag_off = GoogleChromeCompatibilityCheck(FALSE, &reason);
+ result_flag_off = GoogleChromeCompatibilityCheck(FALSE, &reason);
result_flag_on = GoogleChromeCompatibilityCheck(TRUE, &reason);
-
+
if (result_flag_off != result_flag_on)
printf("Registry key flag is not being set properly.");
@@ -30,7 +30,7 @@ void call_dynamically() {
printf("Couldn't load gcapi_dll.dll.\n");
return;
}
-
+
GCCC_CompatibilityCheck gccfn = (GCCC_CompatibilityCheck) GetProcAddress(
module, "GoogleChromeCompatibilityCheck");
if (gccfn != NULL) {
diff --git a/chrome/installer/gcapi/resource.h b/chrome/installer/gcapi/resource.h
index 8295c6c..3b9f419 100644
--- a/chrome/installer/gcapi/resource.h
+++ b/chrome/installer/gcapi/resource.h
@@ -1,14 +1,14 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by gcapi_test.rc
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 101
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1001
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by gcapi_test.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/chrome/installer/mini_installer/mini_installer.cc b/chrome/installer/mini_installer/mini_installer.cc
index d81c992..6c659be 100644
--- a/chrome/installer/mini_installer/mini_installer.cc
+++ b/chrome/installer/mini_installer/mini_installer.cc
@@ -405,7 +405,7 @@ int WMain(HMODULE module) {
if (!RunSetup(have_upacked_setup, base_path,
archive_name, &setup_exit_code)) {
return setup_exit_code;
- }
+ }
wchar_t value[4];
if ((!ReadValueFromRegistry(HKEY_CURRENT_USER, kCleanupRegistryKey,
diff --git a/chrome/installer/setup/main.cc b/chrome/installer/setup/main.cc
index fd2404a..6a2a170 100644
--- a/chrome/installer/setup/main.cc
+++ b/chrome/installer/setup/main.cc
@@ -252,7 +252,7 @@ int GetInstallOptions(const CommandLine& cmd_line) {
if (preferences & installer_util::MASTER_PROFILE_VERBOSE_LOGGING ||
cmd_line.HasSwitch(installer_util::switches::kVerboseLogging))
options |= installer_util::VERBOSE_LOGGING;
-
+
return options;
}
diff --git a/chrome/installer/util/copy_tree_work_item.cc b/chrome/installer/util/copy_tree_work_item.cc
index fc1d5e3..0b51f95 100644
--- a/chrome/installer/util/copy_tree_work_item.cc
+++ b/chrome/installer/util/copy_tree_work_item.cc
@@ -68,7 +68,7 @@ bool CopyTreeWorkItem::Do() {
(overwrite_option_ == WorkItem::IF_NOT_PRESENT)) {
// handle overwrite_option_ = IF_NOT_PRESENT case.
return true;
- }
+ }
// In all cases that reach here, move dest to a backup path.
if (dest_exist) {
diff --git a/chrome/installer/util/html_dialog.h b/chrome/installer/util/html_dialog.h
index 39b741d..46ed1c8 100644
--- a/chrome/installer/util/html_dialog.h
+++ b/chrome/installer/util/html_dialog.h
@@ -16,7 +16,7 @@
namespace installer {
-// Interface for implementing a native HTML dialog.
+// Interface for implementing a native HTML dialog.
class HTMLDialog {
public:
enum DialogResult {
@@ -44,7 +44,7 @@ class HTMLDialog {
// in HTML so each native implementation needs to map the user action into
// one of the 6 possible results of DialogResult. Important, call this
// method only from the main (or UI) thread.
- virtual DialogResult ShowModal(void* parent_window,
+ virtual DialogResult ShowModal(void* parent_window,
CustomizationCallback* callback) = 0;
// If the result of ShowModal() was EXTRA, the information is available
diff --git a/chrome/installer/util/html_dialog_impl.cc b/chrome/installer/util/html_dialog_impl.cc
index a758d42..8925016 100644
--- a/chrome/installer/util/html_dialog_impl.cc
+++ b/chrome/installer/util/html_dialog_impl.cc
@@ -32,7 +32,7 @@ namespace installer {
// <input name="accept" type="checkbox" /> My cool option
// <input name="submit" type="submit" value="[accept]" />
// </form>
-//
+//
// function submit_it(f) {
// if (f.accept.checked) {
// window.returnValue = 1; <-- this matches HTML_DLG_ACCEPT
@@ -85,7 +85,7 @@ HTMLDialogWin::CustomizationCallback* HTMLDialogWin::callback_ = NULL;
// This hook function gets called for messages bound to the windows that
// ShowHTMLDialog creates. We tell apart the top window because it has the
-// system menu style.
+// system menu style.
LRESULT HTMLDialogWin::MsgFilter(int code, WPARAM wParam, LPARAM lParam) {
static bool tweak_window = true;
if (lParam && tweak_window) {
@@ -113,7 +113,7 @@ bool HTMLDialogWin::InternalDoDialog(CustomizationCallback* callback,
IMoniker *url_moniker = NULL;
::CreateURLMoniker(NULL, url_.c_str(), &url_moniker);
- if (!url_moniker)
+ if (!url_moniker)
return false;
wchar_t* extra_args = NULL;
diff --git a/chrome/installer/util/prebuild/create_string_rc.py b/chrome/installer/util/prebuild/create_string_rc.py
index bb4e5a0..2c53380 100755
--- a/chrome/installer/util/prebuild/create_string_rc.py
+++ b/chrome/installer/util/prebuild/create_string_rc.py
@@ -150,7 +150,7 @@ def WriteHeaderFile(translated_strings, out_filename):
"""Writes a .h file with resource ids. This file can be included by the
executable to refer to identifiers."""
lines = []
-
+
# Write the values for how the languages ids are offset.
seen_languages = set()
offset_id = 0
@@ -180,7 +180,7 @@ def WriteHeaderFile(translated_strings, out_filename):
outfile.write('\n'.join(lines))
outfile.write('\n') # .rc files must end in a new line
outfile.close()
-
+
def main(argv):
translated_strings = CollectTranslatedStrings()
kFilebase = os.path.join(argv[1], 'installer_util_strings')
diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h
index 246a50f..b9d7275 100644
--- a/chrome/installer/util/util_constants.h
+++ b/chrome/installer/util/util_constants.h
@@ -16,8 +16,8 @@ enum InstallStatus {
INSTALL_REPAIRED, // Same version reinstalled for repair
NEW_VERSION_UPDATED, // Chrome successfully updated to new version
HIGHER_VERSION_EXISTS, // Higher version of Chrome already exists
- USER_LEVEL_INSTALL_EXISTS, // User level install already exists
- SYSTEM_LEVEL_INSTALL_EXISTS, // Machine level install already exists
+ USER_LEVEL_INSTALL_EXISTS, // User level install already exists
+ SYSTEM_LEVEL_INSTALL_EXISTS, // Machine level install already exists
INSTALL_FAILED, // Install/update failed
OS_NOT_SUPPORTED, // Current OS not supported
OS_ERROR, // OS API call failed
diff --git a/chrome/plugin/plugin_main.cc b/chrome/plugin/plugin_main.cc
index bc40fb9..7c56f24 100644
--- a/chrome/plugin/plugin_main.cc
+++ b/chrome/plugin/plugin_main.cc
@@ -18,7 +18,7 @@
// mainline routine for running as the plugin process
int PluginMain(const MainFunctionParams& parameters) {
const CommandLine& parsed_command_line = parameters.command_line_;
- sandbox::TargetServices* target_services =
+ sandbox::TargetServices* target_services =
parameters.sandbox_info_.TargetServices();
// The main thread of the plugin services IO.
diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc
index 671e977..891a9df 100644
--- a/chrome/plugin/plugin_thread.cc
+++ b/chrome/plugin/plugin_thread.cc
@@ -26,7 +26,7 @@ PluginThread::PluginThread()
: ChildThread(base::Thread::Options(MessageLoop::TYPE_UI, 0)),
preloaded_plugin_module_(NULL) {
plugin_path_ = FilePath::FromWStringHack(
- CommandLine::ForCurrentProcess()->GetSwitchValue(switches::kPluginPath));
+ CommandLine::ForCurrentProcess()->GetSwitchValue(switches::kPluginPath));
}
PluginThread::~PluginThread() {
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc
index b2041d4..023d807 100644
--- a/chrome/plugin/webplugin_delegate_stub.cc
+++ b/chrome/plugin/webplugin_delegate_stub.cc
@@ -80,8 +80,8 @@ void WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) {
OnDidFinishLoadWithReason)
IPC_MESSAGE_HANDLER(PluginMsg_SetFocus, OnSetFocus)
IPC_MESSAGE_HANDLER(PluginMsg_HandleEvent, OnHandleEvent)
- IPC_MESSAGE_HANDLER(PluginMsg_Paint, OnPaint)
- IPC_MESSAGE_HANDLER(PluginMsg_DidPaint, OnDidPaint)
+ IPC_MESSAGE_HANDLER(PluginMsg_Paint, OnPaint)
+ IPC_MESSAGE_HANDLER(PluginMsg_DidPaint, OnDidPaint)
IPC_MESSAGE_HANDLER(PluginMsg_Print, OnPrint)
IPC_MESSAGE_HANDLER(PluginMsg_GetPluginScriptableObject,
OnGetPluginScriptableObject)
diff --git a/chrome/renderer/dom_ui_bindings.h b/chrome/renderer/dom_ui_bindings.h
index 75b1385..2ef55e5 100644
--- a/chrome/renderer/dom_ui_bindings.h
+++ b/chrome/renderer/dom_ui_bindings.h
@@ -15,7 +15,7 @@ class DOMBoundBrowserObject : public CppBoundClass {
public:
DOMBoundBrowserObject() : routing_id_(0) { }
virtual ~DOMBoundBrowserObject();
-
+
// Set the message channel back to the browser.
void set_message_sender(IPC::Message::Sender* sender) {
sender_ = sender;
diff --git a/chrome/renderer/renderer_webkitclient_impl.cc b/chrome/renderer/renderer_webkitclient_impl.cc
index 1d69817..7a065f9 100644
--- a/chrome/renderer/renderer_webkitclient_impl.cc
+++ b/chrome/renderer/renderer_webkitclient_impl.cc
@@ -63,7 +63,7 @@ WebString RendererWebKitClientImpl::MimeRegistry::mimeTypeForExtension(
RenderThread::current()->Send(new ViewHostMsg_GetMimeTypeFromExtension(
webkit_glue::WebStringToFilePathString(file_extension), &mime_type));
return ASCIIToUTF16(mime_type);
-
+
}
WebString RendererWebKitClientImpl::MimeRegistry::mimeTypeFromFile(
@@ -78,7 +78,7 @@ WebString RendererWebKitClientImpl::MimeRegistry::mimeTypeFromFile(
FilePath(webkit_glue::WebStringToFilePathString(file_path)),
&mime_type));
return ASCIIToUTF16(mime_type);
-
+
}
WebString RendererWebKitClientImpl::MimeRegistry::preferredExtensionForMIMEType(
diff --git a/chrome/renderer/user_script_slave.cc b/chrome/renderer/user_script_slave.cc
index 10d4e43..bc612f0 100644
--- a/chrome/renderer/user_script_slave.cc
+++ b/chrome/renderer/user_script_slave.cc
@@ -13,7 +13,7 @@
#include "googleurl/src/gurl.h"
#include "webkit/glue/webframe.h"
-#include "grit/renderer_resources.h"
+#include "grit/renderer_resources.h"
// These two strings are injected before and after the Greasemonkey API and
// user script to wrap it in an anonymous scope.
diff --git a/chrome/renderer/webmediaplayer_delegate_impl.cc b/chrome/renderer/webmediaplayer_delegate_impl.cc
index fbadad0..81d0abc 100644
--- a/chrome/renderer/webmediaplayer_delegate_impl.cc
+++ b/chrome/renderer/webmediaplayer_delegate_impl.cc
@@ -60,7 +60,7 @@ WebMediaPlayerDelegateImpl::~WebMediaPlayerDelegateImpl() {
// Cancel all tasks posted on the main_loop_.
CancelAllTasks();
- // After cancelling all tasks, we are sure there will be no calls to
+ // After cancelling all tasks, we are sure there will be no calls to
// web_media_player_, so we are safe to delete it.
if (web_media_player_) {
delete web_media_player_;
@@ -147,7 +147,7 @@ void WebMediaPlayerDelegateImpl::SetVolume(float volume) {
pipeline_.SetVolume(volume);
}
-
+
void WebMediaPlayerDelegateImpl::SetVisible(bool visible) {
DCHECK(main_loop_ && MessageLoop::current() == main_loop_);
@@ -327,7 +327,7 @@ void WebMediaPlayerDelegateImpl::PostTask(int index,
WebMediaPlayerMethod method) {
DCHECK(main_loop_);
- AutoLock auto_lock(task_lock_);
+ AutoLock auto_lock(task_lock_);
if(!tasks_[index]) {
CancelableTask* task = new NotifyWebMediaPlayerTask(web_media_player_,
method);
diff --git a/chrome/renderer/webmediaplayer_delegate_impl.h b/chrome/renderer/webmediaplayer_delegate_impl.h
index 7266b41..95423c7 100644
--- a/chrome/renderer/webmediaplayer_delegate_impl.h
+++ b/chrome/renderer/webmediaplayer_delegate_impl.h
@@ -145,7 +145,7 @@ class WebMediaPlayerDelegateImpl : public webkit_glue::WebMediaPlayerDelegate,
RenderView* view() { return view_; }
private:
- // Methods for posting tasks and cancelling tasks. This method may lives in
+ // Methods for posting tasks and cancelling tasks. This method may lives in
// the main thread or the media threads.
void PostTask(int index, WebMediaPlayerMethod method);
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index e5cf44a..89a0c45 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -463,7 +463,7 @@ void WebPluginDelegateProxy::Paint(HDC hdc, const gfx::Rect& damaged_rect) {
rect.x()-plugin_rect_.x(), rect.y()-plugin_rect_.y(), SRCCOPY);
if (invalidate_pending_) {
- // Only send the PaintAck message if this paint is in response to an
+ // Only send the PaintAck message if this paint is in response to an
// invalidate from the plugin, since this message acts as an access token
// to ensure only one process is using the transport dib at a time.
invalidate_pending_ = false;
@@ -472,7 +472,7 @@ void WebPluginDelegateProxy::Paint(HDC hdc, const gfx::Rect& damaged_rect) {
}
bool WebPluginDelegateProxy::BackgroundChanged(
- HDC hdc,
+ HDC hdc,
const gfx::Rect& rect) {
HBITMAP hbitmap = static_cast<HBITMAP>(GetCurrentObject(hdc, OBJ_BITMAP));
if (hbitmap == NULL) {
diff --git a/chrome/renderer/webworker_proxy.h b/chrome/renderer/webworker_proxy.h
index 019ff0d..6967ea0 100644
--- a/chrome/renderer/webworker_proxy.h
+++ b/chrome/renderer/webworker_proxy.h
@@ -17,7 +17,7 @@ class Message;
}
// This class provides an implementation of WebWorker that the renderer provides
-// to the glue. This class converts function calls to IPC messages that are
+// to the glue. This class converts function calls to IPC messages that are
// dispatched in the worker process by WebWorkerClientProxy. It also receives
// IPC messages from WebWorkerClientProxy which it converts to function calls to
// WebWorkerClient.
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index 9e724f8..96c779a 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -74,7 +74,7 @@ IPC_BEGIN_MESSAGES(Automation)
// This message notifies the AutomationProvider to navigate to a specified
// url in the tab with given handle. The first parameter is the handle to
// the tab resource. The second parameter is the target url. The return
- // value contains a status code which is nonnegative on success.
+ // value contains a status code which is nonnegative on success.
// See AutomationMsg_NavigationResponseValues for the return value.
IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_NavigateToURL, int, GURL,
AutomationMsg_NavigationResponseValues)
@@ -128,7 +128,7 @@ IPC_BEGIN_MESSAGES(Automation)
// The return value contains the size of the title string. On error, this
// value should be -1 and empty string. Note that the title can be empty in
// which case the size would be 0.
- IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_TabTitle,
+ IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_TabTitle,
int,
int,
std::wstring)
@@ -798,7 +798,7 @@ IPC_BEGIN_MESSAGES(Automation)
// Queries whether an app modal dialog is currently being shown. (i.e. a
// javascript alert) and which buttons it contains.
- IPC_SYNC_MESSAGE_ROUTED0_2(AutomationMsg_ShowingAppModalDialog,
+ IPC_SYNC_MESSAGE_ROUTED0_2(AutomationMsg_ShowingAppModalDialog,
bool /* showing dialog */,
int /* view::DelegateDialog::DialogButton */)
diff --git a/chrome/test/data/extensions/bad/invalid_manifest/1/manifest.json b/chrome/test/data/extensions/bad/invalid_manifest/1/manifest.json
index 3aac2d6..0eb81fa 100644
--- a/chrome/test/data/extensions/bad/invalid_manifest/1/manifest.json
+++ b/chrome/test/data/extensions/bad/invalid_manifest/1/manifest.json
@@ -1 +1 @@
-I am not a manifest
+I am not a manifest
diff --git a/chrome/test/data/extensions/bad/missing_content_script/1/manifest.json b/chrome/test/data/extensions/bad/missing_content_script/1/manifest.json
index af1ea06..55e62a4 100644
--- a/chrome/test/data/extensions/bad/missing_content_script/1/manifest.json
+++ b/chrome/test/data/extensions/bad/missing_content_script/1/manifest.json
@@ -1,13 +1,13 @@
-{
- "format_version": 1,
- "id": "00123456789ABCDEF0123456789ABCDEF0123456",
- "version": "1.0.0.0",
- "name": "My extension 1",
- "description": "The first extension that I made.",
- "content_scripts": [
- {
- "matches": ["http://*.yahoo.com/*"],
- "files": ["script1.js"]
- }
- ]
-}
+{
+ "format_version": 1,
+ "id": "00123456789ABCDEF0123456789ABCDEF0123456",
+ "version": "1.0.0.0",
+ "name": "My extension 1",
+ "description": "The first extension that I made.",
+ "content_scripts": [
+ {
+ "matches": ["http://*.yahoo.com/*"],
+ "files": ["script1.js"]
+ }
+ ]
+}
diff --git a/chrome/test/data/extensions/good/extension1/1/manifest.json b/chrome/test/data/extensions/good/extension1/1/manifest.json
index 5a43dd0..bb8944b 100644
--- a/chrome/test/data/extensions/good/extension1/1/manifest.json
+++ b/chrome/test/data/extensions/good/extension1/1/manifest.json
@@ -1,17 +1,17 @@
-{
- "format_version": 1,
- "id": "00123456789ABCDEF0123456789ABCDEF0123456",
- "version": "1.0.0.0",
- "name": "My extension 1",
- "description": "The first extension that I made.",
- "content_scripts": [
- {
- "matches": ["http://*.google.com/*", "https://*.google.com/*"],
- "js": ["script1.js"]
- },
- {
- "matches": ["http://*.yahoo.com/*"],
- "js": ["script2.js"]
- }
- ]
-}
+{
+ "format_version": 1,
+ "id": "00123456789ABCDEF0123456789ABCDEF0123456",
+ "version": "1.0.0.0",
+ "name": "My extension 1",
+ "description": "The first extension that I made.",
+ "content_scripts": [
+ {
+ "matches": ["http://*.google.com/*", "https://*.google.com/*"],
+ "js": ["script1.js"]
+ },
+ {
+ "matches": ["http://*.yahoo.com/*"],
+ "js": ["script2.js"]
+ }
+ ]
+}
diff --git a/chrome/test/data/extensions/good/extension2/2/manifest.json b/chrome/test/data/extensions/good/extension2/2/manifest.json
index 5e1fb5a..d5bb394 100644
--- a/chrome/test/data/extensions/good/extension2/2/manifest.json
+++ b/chrome/test/data/extensions/good/extension2/2/manifest.json
@@ -1,7 +1,7 @@
-{
- "format_version": 1,
- "id": "10123456789ABCDEF0123456789ABCDEF0123456",
- "version": "1.0.0.0",
- "name": "My extension 2",
- "plugins_dir": "npapi"
-}
+{
+ "format_version": 1,
+ "id": "10123456789ABCDEF0123456789ABCDEF0123456",
+ "version": "1.0.0.0",
+ "name": "My extension 2",
+ "plugins_dir": "npapi"
+}
diff --git a/chrome/test/data/pref_service/overlay.json b/chrome/test/data/pref_service/overlay.json
index ea4d831..11c0293 100644
--- a/chrome/test/data/pref_service/overlay.json
+++ b/chrome/test/data/pref_service/overlay.json
@@ -1,22 +1,22 @@
-{
- "both": {
- "bool": false,
- "dictionary": {
- "value": "persistent"
- },
- "int": 1,
- "list": [ "persistent" ],
- "real": 1,
- "string": "persistent"
- },
- "persistent": {
- "bool": false,
- "dictionary": {
- "value": "persistent"
- },
- "int": 1,
- "list": [ "persistent" ],
- "real": 1.0,
- "string": "persistent"
- }
-}
+{
+ "both": {
+ "bool": false,
+ "dictionary": {
+ "value": "persistent"
+ },
+ "int": 1,
+ "list": [ "persistent" ],
+ "real": 1,
+ "string": "persistent"
+ },
+ "persistent": {
+ "bool": false,
+ "dictionary": {
+ "value": "persistent"
+ },
+ "int": 1,
+ "list": [ "persistent" ],
+ "real": 1.0,
+ "string": "persistent"
+ }
+}
diff --git a/chrome/test/data/safe_browsing/download_update.py b/chrome/test/data/safe_browsing/download_update.py
index ff504f8..bef5c6d 100755
--- a/chrome/test/data/safe_browsing/download_update.py
+++ b/chrome/test/data/safe_browsing/download_update.py
@@ -29,7 +29,7 @@ for line in response_file:
filename = chunk_url[chunk_url.rfind('/') + 1:]
filename = "%03d" % counter + filename[0:filename.rfind('_')]
counter += 1
-
+
urllib.urlretrieve(chunk_url, filename)
response_file.close()
diff --git a/chrome/test/debugger/debugger_unittests.py b/chrome/test/debugger/debugger_unittests.py
index 8384fb0..19db317 100755
--- a/chrome/test/debugger/debugger_unittests.py
+++ b/chrome/test/debugger/debugger_unittests.py
@@ -39,7 +39,7 @@ def RunTests(build_dir=None):
os.path.join(chrome_dir, "test", "debugger", "mjsunit.js"),
os.path.join(chrome_dir, "test", "debugger", "test_protocol.js")
]
- (retcode, output) = google.process_utils.RunCommandFull(cmd,
+ (retcode, output) = google.process_utils.RunCommandFull(cmd,
collect_output=True)
if "Success" in output:
return 0
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc
index aae695b..aec6391 100644
--- a/chrome/test/in_process_browser_test.cc
+++ b/chrome/test/in_process_browser_test.cc
@@ -143,7 +143,7 @@ Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) {
browser->AddTabWithURL(
GURL("about:blank"), GURL(), PageTransition::START_PAGE, true, NULL);
-
+
// Wait for the page to finish loading.
ui_test_utils::WaitForNavigation(
browser->GetSelectedTabContents()->controller());
diff --git a/chrome/test/interactive_ui/npapi_interactive_test.cc b/chrome/test/interactive_ui/npapi_interactive_test.cc
index 4ec2b86..95be3f6 100644
--- a/chrome/test/interactive_ui/npapi_interactive_test.cc
+++ b/chrome/test/interactive_ui/npapi_interactive_test.cc
@@ -41,14 +41,14 @@ const char kTestCompleteCookie[] = "status";
const char kTestCompleteSuccess[] = "OK";
const int kShortWaitTimeout = 5 * 1000;
-// Tests if a plugin executing a self deleting script in the context of
+// Tests if a plugin executing a self deleting script in the context of
// a synchronous mousemove works correctly
TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInvokeInSynchronousMouseMove) {
if (!UITest::in_process_renderer()) {
scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
HWND tab_window = NULL;
tab_proxy->GetHWND(&tab_window);
-
+
EXPECT_TRUE(IsWindow(tab_window));
show_window_ = true;
@@ -59,8 +59,8 @@ TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInvokeInSynchronousMouseMove) {
POINT cursor_position = {130, 130};
ClientToScreen(tab_window, &cursor_position);
- double screen_width = ::GetSystemMetrics( SM_CXSCREEN ) - 1;
- double screen_height = ::GetSystemMetrics( SM_CYSCREEN ) - 1;
+ double screen_width = ::GetSystemMetrics( SM_CXSCREEN ) - 1;
+ double screen_height = ::GetSystemMetrics( SM_CYSCREEN ) - 1;
double location_x = cursor_position.x * (65535.0f / screen_width);
double location_y = cursor_position.y * (65535.0f / screen_height);
diff --git a/chrome/test/interactive_ui/view_event_test_base.h b/chrome/test/interactive_ui/view_event_test_base.h
index 42a614b..673657c 100644
--- a/chrome/test/interactive_ui/view_event_test_base.h
+++ b/chrome/test/interactive_ui/view_event_test_base.h
@@ -81,7 +81,7 @@ class ViewEventTestBase : public views::WindowDelegate,
void Release() {}
protected:
- // Returns the view that is added to the window.
+ // Returns the view that is added to the window.
virtual views::View* CreateContentsView() = 0;
// Called once the message loop is running.
@@ -129,7 +129,7 @@ class ViewEventTestBase : public views::WindowDelegate,
DISALLOW_COPY_AND_ASSIGN(ViewEventTestBase);
};
-// Convenience macro for defining a ViewEventTestBase. See class description
+// Convenience macro for defining a ViewEventTestBase. See class description
// of ViewEventTestBase for details.
#define VIEW_TEST(test_class, name) \
TEST_F(test_class, name) {\
diff --git a/chrome/test/plugin/plugin_test.cpp b/chrome/test/plugin/plugin_test.cpp
index 0faaf8e..07e764a 100644
--- a/chrome/test/plugin/plugin_test.cpp
+++ b/chrome/test/plugin/plugin_test.cpp
@@ -193,7 +193,7 @@ class ActiveXTest : public PluginTest {
L"\\activex_test_control.dll";
HMODULE h = LoadLibrary(test_control_path.c_str());
ASSERT_TRUE(h != NULL) << "Failed to load activex_test_control.dll";
- const char* func_name = register_server ?
+ const char* func_name = register_server ?
"DllRegisterServer" : "DllUnregisterServer";
DllRegUnregServerFunc func = reinterpret_cast<DllRegUnregServerFunc>(
GetProcAddress(h, func_name));
diff --git a/chrome/test/test_location_bar.h b/chrome/test/test_location_bar.h
index 6f9b2ab..d81eb4a 100644
--- a/chrome/test/test_location_bar.h
+++ b/chrome/test/test_location_bar.h
@@ -39,7 +39,7 @@ class TestLocationBar : public LocationBar {
virtual void SaveStateToContents(TabContents* contents) {}
private:
-
+
// Test-supplied values that will be returned through the LocationBar
// interface.
std::wstring input_string_;
diff --git a/chrome/test/ui/npapi_test_helper.cc b/chrome/test/ui/npapi_test_helper.cc
index 83e3c5b..c6753d0 100644
--- a/chrome/test/ui/npapi_test_helper.cc
+++ b/chrome/test/ui/npapi_test_helper.cc
@@ -31,7 +31,7 @@
#include "chrome/test/ui/npapi_test_helper.h"
-NPAPITester::NPAPITester()
+NPAPITester::NPAPITester()
: UITest() {
}
@@ -41,7 +41,7 @@ void NPAPITester::SetUp() {
std::wstring plugins_directory = browser_directory_ + L"\\plugins";
std::wstring plugin_src = browser_directory_ + L"\\npapi_test_plugin.dll";
plugin_dll_ = plugins_directory + L"\\npapi_test_plugin.dll";
-
+
CreateDirectory(plugins_directory.c_str(), NULL);
CopyFile(plugin_src.c_str(), plugin_dll_.c_str(), FALSE);
diff --git a/chrome/test/ui/npapi_uitest.cpp b/chrome/test/ui/npapi_uitest.cpp
index d8dbdff..8d808be 100644
--- a/chrome/test/ui/npapi_uitest.cpp
+++ b/chrome/test/ui/npapi_uitest.cpp
@@ -72,7 +72,7 @@ TEST_F(NPAPITester, Arguments) {
std::wstring test_case = L"arguments.html";
GURL url = GetTestUrl(L"npapi", test_case);
NavigateToURL(url);
- WaitForFinish("arguments", "1", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "1", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
}
@@ -83,35 +83,35 @@ TEST_F(NPAPITester, ManyPlugins) {
GURL url(GetTestUrl(L"npapi", test_case));
NavigateToURL(url);
- WaitForFinish("arguments", "1", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "1", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
- WaitForFinish("arguments", "2", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "2", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
- WaitForFinish("arguments", "3", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "3", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
- WaitForFinish("arguments", "4", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "4", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
- WaitForFinish("arguments", "5", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "5", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
- WaitForFinish("arguments", "6", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "6", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
- WaitForFinish("arguments", "7", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "7", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
- WaitForFinish("arguments", "8", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "8", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
- WaitForFinish("arguments", "9", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "9", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
- WaitForFinish("arguments", "10", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "10", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
- WaitForFinish("arguments", "11", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "11", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
- WaitForFinish("arguments", "12", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "12", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
- WaitForFinish("arguments", "13", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "13", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
- WaitForFinish("arguments", "14", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "14", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
- WaitForFinish("arguments", "15", url, kTestCompleteCookie,
+ WaitForFinish("arguments", "15", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
}
@@ -120,17 +120,17 @@ TEST_F(NPAPITester, GetURL) {
std::wstring test_case = L"geturl.html";
GURL url = GetTestUrl(L"npapi", test_case);
NavigateToURL(url);
- WaitForFinish("geturl", "1", url, kTestCompleteCookie,
+ WaitForFinish("geturl", "1", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
}
-// Test various calls to GetURL for javascript URLs with
+// Test various calls to GetURL for javascript URLs with
// non NULL targets from a plugin.
TEST_F(NPAPITester, GetJavaScriptURL) {
std::wstring test_case = L"get_javascript_url.html";
GURL url = GetTestUrl(L"npapi", test_case);
NavigateToURL(url);
- WaitForFinish("getjavascripturl", "1", url, kTestCompleteCookie,
+ WaitForFinish("getjavascripturl", "1", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
}
@@ -142,13 +142,13 @@ TEST_F(NPAPITester, NPObjectProxy) {
std::wstring test_case = L"npobject_proxy.html";
GURL url = GetTestUrl(L"npapi", test_case);
NavigateToURL(url);
- WaitForFinish("npobject_proxy", "1", url, kTestCompleteCookie,
+ WaitForFinish("npobject_proxy", "1", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
}
// Tests if a plugin executing a self deleting script using NPN_GetURL
// works without crashing or hanging
-TEST_F(NPAPITester, SelfDeletePluginGetUrl) {
+TEST_F(NPAPITester, SelfDeletePluginGetUrl) {
std::wstring test_case = L"self_delete_plugin_geturl.html";
GURL url = GetTestUrl(L"npapi", test_case);
NavigateToURL(url);
@@ -186,7 +186,7 @@ TEST_F(NPAPITester, DISABLED_SelfDeletePluginInvokeAlert) {
kShortWaitTimeout);
}
-// Tests if a plugin executing a self deleting script in the context of
+// Tests if a plugin executing a self deleting script in the context of
// a synchronous paint event works correctly
TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInvokeInSynchronousPaint) {
if (!UITest::in_process_renderer()) {
@@ -218,7 +218,7 @@ TEST_F(NPAPIVisiblePluginTester, VerifyPluginWindowRect) {
std::wstring test_case = L"verify_plugin_window_rect.html";
GURL url = GetTestUrl(L"npapi", test_case);
NavigateToURL(url);
- WaitForFinish("checkwindowrect", "1", url, kTestCompleteCookie,
+ WaitForFinish("checkwindowrect", "1", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
}
@@ -238,7 +238,7 @@ TEST_F(NPAPIVisiblePluginTester, VerifyNPObjectLifetimeTest) {
TEST_F(NPAPIVisiblePluginTester, NewFails) {
GURL url = GetTestUrl(L"npapi", L"new_fails.html");
NavigateToURL(url);
- WaitForFinish("new_fails", "1", url, kTestCompleteCookie,
+ WaitForFinish("new_fails", "1", url, kTestCompleteCookie,
kTestCompleteSuccess, kShortWaitTimeout);
}
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc
index 7471711..af0932b2 100644
--- a/chrome/test/ui_test_utils.cc
+++ b/chrome/test/ui_test_utils.cc
@@ -54,7 +54,7 @@ class NavigationNotificationObserver : public NotificationObserver {
DISALLOW_COPY_AND_ASSIGN(NavigationNotificationObserver);
};
-} // namespace
+} // namespace
void RunMessageLoop() {
MessageLoopForUI* loop = MessageLoopForUI::current();
diff --git a/chrome/tools/automated_ui_test_tools/auto_ui_test_input_generator.py b/chrome/tools/automated_ui_test_tools/auto_ui_test_input_generator.py
index 7756028..7e3d3f9 100755
--- a/chrome/tools/automated_ui_test_tools/auto_ui_test_input_generator.py
+++ b/chrome/tools/automated_ui_test_tools/auto_ui_test_input_generator.py
@@ -4,69 +4,69 @@
"""This generates the input file for automated_ui_tests.exe.
-We take in a list of possible actions separated by new lines, the number of
-commands per file, and the number of actions per command, and generate
+We take in a list of possible actions separated by new lines, the number of
+commands per file, and the number of actions per command, and generate
a single random file, or one or more files containing all possible commands,
-or one file with a partial set of possible commands starting at a certain
+or one file with a partial set of possible commands starting at a certain
command number.
-Example usage:
- python auto_ui_test_input_generator.py --commands-per-file 50
- --actions-per-command 5 --action-list-file possible_actions.txt
+Example usage:
+ python auto_ui_test_input_generator.py --commands-per-file 50
+ --actions-per-command 5 --action-list-file possible_actions.txt
--output random_file.txt
-
- Generates a file called random_file.txt with 50 commands containing 5 actions
- each randomly chosen from the list of new line separated actions in
+
+ Generates a file called random_file.txt with 50 commands containing 5 actions
+ each randomly chosen from the list of new line separated actions in
possible_actions.txt
-
- python auto_ui_test_input_generator.py --commands-per-file 200
+
+ python auto_ui_test_input_generator.py --commands-per-file 200
--actions-per-command 6 --partial-coverage-from 700
- --action-list-file possible_actions.txt
+ --action-list-file possible_actions.txt
--output partial_coverage.txt
-
- Generates a file called partial_coverage.txt with 200 commands containing 6
+
+ Generates a file called partial_coverage.txt with 200 commands containing 6
actions each starting at command #700 and ending at command #899 and chosen
from the list of new line separated actions possible_actions.txt
-
-Options:
- --action-list-file input_file_name
- Name of file containing possible actions separated by new lines. You can
+
+Options:
+ --action-list-file input_file_name
+ Name of file containing possible actions separated by new lines. You can
find supported actions in the automated_ui_tests.h documentation.
-
- --output output_file_name
- Name of XML file that will be outputted for use as input for
+
+ --output output_file_name
+ Name of XML file that will be outputted for use as input for
automated_ui_tests.exe.
-
- --commands-per-file commands_per_file
+
+ --commands-per-file commands_per_file
Number of commands per file.
-
- --actions-per-command actions_per_command
+
+ --actions-per-command actions_per_command
Number of actions per command.
-
- --full-coverage
- If full_coverage flag is set will output as many files as neccesary to cover
- every combination of possible actions. Files will be named
- output_file_name_1.txt, output_file_name_2.txt, etc...
+
+ --full-coverage
+ If full_coverage flag is set will output as many files as neccesary to cover
+ every combination of possible actions. Files will be named
+ output_file_name_1.txt, output_file_name_2.txt, etc...
If --full-coverage is true, --full-coverage-one-file and
--partial-coverage-from are ignored.
-
+
--full-coverage-one-file
- Just like --full_coverage, but outputs to just one file.
- Ignores commands_per_file. This is very likely to cause memory errors on
+ Just like --full_coverage, but outputs to just one file.
+ Ignores commands_per_file. This is very likely to cause memory errors on
large action sets. If --full coverage-one-file is true,
--partial-coverage-from is ignored.
-
- --partial-coverage-from command_to_start_at
- Outputs a part of the full coverage, starting at command number
- |command_to_start_at| and ending at command number |command_to_start_at| +
- |commands_per_file|. Command numbering starts at 0, and the maximum
+
+ --partial-coverage-from command_to_start_at
+ Outputs a part of the full coverage, starting at command number
+ |command_to_start_at| and ending at command number |command_to_start_at| +
+ |commands_per_file|. Command numbering starts at 0, and the maximum
command number is number_of_actions_we_choose_from ^ actions_per_command - 1.
If |command_to_start_at| + |commands_per_file| is greater than the maximum
command number, then only the commands up to the maximum command number
are printed.
-
- --quiet
+
+ --quiet
Silence progress messages.
"""
@@ -76,30 +76,30 @@ import random
import xml.dom.minidom
class ComprehensiveListGenerator:
- """Generates a comprehensive list of all the ways to choose x combinations
+ """Generates a comprehensive list of all the ways to choose x combinations
from an input list, with replacement.
-
- Init takes |list_length|, which is the length of the of the combination and
+
+ Init takes |list_length|, which is the length of the of the combination and
|source_list|, which is the list we want to choose from.
- GetNextPortionOfSourceList() returns a list of length |list_length| with a
- portion of the complete list of all combinations or None once all possible
+ GetNextPortionOfSourceList() returns a list of length |list_length| with a
+ portion of the complete list of all combinations or None once all possible
combinations have been returned.
-
- Example:
+
+ Example:
>>> list_gen = ComprehensiveListGenerator(2, ['a','b','c'])
- >>> print list_gen.GetNextPortionOfSourceList()
+ >>> print list_gen.GetNextPortionOfSourceList()
['a','a']
- >>> print list_gen.GetNextPortionOfSourceList()
+ >>> print list_gen.GetNextPortionOfSourceList()
['a','b']
- >>> print list_gen.GetNextPortionOfSourceList()
+ >>> print list_gen.GetNextPortionOfSourceList()
['a','c']
>>> ...print list_gen.GetNextPortionOfSourceList() 6 more times...
- >>> print list_gen.GetNextPortionOfSourceList()
+ >>> print list_gen.GetNextPortionOfSourceList()
None
>>> list_gen.SetIntegerListToCombinationNumber(2)
>>> print list_gen.GetCurrentPortionOfSourceList()
['a','c']
- >>> print list_gen.GetNextPortionOfSourceList()
+ >>> print list_gen.GetNextPortionOfSourceList()
['b','a']
>>> list_gen.SetIntegerListToCombinationNumber(8)
>>> print list_gen.GetCurrentPortionOfSourceList()
@@ -107,31 +107,31 @@ class ComprehensiveListGenerator:
>>> list_gen.SetIntegerListToCombinationNumber(9)
>>> print list_gen.GetCurrentPortionOfSourceList()
None
-
+
Attributes:
__list_length: Length of the resulting combinations.
__source_list: The list we are pulling combinations from.
- __integer_list: A list of integers representing which indices of
+ __integer_list: A list of integers representing which indices of
|source_list| to return.
"""
-
+
def __init__(self, list_length, source_list):
self.__list_length = list_length
self.__integer_list = None
self.__source_list = source_list
-
+
def SetIntegerListToCombinationNumber(self, combo_number):
- """ Sets the integer list to represent the |combo_number|th number in the
+ """ Sets the integer list to represent the |combo_number|th number in the
sequence, counting from 0.
-
- Args:
+
+ Args:
combo_number: Number to set the integer list to represent.
-
+
Returns: Sets integer_list to None and returns False if the combo_number is
- out of range (bigger than the maximum number of combinations possible or
+ out of range (bigger than the maximum number of combinations possible or
less than 0)
"""
- if (combo_number < 0 or
+ if (combo_number < 0 or
combo_number >= len(self.__source_list) ** self.__list_length):
self.__integer_list = None
return False
@@ -147,18 +147,18 @@ class ComprehensiveListGenerator:
quotient, remainder = divmod(combo_number, index_max_value)
combo_number = quotient
self.__integer_list[index] = remainder
-
+
return True
-
+
def __IncrementIntegerListIndex(self, index):
- """ Increments the given index of integer_list, rolling over to 0 and
- incrementing the a lower index if the index is incremented above the last
+ """ Increments the given index of integer_list, rolling over to 0 and
+ incrementing the a lower index if the index is incremented above the last
index of source_list
-
- Args:
+
+ Args:
index: The index integer_list to attempt to increment.
-
- Returns: False if it is impossible to incremement any index in the list
+
+ Returns: False if it is impossible to incremement any index in the list
which is less than or equal to the given index.
"""
self.__integer_list[index] += 1
@@ -175,14 +175,14 @@ class ComprehensiveListGenerator:
return False
# Successfuly incremented the index, return true.
return True
-
+
def __IncrementIntegerList(self):
- """ Gets the next integer list in the series by attempting to increment the
+ """ Gets the next integer list in the series by attempting to increment the
final index of integer_list.
-
+
Returns: False if we can't increment any index in the integer_list.
"""
-
+
# If the list is empty we just started, so populate it with zeroes.
if self.__integer_list == None:
self.__integer_list = []
@@ -191,50 +191,50 @@ class ComprehensiveListGenerator:
return True
else:
return self.__IncrementIntegerListIndex(self.__list_length-1)
-
+
def GetCurrentPortionOfSourceList(self):
- """ Returns the current portion of source_list corresponding to the
+ """ Returns the current portion of source_list corresponding to the
integer_list
-
+
For example, if our current state is:
- integer_list = [0,1,0,2]
+ integer_list = [0,1,0,2]
source_list = ['a','b','c','d']
Then calling GetCurrentPortionOfSourceList() returns:
['a','b','a','c']
-
+
Returns: None if the integer_list is empty, otherwise a list of length
list_length with a combination of elements from source_list
"""
portion_list = []
if self.__integer_list == None:
return None
-
+
for index in range(self.__list_length):
portion_list.append(self.__source_list[self.__integer_list[index]])
-
+
return portion_list
-
+
def GetNextPortionOfSourceList(self):
- """ Increments the integer_list and then returns the current portion of
+ """ Increments the integer_list and then returns the current portion of
source_list corresponding to the integer_list.
-
+
This is the only function outside users should be calling. It will advance
- to the next combination of elements from source_list, and return it. See
+ to the next combination of elements from source_list, and return it. See
the class documentation for proper use.
-
- Returns: None if all possible combinations of source_list have previously
- been returned. Otherwise a new list of length list_length with a combination
+
+ Returns: None if all possible combinations of source_list have previously
+ been returned. Otherwise a new list of length list_length with a combination
of elements from source_list.
"""
if self.__IncrementIntegerList():
return self.GetCurrentPortionOfSourceList()
else:
return None
-
+
class AutomatedTestInputGenerator:
- """Creates a random file with with the name |file_name| with
+ """Creates a random file with with the name |file_name| with
the number of commands and actions specified in the command line.
-
+
Attributes:
__commands_per_file: Number of commands per file.
__actions_per_command: Number of actions per command.
@@ -246,7 +246,7 @@ class AutomatedTestInputGenerator:
input_file = open(options.input_file_name)
actions_list = input_file.readlines()
input_file.close()
-
+
self.__commands_per_file = options.commands_per_file
self.__actions_per_command = options.actions_per_command
self.__actions_list = [action.strip() for action in actions_list]
@@ -254,7 +254,7 @@ class AutomatedTestInputGenerator:
def __CreateDocument(self):
""" Create the starter XML document.
-
+
Returns: A tuple containing the XML document and its root element named
"Command List".
"""
@@ -262,11 +262,11 @@ class AutomatedTestInputGenerator:
root_element = doc.createElement("CommandList")
doc.appendChild(root_element)
return doc, root_element
-
+
def __WriteToOutputFile(self, file_name, output):
"""Writes |output| to file with name |filename|. Overwriting any pre-existing
file.
-
+
Args:
file_name: Name of the file to create.
output: The string to write to file.
@@ -274,15 +274,15 @@ class AutomatedTestInputGenerator:
output_file = open(file_name, 'w')
output_file.write(output)
output_file.close()
-
+
def CreateRandomFile(self, file_name):
- """Creates a random file with with the name |file_name| with
+ """Creates a random file with with the name |file_name| with
the number of commands and actions specified in the command line.
-
- Args:
+
+ Args:
file_name - Name of the file to create.
-
- Return:
+
+ Return:
Nothing.
"""
output_doc, root_element = self.__CreateDocument()
@@ -294,18 +294,18 @@ class AutomatedTestInputGenerator:
command_element.appendChild(action_element)
root_element.appendChild(command_element)
self.__WriteToOutputFile(file_name, output_doc.toprettyxml())
-
+
def __AddCommandToDoc(self, output_doc, root_element, command, command_num):
"""Adds a given command to the output XML document
-
- Args:
+
+ Args:
output_doc - The output XML document. Used to create elements.
- root_element - The root element of the XML document. (What we add the
+ root_element - The root element of the XML document. (What we add the
command to)
command - The name of the command element we create and add to the doc.
command_num - The number of the command.
-
- Return:
+
+ Return:
Nothing.
"""
command_element = output_doc.createElement("command")
@@ -314,20 +314,20 @@ class AutomatedTestInputGenerator:
action_element = output_doc.createElement(action)
command_element.appendChild(action_element)
root_element.appendChild(command_element)
-
+
def CreateComprehensiveFile(self, file_name, start_command, write_to_end):
- """Creates one file containing all or part of the comprehensive list of
+ """Creates one file containing all or part of the comprehensive list of
commands starting at a set command.
-
- Args:
+
+ Args:
file_name - Name of the file to create.
start_command - Command number to start at.
- write_to_end - If true, writes all remaining commands, starting at
- start_command. (If start_command is 0, this would write all
- possible commands to one file.) If false, write only
+ write_to_end - If true, writes all remaining commands, starting at
+ start_command. (If start_command is 0, this would write all
+ possible commands to one file.) If false, write only
commands_per_file commands starting at start_command
-
- Return:
+
+ Return:
Nothing.
"""
list_generator = ComprehensiveListGenerator(self.__actions_per_command,
@@ -336,80 +336,80 @@ class AutomatedTestInputGenerator:
command_counter = start_command
end_command = start_command + self.__commands_per_file
is_complete = False
- # Set the underlying integer representation of the command to the
+ # Set the underlying integer representation of the command to the
# the starting command number.
list_generator.SetIntegerListToCombinationNumber(start_command)
command = list_generator.GetCurrentPortionOfSourceList()
- while (command != None and
+ while (command != None and
(write_to_end == True or command_counter < end_command)):
self.__AddCommandToDoc(output_doc, root_element, command, command_counter)
command_counter += 1;
command = list_generator.GetNextPortionOfSourceList()
-
- self.__WriteToOutputFile(file_name, output_doc.toprettyxml())
-
+
+ self.__WriteToOutputFile(file_name, output_doc.toprettyxml())
+
def CreateComprehensiveFiles(self, file_name):
- """Creates a comprehensive coverage of all possible combinations from
- action_list of length commands_per_file. Names them |file_name|_1,
- |file_name|_2, and so on.
-
- Args:
+ """Creates a comprehensive coverage of all possible combinations from
+ action_list of length commands_per_file. Names them |file_name|_1,
+ |file_name|_2, and so on.
+
+ Args:
file_name - Name of the file to create.
-
- Return:
+
+ Return:
Nothing.
"""
list_generator = ComprehensiveListGenerator(self.__actions_per_command,
self.__actions_list)
-
+
is_complete = False
file_counter = 0
# Split the file name so we can include the file number before the extension.
base_file_name, extension = os.path.splitext(file_name)
command_num = 0
-
+
while is_complete == False:
output_doc, root_element = self.__CreateDocument()
file_counter += 1
if self.__is_verbose and file_counter % 200 == 0:
print "Created " + str(file_counter) + " files... "
-
+
for i in range(self.__commands_per_file):
# Get the next sequence of actions as a list.
command = list_generator.GetNextPortionOfSourceList()
if command == None:
is_complete = True
break
-
+
# Parse through the list and add them to the output document as children
# of a command element
self.__AddCommandToDoc(output_doc, root_element, command, command_num)
command_num += 1
-
+
# Finished the commands for this file, so write it and start on next file.
- self.__WriteToOutputFile(base_file_name + "_" + str(file_counter) +
+ self.__WriteToOutputFile(base_file_name + "_" + str(file_counter) +
extension, output_doc.toprettyxml())
-
+
def ParseCommandLine():
"""Parses the command line.
-
- Return: List of options and their values and a list of arguments which were
+
+ Return: List of options and their values and a list of arguments which were
unparsed.
"""
parser = optparse.OptionParser()
parser.set_defaults(full_coverage=False)
- parser.add_option("-i", "--action-list-file", dest="input_file_name",
- type="string", action="store", default="possible_actions.txt",
+ parser.add_option("-i", "--action-list-file", dest="input_file_name",
+ type="string", action="store", default="possible_actions.txt",
help="input file with a test of newline separated actions"
"which are possible. Default is 'possible_actions.txt'")
parser.add_option("-o", "--output", dest="output_file_name", type="string",
action="store", default="automated_ui_tests.txt",
help="the file to output the command list to")
- parser.add_option("-c", "--commands-per-file", dest="commands_per_file",
- type="int", action="store", default=500,
+ parser.add_option("-c", "--commands-per-file", dest="commands_per_file",
+ type="int", action="store", default=500,
help="number of commands per file")
- parser.add_option("-a", "--actions-per-command", dest="actions_per_command",
- type="int", action="store", default=5,
+ parser.add_option("-a", "--actions-per-command", dest="actions_per_command",
+ type="int", action="store", default=5,
help="number of actions per command")
parser.add_option("-f", "--full-coverage", dest="full_coverage",
action="store_true", help="Output files for every possible"
@@ -418,14 +418,14 @@ def ParseCommandLine():
action="store_false", dest="is_verbose", default=True,
help="don't print progress message while creating files")
parser.add_option("-1", "--full-coverage-one-file",
- action="store_true", dest="full_coverage_one_file",
+ action="store_true", dest="full_coverage_one_file",
default=False,
help="complete coverage all outputted to one file")
- parser.add_option("-p", "--partial-coverage-from", dest="start_at_command",
- type="int", action="store", default=-1,
- help="partial list from the complete coverage, starting at"
+ parser.add_option("-p", "--partial-coverage-from", dest="start_at_command",
+ type="int", action="store", default=-1,
+ help="partial list from the complete coverage, starting at"
"command #start_at_command")
-
+
return parser.parse_args()
def main():
@@ -445,7 +445,7 @@ def main():
print "Finished writing comprehensive files."
elif options.full_coverage_one_file:
if options.start_at_command >= 0 and options.is_verbose == True:
- print ("Error: Both --full-coverage-one-file present and"
+ print ("Error: Both --full-coverage-one-file present and"
"--partial-coverage-from present, ignoring --partial-coverage-from")
if options.is_verbose == True:
print "Starting to write comprehensive file:"
@@ -455,7 +455,7 @@ def main():
elif options.start_at_command >= 0:
if options.is_verbose == True:
print "Starting to write partial file:"
- test_generator.CreateComprehensiveFile(options.output_file_name,
+ test_generator.CreateComprehensiveFile(options.output_file_name,
options.start_at_command , False)
if options.is_verbose == True:
print "Finished writing partial file."
@@ -463,6 +463,6 @@ def main():
test_generator.CreateRandomFile(options.output_file_name)
if options.is_verbose == True:
print "Output written to file: " + options.output_file_name
-
+
if __name__ == '__main__':
main()
diff --git a/chrome/tools/build/win/create_installer_archive.py b/chrome/tools/build/win/create_installer_archive.py
index 61579ae..cf6d846 100755
--- a/chrome/tools/build/win/create_installer_archive.py
+++ b/chrome/tools/build/win/create_installer_archive.py
@@ -5,11 +5,11 @@
"""Script to create Chrome Installer archive.
- This script is used to create an archive of all the files required for a
+ This script is used to create an archive of all the files required for a
Chrome install in appropriate directory structure. It reads chrome.release
- file as input, creates chrome.7z archive, compresses setup.exe and
- generates packed_files.txt for mini_installer project.
-
+ file as input, creates chrome.7z archive, compresses setup.exe and
+ generates packed_files.txt for mini_installer project.
+
"""
import ConfigParser
@@ -33,13 +33,13 @@ BSDIFF_EXEC = "bsdiff.exe"
VERSION_FILE = "VERSION"
PACKED_FILE_COMMENTS = """
// This file is automatically generated by create_installer_archive.py.
-// It contains the resource entries that are going to be linked inside
-// mini_installer.exe. For each file to be linked there should be two
+// It contains the resource entries that are going to be linked inside
+// mini_installer.exe. For each file to be linked there should be two
// lines:
// - The first line contains the output filename (without path) and the
-// type of the resource ('BN' means the file is not compressed and
+// type of the resource ('BN' means the file is not compressed and
// 'BL' means the file is compressed.
-// - The second line contains the path to the input file. Uses '/' to
+// - The second line contains the path to the input file. Uses '/' to
// separate path components.
"""
@@ -71,7 +71,7 @@ def Readconfig(output_dir, input_file, current_version):
"""
variables = {}
variables['ChromeDir'] = CHROME_DIR
- variables['VersionDir'] = os.path.join(variables['ChromeDir'],
+ variables['VersionDir'] = os.path.join(variables['ChromeDir'],
current_version)
config = ConfigParser.SafeConfigParser(variables)
config.read(input_file)
@@ -131,7 +131,7 @@ def CreateArchiveFile(output_dir, staging_dir, current_version,
lzma_exec = os.path.join(output_dir, "..", "..", "third_party",
"lzma_sdk", "Executable", "7za.exe")
archive_file = os.path.join(output_dir, FULL_ARCHIVE_FILE)
- cmd = '%s a -t7z "%s" "%s" -mx0' % (lzma_exec, archive_file,
+ cmd = '%s a -t7z "%s" "%s" -mx0' % (lzma_exec, archive_file,
os.path.join(staging_dir, CHROME_DIR))
# There doesnt seem to be any way in 7za.exe to override existing file so
# we always delete before creating a new one.
@@ -147,7 +147,7 @@ def CreateArchiveFile(output_dir, staging_dir, current_version,
if (prev_version_dir):
prev_archive_file = os.path.join(prev_version_dir, FULL_ARCHIVE_FILE)
patch_file = os.path.join(output_dir, "patch.7z")
- cmd = '%s "%s" "%s" "%s"' % (os.path.join(output_dir, BSDIFF_EXEC),
+ cmd = '%s "%s" "%s" "%s"' % (os.path.join(output_dir, BSDIFF_EXEC),
prev_archive_file, archive_file, patch_file)
RunSystemCommand(cmd)
@@ -158,7 +158,7 @@ def CreateArchiveFile(output_dir, staging_dir, current_version,
orig_file = archive_file
compressed_archive_file_path = os.path.join(output_dir, archive_file_name)
- cmd = '%s a -t7z "%s" "%s" -mx9' % (lzma_exec, compressed_archive_file_path,
+ cmd = '%s a -t7z "%s" "%s" -mx9' % (lzma_exec, compressed_archive_file_path,
orig_file)
if os.path.exists(compressed_archive_file_path):
os.remove(compressed_archive_file_path)
@@ -169,7 +169,7 @@ def CreateArchiveFile(output_dir, staging_dir, current_version,
def CompressSetupExec(output_dir):
"""Compresses setup.exe to reduce size."""
- cmd = 'makecab.exe /V1 /L "%s" "%s"' % (output_dir,
+ cmd = 'makecab.exe /V1 /L "%s" "%s"' % (output_dir,
os.path.join(output_dir, SETUP_EXEC))
RunSystemCommand(cmd)
@@ -181,15 +181,15 @@ def GetFileMD5Hash(file):
return hash
-def CreateResourceInputFile(output_dir,
+def CreateResourceInputFile(output_dir,
prev_version_dir, archive_file_name):
"""Creates resource input file (packed_files.txt) for mini_installer project.
-
+
This method checks if we are generating a patch instead of full installer. In
case of patch it also checks if setup.exe has changed by comparing its
MD5 hash with the MD5 hash of previous setup.exe. If hash values are same
setup.exe is not included in packed_files.txt.
-
+
In case of patch we include patch.7z and in case of full
installer we include chrome.7z in packed_files.txt.
"""
@@ -199,13 +199,13 @@ def CreateResourceInputFile(output_dir,
prev_hash = GetFileMD5Hash(os.path.join(prev_version_dir, SETUP_EXEC))
if (current_hash == prev_hash):
setup_exe_needed = 0
-
+
if (setup_exe_needed):
CompressSetupExec(output_dir)
c_setup_file = SETUP_EXEC[:len(SETUP_EXEC) - 1] + "_"
- setup_file_entry = "%s\t\tBL\n\"%s\"" % (c_setup_file,
+ setup_file_entry = "%s\t\tBL\n\"%s\"" % (c_setup_file,
os.path.join(output_dir, c_setup_file).replace("\\","/"))
-
+
archive_file_entry = "\n%s\t\tB7\n\"%s\"" % (archive_file_name,
os.path.join(output_dir, archive_file_name).replace("\\","/"))
output_file = os.path.join(output_dir, MINI_INSTALLER_INPUT_FILE)
@@ -231,7 +231,7 @@ def main(options):
CopyAllFilesToStagingDir(config, options.distribution,
staging_dir, options.output_dir)
-
+
# Name of the archive file built (for example - chrome.7z or
# patch-<old_version>-<new_version>.7z or patch-<new_version>.7z
archive_file_name = CreateArchiveFile(options.output_dir, staging_dir,
@@ -250,11 +250,11 @@ if '__main__' == __name__:
help='Name of Chromium Distribution. Optional.')
option_parser.add_option('-s', '--skip_rebuild_archive',
default="False", help='Skip re-building Chrome.7z archive if it exists.')
- option_parser.add_option('-l', '--last_chrome_installer',
+ option_parser.add_option('-l', '--last_chrome_installer',
help='Generate differential installer. The value of this parameter ' +
'specifies the directory that contains base versions of ' +
'setup.exe & chrome.7z.')
- option_parser.add_option('-v', '--last_chrome_version',
+ option_parser.add_option('-v', '--last_chrome_version',
help='Version of the previous installer. ' +
'Used only for the purpose of naming archive file. Optional.')
diff --git a/chrome/tools/build/win/dependencies.py b/chrome/tools/build/win/dependencies.py
index c06f9f3..06ce64c 100755
--- a/chrome/tools/build/win/dependencies.py
+++ b/chrome/tools/build/win/dependencies.py
@@ -160,7 +160,7 @@ def VerifyDependents(pe_name, dependents, delay_loaded, list_file, verbose):
# The dependency files have dependencies in two section - dependents and delay_loaded
# Also various distributions of Chromium can have different dependencies. So first
# we read generic dependencies ("dependents" and "delay_loaded"). If distribution
- # specific dependencies exist (i.e. "dependents_google_chrome" and
+ # specific dependencies exist (i.e. "dependents_google_chrome" and
# "delay_loaded_google_chrome") we use those instead.
distribution = DIST_DEFAULT
if DIST_ENV_VAR in os.environ.keys():
@@ -170,7 +170,7 @@ def VerifyDependents(pe_name, dependents, delay_loaded, list_file, verbose):
dist_dependents = "dependents" + distribution
if dist_dependents in scope.keys():
expected_dependents = scope[dist_dependents]
-
+
expected_delay_loaded = scope["delay_loaded"]
dist_delay_loaded = "delay_loaded" + distribution
if dist_delay_loaded in scope.keys():
@@ -181,7 +181,7 @@ def VerifyDependents(pe_name, dependents, delay_loaded, list_file, verbose):
print "\n".join(expected_dependents)
print "Expected delayloaded:"
print "\n".join(expected_delay_loaded)
-
+
deps_result = Diff(pe_name,
"dll",
dependents,
diff --git a/chrome/tools/build/win/sln_deps.py b/chrome/tools/build/win/sln_deps.py
index fecb100..ef7803e 100755
--- a/chrome/tools/build/win/sln_deps.py
+++ b/chrome/tools/build/win/sln_deps.py
@@ -95,7 +95,7 @@ def main(filename, project_to_scan, reverse):
if __name__ == '__main__':
usage = "usage: %prog [options] solution [project]"
-
+
description = ("Display the dependencies of a project in human readable"
" form. [project] is optional. If omited, all projects are"
" listed.")
diff --git a/chrome/tools/convert_dict/dic_reader.cc b/chrome/tools/convert_dict/dic_reader.cc
index 5ddbee7..6035d23 100644
--- a/chrome/tools/convert_dict/dic_reader.cc
+++ b/chrome/tools/convert_dict/dic_reader.cc
@@ -43,12 +43,12 @@ void SplitDicLine(const std::string& line, std::vector<std::string>* output) {
output->push_back(line.substr(slash_index + 1));
}
-// This function reads words from a .dic file, or a .dic_delta file. Note that
+// This function reads words from a .dic file, or a .dic_delta file. Note that
// we read 'all' the words in the file, irrespective of the word count given
// in the first non empty line of a .dic file. Also note that, for a .dic_delta
// file, the first line actually does _not_ have the number of words. In order
-// to control this, we use the |file_has_word_count_in_the_first_line|
-// parameter to tell this method whether the first non empty line in the file
+// to control this, we use the |file_has_word_count_in_the_first_line|
+// parameter to tell this method whether the first non empty line in the file
// contains the number of words or not. If it does, skip the first line. If it
// does not, then the first line contains a word.
bool PopulateWordSet(WordSet* word_set, FILE* file, AffReader* aff_reader,
@@ -141,7 +141,7 @@ bool DicReader::Read(AffReader* aff_reader) {
// Add words from the dic file to the word set.
// Note that the first line is the word count in the file.
- if (!PopulateWordSet(&word_set, file_, aff_reader, "dic",
+ if (!PopulateWordSet(&word_set, file_, aff_reader, "dic",
aff_reader->encoding(), true))
return false;
diff --git a/chrome/tools/extensions/chromium_extension.py b/chrome/tools/extensions/chromium_extension.py
index 4431b34..81e4662 100755
--- a/chrome/tools/extensions/chromium_extension.py
+++ b/chrome/tools/extensions/chromium_extension.py
@@ -56,7 +56,7 @@ class ExtensionDir:
f = open(os.path.join(self._root, MANIFEST_FILENAME))
manifest = json.load(f)
f.close()
-
+
zip_path = path + ".zip"
if os.path.exists(zip_path):
os.remove(zip_path)
@@ -68,7 +68,7 @@ class ExtensionDir:
logging.debug("%s: %s" % (arcname, file))
zip.write(file, arcname)
zip.close()
-
+
zip = open(zip_path, mode="rb")
hash = hashlib.sha256()
while True:
@@ -77,11 +77,11 @@ class ExtensionDir:
break
hash.update(buf)
zip.close()
-
+
manifest["zip_hash"] = hash.hexdigest()
# This is a bit odd - we're actually appending a new zip file to the end
- # of the manifest. Believe it or not, this is actually an explicit
+ # of the manifest. Believe it or not, this is actually an explicit
# feature of the zip format, and many zip utilities (this library
# and three others I tried) can still read the underlying zip file.
if os.path.exists(path):
@@ -105,7 +105,7 @@ class ExtensionDir:
out.write(buf)
zip.close()
out.close()
-
+
os.remove(zip_path)
logging.info("created extension package %s" % path)
@@ -136,7 +136,7 @@ class ExtensionPackage:
def Run():
logging.basicConfig(level=logging.INFO, format="[%(levelname)s] %(message)s")
-
+
parser = optparse.OptionParser("usage: %prog --indir=<dir> --outfile=<file>")
parser.add_option("", "--indir",
help="an input directory where the extension lives")
diff --git a/chrome/tools/extract_actions.py b/chrome/tools/extract_actions.py
index 8eefbb6..6381976 100755
--- a/chrome/tools/extract_actions.py
+++ b/chrome/tools/extract_actions.py
@@ -58,7 +58,7 @@ def AddComputedActions(actions):
def AddWebKitEditorActions(actions):
"""Add editor actions from editor_client_impl.cc.
-
+
Arguments:
actions: set of actions to add to.
"""
diff --git a/chrome/tools/history-viz.py b/chrome/tools/history-viz.py
index 2f94d9a..ecceee4 100755
--- a/chrome/tools/history-viz.py
+++ b/chrome/tools/history-viz.py
@@ -40,11 +40,11 @@ class URL:
def PrettyPrint(self, include_host=True, include_path=True):
"""Pretty-print this URL in a form more suitable for the graph.
-
+
This will elide very long paths and potentially puts newlines between parts
of long components. include_host and include_path determine whether to
include the host and path in the output.
-
+
Returns: the pretty-printed string."""
MAX_LEN = 30 # Maximum length of a line in the output.
parts = []
@@ -130,7 +130,7 @@ class SQLite:
for line in subproc.stdout:
row = line.strip().split('\t')
yield row
-
+
def LoadHistory(filename):
db = SQLite(filename)
@@ -223,7 +223,7 @@ for src, dsts in edges.items():
label.append(text)
if len(label) == 0:
continue
-
+
edgeattrs = [] # Graphviz attributes for the edge.
# If the edge is from the start and the transitions are fishy, make it
# display as a dotted line.
diff --git a/chrome/tools/test/smoketests.py b/chrome/tools/test/smoketests.py
index cb566d4..c96f22f 100755
--- a/chrome/tools/test/smoketests.py
+++ b/chrome/tools/test/smoketests.py
@@ -145,7 +145,7 @@ def main(options, args):
len([x for x in tests if x.startswith('page-cycler')])):
print 'Skipping page-cycler tests (no data)'
options.nopage_cycler = True
-
+
# Start an httpd if needed.
http_tests = [x for x in tests if x.endswith('-http')]
if http_tests and not options.nopage_cycler and not options.nohttp:
diff --git a/chrome/views/accelerator.cc b/chrome/views/accelerator.cc
index b86133f..1a70c44 100644
--- a/chrome/views/accelerator.cc
+++ b/chrome/views/accelerator.cc
@@ -53,16 +53,16 @@ std::wstring Accelerator::GetShortcutText() const {
std::wstring shortcut;
if (!string_id) {
- // Our fallback is to try translate the key code to a regular character
+ // Our fallback is to try translate the key code to a regular character
// unless it is one of digits (VK_0 to VK_9). Some keyboard
// layouts have characters other than digits assigned in
// an unshifted mode (e.g. French AZERY layout has 'a with grave
- // accent' for '0'). For display in the menu (e.g. Ctrl-0 for the
+ // accent' for '0'). For display in the menu (e.g. Ctrl-0 for the
// default zoom level), we leave VK_[0-9] alone without translation.
wchar_t key;
if (key_code_ >= '0' && key_code_ <= '9')
key = key_code_;
- else
+ else
key = LOWORD(::MapVirtualKeyW(key_code_, MAPVK_VK_TO_CHAR));
shortcut += key;
} else {
diff --git a/chrome/views/client_view.h b/chrome/views/client_view.h
index 919f661..d573039 100644
--- a/chrome/views/client_view.h
+++ b/chrome/views/client_view.h
@@ -42,7 +42,7 @@ class ClientView : public View {
// forwards the notification to the delegate.
virtual void WindowClosing();
- // Tests to see if the specified point (in view coordinates) is within the
+ // Tests to see if the specified point (in view coordinates) is within the
// bounds of this view. If so, it returns HTCLIENT in this default
// implementation. If it is outside the bounds of this view, this must return
// HTNOWHERE to tell the caller to do further processing to determine where
diff --git a/chrome/views/dialog_client_view.h b/chrome/views/dialog_client_view.h
index 32713d0..52862fb 100644
--- a/chrome/views/dialog_client_view.h
+++ b/chrome/views/dialog_client_view.h
@@ -97,7 +97,7 @@ class DialogClientView : public ClientView,
// The dialog buttons.
NativeButton* ok_button_;
NativeButton* cancel_button_;
-
+
// The button that is currently the default button if any.
NativeButton* default_button_;
diff --git a/chrome/views/focus_manager.cc b/chrome/views/focus_manager.cc
index 6dac309..093b0a4 100644
--- a/chrome/views/focus_manager.cc
+++ b/chrome/views/focus_manager.cc
@@ -744,7 +744,7 @@ void FocusManager::UnregisterAccelerator(const Accelerator& accelerator,
NOTREACHED() << "Unregistering non-existing accelerator";
return;
}
-
+
if (iter->second != target) {
NOTREACHED() << "Unregistering accelerator for wrong target";
return;
diff --git a/chrome/views/focus_manager_unittest.cc b/chrome/views/focus_manager_unittest.cc
index 30f7e85..edbb403 100644
--- a/chrome/views/focus_manager_unittest.cc
+++ b/chrome/views/focus_manager_unittest.cc
@@ -175,7 +175,7 @@ class TestViewWindow : public views::WidgetWin {
void Init();
views::View* contents() const { return contents_; }
-
+
// Return the ID of the component that currently has the focus.
int GetFocusedComponentID();
diff --git a/chrome/views/grid_layout.h b/chrome/views/grid_layout.h
index 358422a..27ccc3e 100644
--- a/chrome/views/grid_layout.h
+++ b/chrome/views/grid_layout.h
@@ -174,7 +174,7 @@ class GridLayout : public LayoutManager {
// they both call into this method. This sizes the Columns/Rows as
// appropriate. If layout is true, width/height give the width/height the
// of the host, otherwise they are ignored.
- void SizeRowsAndColumns(bool layout, int width, int height,
+ void SizeRowsAndColumns(bool layout, int width, int height,
gfx::Size* pref);
// Calculates the master columns of all the column sets. See Column for
diff --git a/chrome/views/hwnd_view.cc b/chrome/views/hwnd_view.cc
index e812a06..82ce224 100644
--- a/chrome/views/hwnd_view.cc
+++ b/chrome/views/hwnd_view.cc
@@ -176,9 +176,9 @@ void HWNDView::Focus() {
}
void HWNDView::Paint(ChromeCanvas* canvas) {
- // The area behind our window is black, so during a fast resize (where our
- // content doesn't draw over the full size of our HWND, and the HWND
- // background color doesn't show up), we need to cover that blackness with
+ // The area behind our window is black, so during a fast resize (where our
+ // content doesn't draw over the full size of our HWND, and the HWND
+ // background color doesn't show up), we need to cover that blackness with
// something so that fast resizes don't result in black flash.
//
// It would be nice if this used some approximation of the page's
diff --git a/chrome/views/hwnd_view.h b/chrome/views/hwnd_view.h
index ae33d0f..8219991 100644
--- a/chrome/views/hwnd_view.h
+++ b/chrome/views/hwnd_view.h
@@ -69,7 +69,7 @@ class HWNDView : public View {
// Notification that our visible bounds relative to the root has changed.
// This updates the bounds of the HWND.
virtual void VisibleBoundsInRootChanged();
-
+
virtual void Focus();
private:
diff --git a/chrome/views/native_button.cc b/chrome/views/native_button.cc
index d6db326..71ff637 100644
--- a/chrome/views/native_button.cc
+++ b/chrome/views/native_button.cc
@@ -14,7 +14,7 @@ namespace views {
const char NativeButton::kViewClassName[] = "chrome/views/NativeButton";
-NativeButton::NativeButton(const std::wstring& label)
+NativeButton::NativeButton(const std::wstring& label)
: enforce_dlu_min_size_(true) {
Init(label, false);
}
diff --git a/chrome/views/single_split_view.cc b/chrome/views/single_split_view.cc
index a7832b6..845d980 100644
--- a/chrome/views/single_split_view.cc
+++ b/chrome/views/single_split_view.cc
@@ -13,7 +13,7 @@ namespace views {
// Size of the divider in pixels.
static const int kDividerSize = 4;
-SingleSplitView::SingleSplitView(View* leading, View* trailing)
+SingleSplitView::SingleSplitView(View* leading, View* trailing)
: divider_x_(-1) {
AddChildView(leading);
AddChildView(trailing);
diff --git a/chrome/views/table_view_unittest.cc b/chrome/views/table_view_unittest.cc
index 9ef53da..41c985c 100644
--- a/chrome/views/table_view_unittest.cc
+++ b/chrome/views/table_view_unittest.cc
@@ -83,7 +83,7 @@ void TestTableModel::ChangeRow(int row, int c1_value, int c2_value) {
int TestTableModel::RowCount() {
return static_cast<int>(rows_.size());
}
-
+
std::wstring TestTableModel::GetText(int row, int column_id) {
return IntToWString(rows_[row][column_id]);
}
diff --git a/chrome/views/text_button.cc b/chrome/views/text_button.cc
index ba4e3b2..1eca617 100644
--- a/chrome/views/text_button.cc
+++ b/chrome/views/text_button.cc
@@ -169,7 +169,7 @@ gfx::Size TextButton::GetPreferredSize() {
if (max_width_ > 0)
prefsize.set_width(std::min(max_width_, prefsize.width()));
-
+
return prefsize;
}
diff --git a/chrome/views/tree_view.cc b/chrome/views/tree_view.cc
index 4e77db0..7166a31 100644
--- a/chrome/views/tree_view.cc
+++ b/chrome/views/tree_view.cc
@@ -487,7 +487,7 @@ void TreeView::OnContextMenu(const CPoint& location) {
NativeControl::OnContextMenu(location);
return;
}
-
+
if (show_context_menu_only_when_node_selected_) {
if (!GetSelectedNode())
return;
diff --git a/chrome/views/view_unittest.cc b/chrome/views/view_unittest.cc
index e26ff2f..feb9182 100644
--- a/chrome/views/view_unittest.cc
+++ b/chrome/views/view_unittest.cc
@@ -27,7 +27,7 @@ class ViewTest : public testing::Test {
~ViewTest() {
OleUninitialize();
}
-
+
private:
MessageLoopForUI message_loop_;
};
@@ -592,7 +592,7 @@ class TestDialogView : public views::View,
public:
TestDialogView() {
}
-
+
// views::DialogDelegate implementation:
virtual int GetDialogButtons() const {
return DIALOGBUTTON_OK | DIALOGBUTTON_CANCEL;
@@ -658,4 +658,4 @@ TEST_F(ViewTest, DialogDefaultButtonTest) {
EXPECT_TRUE(cancel_button->IsDefaultButton());
EXPECT_FALSE(dialog_view_->button1_->IsDefaultButton());
EXPECT_FALSE(dialog_view_->button2_->IsDefaultButton());
-} \ No newline at end of file
+}
diff --git a/chrome/views/window.cc b/chrome/views/window.cc
index 12f7d9a..1dcf75f 100644
--- a/chrome/views/window.cc
+++ b/chrome/views/window.cc
@@ -352,7 +352,7 @@ void Window::Init(HWND parent, const gfx::Rect& bounds) {
WidgetWin::Init(parent, bounds, true);
win_util::SetWindowUserData(GetHWND(), this);
-
+
// Create the ClientView, add it to the NonClientView and add the
// NonClientView to the RootView. This will cause everything to be parented.
non_client_view_->set_client_view(window_delegate_->CreateClientView(this));
diff --git a/chrome/views/window.h b/chrome/views/window.h
index 564cfab..089fea4 100644
--- a/chrome/views/window.h
+++ b/chrome/views/window.h
@@ -252,7 +252,7 @@ class Window : public WidgetWin,
enum ResizeCursor {
RC_NORMAL = 0, RC_VERTICAL, RC_HORIZONTAL, RC_NESW, RC_NWSE
};
- static HCURSOR resize_cursors_[6];
+ static HCURSOR resize_cursors_[6];
// Our window delegate (see Init method for documentation).
WindowDelegate* window_delegate_;
diff --git a/chrome/views/window_delegate.cc b/chrome/views/window_delegate.cc
index 171b642..e76330a 100644
--- a/chrome/views/window_delegate.cc
+++ b/chrome/views/window_delegate.cc
@@ -48,7 +48,7 @@ bool WindowDelegate::GetSavedWindowBounds(gfx::Rect* bounds) const {
if (window_name.empty())
return false;
- const DictionaryValue* dictionary =
+ const DictionaryValue* dictionary =
g_browser_process->local_state()->GetDictionary(window_name.c_str());
int left, top, right, bottom;
if (!dictionary || !dictionary->GetInteger(L"left", &left) ||
@@ -66,7 +66,7 @@ bool WindowDelegate::GetSavedMaximizedState(bool* maximized) const {
if (window_name.empty())
return false;
- const DictionaryValue* dictionary =
+ const DictionaryValue* dictionary =
g_browser_process->local_state()->GetDictionary(window_name.c_str());
return dictionary && dictionary->GetBoolean(L"maximized", maximized);
}
@@ -79,7 +79,7 @@ bool WindowDelegate::GetSavedAlwaysOnTopState(bool* always_on_top) const {
if (window_name.empty())
return false;
- const DictionaryValue* dictionary =
+ const DictionaryValue* dictionary =
g_browser_process->local_state()->GetDictionary(window_name.c_str());
return dictionary && dictionary->GetBoolean(L"always_on_top", always_on_top);
}
diff --git a/chrome/views/window_delegate.h b/chrome/views/window_delegate.h
index 8f60db4..7d0cb44 100644
--- a/chrome/views/window_delegate.h
+++ b/chrome/views/window_delegate.h
@@ -120,7 +120,7 @@ class WindowDelegate {
virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const;
virtual bool GetSavedMaximizedState(bool* maximized) const;
virtual bool GetSavedAlwaysOnTopState(bool* always_on_top) const;
-
+
// Called when the window closes.
virtual void WindowClosing() { }
diff --git a/chrome/worker/webworkerclient_proxy.cc b/chrome/worker/webworkerclient_proxy.cc
index 84cb2ed..fc8c2d3 100644
--- a/chrome/worker/webworkerclient_proxy.cc
+++ b/chrome/worker/webworkerclient_proxy.cc
@@ -67,7 +67,7 @@ bool WebWorkerClientProxy::Send(IPC::Message* message) {
}
void WebWorkerClientProxy::OnMessageReceived(const IPC::Message& message) {
- if (!started_worker_ &&
+ if (!started_worker_ &&
message.type() != WorkerMsg_StartWorkerContext::ID) {
queued_messages_.push_back(new IPC::Message(message));
return;
diff --git a/media/audio/win/audio_output_win.cc b/media/audio/win/audio_output_win.cc
index ebe4401..880555b 100644
--- a/media/audio/win/audio_output_win.cc
+++ b/media/audio/win/audio_output_win.cc
@@ -94,7 +94,7 @@ void ReplaceLastMockStream(AudioOutputStreamMockWin* newer) {
bool AudioManagerWin::HasAudioDevices() {
- return (::waveOutGetNumDevs() != 0);
+ return (::waveOutGetNumDevs() != 0);
}
// Factory for the implementations of AudioOutputStream. Two implementations
diff --git a/media/filters/audio_renderer_base.h b/media/filters/audio_renderer_base.h
index fc0b13b..7d8d571 100644
--- a/media/filters/audio_renderer_base.h
+++ b/media/filters/audio_renderer_base.h
@@ -45,7 +45,7 @@ class AudioRendererBase : public AudioRenderer {
// Only allow a factory to create this class.
AudioRendererBase(size_t max_queue_size);
virtual ~AudioRendererBase();
-
+
// Called by Initialize(). |media_format| is the format of the AudioDecoder.
// Subclasses should return true if they were able to initialize, false
// otherwise.
diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h
index c9e48d7..580e176 100644
--- a/net/base/cookie_monster.h
+++ b/net/base/cookie_monster.h
@@ -53,7 +53,7 @@ class CookieMonster {
public:
// Default is to exclude httponly, which means:
// - reading operations will not return httponly cookies.
- // - writing operations will not write httponly cookies.
+ // - writing operations will not write httponly cookies.
CookieOptions() : exclude_httponly_(true) {}
void set_exclude_httponly() { exclude_httponly_ = true; }
void set_include_httponly() { exclude_httponly_ = false; }
diff --git a/net/base/cookie_monster_unittest.cc b/net/base/cookie_monster_unittest.cc
index 48843d1..1878285 100644
--- a/net/base/cookie_monster_unittest.cc
+++ b/net/base/cookie_monster_unittest.cc
@@ -533,7 +533,7 @@ TEST(CookieMonsterTest, HttpOnlyTest) {
// Create a httponly cookie.
EXPECT_TRUE(cm.SetCookieWithOptions(url_google, "A=B; httponly", options));
-
+
// Check httponly read protection.
EXPECT_EQ("", cm.GetCookies(url_google));
EXPECT_EQ("A=B", cm.GetCookiesWithOptions(url_google, options));
diff --git a/net/base/file_stream.h b/net/base/file_stream.h
index eaf6a0d..28b40e7 100644
--- a/net/base/file_stream.h
+++ b/net/base/file_stream.h
@@ -70,12 +70,12 @@ class FileStream {
// not complete synchronously, then ERR_IO_PENDING is returned, and the
// callback will be notified on the current thread (via the MessageLoop) when
// the read has completed.
- //
+ //
// In the case of an asychronous read, the memory pointed to by |buf| must
// remain valid until the callback is notified. However, it is valid to
// destroy or close the file stream while there is an asynchronous read in
// progress. That will cancel the read and allow the buffer to be freed.
- //
+ //
// This method should not be called if the stream was opened WRITE_ONLY.
//
// You can pass NULL as the callback for synchronous I/O.
@@ -90,7 +90,7 @@ class FileStream {
// Call this method to write data at the current stream position. Up to
// buf_len bytes will be written from buf. (In other words, partial writes are
- // allowed.) Returns the number of bytes written, or an error code if the
+ // allowed.) Returns the number of bytes written, or an error code if the
// operation could not be performed.
//
// If opened with PLATFORM_FILE_ASYNC, then a non-null callback
@@ -98,12 +98,12 @@ class FileStream {
// not complete synchronously, then ERR_IO_PENDING is returned, and the
// callback will be notified on the current thread (via the MessageLoop) when
// the write has completed.
- //
+ //
// In the case of an asychronous write, the memory pointed to by |buf| must
// remain valid until the callback is notified. However, it is valid to
// destroy or close the file stream while there is an asynchronous write in
// progress. That will cancel the write and allow the buffer to be freed.
- //
+ //
// This method should not be called if the stream was opened READ_ONLY.
//
// You can pass NULL as the callback for synchronous I/O.
diff --git a/net/base/file_stream_posix.cc b/net/base/file_stream_posix.cc
index 151cf5d..34f7889 100644
--- a/net/base/file_stream_posix.cc
+++ b/net/base/file_stream_posix.cc
@@ -106,7 +106,7 @@ int64 FileStream::Seek(Whence whence, int64 offset) {
// If we're in async, make sure we don't have a request in flight.
DCHECK(!async_context_.get() || !async_context_->callback());
-
+
off_t res = lseek(file_, static_cast<off_t>(offset),
static_cast<int>(whence));
if (res == static_cast<off_t>(-1))
diff --git a/net/base/file_stream_unittest.cc b/net/base/file_stream_unittest.cc
index f96d57f..318eb93 100644
--- a/net/base/file_stream_unittest.cc
+++ b/net/base/file_stream_unittest.cc
@@ -35,7 +35,7 @@ class FileStreamTest : public PlatformTest {
TEST_F(FileStreamTest, BasicOpenClose) {
net::FileStream stream;
- int rv = stream.Open(temp_file_path(),
+ int rv = stream.Open(temp_file_path(),
base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ);
EXPECT_EQ(net::OK, rv);
}
@@ -103,7 +103,7 @@ TEST_F(FileStreamTest, BasicRead) {
EXPECT_TRUE(ok);
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
+ int flags = base::PLATFORM_FILE_OPEN |
base::PLATFORM_FILE_READ;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -133,8 +133,8 @@ TEST_F(FileStreamTest, AsyncRead) {
EXPECT_TRUE(ok);
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
- base::PLATFORM_FILE_READ |
+ int flags = base::PLATFORM_FILE_OPEN |
+ base::PLATFORM_FILE_READ |
base::PLATFORM_FILE_ASYNC;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -168,7 +168,7 @@ TEST_F(FileStreamTest, BasicRead_FromOffset) {
EXPECT_TRUE(ok);
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
+ int flags = base::PLATFORM_FILE_OPEN |
base::PLATFORM_FILE_READ;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -202,8 +202,8 @@ TEST_F(FileStreamTest, AsyncRead_FromOffset) {
EXPECT_TRUE(ok);
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
- base::PLATFORM_FILE_READ |
+ int flags = base::PLATFORM_FILE_OPEN |
+ base::PLATFORM_FILE_READ |
base::PLATFORM_FILE_ASYNC;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -237,7 +237,7 @@ TEST_F(FileStreamTest, AsyncRead_FromOffset) {
TEST_F(FileStreamTest, SeekAround) {
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
+ int flags = base::PLATFORM_FILE_OPEN |
base::PLATFORM_FILE_READ;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -260,7 +260,7 @@ TEST_F(FileStreamTest, SeekAround) {
TEST_F(FileStreamTest, BasicWrite) {
net::FileStream stream;
- int flags = base::PLATFORM_FILE_CREATE_ALWAYS |
+ int flags = base::PLATFORM_FILE_CREATE_ALWAYS |
base::PLATFORM_FILE_WRITE;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -281,8 +281,8 @@ TEST_F(FileStreamTest, BasicWrite) {
TEST_F(FileStreamTest, AsyncWrite) {
net::FileStream stream;
- int flags = base::PLATFORM_FILE_CREATE_ALWAYS |
- base::PLATFORM_FILE_WRITE |
+ int flags = base::PLATFORM_FILE_CREATE_ALWAYS |
+ base::PLATFORM_FILE_WRITE |
base::PLATFORM_FILE_ASYNC;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -311,7 +311,7 @@ TEST_F(FileStreamTest, AsyncWrite) {
TEST_F(FileStreamTest, BasicWrite_FromOffset) {
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
+ int flags = base::PLATFORM_FILE_OPEN |
base::PLATFORM_FILE_WRITE;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -340,7 +340,7 @@ TEST_F(FileStreamTest, AsyncWrite_FromOffset) {
EXPECT_TRUE(ok);
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
+ int flags = base::PLATFORM_FILE_OPEN |
base::PLATFORM_FILE_WRITE |
base::PLATFORM_FILE_ASYNC;
int rv = stream.Open(temp_file_path(), flags);
@@ -373,8 +373,8 @@ TEST_F(FileStreamTest, BasicReadWrite) {
EXPECT_TRUE(ok);
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
- base::PLATFORM_FILE_READ |
+ int flags = base::PLATFORM_FILE_OPEN |
+ base::PLATFORM_FILE_READ |
base::PLATFORM_FILE_WRITE;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
diff --git a/net/base/gzip_filter.cc b/net/base/gzip_filter.cc
index af7609b..79395a2 100644
--- a/net/base/gzip_filter.cc
+++ b/net/base/gzip_filter.cc
@@ -41,7 +41,7 @@ bool GZipFilter::InitDecoding(Filter::FilterType filter_type) {
decoding_mode_ = DECODE_MODE_DEFLATE;
break;
}
- case Filter::FILTER_TYPE_GZIP_HELPING_SDCH:
+ case Filter::FILTER_TYPE_GZIP_HELPING_SDCH:
possible_sdch_pass_through_ = true; // Needed to optionally help sdch.
// Fall through to GZIP case.
case Filter::FILTER_TYPE_GZIP: {
@@ -105,7 +105,7 @@ Filter::FilterStatus GZipFilter::ReadFilteredData(char* dest_buffer,
break;
}
case Filter::FILTER_ERROR: {
- if (possible_sdch_pass_through_ &&
+ if (possible_sdch_pass_through_ &&
GZIP_GET_INVALID_HEADER == gzip_header_status_) {
decoding_status_ = DECODING_DONE; // Become a pass through filter.
return CopyOut(dest_buffer, dest_len);
diff --git a/net/base/listen_socket.cc b/net/base/listen_socket.cc
index b2185a2..a172e46 100644
--- a/net/base/listen_socket.cc
+++ b/net/base/listen_socket.cc
@@ -216,7 +216,7 @@ void ListenSocket::Send(const std::string& str, bool append_linefeed) {
}
// TODO (ibrar): We can add these functions into OS dependent files
-#if defined(OS_WIN)
+#if defined(OS_WIN)
// MessageLoop watcher callback
void ListenSocket::OnObjectSignaled(HANDLE object) {
WSANETWORKEVENTS ev;
@@ -224,10 +224,10 @@ void ListenSocket::OnObjectSignaled(HANDLE object) {
// TODO
return;
}
-
+
// The object was reset by WSAEnumNetworkEvents. Watch for the next signal.
watcher_.StartWatching(object, this);
-
+
if (ev.lNetworkEvents == 0) {
// Occasionally the event is set even though there is no new data.
// The net seems to think that this is ignorable.
diff --git a/net/base/listen_socket_unittest.cc b/net/base/listen_socket_unittest.cc
index aaac099..6ae798a 100644
--- a/net/base/listen_socket_unittest.cc
+++ b/net/base/listen_socket_unittest.cc
@@ -33,7 +33,7 @@ void ListenSocketTester::SetUp() {
ASSERT_EQ(0, pthread_mutex_init(&lock_, NULL ));
sem_unlink(kSemaphoreName);
semaphore_ = sem_open(kSemaphoreName, O_CREAT, 0, 0);
- ASSERT_NE(SEM_FAILED, semaphore_);
+ ASSERT_NE(SEM_FAILED, semaphore_);
#endif
base::Thread::Options options;
options.message_loop_type = MessageLoop::TYPE_IO;
@@ -132,7 +132,7 @@ bool ListenSocketTester::NextAction(int timeout) {
timeout--;
if (timeout <= 0)
return false;
- if (result == 0)
+ if (result == 0)
break;
}
pthread_mutex_lock(&lock_);
@@ -163,7 +163,7 @@ int ListenSocketTester::ClearTestSocket() {
#endif
PlatformThread::Sleep(1);
time_out++;
- if (time_out > 10)
+ if (time_out > 10)
break;
continue; // still trying
}
@@ -199,14 +199,14 @@ void ListenSocketTester::SendFromTester() {
ReportAction(ListenSocketTestAction(ACTION_SEND));
}
-void ListenSocketTester::DidAccept(ListenSocket *server,
+void ListenSocketTester::DidAccept(ListenSocket *server,
ListenSocket *connection) {
connection_ = connection;
connection_->AddRef();
ReportAction(ListenSocketTestAction(ACTION_ACCEPT));
}
-void ListenSocketTester::DidRead(ListenSocket *connection,
+void ListenSocketTester::DidRead(ListenSocket *connection,
const std::string& data) {
ReportAction(ListenSocketTestAction(ACTION_READ, data));
}
diff --git a/net/base/listen_socket_unittest.h b/net/base/listen_socket_unittest.h
index 5a04099..382508e 100644
--- a/net/base/listen_socket_unittest.h
+++ b/net/base/listen_socket_unittest.h
@@ -30,7 +30,7 @@
#if defined(OS_POSIX)
// Used same name as in Windows to avoid #ifdef where refrenced
#define SOCKET int
-const int INVALID_SOCKET = -1;
+const int INVALID_SOCKET = -1;
const int SOCKET_ERROR = -1;
#endif
@@ -73,7 +73,7 @@ class ListenSocketTester :
public:
ListenSocketTester()
: thread_(NULL),
- loop_(NULL),
+ loop_(NULL),
server_(NULL),
connection_(NULL){
}
diff --git a/net/base/mime_sniffer.cc b/net/base/mime_sniffer.cc
index d982f85..d67682b 100644
--- a/net/base/mime_sniffer.cc
+++ b/net/base/mime_sniffer.cc
@@ -144,9 +144,9 @@ static const MagicNumber kMagicNumbers[] = {
MAGIC_NUMBER("image/jpeg", "\xFF\xD8\xFF")
MAGIC_NUMBER("image/bmp", "BM")
// Source: Mozilla
- MAGIC_NUMBER("text/plain", "#!") // Script
- MAGIC_NUMBER("text/plain", "%!") // Script, similar to PS
- MAGIC_NUMBER("text/plain", "From")
+ MAGIC_NUMBER("text/plain", "#!") // Script
+ MAGIC_NUMBER("text/plain", "%!") // Script, similar to PS
+ MAGIC_NUMBER("text/plain", "From")
MAGIC_NUMBER("text/plain", ">From")
// Chrome specific
MAGIC_NUMBER("application/x-gzip", "\x1F\x8B\x08")
diff --git a/net/base/mime_sniffer_unittest.cc b/net/base/mime_sniffer_unittest.cc
index caf258b..96eb441 100644
--- a/net/base/mime_sniffer_unittest.cc
+++ b/net/base/mime_sniffer_unittest.cc
@@ -298,7 +298,7 @@ TEST(MimeSnifferTest, XMLTest) {
// Test content which is >= 512 bytes, and includes no open angle bracket.
// http://code.google.com/p/chromium/issues/detail?id=3521
TEST(MimeSnifferTest, XMLTestLargeNoAngledBracket) {
- // Make a large input, with 600 bytes of "x".
+ // Make a large input, with 600 bytes of "x".
std::string content;
content.resize(600);
std::fill(content.begin(), content.end(), 'x');
diff --git a/net/base/nss_memio.c b/net/base/nss_memio.c
index ca3421e..f32ca5d 100644
--- a/net/base/nss_memio.c
+++ b/net/base/nss_memio.c
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// Written in NSPR style to also be suitable for adding to the NSS demo suite
-/* memio is a simple NSPR I/O layer that lets you decouple NSS from
+/* memio is a simple NSPR I/O layer that lets you decouple NSS from
* the real network. It's rather like openssl's memory bio,
* and is useful when your app absolutely, positively doesn't
* want to let NSS do its own networking.
@@ -38,21 +38,21 @@ struct memio_buffer {
};
-/* The 'secret' field of a PRFileDesc created by memio_CreateIOLayer points
+/* The 'secret' field of a PRFileDesc created by memio_CreateIOLayer points
* to one of these.
- * In the public header, we use struct memio_Private as a typesafe alias
+ * In the public header, we use struct memio_Private as a typesafe alias
* for this. This causes a few ugly typecasts in the private file, but
* seems safer.
*/
struct PRFilePrivate {
/* read requests are satisfied from this buffer */
- struct memio_buffer readbuf;
+ struct memio_buffer readbuf;
/* write requests are satisfied from this buffer */
- struct memio_buffer writebuf;
+ struct memio_buffer writebuf;
/* SSL needs to know socket peer's name */
- PRNetAddr peername;
+ PRNetAddr peername;
/* if set, empty I/O returns EOF instead of EWOULDBLOCK */
int eof;
@@ -120,7 +120,7 @@ static int memio_buffer_used(const struct memio_buffer *mb)
/* How many bytes can be read out of the buffer without wrapping */
static int memio_buffer_used_contiguous(const struct memio_buffer *mb)
-{
+{
return (((mb->tail >= mb->head) ? mb->tail : mb->bufsize) - mb->head);
}
@@ -132,7 +132,7 @@ static int memio_buffer_unused(const struct memio_buffer *mb)
/* How many bytes can be written into the buffer without wrapping */
static int memio_buffer_unused_contiguous(const struct memio_buffer *mb)
-{
+{
if (mb->head > mb->tail) return mb->head - mb->tail - 1;
return mb->bufsize - mb->tail - (mb->head == 0);
}
@@ -236,7 +236,7 @@ static PRStatus PR_CALLBACK memio_Shutdown(PRFileDesc *fd, PRIntn how)
* out of the buffer, return it to the next call that
* tries to read from an empty buffer.
*/
-static int PR_CALLBACK memio_Recv(PRFileDesc *fd, void *buf, PRInt32 len,
+static int PR_CALLBACK memio_Recv(PRFileDesc *fd, void *buf, PRInt32 len,
PRIntn flags, PRIntervalTime timeout)
{
struct PRFilePrivate *secret;
@@ -323,11 +323,11 @@ static PRStatus memio_GetSocketOption(PRFileDesc *fd, PRSocketOptionData *data)
/*--------------- private memio data -----------------------*/
-/*
+/*
* Implement just the bare minimum number of methods needed to make ssl happy.
*
- * Oddly, PR_Recv calls ssl_Recv calls ssl_SocketIsBlocking calls
- * PR_GetSocketOption, so we have to provide an implementation of
+ * Oddly, PR_Recv calls ssl_Recv calls ssl_SocketIsBlocking calls
+ * PR_GetSocketOption, so we have to provide an implementation of
* PR_GetSocketOption that just says "I'm nonblocking".
*/
diff --git a/net/base/nss_memio.h b/net/base/nss_memio.h
index b766007..0bee53e 100644
--- a/net/base/nss_memio.h
+++ b/net/base/nss_memio.h
@@ -8,7 +8,7 @@
#ifdef __cplusplus
extern "C" {
-#endif
+#endif
#include "prio.h"
@@ -27,7 +27,7 @@ typedef struct memio_Private memio_Private;
5) While at the same time doing plaintext nonblocking NSPR I/O as
usual to the nspr file descriptor returned by SSL_ImportFD,
your app must shuttle encrypted data between
- the real network and memio's network buffers.
+ the real network and memio's network buffers.
memio_GetReadParams/memio_PutReadResult
are the hooks you need to pump data into memio's input buffer,
and memio_GetWriteParams/memio_PutWriteResult
@@ -55,7 +55,7 @@ memio_Private *memio_GetSecret(PRFileDesc *fd);
int memio_GetReadParams(memio_Private *secret, char **buf);
/* Tell memio how many bytes were read from the network.
- * If bytes_read is 0, causes EOF to be reported to
+ * If bytes_read is 0, causes EOF to be reported to
* NSS after it reads the last byte from the circular buffer.
* If bytes_read is < 0, it is treated as an NSPR error code.
* See nspr/pr/src/md/unix/unix_errors.c for how to
@@ -81,6 +81,6 @@ void memio_PutWriteResult(memio_Private *secret, int bytes_written);
#ifdef __cplusplus
}
-#endif
+#endif
#endif
diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc
index 458c3a4..ac63c6c 100644
--- a/net/base/sdch_manager.cc
+++ b/net/base/sdch_manager.cc
@@ -142,12 +142,12 @@ const bool SdchManager::IsInSupportedDomain(const GURL& url) {
bool SdchManager::CanFetchDictionary(const GURL& referring_url,
const GURL& dictionary_url) const {
- /* The user agent may retrieve a dictionary from the dictionary URL if all of
+ /* The user agent may retrieve a dictionary from the dictionary URL if all of
the following are true:
1 The dictionary URL host name matches the referrer URL host name
2 The dictionary URL host name domain matches the parent domain of the
referrer URL host name
- 3 The parent domain of the referrer URL host name is not a top level
+ 3 The parent domain of the referrer URL host name is not a top level
domain
4 The dictionary URL is not an HTTPS URL.
*/
@@ -365,7 +365,7 @@ bool SdchManager::Dictionary::CanSet(const std::string& domain,
const GURL& dictionary_url) {
if (!SdchManager::Global()->IsInSupportedDomain(dictionary_url))
return false;
- /*
+ /*
A dictionary is invalid and must not be stored if any of the following are
true:
1. The dictionary has no Domain attribute.
@@ -459,7 +459,7 @@ bool SdchManager::Dictionary::CanUse(const GURL referring_url) {
bool SdchManager::Dictionary::CanAdvertise(const GURL& target_url) {
if (!SdchManager::Global()->IsInSupportedDomain(target_url))
return false;
- /* The specific rules of when a dictionary should be advertised in an
+ /* The specific rules of when a dictionary should be advertised in an
Avail-Dictionary header are modeled after the rules for cookie scoping. The
terms "domain-match" and "pathmatch" are defined in RFC 2965 [6]. A
dictionary may be advertised in the Avail-Dictionaries header exactly when
@@ -489,7 +489,7 @@ bool SdchManager::Dictionary::PathMatch(const std::string& path,
/* Must be either:
1. P2 is equal to P1
2. P2 is a prefix of P1 and either the final character in P2 is "/" or the
- character following P2 in P1 is "/".
+ character following P2 in P1 is "/".
*/
if (path == restriction)
return true;
diff --git a/net/base/ssl_client_socket_mac.cc b/net/base/ssl_client_socket_mac.cc
index d351db5..0d10030 100644
--- a/net/base/ssl_client_socket_mac.cc
+++ b/net/base/ssl_client_socket_mac.cc
@@ -119,11 +119,11 @@ int NetErrorFromOSStatus(OSStatus status) {
return ERR_CERT_INVALID;
case errSSLPeerCertRevoked:
return ERR_CERT_REVOKED;
-
+
case errSSLClosedGraceful:
case noErr:
return OK;
-
+
case errSSLBadRecordMac:
case errSSLBufferOverflow:
case errSSLDecryptionFail:
@@ -168,7 +168,7 @@ OSStatus OSStatusFromNetError(int net_error) {
int KeySizeOfCipherSuite(SSLCipherSuite suite) {
switch (suite) {
// SSL 2 only
-
+
case SSL_RSA_WITH_DES_CBC_MD5:
return 56;
case SSL_RSA_WITH_3DES_EDE_CBC_MD5:
@@ -178,9 +178,9 @@ int KeySizeOfCipherSuite(SSLCipherSuite suite) {
return 128;
case SSL_NO_SUCH_CIPHERSUITE: // **
return 0;
-
+
// SSL 2, 3, TLS
-
+
case SSL_NULL_WITH_NULL_NULL:
case SSL_RSA_WITH_NULL_MD5:
case SSL_RSA_WITH_NULL_SHA: // **
@@ -217,9 +217,9 @@ int KeySizeOfCipherSuite(SSLCipherSuite suite) {
case SSL_RSA_WITH_IDEA_CBC_SHA: // **
case SSL_DH_anon_WITH_RC4_128_MD5:
return 128;
-
+
// TLS AES options (see RFC 3268)
-
+
case TLS_RSA_WITH_AES_128_CBC_SHA:
case TLS_DH_DSS_WITH_AES_128_CBC_SHA: // **
case TLS_DH_RSA_WITH_AES_128_CBC_SHA: // **
@@ -234,7 +234,7 @@ int KeySizeOfCipherSuite(SSLCipherSuite suite) {
case TLS_DHE_RSA_WITH_AES_256_CBC_SHA:
case TLS_DH_anon_WITH_AES_256_CBC_SHA:
return 256;
-
+
default:
return -1;
}
@@ -287,13 +287,13 @@ int SSLClientSocketMac::ReconnectIgnoringLastError(
void SSLClientSocketMac::Disconnect() {
completed_handshake_ = false;
-
+
if (ssl_context_) {
SSLClose(ssl_context_);
SSLDisposeContext(ssl_context_);
ssl_context_ = NULL;
}
-
+
transport_->Disconnect();
}
@@ -342,7 +342,7 @@ int SSLClientSocketMac::Write(const char* buf, int buf_len,
user_buf_ = const_cast<char*>(buf);
user_buf_len_ = buf_len;
-
+
next_state_ = STATE_PAYLOAD_WRITE;
int rv = DoLoop(OK);
if (rv == ERR_IO_PENDING)
@@ -353,15 +353,15 @@ int SSLClientSocketMac::Write(const char* buf, int buf_len,
void SSLClientSocketMac::GetSSLInfo(SSLInfo* ssl_info) {
DCHECK(completed_handshake_);
OSStatus status;
-
+
ssl_info->Reset();
-
+
// set cert
CFArrayRef certs;
status = SSLCopyPeerCertificates(ssl_context_, &certs);
if (!status) {
DCHECK(CFArrayGetCount(certs) > 0);
-
+
SecCertificateRef client_cert =
static_cast<SecCertificateRef>(
const_cast<void*>(CFArrayGetValueAtIndex(certs, 0)));
@@ -370,17 +370,17 @@ void SSLClientSocketMac::GetSSLInfo(SSLInfo* ssl_info) {
client_cert, X509Certificate::SOURCE_FROM_NETWORK);
CFRelease(certs);
}
-
+
// update status
ssl_info->cert_status = server_cert_status_;
-
+
// security info
SSLCipherSuite suite;
status = SSLGetNegotiatedCipher(ssl_context_, &suite);
if (!status)
ssl_info->security_bits = KeySizeOfCipherSuite(suite);
}
-
+
void SSLClientSocketMac::DoCallback(int rv) {
DCHECK(rv != ERR_IO_PENDING);
DCHECK(user_callback_);
@@ -459,78 +459,78 @@ int SSLClientSocketMac::DoConnectComplete(int result) {
return result;
OSStatus status = noErr;
-
+
status = SSLNewContext(false, &ssl_context_);
if (status)
return NetErrorFromOSStatus(status);
-
+
status = SSLSetProtocolVersionEnabled(ssl_context_,
kSSLProtocol2,
ssl_config_.ssl2_enabled);
if (status)
return NetErrorFromOSStatus(status);
-
+
status = SSLSetProtocolVersionEnabled(ssl_context_,
kSSLProtocol3,
ssl_config_.ssl3_enabled);
if (status)
return NetErrorFromOSStatus(status);
-
+
status = SSLSetProtocolVersionEnabled(ssl_context_,
kTLSProtocol1,
ssl_config_.tls1_enabled);
if (status)
return NetErrorFromOSStatus(status);
-
+
status = SSLSetIOFuncs(ssl_context_, SSLReadCallback, SSLWriteCallback);
if (status)
return NetErrorFromOSStatus(status);
-
+
status = SSLSetConnection(ssl_context_, this);
if (status)
return NetErrorFromOSStatus(status);
-
+
status = SSLSetPeerDomainName(ssl_context_, hostname_.c_str(),
hostname_.length());
if (status)
return NetErrorFromOSStatus(status);
-
+
next_state_ = STATE_HANDSHAKE;
return OK;
}
int SSLClientSocketMac::DoHandshake() {
OSStatus status = SSLHandshake(ssl_context_);
-
+
if (status == errSSLWouldBlock)
next_state_ = STATE_HANDSHAKE;
-
+
if (status == noErr)
completed_handshake_ = true;
-
+
int net_error = NetErrorFromOSStatus(status);
-
+
// At this point we have a connection. For now, we're going to use the default
// certificate verification that the system does, and accept its answer for
// the cert status. In the future, we'll need to call SSLSetEnableCertVerify
// to disable cert verification and do the verification ourselves. This allows
// very fine-grained control over what we'll accept for certification.
// TODO(avi): ditto
-
+
// TODO(wtc): for now, always check revocation.
server_cert_status_ = CERT_STATUS_REV_CHECKING_ENABLED;
if (net_error)
server_cert_status_ |= MapNetErrorToCertStatus(net_error);
-
+
return net_error;
}
int SSLClientSocketMac::DoReadComplete(int result) {
if (result < 0)
return result;
-
+
recv_buffer_tail_slop_ -= result;
-
+
return result;
}
@@ -539,10 +539,10 @@ void SSLClientSocketMac::OnWriteComplete(int result) {
pending_send_error_ = result;
return;
}
-
+
send_buffer_.erase(send_buffer_.begin(),
send_buffer_.begin() + result);
-
+
if (!send_buffer_.empty())
SSLWriteCallback(this, NULL, NULL);
}
@@ -553,22 +553,22 @@ int SSLClientSocketMac::DoPayloadRead() {
user_buf_,
user_buf_len_,
&processed);
-
+
// There's a subtle difference here in semantics of the "would block" errors.
// In our code, ERR_IO_PENDING means the whole operation is async, while
// errSSLWouldBlock means that the stream isn't ending (and is often returned
// along with partial data). So even though "would block" is returned, if we
// have data, let's just return it.
-
+
if (processed > 0) {
next_state_ = STATE_NONE;
return processed;
}
-
+
if (status == errSSLWouldBlock) {
next_state_ = STATE_PAYLOAD_READ;
}
-
+
return NetErrorFromOSStatus(status);
}
@@ -578,10 +578,10 @@ int SSLClientSocketMac::DoPayloadWrite() {
user_buf_,
user_buf_len_,
&processed);
-
+
if (processed > 0)
return processed;
-
+
return NetErrorFromOSStatus(status);
}
@@ -665,40 +665,40 @@ OSStatus SSLClientSocketMac::SSLReadCallback(SSLConnectionRef connection,
SSLClientSocketMac* us =
const_cast<SSLClientSocketMac*>(
static_cast<const SSLClientSocketMac*>(connection));
-
+
// If we have I/O in flight, promise we'll get back to them and use the
// existing callback to do so
-
+
if (us->next_io_state_ == STATE_READ_COMPLETE) {
*data_length = 0;
return errSSLWouldBlock;
}
-
+
// Start with what's in the buffer
-
+
size_t total_read = us->recv_buffer_.size() - us->recv_buffer_head_slop_ -
us->recv_buffer_tail_slop_;
-
+
// Resize the buffer if needed
-
+
if (us->recv_buffer_.size() - us->recv_buffer_head_slop_ < *data_length) {
us->recv_buffer_.resize(us->recv_buffer_head_slop_ + *data_length);
us->recv_buffer_tail_slop_ = *data_length - total_read;
}
-
+
int rv = 1; // any old value to spin the loop below
while (rv > 0 && total_read < *data_length) {
rv = us->transport_->Read(&us->recv_buffer_[us->recv_buffer_head_slop_ +
total_read],
us->recv_buffer_tail_slop_,
&us->io_callback_);
-
+
if (rv > 0) {
total_read += rv;
us->recv_buffer_tail_slop_ -= rv;
}
- }
-
+ }
+
*data_length = total_read;
if (total_read) {
memcpy(data, &us->recv_buffer_[us->recv_buffer_head_slop_], total_read);
@@ -714,31 +714,31 @@ OSStatus SSLClientSocketMac::SSLReadCallback(SSLConnectionRef connection,
us->recv_buffer_head_slop_ = 0;
}
}
-
+
if (rv == ERR_IO_PENDING) {
us->next_io_state_ = STATE_READ_COMPLETE;
}
-
+
if (rv < 0)
return OSStatusFromNetError(rv);
-
+
return noErr;
}
// static
-OSStatus SSLClientSocketMac::SSLWriteCallback(SSLConnectionRef connection,
- const void* data,
+OSStatus SSLClientSocketMac::SSLWriteCallback(SSLConnectionRef connection,
+ const void* data,
size_t* data_length) {
SSLClientSocketMac* us =
const_cast<SSLClientSocketMac*>(
static_cast<const SSLClientSocketMac*>(connection));
-
+
if (us->pending_send_error_ != OK) {
OSStatus status = OSStatusFromNetError(us->pending_send_error_);
us->pending_send_error_ = OK;
return status;
}
-
+
if (data)
us->send_buffer_.insert(us->send_buffer_.end(),
static_cast<const char*>(data),
@@ -751,14 +751,14 @@ OSStatus SSLClientSocketMac::SSLWriteCallback(SSLConnectionRef connection,
if (rv > 0) {
us->send_buffer_.erase(us->send_buffer_.begin(),
us->send_buffer_.begin() + rv);
-
+
}
} while (rv > 0 && !us->send_buffer_.empty());
-
+
if (rv < 0 && rv != ERR_IO_PENDING) {
return OSStatusFromNetError(rv);
}
-
+
// always lie to our caller
return noErr;
}
diff --git a/net/base/ssl_client_socket_mac.h b/net/base/ssl_client_socket_mac.h
index c8a43ce..0bff718 100644
--- a/net/base/ssl_client_socket_mac.h
+++ b/net/base/ssl_client_socket_mac.h
@@ -31,7 +31,7 @@ class SSLClientSocketMac : public SSLClientSocket {
// SSLClientSocket methods:
virtual void GetSSLInfo(SSLInfo* ssl_info);
-
+
// ClientSocket methods:
virtual int Connect(CompletionCallback* callback);
virtual int ReconnectIgnoringLastError(CompletionCallback* callback);
@@ -55,12 +55,12 @@ class SSLClientSocketMac : public SSLClientSocket {
int DoHandshake();
int DoReadComplete(int result);
void OnWriteComplete(int result);
-
+
static OSStatus SSLReadCallback(SSLConnectionRef connection,
void* data,
size_t* data_length);
- static OSStatus SSLWriteCallback(SSLConnectionRef connection,
- const void* data,
+ static OSStatus SSLWriteCallback(SSLConnectionRef connection,
+ const void* data,
size_t* data_length);
CompletionCallbackImpl<SSLClientSocketMac> io_callback_;
@@ -87,12 +87,12 @@ class SSLClientSocketMac : public SSLClientSocket {
};
State next_state_;
State next_io_state_;
-
+
int server_cert_status_;
bool completed_handshake_;
SSLContextRef ssl_context_;
-
+
// These are buffers for holding data during I/O. The "slop" is the amount of
// space at the ends of the receive buffer that are allocated for holding data
// but don't (yet).
diff --git a/net/base/telnet_server.cc b/net/base/telnet_server.cc
index 3260951..8cd2451 100644
--- a/net/base/telnet_server.cc
+++ b/net/base/telnet_server.cc
@@ -22,7 +22,7 @@
#if defined(OS_POSIX)
// Used same name as in Windows to avoid #ifdef where refrenced
#define SOCKET int
-const int INVALID_SOCKET = -1;
+const int INVALID_SOCKET = -1;
const int SOCKET_ERROR = -1;
struct event; // From libevent
#endif
@@ -259,7 +259,7 @@ void TelnetServer::Read() {
break;
#else
if (len == SOCKET_ERROR) {
- if (errno == EWOULDBLOCK || errno == EAGAIN)
+ if (errno == EWOULDBLOCK || errno == EAGAIN)
break;
#endif
} else if (len == 0) {
diff --git a/net/base/test_completion_callback_unittest.cc b/net/base/test_completion_callback_unittest.cc
index 9967482..1d333f7 100644
--- a/net/base/test_completion_callback_unittest.cc
+++ b/net/base/test_completion_callback_unittest.cc
@@ -16,7 +16,7 @@ using net::CompletionCallback;
const int kMagicResult = 8888;
-// ExampleEmployer is a toy version of HostResolver
+// ExampleEmployer is a toy version of HostResolver
// TODO: restore damage done in extracting example from real code
// (e.g. bring back real destructor, bring back comments)
class ExampleEmployer {
@@ -37,7 +37,7 @@ class ExampleEmployer {
};
// Helper class; this is how ExampleEmployer puts work on a different thread
-class ExampleEmployer::ExampleWorker
+class ExampleEmployer::ExampleWorker
: public base::RefCountedThreadSafe<ExampleWorker> {
public:
ExampleWorker(ExampleEmployer* employer, CompletionCallback* callback)
@@ -70,7 +70,7 @@ void ExampleEmployer::ExampleWorker::DoWork() {
reply = NULL;
}
}
-
+
// Does nothing if it got posted.
delete reply;
}
diff --git a/net/base/x509_certificate_mac.cc b/net/base/x509_certificate_mac.cc
index 3ab62e9..f20d683 100644
--- a/net/base/x509_certificate_mac.cc
+++ b/net/base/x509_certificate_mac.cc
@@ -87,21 +87,21 @@ OSStatus GetCertFieldsForOID(X509Certificate::OSCertHandle cert_handle,
CSSM_FIELD_PTR* fields) {
*num_of_fields = 0;
*fields = NULL;
-
+
CSSM_DATA cert_data;
OSStatus status = SecCertificateGetData(cert_handle, &cert_data);
if (status)
return status;
-
+
CSSM_CL_HANDLE cl_handle;
status = SecCertificateGetCLHandle(cert_handle, &cl_handle);
if (status)
return status;
-
+
status = CSSM_CL_CertGetAllFields(cl_handle, &cert_data, num_of_fields,
fields);
return status;
-}
+}
void GetCertGeneralNamesForOID(X509Certificate::OSCertHandle cert_handle,
CSSM_OID oid, CE_GeneralNameType name_type,
@@ -112,14 +112,14 @@ void GetCertGeneralNamesForOID(X509Certificate::OSCertHandle cert_handle,
&fields);
if (status)
return;
-
+
for (size_t field = 0; field < num_of_fields; ++field) {
if (CSSMOIDEqual(&fields[field].FieldOid, &oid)) {
CSSM_X509_EXTENSION_PTR cssm_ext =
(CSSM_X509_EXTENSION_PTR)fields[field].FieldValue.Data;
CE_GeneralNames* alt_name =
(CE_GeneralNames*) cssm_ext->value.parsedValue;
-
+
for (size_t name = 0; name < alt_name->numNames; ++name) {
const CE_GeneralName& name_struct = alt_name->generalName[name];
// For future extension: We're assuming that these values are of types
@@ -146,15 +146,15 @@ void GetCertGeneralNamesForOID(X509Certificate::OSCertHandle cert_handle,
void GetCertDateForOID(X509Certificate::OSCertHandle cert_handle,
CSSM_OID oid, Time* result) {
- *result = Time::Time();
-
+ *result = Time::Time();
+
uint32 num_of_fields;
CSSM_FIELD_PTR fields;
OSStatus status = GetCertFieldsForOID(cert_handle, oid, &num_of_fields,
&fields);
if (status)
return;
-
+
for (size_t field = 0; field < num_of_fields; ++field) {
if (CSSMOIDEqual(&fields[field].FieldOid, &oid)) {
CSSM_X509_TIME* x509_time =
@@ -163,10 +163,10 @@ void GetCertDateForOID(X509Certificate::OSCertHandle cert_handle,
std::string(reinterpret_cast<std::string::value_type*>
(x509_time->time.Data),
x509_time->time.Length);
-
+
DCHECK(x509_time->timeType == BER_TAG_UTC_TIME ||
x509_time->timeType == BER_TAG_GENERALIZED_TIME);
-
+
struct tm time;
const char* parse_string;
if (x509_time->timeType == BER_TAG_UTC_TIME)
@@ -178,9 +178,9 @@ void GetCertDateForOID(X509Certificate::OSCertHandle cert_handle,
// this is a rather broken cert.
return;
}
-
+
strptime(time_string.c_str(), parse_string, &time);
-
+
Time::Exploded exploded;
exploded.year = time.tm_year + 1900;
exploded.month = time.tm_mon + 1;
@@ -190,7 +190,7 @@ void GetCertDateForOID(X509Certificate::OSCertHandle cert_handle,
exploded.minute = time.tm_min;
exploded.second = time.tm_sec;
exploded.millisecond = 0;
-
+
*result = Time::FromUTCExploded(exploded);
break;
}
@@ -209,12 +209,12 @@ void X509Certificate::Initialize() {
if (!status) {
ParsePrincipal(name, &issuer_);
}
-
+
GetCertDateForOID(cert_handle_, CSSMOID_X509V1ValidityNotBefore,
&valid_start_);
GetCertDateForOID(cert_handle_, CSSMOID_X509V1ValidityNotAfter,
&valid_expiry_);
-
+
fingerprint_ = CalculateFingerprint(cert_handle_);
// Store the certificate in the cache in case we need it later.
@@ -228,7 +228,7 @@ X509Certificate* X509Certificate::CreateFromPickle(const Pickle& pickle,
int length;
if (!pickle.ReadData(pickle_iter, &data, &length))
return NULL;
-
+
return CreateFromBytes(data, length);
}
@@ -250,10 +250,10 @@ bool X509Certificate::HasExpired() const {
void X509Certificate::GetDNSNames(std::vector<std::string>* dns_names) const {
dns_names->clear();
-
+
GetCertGeneralNamesForOID(cert_handle_, CSSMOID_SubjectAltName, GNT_DNSName,
dns_names);
-
+
if (dns_names->empty())
dns_names->push_back(subject_.common_name);
}
@@ -264,7 +264,7 @@ int X509Certificate::Verify(const std::string& hostname,
NOTIMPLEMENTED();
return ERR_NOT_IMPLEMENTED;
}
-
+
// Returns true if the certificate is an extended-validation certificate.
//
// The certificate has already been verified by the HTTP library. cert_status
diff --git a/net/disk_cache/disk_cache_perftest.cc b/net/disk_cache/disk_cache_perftest.cc
index 74cac65..785f93f 100644
--- a/net/disk_cache/disk_cache_perftest.cc
+++ b/net/disk_cache/disk_cache_perftest.cc
@@ -222,7 +222,7 @@ TEST_F(DiskCacheTest, BlockFilesPerformance) {
memset(buffer, 0, sizeof(buffer));
disk_cache::Addr* address = reinterpret_cast<disk_cache::Addr*>(buffer);
ASSERT_EQ(sizeof(*address), sizeof(*buffer));
-
+
PerfTimeLogger timer1("Fill three block-files");
// Fill up the 32-byte block file (use three files).
diff --git a/net/disk_cache/disk_cache_test_util.cc b/net/disk_cache/disk_cache_test_util.cc
index 4920e54..9a15209 100644
--- a/net/disk_cache/disk_cache_test_util.cc
+++ b/net/disk_cache/disk_cache_test_util.cc
@@ -50,8 +50,8 @@ std::wstring GetCachePath() {
bool CreateCacheTestFile(const wchar_t* name) {
using namespace disk_cache;
- int flags = base::PLATFORM_FILE_CREATE_ALWAYS |
- base::PLATFORM_FILE_READ |
+ int flags = base::PLATFORM_FILE_CREATE_ALWAYS |
+ base::PLATFORM_FILE_READ |
base::PLATFORM_FILE_WRITE;
scoped_refptr<File> file(new File(
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc
index bb7cc2e..a79b3f7 100644
--- a/net/disk_cache/entry_unittest.cc
+++ b/net/disk_cache/entry_unittest.cc
@@ -607,7 +607,7 @@ void DiskCacheEntryTest::ZeroLengthIO() {
std::string key1("the first key");
disk_cache::Entry *entry1;
ASSERT_TRUE(cache_->CreateEntry(key1, &entry1));
-
+
EXPECT_EQ(0, entry1->ReadData(0, 0, NULL, 0, NULL));
EXPECT_EQ(0, entry1->WriteData(0, 0, NULL, 0, NULL, false));
diff --git a/net/disk_cache/file.h b/net/disk_cache/file.h
index b457e88..53c72bd 100644
--- a/net/disk_cache/file.h
+++ b/net/disk_cache/file.h
@@ -20,7 +20,7 @@ class FileIOCallback {
// Notified of the actual number of bytes read or written. This value is
// negative if an error occurred.
virtual void OnFileIOComplete(int bytes_copied) = 0;
-
+
virtual ~FileIOCallback() {}
};
diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc
index e35a195..4c19cd8 100644
--- a/net/disk_cache/stress_cache.cc
+++ b/net/disk_cache/stress_cache.cc
@@ -179,7 +179,7 @@ void CrashHandler(const std::string& str) {
int main(int argc, const char* argv[]) {
// Setup an AtExitManager so Singleton objects will be destructed.
- base::AtExitManager at_exit_manager;
+ base::AtExitManager at_exit_manager;
if (argc < 2)
return MasterCode();
diff --git a/net/ftp/ftp_request_info.h b/net/ftp/ftp_request_info.h
index b1d3e1c..235a264 100644
--- a/net/ftp/ftp_request_info.h
+++ b/net/ftp/ftp_request_info.h
@@ -7,7 +7,7 @@
class FtpRequestInfo {
public:
- // The requested URL.
+ // The requested URL.
GURL url;
// Any upload data.
diff --git a/net/http/http_auth.h b/net/http/http_auth.h
index 7442898..041581e 100644
--- a/net/http/http_auth.h
+++ b/net/http/http_auth.h
@@ -17,7 +17,7 @@ class HttpResponseHeaders;
class HttpAuth {
public:
- // Http authentication can be done the the proxy server, origin server,
+ // Http authentication can be done the the proxy server, origin server,
// or both. This enum tracks who the target is.
enum Target {
AUTH_PROXY = 0,
@@ -46,7 +46,7 @@ class HttpAuth {
IDENT_SRC_EXTERNAL,
};
- // Helper structure used by HttpNetworkTransaction to track
+ // Helper structure used by HttpNetworkTransaction to track
// the current identity being used for authorization.
struct Identity {
Identity() : source(IDENT_SRC_NONE), invalid(true) { }
@@ -108,7 +108,7 @@ class HttpAuth {
std::string scheme() const {
return std::string(scheme_begin_, scheme_end_);
}
-
+
// Returns false if there was a parse error.
bool valid() const {
return valid_;
@@ -134,7 +134,7 @@ class HttpAuth {
// If value() has quotemarks, unquote it.
std::string unquoted_value() const;
-
+
// True if the name-value pair's value has quote marks.
bool value_is_quoted() const { return value_is_quoted_; }
diff --git a/net/http/http_auth_cache.cc b/net/http/http_auth_cache.cc
index 39db6418..3076a89 100644
--- a/net/http/http_auth_cache.cc
+++ b/net/http/http_auth_cache.cc
@@ -104,7 +104,7 @@ HttpAuthCache::Entry* HttpAuthCache::Add(const GURL& origin,
// Check for existing entry (we will re-use it if present).
HttpAuthCache::Entry* entry = LookupByRealm(origin, handler->realm());
-
+
if (!entry) {
// Failsafe to prevent unbounded memory growth of the cache.
if (entries_.size() >= kMaxNumRealmEntries) {
diff --git a/net/http/http_auth_handler_basic.h b/net/http/http_auth_handler_basic.h
index 2db2fcb..1424c8f 100644
--- a/net/http/http_auth_handler_basic.h
+++ b/net/http/http_auth_handler_basic.h
@@ -18,7 +18,7 @@ class HttpAuthHandlerBasic : public HttpAuthHandler {
const ProxyInfo*);
protected:
virtual bool Init(std::string::const_iterator challenge_begin,
- std::string::const_iterator challenge_end);
+ std::string::const_iterator challenge_end);
};
diff --git a/net/http/http_auth_handler_digest_unittest.cc b/net/http/http_auth_handler_digest_unittest.cc
index bb21d8b..c4abe26 100644
--- a/net/http/http_auth_handler_digest_unittest.cc
+++ b/net/http/http_auth_handler_digest_unittest.cc
@@ -35,7 +35,7 @@ TEST(HttpAuthHandlerDigestTest, ParseChallenge) {
HttpAuthHandlerDigest::ALGORITHM_UNSPECIFIED,
HttpAuthHandlerDigest::QOP_UNSPECIFIED
},
-
+
{// Check that when algorithm has an unsupported value, parsing fails.
"Digest nonce=\"xyz\", algorithm=\"awezum\", realm=\"Thunder\"",
false,
@@ -92,7 +92,7 @@ TEST(HttpAuthHandlerDigestTest, ParseChallenge) {
scoped_refptr<HttpAuthHandlerDigest> digest = new HttpAuthHandlerDigest;
bool ok = digest->ParseChallenge(challenge.begin(), challenge.end());
-
+
EXPECT_EQ(tests[i].parsed_success, ok);
EXPECT_STREQ(tests[i].parsed_realm, digest->realm_.c_str());
EXPECT_STREQ(tests[i].parsed_nonce, digest->nonce_.c_str());
@@ -244,7 +244,7 @@ TEST(HttpAuthHandlerDigestTest, AssembleCredentials) {
std::string creds = digest->AssembleCredentials(tests[i].req_method,
tests[i].req_path, tests[i].username, tests[i].password,
tests[i].cnonce, tests[i].nonce_count);
-
+
EXPECT_STREQ(tests[i].expected_creds, creds.c_str());
}
}
diff --git a/net/http/http_chunked_decoder.cc b/net/http/http_chunked_decoder.cc
index 14d1631..e030dc0 100644
--- a/net/http/http_chunked_decoder.cc
+++ b/net/http/http_chunked_decoder.cc
@@ -136,7 +136,7 @@ int HttpChunkedDecoder::ScanForChunkRemaining(const char* buf, int buf_len) {
} else {
DLOG(ERROR) << "missing chunk-size";
return ERR_INVALID_CHUNKED_ENCODING;
- }
+ }
line_buf_.clear();
} else {
// Save the partial line; wait for more data.
diff --git a/net/http/http_chunked_decoder.h b/net/http/http_chunked_decoder.h
index 0e41bb1..1eb3ea0 100644
--- a/net/http/http_chunked_decoder.h
+++ b/net/http/http_chunked_decoder.h
@@ -92,7 +92,7 @@ class HttpChunkedDecoder {
// Convert string |start| of length |len| to a numeric value.
// |start| is a string of type "chunk-size" (hex string).
// If the conversion succeeds, return true and place the result in |out|.
- static bool ParseChunkSize(const char* start, int len, int* out);
+ static bool ParseChunkSize(const char* start, int len, int* out);
// Indicates the number of bytes remaining for the current chunk.
int chunk_remaining_;
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index 47d2f85..536a571 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -510,7 +510,7 @@ void HttpResponseHeaders::ParseStatusLine(
raw_headers_.append(" 200 OK");
response_code_ = 200;
return;
- }
+ }
raw_headers_.push_back(' ');
raw_headers_.append(code, p);
raw_headers_.push_back(' ');
@@ -967,7 +967,7 @@ int64 HttpResponseHeaders::GetContentLength() const {
int64 result;
bool ok = StringToInt64(content_length_val, &result);
- if (!ok || result < 0)
+ if (!ok || result < 0)
return -1;
return result;
diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc
index 79064b6..a8d76304 100644
--- a/net/http/http_response_headers_unittest.cc
+++ b/net/http/http_response_headers_unittest.cc
@@ -103,7 +103,7 @@ TEST(HttpResponseHeadersTest, NormalizeHeadersLeadingWhitespace) {
"HTTP/1.1 202 Accepted\n"
"Set-Cookie: a, b\n",
- 202,
+ 202,
HttpVersion(1,1),
HttpVersion(1,1)
};
diff --git a/net/http/http_util.h b/net/http/http_util.h
index 9966c60..91f893c 100644
--- a/net/http/http_util.h
+++ b/net/http/http_util.h
@@ -108,9 +108,9 @@ class HttpUtil {
// starts with 1.0 and is decremented by 0.2 for each successive entry
// in the list until it reaches 0.2. All the entries after that are
// assigned the same qvalue of 0.2. Also, note that the 1st language
- // will not have a qvalue added because the absence of a qvalue implicitly
+ // will not have a qvalue added because the absence of a qvalue implicitly
// means q=1.0.
- //
+ //
// When making a http request, this should be used to determine what
// to put in Accept-Language header. If a comma separated list of language
// codes *without* qvalue is sent, web servers regard all
diff --git a/net/http/http_version.h b/net/http/http_version.h
index 8ea8fd5..f6fe70b 100644
--- a/net/http/http_version.h
+++ b/net/http/http_version.h
@@ -29,7 +29,7 @@ class HttpVersion {
}
// Overloaded operators:
-
+
bool operator==(const HttpVersion& v) const {
return value_ == v.value_;
}
diff --git a/net/http/md4.cc b/net/http/md4.cc
index b457f2d..da1e8d3 100644
--- a/net/http/md4.cc
+++ b/net/http/md4.cc
@@ -126,10 +126,10 @@ static void md4step(Uint32 state[4], const Uint8 *data)
RD1(A,B,C,D, 8,3); RD1(D,A,B,C, 9,7); RD1(C,D,A,B,10,11); RD1(B,C,D,A,11,19);
RD1(A,B,C,D,12,3); RD1(D,A,B,C,13,7); RD1(C,D,A,B,14,11); RD1(B,C,D,A,15,19);
- RD2(A,B,C,D, 0,3); RD2(D,A,B,C, 4,5); RD2(C,D,A,B, 8, 9); RD2(B,C,D,A,12,13);
- RD2(A,B,C,D, 1,3); RD2(D,A,B,C, 5,5); RD2(C,D,A,B, 9, 9); RD2(B,C,D,A,13,13);
- RD2(A,B,C,D, 2,3); RD2(D,A,B,C, 6,5); RD2(C,D,A,B,10, 9); RD2(B,C,D,A,14,13);
- RD2(A,B,C,D, 3,3); RD2(D,A,B,C, 7,5); RD2(C,D,A,B,11, 9); RD2(B,C,D,A,15,13);
+ RD2(A,B,C,D, 0,3); RD2(D,A,B,C, 4,5); RD2(C,D,A,B, 8, 9); RD2(B,C,D,A,12,13);
+ RD2(A,B,C,D, 1,3); RD2(D,A,B,C, 5,5); RD2(C,D,A,B, 9, 9); RD2(B,C,D,A,13,13);
+ RD2(A,B,C,D, 2,3); RD2(D,A,B,C, 6,5); RD2(C,D,A,B,10, 9); RD2(B,C,D,A,14,13);
+ RD2(A,B,C,D, 3,3); RD2(D,A,B,C, 7,5); RD2(C,D,A,B,11, 9); RD2(B,C,D,A,15,13);
RD3(A,B,C,D, 0,3); RD3(D,A,B,C, 8,9); RD3(C,D,A,B, 4,11); RD3(B,C,D,A,12,15);
RD3(A,B,C,D, 2,3); RD3(D,A,B,C,10,9); RD3(C,D,A,B, 6,11); RD3(B,C,D,A,14,15);
diff --git a/net/http/md4.h b/net/http/md4.h
index 419ec39..b416e26 100644
--- a/net/http/md4.h
+++ b/net/http/md4.h
@@ -51,7 +51,7 @@ namespace weak_crypto {
/**
* MD4Sum - computes the MD4 sum over the input buffer per RFC 1320
- *
+ *
* @param input
* buffer containing input data
* @param inputLen
diff --git a/net/proxy/proxy_config_service_fixed.h b/net/proxy/proxy_config_service_fixed.h
index 5120093..9b8b589 100644
--- a/net/proxy/proxy_config_service_fixed.h
+++ b/net/proxy/proxy_config_service_fixed.h
@@ -19,7 +19,7 @@ class ProxyConfigServiceFixed : public ProxyConfigService {
config->proxy_rules = pi_.proxy_server().ToURI();
return OK;
}
-
+
private:
ProxyInfo pi_;
};
diff --git a/net/proxy/proxy_config_service_win.cc b/net/proxy/proxy_config_service_win.cc
index e3dc95e..d4d18e3 100644
--- a/net/proxy/proxy_config_service_win.cc
+++ b/net/proxy/proxy_config_service_win.cc
@@ -40,7 +40,7 @@ int ProxyConfigServiceWin::GetProxyConfig(ProxyConfig* config) {
config->proxy_rules = WideToASCII(ie_config.lpszProxy);
if (ie_config.lpszProxyBypass) {
std::string proxy_bypass = WideToASCII(ie_config.lpszProxyBypass);
-
+
StringTokenizer proxy_server_bypass_list(proxy_bypass, "; \t\n\r");
while (proxy_server_bypass_list.GetNext()) {
std::string bypass_url_domain = proxy_server_bypass_list.token();
diff --git a/net/proxy/proxy_resolver_mac.cc b/net/proxy/proxy_resolver_mac.cc
index 796847d..4ac2b18 100644
--- a/net/proxy/proxy_resolver_mac.cc
+++ b/net/proxy/proxy_resolver_mac.cc
@@ -26,7 +26,7 @@ CFTypeRef GetValueFromDictionary(CFDictionaryRef dict,
CFTypeRef value = CFDictionaryGetValue(dict, key);
if (!value)
return value;
-
+
if (CFGetTypeID(value) != expected_type) {
scoped_cftyperef<CFStringRef> expected_type_ref(
CFCopyTypeIDDescription(expected_type));
@@ -41,7 +41,7 @@ CFTypeRef GetValueFromDictionary(CFDictionaryRef dict,
<< " instead";
return NULL;
}
-
+
return value;
}
@@ -54,7 +54,7 @@ bool GetBoolFromDictionary(CFDictionaryRef dict,
CFNumberGetTypeID());
if (!number)
return default_value;
-
+
int int_value;
if (CFNumberGetValue(number, kCFNumberIntType, &int_value))
return int_value;
@@ -86,7 +86,7 @@ net::ProxyServer GetProxyServerFromDictionary(net::ProxyServer::Scheme scheme,
return net::ProxyServer(); // Invalid.
}
std::string host = base::SysCFStringRefToUTF8(host_ref);
-
+
CFNumberRef port_ref =
(CFNumberRef)GetValueFromDictionary(dict, port_key,
CFNumberGetTypeID());
@@ -96,7 +96,7 @@ net::ProxyServer GetProxyServerFromDictionary(net::ProxyServer::Scheme scheme,
} else {
port = net::ProxyServer::GetDefaultPortForScheme(scheme);
}
-
+
return net::ProxyServer(scheme, host, port);
}
@@ -119,18 +119,18 @@ net::ProxyServer::Scheme GetProxyServerScheme(CFStringRef proxy_type) {
// to a CFTypeRef. This stashes either |error| or |proxies| in that location.
void ResultCallback(void* client, CFArrayRef proxies, CFErrorRef error) {
DCHECK((proxies != NULL) == (error == NULL));
-
+
CFTypeRef* result_ptr = (CFTypeRef*)client;
DCHECK(result_ptr != NULL);
DCHECK(*result_ptr == NULL);
-
+
if (error != NULL) {
*result_ptr = CFRetain(error);
} else {
*result_ptr = CFRetain(proxies);
}
CFRunLoopStop(CFRunLoopGetCurrent());
-}
+}
} // namespace
@@ -140,9 +140,9 @@ int ProxyConfigServiceMac::GetProxyConfig(ProxyConfig* config) {
scoped_cftyperef<CFDictionaryRef> config_dict(
SCDynamicStoreCopyProxies(NULL));
DCHECK(config_dict);
-
+
// auto-detect
-
+
// There appears to be no UI for this configuration option, and we're not sure
// if Apple's proxy code even takes it into account. But the constant is in
// the header file so we'll use it.
@@ -150,9 +150,9 @@ int ProxyConfigServiceMac::GetProxyConfig(ProxyConfig* config) {
GetBoolFromDictionary(config_dict.get(),
kSCPropNetProxiesProxyAutoDiscoveryEnable,
false);
-
+
// PAC file
-
+
if (GetBoolFromDictionary(config_dict.get(),
kSCPropNetProxiesProxyAutoConfigEnable,
false)) {
@@ -164,9 +164,9 @@ int ProxyConfigServiceMac::GetProxyConfig(ProxyConfig* config) {
if (pac_url_ref)
config->pac_url = GURL(base::SysCFStringRefToUTF8(pac_url_ref));
}
-
+
// proxies (for now only ftp, http and https)
-
+
if (GetBoolFromDictionary(config_dict.get(),
kSCPropNetProxiesFTPEnable,
false)) {
@@ -210,9 +210,9 @@ int ProxyConfigServiceMac::GetProxyConfig(ProxyConfig* config) {
config->proxy_rules += proxy_server.ToURI();
}
}
-
+
// proxy bypass list
-
+
CFArrayRef bypass_array_ref =
(CFArrayRef)GetValueFromDictionary(config_dict.get(),
kSCPropNetProxiesExceptionsList,
@@ -225,22 +225,22 @@ int ProxyConfigServiceMac::GetProxyConfig(ProxyConfig* config) {
if (CFGetTypeID(bypass_item_ref) != CFStringGetTypeID()) {
LOG(WARNING) << "Expected value for item " << i
<< " in the kSCPropNetProxiesExceptionsList"
- " to be a CFStringRef but it was not";
-
+ " to be a CFStringRef but it was not";
+
} else {
config->proxy_bypass.push_back(
base::SysCFStringRefToUTF8(bypass_item_ref));
}
}
}
-
+
// proxy bypass boolean
-
+
config->proxy_bypass_local_names =
GetBoolFromDictionary(config_dict.get(),
kSCPropNetProxiesExcludeSimpleHostnames,
false);
-
+
return OK;
}
@@ -261,21 +261,21 @@ int ProxyResolverMac::GetProxyForURL(const GURL& query_url,
CFURLCreateWithString(kCFAllocatorDefault,
pac_ref.get(),
NULL));
-
+
// Work around <rdar://problem/5530166>. This dummy call to
// CFNetworkCopyProxiesForURL initializes some state within CFNetwork that is
// required by CFNetworkExecuteProxyAutoConfigurationURL.
-
+
CFArrayRef dummy_result = CFNetworkCopyProxiesForURL(query_url_ref.get(),
NULL);
if (dummy_result)
CFRelease(dummy_result);
-
+
// We cheat here. We need to act as if we were synchronous, so we pump the
// runloop ourselves. Our caller moved us to a new thread anyway, so this is
// OK to do. (BTW, CFNetworkExecuteProxyAutoConfigurationURL returns a
// runloop source we need to release despite its name.)
-
+
CFTypeRef result = NULL;
CFStreamClientContext context = { 0, &result, NULL, NULL, NULL };
scoped_cftyperef<CFRunLoopSourceRef> runloop_source(
@@ -285,17 +285,17 @@ int ProxyResolverMac::GetProxyForURL(const GURL& query_url,
&context));
if (!runloop_source)
return ERR_FAILED;
-
+
const CFStringRef private_runloop_mode =
CFSTR("org.chromium.ProxyResolverMac");
-
+
CFRunLoopAddSource(CFRunLoopGetCurrent(), runloop_source.get(),
private_runloop_mode);
CFRunLoopRunInMode(private_runloop_mode, DBL_MAX, false);
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), runloop_source.get(),
private_runloop_mode);
DCHECK(result != NULL);
-
+
if (CFGetTypeID(result) == CFErrorGetTypeID()) {
// TODO(avi): do something better than this
CFRelease(result);
@@ -303,19 +303,19 @@ int ProxyResolverMac::GetProxyForURL(const GURL& query_url,
}
DCHECK(CFGetTypeID(result) == CFArrayGetTypeID());
scoped_cftyperef<CFArrayRef> proxy_array_ref((CFArrayRef)result);
-
+
// This string will be an ordered list of <proxy-uri> entries, separated by
// semi-colons. It is the format that ProxyInfo::UseNamedProxy() expects.
// proxy-uri = [<proxy-scheme>"://"]<proxy-host>":"<proxy-port>
// (This also includes entries for direct connection, as "direct://").
std::string proxy_uri_list;
-
+
CFIndex proxy_array_count = CFArrayGetCount(proxy_array_ref.get());
for (CFIndex i = 0; i < proxy_array_count; ++i) {
CFDictionaryRef proxy_dictionary =
(CFDictionaryRef)CFArrayGetValueAtIndex(proxy_array_ref.get(), i);
DCHECK(CFGetTypeID(proxy_dictionary) == CFDictionaryGetTypeID());
-
+
// The dictionary may have the following keys:
// - kCFProxyTypeKey : The type of the proxy
// - kCFProxyHostNameKey
@@ -329,7 +329,7 @@ int ProxyResolverMac::GetProxyForURL(const GURL& query_url,
// tease.
// - kCFProxyAutoConfigurationURLKey : If the PAC file specifies another
// PAC file, I'm going home.
-
+
CFStringRef proxy_type =
(CFStringRef)GetValueFromDictionary(proxy_dictionary,
kCFProxyTypeKey,
@@ -346,11 +346,11 @@ int ProxyResolverMac::GetProxyForURL(const GURL& query_url,
proxy_uri_list += ";";
proxy_uri_list += proxy_server.ToURI();
}
-
+
if (!proxy_uri_list.empty())
results->UseNamedProxy(proxy_uri_list);
// Else do nothing (results is already guaranteed to be in the default state).
-
+
return OK;
}
diff --git a/net/proxy/proxy_resolver_script.h b/net/proxy/proxy_resolver_script.h
index 5b19924..be592e4 100644
--- a/net/proxy/proxy_resolver_script.h
+++ b/net/proxy/proxy_resolver_script.h
@@ -50,7 +50,7 @@
// sed -e 's/"\s*[+]\s*$/"/g' |
// sed -e 's/"$/" \\/g' |
// sed -e 's/\/(ipaddr);/\/.exec(ipaddr);/g' |
-// grep -v '^var pacUtils ='
+// grep -v '^var pacUtils ='
#define PROXY_RESOLVER_SCRIPT \
"function dnsDomainIs(host, domain) {\n" \
" return (host.length >= domain.length &&\n" \
diff --git a/net/proxy/proxy_resolver_v8.h b/net/proxy/proxy_resolver_v8.h
index a0275c8..219560c 100644
--- a/net/proxy/proxy_resolver_v8.h
+++ b/net/proxy/proxy_resolver_v8.h
@@ -82,8 +82,8 @@ class ProxyResolverV8::JSBindings {
// Handler for "alert(message)"
virtual void Alert(const std::string& message) = 0;
- // Handler for "myIpAddress()". Returns empty string on failure.
- virtual std::string MyIpAddress() = 0;
+ // Handler for "myIpAddress()". Returns empty string on failure.
+ virtual std::string MyIpAddress() = 0;
// Handler for "dnsResolve(host)". Returns empty string on failure.
virtual std::string DnsResolve(const std::string& host) = 0;
diff --git a/net/proxy/proxy_resolver_v8_unittest.cc b/net/proxy/proxy_resolver_v8_unittest.cc
index 5cbdfd4..dff8843 100644
--- a/net/proxy/proxy_resolver_v8_unittest.cc
+++ b/net/proxy/proxy_resolver_v8_unittest.cc
@@ -379,7 +379,7 @@ TEST(ProxyResolverV8DefaultBindingsTest, DnsResolve) {
// Get a hold of a DefaultJSBindings* (it is a hidden impl class).
net::ProxyResolverV8 resolver;
net::ProxyResolverV8::JSBindings* bindings = resolver.js_bindings();
-
+
// Considered an error.
EXPECT_EQ("", bindings->DnsResolve(""));
diff --git a/net/proxy/proxy_script_fetcher.cc b/net/proxy/proxy_script_fetcher.cc
index b48ee1a..22e559ee 100644
--- a/net/proxy/proxy_script_fetcher.cc
+++ b/net/proxy/proxy_script_fetcher.cc
@@ -12,7 +12,7 @@
#include "net/base/load_flags.h"
#include "net/url_request/url_request.h"
-// TODO(eroman):
+// TODO(eroman):
// - Support auth-prompts.
namespace net {
@@ -197,7 +197,7 @@ void ProxyScriptFetcherImpl::OnResponseStarted(URLRequest* request) {
// NOTE about mime types: We do not enforce mime types on PAC files.
// This is for compatibility with {IE 7, Firefox 3, Opera 9.5}
- // NOTE about status codes: We are like Firefox 3 in this respect.
+ // NOTE about status codes: We are like Firefox 3 in this respect.
// {IE 7, Safari 3, Opera 9.5} do not care about the status code.
if (request->GetResponseCode() != 200) {
result_code_ = ERR_PAC_STATUS_NOT_OK;
diff --git a/net/proxy/proxy_server.cc b/net/proxy/proxy_server.cc
index 3ff5432..c6aea17 100644
--- a/net/proxy/proxy_server.cc
+++ b/net/proxy/proxy_server.cc
@@ -182,7 +182,7 @@ int ProxyServer::GetDefaultPortForScheme(Scheme scheme) {
return -1;
}
}
-
+
// static
ProxyServer ProxyServer::FromSchemeHostAndPort(
Scheme scheme,
diff --git a/net/proxy/proxy_server.h b/net/proxy/proxy_server.h
index 45db1fc..6c3354d 100644
--- a/net/proxy/proxy_server.h
+++ b/net/proxy/proxy_server.h
@@ -98,7 +98,7 @@ class ProxyServer {
// Format as a PAC result entry. This does the reverse of FromPacString().
std::string ToPacString() const;
-
+
// Returns the default port number for a proxy server with the specified
// scheme. Returns -1 if unknown.
static int GetDefaultPortForScheme(Scheme scheme);
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index 443a46b..ed6fa97 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -398,7 +398,7 @@ void ProxyService::ProcessPendingRequests(PacRequest* recent_req) {
// For auto-detect we use the well known WPAD url.
GURL pac_url = config_.auto_detect ?
GURL("http://wpad/wpad.dat") : config_.pac_url;
-
+
in_progress_fetch_config_id_ = config_.id();
proxy_script_fetcher_->Fetch(
diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h
index cb1fc91..81859d8 100644
--- a/net/proxy/proxy_service.h
+++ b/net/proxy/proxy_service.h
@@ -134,7 +134,7 @@ class ProxyService {
// Callback for when the PAC script has finished downloading.
void OnScriptFetchCompletion(int result);
-
+
// Returns ERR_IO_PENDING if the request cannot be completed synchronously.
// Otherwise it fills |result| with the proxy information for |url|.
// Completing synchronously means we don't need to query ProxyResolver.
diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc
index 9d6f3d6..00b0248 100644
--- a/net/tools/crash_cache/crash_cache.cc
+++ b/net/tools/crash_cache/crash_cache.cc
@@ -285,7 +285,7 @@ int SlaveCode(const std::wstring& path, RankCrashes action) {
int main(int argc, const char* argv[]) {
// Setup an AtExitManager so Singleton objects will be destructed.
- base::AtExitManager at_exit_manager;
+ base::AtExitManager at_exit_manager;
if (argc < 2)
return MasterCode();
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index acbfd67..d0e7927 100644
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -27,7 +27,7 @@ import tlslite
import tlslite.api
import pyftpdlib.ftpserver
-SERVER_HTTP = 0
+SERVER_HTTP = 0
SERVER_FTP = 1
debug_output = sys.stderr
@@ -410,11 +410,11 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def WriteFile(self):
"""This is handler dumps the content of POST request to a disk file into
the data_dir/dump. Sub-directories are not supported."""
-
+
prefix='/writefile/'
if not self.path.startswith(prefix):
return False
-
+
file_name = self.path[len(prefix):]
# do not allow fancy chars in file name
@@ -426,13 +426,13 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
f = open(path, "wb")
f.write(request);
f.close()
-
+
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write('<html>%s</html>' % file_name)
return True
-
+
def EchoTitleHandler(self):
"""This handler is like Echo, but sets the page title to the request."""
@@ -1013,7 +1013,7 @@ def main(options, args):
server.data_dir = MakeDataDir()
MakeDumpDir(server.data_dir)
-
+
# means FTP Server
else:
my_data_dir = MakeDataDir()
@@ -1069,4 +1069,4 @@ if __name__ == '__main__':
options, args = option_parser.parse_args()
sys.exit(main(options, args))
-
+
diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h
index 38ab199..fae5a1b 100644
--- a/net/url_request/url_request_job.h
+++ b/net/url_request/url_request_job.h
@@ -285,7 +285,7 @@ class URLRequestJob : public base::RefCountedThreadSafe<URLRequestJob> {
// The data stream filter which is enabled on demand.
scoped_ptr<Filter> filter_;
-
+
// If the filter filled its output buffer, then there is a change that it
// still has internal data to emit, and this flag is set.
bool filter_needs_more_output_space_;
diff --git a/net/url_request/url_request_job_manager.cc b/net/url_request/url_request_job_manager.cc
index 3dd7929..a0198b8 100644
--- a/net/url_request/url_request_job_manager.cc
+++ b/net/url_request/url_request_job_manager.cc
@@ -27,7 +27,7 @@ struct SchemeToFactory {
const char* scheme;
URLRequest::ProtocolFactory* factory;
};
-
+
} // namespace
static const SchemeToFactory kBuiltinFactories[] = {
diff --git a/net/url_request/url_request_job_tracker.h b/net/url_request/url_request_job_tracker.h
index ce276a8..7c506e7 100644
--- a/net/url_request/url_request_job_tracker.h
+++ b/net/url_request/url_request_job_tracker.h
@@ -46,7 +46,7 @@ class URLRequestJobTracker {
// Called when a new chunk of bytes has been read for the given job. The
// byte count is the number of bytes for that read event only.
virtual void OnBytesRead(URLRequestJob* job, int byte_count) = 0;
-
+
virtual ~JobObserver() {}
};
diff --git a/sandbox/src/interception.cc b/sandbox/src/interception.cc
index 621a27d..3e3b54f 100644
--- a/sandbox/src/interception.cc
+++ b/sandbox/src/interception.cc
@@ -237,7 +237,7 @@ bool InterceptionManager::SetupInterceptionInfo(const InterceptionData& data,
DCHECK(buffer);
DCHECK(*buffer);
- if ((dll_info->unload_module) &&
+ if ((dll_info->unload_module) &&
(data.function != kUnloadDLLDummyFunction)) {
// Can't specify a dll for both patch and unload.
NOTREACHED();
diff --git a/sandbox/src/interception_unittest.cc b/sandbox/src/interception_unittest.cc
index 551aaa5..78c6f7c 100644
--- a/sandbox/src/interception_unittest.cc
+++ b/sandbox/src/interception_unittest.cc
@@ -184,7 +184,7 @@ TEST(InterceptionManagerTest, BufferLayout2) {
// groups: one group with the local ("cold") interceptions, and another
// group with the interceptions belonging to dlls that will be "hot"
// patched on the client. The second group lives on local_buffer, and the
- // first group remains on the list of interceptions, in this case just one.
+ // first group remains on the list of interceptions, in this case just one.
EXPECT_EQ(1, interceptions.interceptions_.size());
int num_dlls, num_functions, num_names;
diff --git a/sandbox/src/sandbox_nt_util.cc b/sandbox/src/sandbox_nt_util.cc
index a7f1be0..f233088 100644
--- a/sandbox/src/sandbox_nt_util.cc
+++ b/sandbox/src/sandbox_nt_util.cc
@@ -342,7 +342,7 @@ UNICODE_STRING* GetBackingFilePath(PVOID address) {
}
UNICODE_STRING* ExtractModuleName(const UNICODE_STRING* module_path) {
- if ((!module_path) || (!module_path->Buffer))
+ if ((!module_path) || (!module_path->Buffer))
return NULL;
wchar_t* sep = NULL;
diff --git a/sandbox/src/unload_dll_test.cc b/sandbox/src/unload_dll_test.cc
index 55994b7..9441d7c 100644
--- a/sandbox/src/unload_dll_test.cc
+++ b/sandbox/src/unload_dll_test.cc
@@ -26,7 +26,7 @@ SBOX_TESTS_COMMAND int UseOneDLL(int argc, wchar_t **argv) {
if ((option == L'U') || (option == L'B')) {
HMODULE module2 = ::GetModuleHandleW(argv[1]);
- rv = FreeLibrary(module2) ? SBOX_TEST_SUCCEEDED : SBOX_TEST_FAILED;
+ rv = FreeLibrary(module2) ? SBOX_TEST_SUCCEEDED : SBOX_TEST_FAILED;
}
return rv;
}
diff --git a/sandbox/src/win2k_threadpool.cc b/sandbox/src/win2k_threadpool.cc
index 2882e3d..88801a0 100644
--- a/sandbox/src/win2k_threadpool.cc
+++ b/sandbox/src/win2k_threadpool.cc
@@ -62,4 +62,4 @@ Win2kThreadPool::~Win2kThreadPool() {
::DeleteCriticalSection(&lock_);
}
-} // namespace sandbox \ No newline at end of file
+} // namespace sandbox
diff --git a/testing/multiprocess_func_list.cc b/testing/multiprocess_func_list.cc
index 236edbf..1e19704 100644
--- a/testing/multiprocess_func_list.cc
+++ b/testing/multiprocess_func_list.cc
@@ -9,20 +9,20 @@
// Helper functions to maintain mapping of "test name"->test func.
// The information is accessed via a global map.
namespace multi_process_function_list {
-
+
namespace {
typedef std::map<std::string, ChildFunctionPtr> MultiProcessTestMap;
-
+
// Retrieve a reference to the global 'func name' -> func ptr map.
MultiProcessTestMap &GetMultiprocessFuncMap() {
static MultiProcessTestMap test_name_to_func_ptr_map;
return test_name_to_func_ptr_map;
}
-
+
} // namespace
-AppendMultiProcessTest::AppendMultiProcessTest(std::string test_name,
+AppendMultiProcessTest::AppendMultiProcessTest(std::string test_name,
ChildFunctionPtr func_ptr) {
GetMultiprocessFuncMap()[test_name] = func_ptr;
}
@@ -36,7 +36,7 @@ int InvokeChildProcessTest(std::string test_name) {
return (*func)();
}
}
-
+
return -1;
}
diff --git a/testing/multiprocess_func_list.h b/testing/multiprocess_func_list.h
index 0d53b2b..6ba8495 100644
--- a/testing/multiprocess_func_list.h
+++ b/testing/multiprocess_func_list.h
@@ -11,7 +11,7 @@
// as the main function of a child process in a multi-process test.
// This complements the MultiProcessTest class which provides facilities
// for launching such tests.
-//
+//
// The MULTIPROCESS_TEST_MAIN() macro registers a string -> func_ptr mapping
// by creating a new global instance of the AppendMultiProcessTest() class
// this means that by the time that we reach our main() function the mapping
@@ -32,13 +32,13 @@ namespace multi_process_function_list {
typedef int (*ChildFunctionPtr)();
// Helper class to append a test function to the global mapping.
-// Used by the MULTIPROCESS_TEST_MAIN macro.
+// Used by the MULTIPROCESS_TEST_MAIN macro.
class AppendMultiProcessTest {
public:
AppendMultiProcessTest(std::string test_name, ChildFunctionPtr func_ptr);
};
-// Invoke the main function of a test previously registered with
+// Invoke the main function of a test previously registered with
// MULTIPROCESS_TEST_MAIN()
int InvokeChildProcessTest(std::string test_name);
diff --git a/testing/platform_test.h b/testing/platform_test.h
index 6e5e039..991ad09 100644
--- a/testing/platform_test.h
+++ b/testing/platform_test.h
@@ -20,7 +20,7 @@ class NSAutoreleasePool;
// only implemented on the Mac. To enable this for another platform, just
// adjust the #ifdefs and add a platform_test_<platform>.cc implementation file.
class PlatformTest : public testing::Test {
- protected:
+ protected:
virtual void SetUp();
virtual void TearDown();
diff --git a/tools/channel_changer/resource.h b/tools/channel_changer/resource.h
index fe16158..6316987 100644
--- a/tools/channel_changer/resource.h
+++ b/tools/channel_changer/resource.h
@@ -12,7 +12,7 @@
#define IDC_CUTTING_EDGE 1003
#define IDC_SECONDARY_LABEL 1004
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
diff --git a/tools/code_coverage/coverage.py b/tools/code_coverage/coverage.py
index c28c03d..976fb86 100644
--- a/tools/code_coverage/coverage.py
+++ b/tools/code_coverage/coverage.py
@@ -6,12 +6,12 @@
"""Module to setup and generate code coverage data
-This module first sets up the environment for code coverage, instruments the
+This module first sets up the environment for code coverage, instruments the
binaries, runs the tests and collects the code coverage data.
Usage:
- coverage.py --upload=<upload_location>
+ coverage.py --upload=<upload_location>
--revision=<revision_number>
--src_root=<root_of_source_tree>
[--tools_path=<tools_path>]
@@ -50,13 +50,13 @@ windows_binaries = [#'chrome.exe',
'test_shell_tests.exe',
'test_shell.exe',
'activex_test_control.dll']
-
-# The list of [tests, args] that will be run.
+
+# The list of [tests, args] that will be run.
# Failing tests have been commented out.
# TODO(niranjan): Need to add layout tests that excercise the test shell.
windows_tests = [
['unit_tests.exe', ''],
-# ['automated_ui_tests.exe', ''],
+# ['automated_ui_tests.exe', ''],
['ui_tests.exe', '--no-sandbox'],
['installer_unittests.exe', ''],
['ipc_tests.exe', ''],
@@ -78,7 +78,7 @@ def IsWindows():
class Coverage(object):
"""Class to set up and generate code coverage.
- This class contains methods that are useful to set up the environment for
+ This class contains methods that are useful to set up the environment for
code coverage.
Attributes:
@@ -86,7 +86,7 @@ class Coverage(object):
instrumented.
"""
- def __init__(self,
+ def __init__(self,
revision,
src_path = None,
tools_path = None,
@@ -106,13 +106,13 @@ class Coverage(object):
self.src_path = src_path
self._dir = tempfile.mkdtemp()
self._archive = archive
-
-
+
+
def SetUp(self, binaries):
"""Set up the platform specific environment and instrument the binaries for
coverage.
- This method sets up the environment, instruments all the compiled binaries
+ This method sets up the environment, instruments all the compiled binaries
and sets up the code coverage counters.
Args:
@@ -127,7 +127,7 @@ class Coverage(object):
return False
if IsWindows():
# Stop all previous instance of VSPerfMon counters
- counters_command = ('%s -shutdown' %
+ counters_command = ('%s -shutdown' %
(os.path.join(self.tools_path, 'vsperfcmd.exe')))
(retcode, output) = proc.RunCommandFull(counters_command,
collect_output=True)
@@ -156,20 +156,20 @@ class Coverage(object):
# We are now ready to run tests and measure code coverage.
self.instrumented = True
return True
-
+
def TearDown(self):
"""Tear down method.
This method shuts down the counters, and cleans up all the intermediate
- artifacts.
+ artifacts.
"""
if self.instrumented == False:
return
-
+
if IsWindows():
# Stop counters
- counters_command = ('%s -shutdown' %
+ counters_command = ('%s -shutdown' %
(os.path.join(self.tools_path, 'vsperfcmd.exe')))
(retcode, output) = proc.RunCommandFull(counters_command,
collect_output=True)
@@ -187,12 +187,12 @@ class Coverage(object):
logging.info('Cleaned up temporary files and folders')
# Reset the instrumented flag.
self.instrumented = False
-
+
def RunTest(self, src_root, test):
"""Run tests and collect the .coverage file
- Args:
+ Args:
src_root: Path to the root of the source.
test: Path to the test to be run.
@@ -203,13 +203,13 @@ class Coverage(object):
# Generate the intermediate file name for the coverage results
test_name = os.path.split(test[0])[1].strip('.exe')
# test_command = binary + args
- test_command = '%s %s' % (os.path.join(src_root,
+ test_command = '%s %s' % (os.path.join(src_root,
'chrome',
'Release',
- test[0]),
+ test[0]),
test[1])
-
- coverage_file = os.path.join(self._dir, '%s_win32_%s.coverage' %
+
+ coverage_file = os.path.join(self._dir, '%s_win32_%s.coverage' %
(test_name, self.revision))
logging.info('.coverage file for test %s: %s' % (test_name, coverage_file))
@@ -221,16 +221,16 @@ class Coverage(object):
# VSPerfCmd spawns another process before terminating and this confuses
# the subprocess.Popen() used by RunCommandFull.
retcode = subprocess.call(counters_command)
-
+
# Run the test binary
logging.info('Executing test %s: ' % test_command)
(retcode, output) = proc.RunCommandFull(test_command, collect_output=True)
if retcode != 0: # Return error if the tests fail
logging.error('One or more tests failed in %s.' % test_command)
return None
-
+
# Stop the counters
- counters_command = ('%s -shutdown' %
+ counters_command = ('%s -shutdown' %
(os.path.join(self.tools_path, 'vsperfcmd.exe')))
(retcode, output) = proc.RunCommandFull(counters_command,
collect_output=True)
@@ -238,7 +238,7 @@ class Coverage(object):
# Return the intermediate .coverage file
return coverage_file
-
+
def Upload(self, list_coverage, upload_path, sym_path=None, src_root=None):
"""Upload the results to the dashboard.
@@ -251,7 +251,7 @@ class Coverage(object):
upload_path: Destination where the coverage data will be processed.
sym_path: Symbol path for the build (Win32 only)
src_root: Root folder of the source tree (Win32 only)
-
+
Returns:
True on success.
False on failure.
@@ -259,15 +259,15 @@ class Coverage(object):
if upload_path == None:
logging.info('Upload path not specified. Will not convert to LCOV')
return True
-
+
if IsWindows():
# Stop counters
- counters_command = ('%s -shutdown' %
+ counters_command = ('%s -shutdown' %
(os.path.join(self.tools_path, 'vsperfcmd.exe')))
(retcode, output) = proc.RunCommandFull(counters_command,
collect_output=True)
logging.info('Counters shut down: %s' % (output))
- lcov_file = os.path.join(upload_path, 'chrome_win32_%s.lcov' %
+ lcov_file = os.path.join(upload_path, 'chrome_win32_%s.lcov' %
(self.revision))
lcov = open(lcov_file, 'w')
for coverage_file in list_coverage:
@@ -276,8 +276,8 @@ class Coverage(object):
logging.error('Lcov converter tool not found')
return False
self.tools_path = self.tools_path.rstrip('\\')
- convert_command = ('%s -sym_path=%s -src_root=%s %s' %
- (os.path.join(self.tools_path,
+ convert_command = ('%s -sym_path=%s -src_root=%s %s' %
+ (os.path.join(self.tools_path,
'coverage_analyzer.exe'),
sym_path,
src_root,
@@ -333,12 +333,12 @@ def main():
help='Archive location of the intermediate .coverage data')
(options, args) = parser.parse_args()
-
+
if options.revision == None:
parser.error('Revision number not specified')
if options.src_root == None:
parser.error('Source root not specified')
-
+
if IsWindows():
# Initialize coverage
cov = Coverage(options.revision,
@@ -355,7 +355,7 @@ def main():
return 1
# Collect the intermediate file
list_coverage.append(coverage)
- else:
+ else:
logging.error('Error during instrumentation.')
sys.exit(1)
@@ -368,4 +368,4 @@ def main():
if __name__ == '__main__':
sys.exit(main())
-
+
diff --git a/tools/code_coverage/process_coverage.py b/tools/code_coverage/process_coverage.py
index e42e95b..a1f3c1e 100644
--- a/tools/code_coverage/process_coverage.py
+++ b/tools/code_coverage/process_coverage.py
@@ -54,7 +54,7 @@ win32_srcs_exclude = ['parse.y',
'cssgrammar.cpp',
'csspropertynames.gperf']
-# Number of lines of a new coverage data set
+# Number of lines of a new coverage data set
# to send at a time to the dashboard.
POST_CHUNK_SIZE = 50
@@ -190,7 +190,7 @@ def CleanWin32Lcov(lcov_path, src_root):
stderr=subprocess.STDOUT).communicate()[0]
if output.rfind('error:'):
return None
-
+
tmp_buf1 = output.split('=')
tmp_buf2 = tmp_buf1[len(tmp_buf1) - 2].split('x')[0].split(' ')
loc = tmp_buf2[len(tmp_buf2) - 2]
@@ -220,7 +220,7 @@ def ParseCoverageDataForDashboard(lcov_path):
Args:
lcov_path: File path to lcov coverage data.
-
+
Returns:
List of strings with comma separated source node and coverage.
"""
@@ -241,7 +241,7 @@ def ParseCoverageDataForDashboard(lcov_path):
instrumented_set = {}
executed_set = {}
srcfile_name = line[len('SF:'):]
-
+
# Mark coverage data points hashlist style for the current src file.
if line[:len('DA:')] == 'DA:':
line_info = line[len('DA:'):].split(',')
@@ -251,18 +251,18 @@ def ParseCoverageDataForDashboard(lcov_path):
# line_was_executed is '0' or '1'
if int(line_was_executed):
executed_set[line_num] = True
-
+
# Update results for the current src file at record end.
if line == 'end_of_record':
instrumented = len(instrumented_set.keys())
executed = len(executed_set.keys())
parent_directory = srcfile_name[:srcfile_name.rfind('/') + 1]
linecount_point = linecounts[srcfile_index].strip().split(',')
- assert(len(linecount_point) == 2,
+ assert(len(linecount_point) == 2,
'lintcount format unexpected - %s' % linecounts[srcfile_index])
(linecount_path, linecount_count) = linecount_point
srcfile_index += 1
-
+
# Sanity check that path names in the lcov and linecount are lined up.
if linecount_path[-10:] != srcfile_name[-10:]:
print 'NAME MISMATCH: %s :: %s' % (srcfile_name, linecount_path)
@@ -282,7 +282,7 @@ def ParseCoverageDataForDashboard(lcov_path):
# The first key (sorted) will be the base directory '/'
# but its full path may be '/mnt/chrome_src/src/'
# using this offset will ignore the part '/mnt/chrome_src/src'.
- # Offset is the last '/' that isn't the last character for the
+ # Offset is the last '/' that isn't the last character for the
# first directory name in results (position 1 in keys).
offset = len(keys[1][:keys[1][:-1].rfind('/')])
lines = []
@@ -299,7 +299,7 @@ def ParseCoverageDataForDashboard(lcov_path):
def AddResults(results, location, lines_total, lines_executed):
"""Add resulting line tallies to a location's total.
-
+
Args:
results: Map of node location to corresponding coverage data.
location: Source node string.
@@ -315,7 +315,7 @@ def AddResults(results, location, lines_total, lines_executed):
def PostResultsToDashboard(lcov_path, results, post_url):
"""Post coverage results to coverage dashboard.
-
+
Args:
lcov_path: File path for lcov data in the expected format:
<project>_<platform>_<cl#>.coverage.lcov
@@ -346,7 +346,7 @@ num_fails = 0
def SendPost(req):
"""Execute a post request and retry for up to MAX_FAILURES.
-
+
Args:
req: A urllib2 request object.
@@ -428,7 +428,7 @@ def main():
else:
print 'Unsupported platform'
os.exit(1)
-
+
# Prep coverage results for dashboard and post new set.
parsed_data = ParseCoverageDataForDashboard(options.lcov_path)
PostResultsToDashboard(options.lcov_path, parsed_data, options.post_url)
diff --git a/tools/grit/grit/clique.py b/tools/grit/grit/clique.py
index 2f6fe40..52a50c6 100644
--- a/tools/grit/grit/clique.py
+++ b/tools/grit/grit/clique.py
@@ -19,7 +19,7 @@ class UberClique(object):
'''A factory (NOT a singleton factory) for making cliques. It has several
methods for working with the cliques created using the factory.
'''
-
+
def __init__(self):
# A map from message ID to list of cliques whose source messages have
# that ID. This will contain all cliques created using this factory.
@@ -27,14 +27,14 @@ class UberClique(object):
# same translateable portion and placeholder names, but occur in different
# places in the resource tree.
self.cliques_ = {}
-
+
# A map of clique IDs to list of languages to indicate translations where we
# fell back to English.
self.fallback_translations_ = {}
-
+
# A map of clique IDs to list of languages to indicate missing translations.
self.missing_translations_ = {}
-
+
def _AddMissingTranslation(self, lang, clique, is_error):
tl = self.fallback_translations_
if is_error:
@@ -44,10 +44,10 @@ class UberClique(object):
tl[id] = {}
if lang not in tl[id]:
tl[id][lang] = 1
-
+
def HasMissingTranslations(self):
return len(self.missing_translations_) > 0
-
+
def MissingTranslationsReport(self):
'''Returns a string suitable for printing to report missing
and fallback translations to the user.
@@ -78,13 +78,13 @@ class UberClique(object):
def MakeClique(self, message, translateable=True):
'''Create a new clique initialized with a message.
-
+
Args:
message: tclib.Message()
translateable: True | False
'''
clique = MessageClique(self, message, translateable)
-
+
# Enable others to find this clique by its message ID
if message.GetId() in self.cliques_:
presentable_text = clique.GetMessage().GetPresentableContent()
@@ -93,17 +93,17 @@ class UberClique(object):
self.cliques_[message.GetId()].append(clique)
else:
self.cliques_[message.GetId()] = [clique]
-
+
return clique
def FindCliqueAndAddTranslation(self, translation, language):
'''Adds the specified translation to the clique with the source message
it is a translation of.
-
+
Args:
translation: tclib.Translation()
language: 'en' | 'fr' ...
-
+
Return:
True if the source message was found, otherwise false.
'''
@@ -113,7 +113,7 @@ class UberClique(object):
return True
else:
return False
-
+
def BestClique(self, id):
'''Returns the "best" clique from a list of cliques. All the cliques
must have the same ID. The "best" clique is chosen in the following
@@ -127,14 +127,14 @@ class UberClique(object):
for clique in clique_list:
if not clique_to_ret:
clique_to_ret = clique
-
+
description = clique.GetMessage().GetDescription()
if description and len(description) > 0:
clique_to_ret = clique
if not description.startswith('ID:'):
break # this is the preferred case so we exit right away
return clique_to_ret
-
+
def BestCliquePerId(self):
'''Iterates over the list of all cliques and returns the best clique for
each ID. This will be the first clique with a source message that has a
@@ -143,7 +143,7 @@ class UberClique(object):
'''
for id in self.cliques_:
yield self.BestClique(id)
-
+
def BestCliqueByOriginalText(self, text, meaning):
'''Finds the "best" (as in BestClique()) clique that has original text
'text' and meaning 'meaning'. Returns None if there is no such clique.
@@ -160,7 +160,7 @@ class UberClique(object):
'''Returns a list of all defined message IDs.
'''
return self.cliques_.keys()
-
+
def AllCliques(self):
'''Iterates over all cliques. Note that this can return multiple cliques
with the same ID.
@@ -168,14 +168,14 @@ class UberClique(object):
for cliques in self.cliques_.values():
for c in cliques:
yield c
-
+
def GenerateXtbParserCallback(self, lang, debug=False):
'''Creates a callback function as required by grit.xtb_reader.Parse().
This callback will create Translation objects for each message from
the XTB that exists in this uberclique, and add them as translations for
the relevant cliques. The callback will add translations to the language
specified by 'lang'
-
+
Args:
lang: 'fr'
debug: True | False
@@ -184,13 +184,13 @@ class UberClique(object):
if id not in self.cliques_:
if debug: print "Ignoring translation #%s" % id
return
-
+
if debug: print "Adding translation #%s" % id
-
+
# We fetch placeholder information from the original message (the XTB file
# only contains placeholder names).
original_msg = self.BestClique(id).GetMessage()
-
+
translation = tclib.Translation(id=id)
for is_ph,text in structure:
if not is_ph:
@@ -215,27 +215,27 @@ class CustomType(object):
'''A base class you should implement if you wish to specify a custom type
for a message clique (i.e. custom validation and optional modification of
translations).'''
-
+
def Validate(self, message):
'''Returns true if the message (a tclib.Message object) is valid,
otherwise false.
'''
raise NotImplementedError()
-
+
def ValidateAndModify(self, lang, translation):
'''Returns true if the translation (a tclib.Translation object) is valid,
otherwise false. The language is also passed in. This method may modify
the translation that is passed in, if it so wishes.
'''
raise NotImplementedError()
-
+
def ModifyTextPart(self, lang, text):
'''If you call ModifyEachTextPart, it will turn around and call this method
for each text part of the translation. You should return the modified
version of the text, or just the original text to not change anything.
'''
raise NotImplementedError()
-
+
def ModifyEachTextPart(self, lang, translation):
'''Call this to easily modify one or more of the textual parts of a
translation. It will call ModifyTextPart for each part of the
@@ -271,18 +271,18 @@ class OneOffCustomType(CustomType):
class MessageClique(object):
'''A message along with all of its translations. Also code to bring
translations together with their original message.'''
-
+
# change this to the language code of Messages you add to cliques_.
# TODO(joi) Actually change this based on the <grit> node's source language
source_language = 'en'
-
+
# A constant translation we use when asked for a translation into the
# special language constants.CONSTANT_LANGUAGE.
CONSTANT_TRANSLATION = tclib.Translation(text='TTTTTT')
-
+
def __init__(self, uber_clique, message, translateable=True, custom_type=None):
'''Create a new clique initialized with just a message.
-
+
Args:
uber_clique: Our uber-clique (collection of cliques)
message: tclib.Message()
@@ -305,21 +305,21 @@ class MessageClique(object):
# be used to validate the original message and translations thereof, and
# will also get a chance to modify translations of the message.
self.SetCustomType(custom_type)
-
+
def GetMessage(self):
'''Retrieves the tclib.Message that is the source for this clique.'''
return self.clique[MessageClique.source_language]
-
+
def GetId(self):
'''Retrieves the message ID of the messages in this clique.'''
return self.GetMessage().GetId()
-
+
def IsTranslateable(self):
return self.translateable
-
+
def AddToShortcutGroup(self, group):
self.shortcut_groups.append(group)
-
+
def SetCustomType(self, custom_type):
'''Makes this clique use custom_type for validating messages and
translations, and optionally modifying translations.
@@ -327,53 +327,53 @@ class MessageClique(object):
self.custom_type = custom_type
if custom_type and not custom_type.Validate(self.GetMessage()):
raise exception.InvalidMessage(self.GetMessage().GetRealContent())
-
+
def MessageForLanguage(self, lang, pseudo_if_no_match=True, fallback_to_english=False):
'''Returns the message/translation for the specified language, providing
a pseudotranslation if there is no available translation and a pseudo-
translation is requested.
-
+
The translation of any message whatsoever in the special language
'x_constant' is the message "TTTTTT".
-
+
Args:
lang: 'en'
pseudo_if_no_match: True
fallback_to_english: False
-
+
Return:
tclib.BaseMessage
'''
if not self.translateable:
return self.GetMessage()
-
+
if lang == constants.CONSTANT_LANGUAGE:
return self.CONSTANT_TRANSLATION
-
+
for msglang in self.clique.keys():
if lang == msglang:
return self.clique[msglang]
-
+
if fallback_to_english:
self.uber_clique._AddMissingTranslation(lang, self, is_error=False)
return self.GetMessage()
-
+
# If we're not supposed to generate pseudotranslations, we add an error
# report to a list of errors, then fail at a higher level, so that we
# get a list of all messages that are missing translations.
if not pseudo_if_no_match:
self.uber_clique._AddMissingTranslation(lang, self, is_error=True)
-
+
return pseudo.PseudoMessage(self.GetMessage())
def AllMessagesThatMatch(self, lang_re, include_pseudo = True):
'''Returns a map of all messages that match 'lang', including the pseudo
translation if requested.
-
+
Args:
lang_re: re.compile('fr|en')
include_pseudo: True
-
+
Return:
{ 'en' : tclib.Message,
'fr' : tclib.Translation,
@@ -381,27 +381,27 @@ class MessageClique(object):
'''
if not self.translateable:
return [self.GetMessage()]
-
+
matches = {}
for msglang in self.clique:
if lang_re.match(msglang):
matches[msglang] = self.clique[msglang]
-
+
if include_pseudo:
matches[pseudo.PSEUDO_LANG] = pseudo.PseudoMessage(self.GetMessage())
-
+
return matches
-
+
def AddTranslation(self, translation, language):
'''Add a translation to this clique. The translation must have the same
ID as the message that is the source for this clique.
-
+
If this clique is not translateable, the function just returns.
-
+
Args:
translation: tclib.Translation()
language: 'en'
-
+
Throws:
grit.exception.InvalidTranslation if the translation you're trying to add
doesn't have the same message ID as the source message of this clique.
@@ -411,9 +411,9 @@ class MessageClique(object):
if translation.GetId() != self.GetId():
raise exception.InvalidTranslation(
'Msg ID %s, transl ID %s' % (self.GetId(), translation.GetId()))
-
+
assert not language in self.clique
-
+
# Because two messages can differ in the original content of their
# placeholders yet share the same ID (because they are otherwise the
# same), the translation we are getting may have different original
@@ -424,20 +424,20 @@ class MessageClique(object):
#
# See grit.clique_unittest.MessageCliqueUnittest.testSemiIdenticalCliques
# for a concrete explanation of why this is necessary.
-
+
original = self.MessageForLanguage(self.source_language, False)
if len(original.GetPlaceholders()) != len(translation.GetPlaceholders()):
print ("ERROR: '%s' translation of message id %s does not match" %
(language, translation.GetId()))
assert False
-
+
transl_msg = tclib.Translation(id=self.GetId(),
text=translation.GetPresentableContent(),
placeholders=original.GetPlaceholders())
-
+
if self.custom_type and not self.custom_type.ValidateAndModify(language, transl_msg):
print "WARNING: %s translation failed validation: %s" % (
language, transl_msg.GetId())
-
+
self.clique[language] = transl_msg
diff --git a/tools/grit/grit/clique_unittest.py b/tools/grit/grit/clique_unittest.py
index a1bc487..537f1b7 100644
--- a/tools/grit/grit/clique_unittest.py
+++ b/tools/grit/grit/clique_unittest.py
@@ -28,24 +28,24 @@ class MessageCliqueUnittest(unittest.TestCase):
placeholders=[
tclib.Placeholder('USERNAME', '%s', 'Joi')])
c = factory.MakeClique(msg)
-
+
self.failUnless(c.GetMessage() == msg)
self.failUnless(c.GetId() == msg.GetId())
-
+
msg_fr = tclib.Translation(text='Bonjour USERNAME, comment ca va?',
id=msg.GetId(), placeholders=[
tclib.Placeholder('USERNAME', '%s', 'Joi')])
msg_de = tclib.Translation(text='Guten tag USERNAME, wie geht es dir?',
id=msg.GetId(), placeholders=[
tclib.Placeholder('USERNAME', '%s', 'Joi')])
-
+
c.AddTranslation(msg_fr, 'fr')
factory.FindCliqueAndAddTranslation(msg_de, 'de')
-
+
# sort() sorts lists in-place and does not return them
for lang in ('en', 'fr', 'de'):
self.failUnless(lang in c.clique)
-
+
self.failUnless(c.MessageForLanguage('fr').GetRealContent() ==
msg_fr.GetRealContent())
@@ -56,11 +56,11 @@ class MessageCliqueUnittest(unittest.TestCase):
pass
self.failUnless(c.MessageForLanguage('zh-CN', True) != None)
-
+
rex = re.compile('fr|de|bingo')
self.failUnless(len(c.AllMessagesThatMatch(rex, False)) == 2)
self.failUnless(c.AllMessagesThatMatch(rex, True)[pseudo.PSEUDO_LANG] != None)
-
+
def testBestClique(self):
factory = clique.UberClique()
factory.MakeClique(tclib.Message(text='Alfur', description='alfaholl'))
@@ -72,7 +72,7 @@ class MessageCliqueUnittest(unittest.TestCase):
factory.MakeClique(tclib.Message(text='Gryla', description='vondakerling'))
factory.MakeClique(tclib.Message(text='Leppaludi', description='ID: IDS_LL'))
factory.MakeClique(tclib.Message(text='Leppaludi', description=''))
-
+
count_best_cliques = 0
for c in factory.BestCliquePerId():
count_best_cliques += 1
@@ -111,7 +111,7 @@ class MessageCliqueUnittest(unittest.TestCase):
self.failUnless('Hello %s, how are you doing today?' in content_list)
self.failUnless('Jack "Black" Daniels' in content_list)
self.failUnless('Hello!' in content_list)
-
+
def testCorrectExceptionIfWrongEncodingOnResourceFile(self):
'''This doesn't really belong in this unittest file, but what the heck.'''
resources = grd_reader.Parse(util.WrapInputStream(
@@ -133,37 +133,37 @@ class MessageCliqueUnittest(unittest.TestCase):
placeholders=[tclib.Placeholder('USERNAME', '%s', 'Joi')]),
]
self.failUnless(messages[0].GetId() == messages[1].GetId())
-
+
# Both of the above would share a translation.
translation = tclib.Translation(id=messages[0].GetId(),
text='Bonjour USERNAME',
placeholders=[tclib.Placeholder(
'USERNAME', '$1', 'Joi')])
-
+
factory = clique.UberClique()
cliques = [factory.MakeClique(msg) for msg in messages]
-
+
for clq in cliques:
clq.AddTranslation(translation, 'fr')
-
+
self.failUnless(cliques[0].MessageForLanguage('fr').GetRealContent() ==
'Bonjour $1')
self.failUnless(cliques[1].MessageForLanguage('fr').GetRealContent() ==
'Bonjour %s')
-
+
def testMissingTranslations(self):
messages = [ tclib.Message(text='Hello'), tclib.Message(text='Goodbye') ]
factory = clique.UberClique()
cliques = [factory.MakeClique(msg) for msg in messages]
-
+
cliques[1].MessageForLanguage('fr', False, True)
-
+
self.failUnless(not factory.HasMissingTranslations())
cliques[0].MessageForLanguage('de', False, False)
-
+
self.failUnless(factory.HasMissingTranslations())
-
+
report = factory.MissingTranslationsReport()
self.failUnless(report.count('WARNING') == 1)
self.failUnless(report.count('8053599568341804890 "Goodbye" fr') == 1)
@@ -179,7 +179,7 @@ class MessageCliqueUnittest(unittest.TestCase):
self.fail()
except:
pass # expected case - 'Bingo bongo' does not start with 'jjj'
-
+
message = tclib.Message(text='jjjBingo bongo')
c = factory.MakeClique(message)
c.SetCustomType(util.NewClassInstance(
diff --git a/tools/grit/grit/extern/FP.py b/tools/grit/grit/extern/FP.py
index 1e0bce8..77b1adc 100644
--- a/tools/grit/grit/extern/FP.py
+++ b/tools/grit/grit/extern/FP.py
@@ -31,4 +31,4 @@ def FingerPrint(str, encoding='utf-8'):
if fp & 0x8000000000000000L:
fp = - ((~fp & 0xFFFFFFFFFFFFFFFFL) + 1)
return fp
-
+
diff --git a/tools/grit/grit/extern/tclib.py b/tools/grit/grit/extern/tclib.py
index 8438835..c9dba2b 100644
--- a/tools/grit/grit/extern/tclib.py
+++ b/tools/grit/grit/extern/tclib.py
@@ -358,7 +358,7 @@ class Message(BaseMessage):
self.__meaning = meaning
self.__time_created = time_created
self.SetIsHidden(is_hidden)
-
+
# String representation
def __str__(self):
s = 'source: %s, id: %s, content: "%s", meaning: "%s", ' \
@@ -443,7 +443,7 @@ class Message(BaseMessage):
is_hidden : 0 or 1 - if the message should be hidden, 0 otherwise
"""
if is_hidden not in [0, 1]:
- raise MessageTranslationError, "is_hidden must be 0 or 1, got %s"
+ raise MessageTranslationError, "is_hidden must be 0 or 1, got %s"
self.__is_hidden = is_hidden
def IsHidden(self):
diff --git a/tools/grit/grit/format/html_inline.py b/tools/grit/grit/format/html_inline.py
index f66737c..cf8effe 100755
--- a/tools/grit/grit/format/html_inline.py
+++ b/tools/grit/grit/format/html_inline.py
@@ -25,10 +25,10 @@ DIST_SUBSTR = '%DISTRIBUTION%'
def ReadFile(input_filename):
"""Helper function that returns input_filename as a string.
-
+
Args:
input_filename: name of file to be read
-
+
Returns:
string
"""
@@ -40,7 +40,7 @@ def ReadFile(input_filename):
def SrcInline(src_match, base_path, distribution):
"""regex replace function.
- Takes a regex match for src="filename", attempts to read the file
+ Takes a regex match for src="filename", attempts to read the file
at 'filename' and returns the src attribute with the file inlined
as a data URI. If it finds DIST_SUBSTR string in file name, replaces
it with distribution.
@@ -60,37 +60,37 @@ def SrcInline(src_match, base_path, distribution):
return src_match.group(0)
filename = filename.replace('%DISTRIBUTION%', distribution)
- filepath = os.path.join(base_path, filename)
+ filepath = os.path.join(base_path, filename)
mimetype = mimetypes.guess_type(filename)[0] or 'text/plain'
inline_data = base64.standard_b64encode(ReadFile(filepath))
prefix = src_match.string[src_match.start():src_match.start('filename')-1]
return "%s\"data:%s;base64,%s\"" % (prefix, mimetype, inline_data)
-
+
def InlineFile(input_filename, output_filename):
"""Inlines the resources in a specified file.
-
+
Reads input_filename, finds all the src attributes and attempts to
inline the files they are referring to, then writes the result
to output_filename.
-
+
Args:
input_filename: name of file to read in
output_filename: name of file to be written to
"""
print "inlining %s to %s" % (input_filename, output_filename)
- input_filepath = os.path.dirname(input_filename)
-
+ input_filepath = os.path.dirname(input_filename)
+
distribution = DIST_DEFAULT
if DIST_ENV_VAR in os.environ.keys():
distribution = os.environ[DIST_ENV_VAR]
if len(distribution) > 1 and distribution[0] == '_':
distribution = distribution[1:].lower()
-
+
def SrcReplace(src_match):
"""Helper function to provide SrcInline with the base file path"""
return SrcInline(src_match, input_filepath, distribution)
-
+
# TODO(glen): Make this regex not match src="" text that is not inside a tag
flat_text = re.sub('src="(?P<filename>[^"\']*)"',
SrcReplace,
diff --git a/tools/grit/grit/format/interface.py b/tools/grit/grit/format/interface.py
index a9395eb..3f91ab2 100644
--- a/tools/grit/grit/format/interface.py
+++ b/tools/grit/grit/format/interface.py
@@ -12,19 +12,19 @@ import re
class ItemFormatter(object):
'''Base class for a formatter that knows how to format a single item.'''
-
+
def Format(self, item, lang='', begin_item=True, output_dir='.'):
'''Returns a Unicode string representing 'item' in the format known by this
item formatter, for the language 'lang'. May be called once at the
start of the item (begin_item == True) and again at the end
(begin_item == False), or only at the start of the item (begin_item == True)
-
+
Args:
item: anything
lang: 'en'
begin_item: True | False
output_dir: '.'
-
+
Return:
u'hello'
'''
diff --git a/tools/grit/grit/format/rc.py b/tools/grit/grit/format/rc.py
index 1975acf..d7656a0 100644
--- a/tools/grit/grit/format/rc.py
+++ b/tools/grit/grit/format/rc.py
@@ -19,20 +19,20 @@ _LINEBREAKS = re.compile('\r\n|\n|\r')
'''
This dictionary defines the langauge charset pair lookup table, which is used
-for replacing the GRIT expand variables for language info in Product Version
-resource. The key is the language ISO country code, and the value
+for replacing the GRIT expand variables for language info in Product Version
+resource. The key is the language ISO country code, and the value
is the language and character-set pair, which is a hexadecimal string
consisting of the concatenation of the language and character-set identifiers.
-The first 4 digit of the value is the hex value of LCID, the remaining
+The first 4 digit of the value is the hex value of LCID, the remaining
4 digits is the hex value of character-set id(code page)of the language.
-
+
We have defined three GRIT expand_variables to be used in the version resource
-file to set the language info. Here is an example how they should be used in
-the VS_VERSION_INFO section of the resource file to allow GRIT to localize
+file to set the language info. Here is an example how they should be used in
+the VS_VERSION_INFO section of the resource file to allow GRIT to localize
the language info correctly according to product locale.
VS_VERSION_INFO VERSIONINFO
-...
+...
BEGIN
BLOCK "StringFileInfo"
BEGIN
@@ -90,7 +90,7 @@ _LANGUAGE_CHARSET_PAIR = {
'sk' : '041b04e2',
'et' : '042504e9',
'ja' : '041103a4',
- 'sl' : '042404e2',
+ 'sl' : '042404e2',
'en' : '040904b0',
}
@@ -135,28 +135,28 @@ _LANGUAGE_DIRECTIVE_PAIR = {
'sk' : 'LANG_SLOVAK, SUBLANG_DEFAULT',
'et' : 'LANG_ESTONIAN, SUBLANG_DEFAULT',
'ja' : 'LANG_JAPANESE, SUBLANG_DEFAULT',
- 'sl' : 'LANG_SLOVENIAN, SUBLANG_DEFAULT',
+ 'sl' : 'LANG_SLOVENIAN, SUBLANG_DEFAULT',
'en' : 'LANG_ENGLISH, SUBLANG_ENGLISH_US',
}
-def GetLangCharsetPair(language) :
+def GetLangCharsetPair(language) :
if _LANGUAGE_CHARSET_PAIR.has_key(language) :
return _LANGUAGE_CHARSET_PAIR[language]
else :
print 'Warning:GetLangCharsetPair() found undefined language %s' %(language)
return ''
-def GetLangDirectivePair(language) :
+def GetLangDirectivePair(language) :
if _LANGUAGE_DIRECTIVE_PAIR.has_key(language) :
return _LANGUAGE_DIRECTIVE_PAIR[language]
else :
print 'Warning:GetLangDirectivePair() found undefined language %s' %(language)
return 'unknown language: see tools/grit/format/rc.py'
-def GetLangIdHex(language) :
+def GetLangIdHex(language) :
if _LANGUAGE_CHARSET_PAIR.has_key(language) :
- langcharset = _LANGUAGE_CHARSET_PAIR[language]
- lang_id = '0x' + langcharset[0:4]
+ langcharset = _LANGUAGE_CHARSET_PAIR[language]
+ lang_id = '0x' + langcharset[0:4]
return lang_id
else :
print 'Warning:GetLangIdHex() found undefined language %s' %(language)
@@ -165,8 +165,8 @@ def GetLangIdHex(language) :
def GetCharsetIdDecimal(language) :
if _LANGUAGE_CHARSET_PAIR.has_key(language) :
- langcharset = _LANGUAGE_CHARSET_PAIR[language]
- charset_decimal = int(langcharset[4:], 16)
+ langcharset = _LANGUAGE_CHARSET_PAIR[language]
+ charset_decimal = int(langcharset[4:], 16)
return str(charset_decimal)
else :
print 'Warning:GetCharsetIdDecimal() found undefined language %s' %(language)
@@ -181,15 +181,15 @@ def GetUnifiedLangCode(language) :
else :
return language
-
+
def _MakeRelativePath(base_path, path_to_make_relative):
'''Returns a relative path such from the base_path to
the path_to_make_relative.
-
+
In other words, os.join(base_path,
MakeRelativePath(base_path, path_to_make_relative))
is the same location as path_to_make_relative.
-
+
Args:
base_path: the root path
path_to_make_relative: an absolute path that is on the same drive
@@ -199,7 +199,7 @@ def _MakeRelativePath(base_path, path_to_make_relative):
def _GetPathAfterPrefix(prefix_path, path_with_prefix):
'''Gets the subpath within in prefix_path for the path_with_prefix
with no beginning or trailing path separators.
-
+
Args:
prefix_path: the base path
path_with_prefix: a path that starts with prefix_path
@@ -210,7 +210,7 @@ def _MakeRelativePath(base_path, path_to_make_relative):
if normalized_path == '.':
normalized_path = ''
return normalized_path
-
+
def _GetCommonBaseDirectory(*args):
'''Returns the common prefix directory for the given paths
@@ -253,13 +253,13 @@ def _MakeRelativePath(base_path, path_to_make_relative):
# common to all paths, so we can quit going through all of
# the paths.
break
- return prefix
+ return prefix
prefix = _GetCommonBaseDirectory(base_path, path_to_make_relative)
# If the paths had no commonality at all, then return the absolute path
# because it is the best that can be done. If the path had to be relative
# then eventually this absolute path will be discovered (when a build breaks)
- # and an appropriate fix can be made, but having this allows for the best
+ # and an appropriate fix can be made, but having this allows for the best
# backward compatibility with the absolute path behavior in the past.
if len(prefix) <= 0:
return path_to_make_relative
@@ -270,7 +270,7 @@ def _MakeRelativePath(base_path, path_to_make_relative):
path_pieces = remaining_base_path.split(os.path.sep)
base_depth_from_prefix = len([d for d in path_pieces if len(d)])
base_to_prefix = (".." + os.path.sep) * base_depth_from_prefix
-
+
# Put add in the path from the prefix to the path_to_make_relative
remaining_other_path = _GetPathAfterPrefix(prefix, path_to_make_relative)
return base_to_prefix + remaining_other_path
@@ -297,11 +297,11 @@ class TopLevel(interface.ItemFormatter):
continue
if output.attrs['language_section'] == '':
# If no language_section is requested, no directive is added
- # (Used when the generated rc will be included from another rc
+ # (Used when the generated rc will be included from another rc
# file that will have the appropriate language directive)
language_directive = ''
elif output.attrs['language_section'] == 'neutral':
- # If a neutral language section is requested (default), add a
+ # If a neutral language section is requested (default), add a
# neutral language directive
language_directive = 'LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL'
elif output.attrs['language_section'] == 'lang':
@@ -337,37 +337,37 @@ class StringTable(interface.ItemFormatter):
class Message(interface.ItemFormatter):
'''Writes out a single message to a string table.'''
-
+
def Format(self, item, lang='en', begin_item=True, output_dir='.'):
from grit.node import message
if not begin_item:
return ''
-
+
assert isinstance(lang, types.StringTypes)
assert isinstance(item, message.MessageNode)
-
+
message = item.ws_at_start + item.Translate(lang) + item.ws_at_end
# Escape quotation marks (RC format uses doubling-up
message = message.replace('"', '""')
# Replace linebreaks with a \n escape
message = _LINEBREAKS.sub(r'\\n', message)
-
+
name_attr = item.GetTextualIds()[0]
-
+
return ' %-15s "%s"\n' % (name_attr, message)
class RcSection(interface.ItemFormatter):
'''Writes out an .rc file section.'''
-
+
def Format(self, item, lang='en', begin_item=True, output_dir='.'):
if not begin_item:
return ''
-
+
assert isinstance(lang, types.StringTypes)
from grit.node import structure
assert isinstance(item, structure.StructureNode)
-
+
if item.IsExcludedFromRc():
return ''
else:
@@ -378,7 +378,7 @@ class RcSection(interface.ItemFormatter):
# Replace the language expand_variables in version rc info.
unified_lang_code = GetUnifiedLangCode(lang)
- text = text.replace('[GRITVERLANGCHARSETHEX]',
+ text = text.replace('[GRITVERLANGCHARSETHEX]',
GetLangCharsetPair(unified_lang_code))
text = text.replace('[GRITVERLANGID]', GetLangIdHex(unified_lang_code))
text = text.replace('[GRITVERCHARSETID]',
@@ -389,13 +389,13 @@ class RcSection(interface.ItemFormatter):
class RcInclude(interface.ItemFormatter):
'''Writes out an item that is included in an .rc file (e.g. an ICON)'''
-
+
def __init__(self, type, filenameWithoutPath = 0, relative_path = 0,
flatten_html = 0):
'''Indicates to the instance what the type of the resource include is,
e.g. 'ICON' or 'HTML'. Case must be correct, i.e. if the type is all-caps
the parameter should be all-caps.
-
+
Args:
type: 'ICON'
'''
@@ -403,7 +403,7 @@ class RcInclude(interface.ItemFormatter):
self.filenameWithoutPath = filenameWithoutPath
self.relative_path_ = relative_path
self.flatten_html = flatten_html
-
+
def Format(self, item, lang='en', begin_item=True, output_dir='.'):
if not begin_item:
return ''
@@ -414,7 +414,7 @@ class RcInclude(interface.ItemFormatter):
assert isinstance(item, (structure.StructureNode, include.IncludeNode))
assert (isinstance(item, include.IncludeNode) or
item.attrs['type'] in ['tr_html', 'admin_template', 'txt', 'muppet'])
-
+
# By default, we use relative pathnames to included resources so that
# sharing the resulting .rc files is possible.
#
diff --git a/tools/grit/grit/format/rc_header.py b/tools/grit/grit/format/rc_header.py
index b67a1cb..4da974a 100644
--- a/tools/grit/grit/format/rc_header.py
+++ b/tools/grit/grit/format/rc_header.py
@@ -18,7 +18,7 @@ from grit.extern import FP
class TopLevel(interface.ItemFormatter):
'''Writes the necessary preamble for a resource.h file.'''
-
+
def Format(self, item, lang='', begin_item=True, output_dir='.'):
if not begin_item:
return ''
@@ -38,9 +38,9 @@ class TopLevel(interface.ItemFormatter):
for child in output_node.children:
if child.name == 'emit':
if child.attrs['emit_type'] == 'prepend':
- return header_string
+ return header_string
# else print out the default header with include
- return header_string + '''
+ return header_string + '''
#include <atlres.h>
'''
@@ -61,7 +61,7 @@ class Item(interface.ItemFormatter):
dialog resources) it should define a function GetTextIds(self) that returns
a list of textual IDs (strings). Otherwise the formatter will use the
'name' attribute of the node.'''
-
+
# All IDs allocated so far, mapped to the textual ID they represent.
# Used to detect and resolve collisions.
ids_ = {}
@@ -70,7 +70,7 @@ class Item(interface.ItemFormatter):
# represent. Used when literal IDs are being defined in the 'identifiers'
# section of the GRD file to define other message IDs.
tids_ = {}
-
+
def _VerifyId(self, id, tid, msg_if_error):
if id in self.ids_ and self.ids_[id] != tid:
raise exception.IdRangeOverlap(msg_if_error +
@@ -79,7 +79,7 @@ class Item(interface.ItemFormatter):
if id < 101:
print ('WARNING: Numeric resource IDs should be greater than 100 to avoid\n'
'conflicts with system-defined resource IDs.')
-
+
def Format(self, item, lang='', begin_item=True, output_dir='.'):
if not begin_item:
return ''
@@ -91,7 +91,7 @@ class Item(interface.ItemFormatter):
if 'generateid' in item.attrs:
if item.attrs['generateid'] == 'false':
return ''
-
+
text_ids = item.GetTextualIds()
# We consider the "parent" of the item to be the GroupingNode containing
@@ -101,7 +101,7 @@ class Item(interface.ItemFormatter):
while item_parent and not isinstance(item_parent,
grit.node.empty.GroupingNode):
item_parent = item_parent.parent
-
+
lines = []
for tid in text_ids:
if util.SYSTEM_IDENTIFIERS.match(tid):
@@ -113,11 +113,11 @@ class Item(interface.ItemFormatter):
if hasattr(item, 'GetId') and item.GetId():
id = long(item.GetId())
- elif ('offset' in item.attrs and item_parent and
+ elif ('offset' in item.attrs and item_parent and
'first_id' in item_parent.attrs and item_parent.attrs['first_id'] != ''):
offset_text = item.attrs['offset']
parent_text = item_parent.attrs['first_id']
-
+
try:
offset_id = long(offset_text)
except ValueError:
@@ -125,11 +125,11 @@ class Item(interface.ItemFormatter):
try:
parent_id = long(parent_text)
- except ValueError:
+ except ValueError:
parent_id = self.tids_[parent_text]
-
+
id = parent_id + offset_id
-
+
# We try to allocate IDs sequentially for blocks of items that might
# be related, for instance strings in a stringtable (as their IDs might be
# used e.g. as IDs for some radio buttons, in which case the IDs must
@@ -151,7 +151,7 @@ class Item(interface.ItemFormatter):
# Automatically generate the ID based on the first clique from the
# first child of the first child node of our parent (i.e. when we
# first get to this location in the code).
-
+
# According to
# http://msdn.microsoft.com/en-us/library/t2zechd4(VS.71).aspx
# the safe usable range for resource IDs in Windows is from decimal
@@ -160,11 +160,11 @@ class Item(interface.ItemFormatter):
id = FP.UnsignedFingerPrint(tid)
id = id % (0x7FFF - 101)
id += 101
-
+
self._VerifyId(id, tid,
'Automatic (fingerprint-based) numeric ID for %s (%d) overlapped\n'
'with a previously allocated range.' % (tid, id))
-
+
if item_parent:
item_parent._last_id_ = id
else:
@@ -173,7 +173,7 @@ class Item(interface.ItemFormatter):
self._VerifyId(id, tid,
'Wanted to make numeric value for ID %s (%d) follow the numeric value of\n'
'the previous ID in the .grd file, but it was already used.' % (tid, id))
-
+
if tid not in self.ids_.values():
self.ids_[id] = tid
self.tids_[tid] = id
diff --git a/tools/grit/grit/format/rc_header_unittest.py b/tools/grit/grit/format/rc_header_unittest.py
index b1ffba3..3f2a228 100644
--- a/tools/grit/grit/format/rc_header_unittest.py
+++ b/tools/grit/grit/format/rc_header_unittest.py
@@ -26,7 +26,7 @@ class RcHeaderFormatterUnittest(unittest.TestCase):
def setUp(self):
self.formatter = rc_header.Item()
self.formatter.ids_ = {} # need to reset this between tests
-
+
def FormatAll(self, grd):
output = []
for node in grd:
@@ -35,7 +35,7 @@ class RcHeaderFormatterUnittest(unittest.TestCase):
output.append(self.formatter.Format(node))
output = ''.join(output)
return output.replace(' ', '')
-
+
def testFormatter(self):
grd = grd_reader.Parse(StringIO.StringIO('''<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="2" source_lang_id="en" current_release="3" base_dir=".">
@@ -60,7 +60,7 @@ class RcHeaderFormatterUnittest(unittest.TestCase):
output = self.FormatAll(grd)
self.failUnless(output.count('IDS_GREETING10000'))
self.failUnless(output.count('ID_LOGO300'))
-
+
def testExplicitFirstIdOverlaps(self):
# second first_id will overlap preexisting range
grd = grd_reader.Parse(StringIO.StringIO('''<?xml version="1.0" encoding="UTF-8"?>
@@ -79,7 +79,7 @@ class RcHeaderFormatterUnittest(unittest.TestCase):
</release>
</grit>'''), '.')
self.assertRaises(exception.IdRangeOverlap, self.FormatAll, grd)
-
+
def testImplicitOverlapsPreexisting(self):
# second message in <messages> will overlap preexisting range
grd = grd_reader.Parse(StringIO.StringIO('''<?xml version="1.0" encoding="UTF-8"?>
diff --git a/tools/grit/grit/format/rc_unittest.py b/tools/grit/grit/format/rc_unittest.py
index 4e97575..c7b0ee8 100644
--- a/tools/grit/grit/format/rc_unittest.py
+++ b/tools/grit/grit/format/rc_unittest.py
@@ -50,7 +50,7 @@ Sting sting
</messages>
'''), flexible_root = True)
util.FixRootForUnittest(root)
-
+
buf = StringIO.StringIO()
build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en'), buf)
output = buf.getvalue()
@@ -73,12 +73,12 @@ END'''.strip())
</structures>'''), flexible_root = True)
util.FixRootForUnittest(root)
root.RunGatherers(recursive = True)
-
+
buf = StringIO.StringIO()
build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en'), buf)
output = buf.getvalue()
self.failUnless(output.strip() == u'''
-IDC_KLONKMENU MENU
+IDC_KLONKMENU MENU
BEGIN
POPUP "&File"
BEGIN
@@ -150,7 +150,7 @@ END'''.strip())
</structures>'''), flexible_root = True)
util.FixRootForUnittest(root, '/temp')
# We do not run gatherers as it is not needed and wouldn't find the file
-
+
buf = StringIO.StringIO()
build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en'), buf)
output = buf.getvalue()
@@ -159,7 +159,7 @@ END'''.strip())
% (util.normpath('/temp/bingo.html').replace('\\', '\\\\'),
util.normpath('/temp/bingo2.html').replace('\\', '\\\\')))
# hackety hack to work on win32&lin
- output = re.sub('"[c-zC-Z]:', '"', output)
+ output = re.sub('"[c-zC-Z]:', '"', output)
self.failUnless(output.strip() == expected)
def testRcIncludeFile(self):
@@ -169,7 +169,7 @@ END'''.strip())
<include type="TXT" name="TEXT_TWO" file="bingo2.txt" filenameonly="true" />
</includes>'''), flexible_root = True)
util.FixRootForUnittest(root, '/temp')
-
+
buf = StringIO.StringIO()
build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en'), buf)
output = buf.getvalue()
@@ -191,21 +191,21 @@ END'''.strip())
# We must run the gatherers since we'll be wanting the translation of the
# file. The file exists in the location pointed to.
root.RunGatherers(recursive=True)
-
+
output_dir = tempfile.gettempdir()
en_file = root.FileForLanguage('en', output_dir)
self.failUnless(en_file == input_file)
fr_file = root.FileForLanguage('fr', output_dir)
self.failUnless(fr_file == os.path.join(output_dir, 'fr_simple.html'))
-
+
fo = file(fr_file)
contents = fo.read()
fo.close()
-
+
self.failUnless(contents.find('<p>') != -1) # should contain the markup
self.failUnless(contents.find('Hello!') == -1) # should be translated
-
-
+
+
def testFallbackToEnglish(self):
root = grd_reader.Parse(StringIO.StringIO('''<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
@@ -217,7 +217,7 @@ END'''.strip())
</grit>'''), util.PathFromRoot('.'))
util.FixRootForUnittest(root)
root.RunGatherers(recursive = True)
-
+
node = root.GetNodeById("IDD_ABOUTBOX")
formatter = node.ItemFormatter('rc_all')
output = formatter.Format(node, 'bingobongo')
diff --git a/tools/grit/grit/gather/admin_template.py b/tools/grit/grit/gather/admin_template.py
index ae63904..fc07ed8 100644
--- a/tools/grit/grit/gather/admin_template.py
+++ b/tools/grit/grit/gather/admin_template.py
@@ -23,7 +23,7 @@ class MalformedAdminTemplateException(exception.Base):
class AdmGatherer(regexp.RegexpGatherer):
'''Gatherer for the translateable portions of an admin template.
-
+
This gatherer currently makes the following assumptions:
- there is only one [strings] section and it is always the last section
of the file
@@ -33,17 +33,17 @@ class AdmGatherer(regexp.RegexpGatherer):
# Finds the strings section as the group named 'strings'
_STRINGS_SECTION = re.compile('(?P<first_part>.+^\[strings\])(?P<strings>.+)\Z',
re.MULTILINE | re.DOTALL)
-
+
# Finds the translateable sections from within the [strings] section.
_TRANSLATEABLES = re.compile('^\s*[A-Za-z0-9_]+\s*=\s*"(?P<text>.+)"\s*$',
re.MULTILINE)
-
+
def __init__(self, text):
regexp.RegexpGatherer.__init__(self, text)
-
+
def Escape(self, text):
return text.replace('\n', '\\n')
-
+
def UnEscape(self, text):
return text.replace('\\n', '\n')
@@ -57,18 +57,18 @@ class AdmGatherer(regexp.RegexpGatherer):
self._AddNontranslateableChunk(m.group('first_part'))
# Then parse the rest using the _TRANSLATEABLES regexp.
self._RegExpParse(self._TRANSLATEABLES, m.group('strings'))
-
+
# static method
def FromFile(adm_file, ext_key=None, encoding='cp1252'):
'''Loads the contents of 'adm_file' in encoding 'encoding' and creates
an AdmGatherer instance that gathers from those contents.
-
+
The 'ext_key' parameter is ignored.
-
+
Args:
adm_file: file('bingo.rc') | 'filename.rc'
encoding: 'utf-8'
-
+
Return:
AdmGatherer(contents_of_file)
'''
diff --git a/tools/grit/grit/gather/admin_template_unittest.py b/tools/grit/grit/gather/admin_template_unittest.py
index 249349a..1889b72 100644
--- a/tools/grit/grit/gather/admin_template_unittest.py
+++ b/tools/grit/grit/gather/admin_template_unittest.py
@@ -34,10 +34,10 @@ class AdmGathererUnittest(unittest.TestCase):
self.failUnless(len(gatherer.GetCliques()) == 2)
self.failUnless(gatherer.GetCliques()[1].GetMessage().GetRealContent() ==
'bingolabongola "the wise" fingulafongula')
-
+
translation = gatherer.Translate('en')
self.failUnless(translation == gatherer.GetText().strip())
-
+
def testErrorHandling(self):
pseudofile = StringIO.StringIO(
'bingo bongo\n'
@@ -47,7 +47,7 @@ class AdmGathererUnittest(unittest.TestCase):
gatherer = admin_template.AdmGatherer.FromFile(pseudofile)
self.assertRaises(admin_template.MalformedAdminTemplateException,
gatherer.Parse)
-
+
_TRANSLATABLES_FROM_FILE = (
'Google', 'Google Desktop Search', 'Preferences',
'Controls Google Deskop Search preferences',
@@ -56,20 +56,20 @@ class AdmGathererUnittest(unittest.TestCase):
'Prevent indexing of e-mail',
# there are lots more but we don't check any further
)
-
+
def VerifyCliquesFromAdmFile(self, cliques):
self.failUnless(len(cliques) > 20)
for ix in range(len(self._TRANSLATABLES_FROM_FILE)):
text = cliques[ix].GetMessage().GetRealContent()
self.failUnless(text == self._TRANSLATABLES_FROM_FILE[ix])
-
+
def testFromFile(self):
fname = util.PathFromRoot('grit/test/data/GoogleDesktopSearch.adm')
gatherer = admin_template.AdmGatherer.FromFile(fname)
gatherer.Parse()
cliques = gatherer.GetCliques()
self.VerifyCliquesFromAdmFile(cliques)
-
+
def MakeGrd(self):
grd = grd_reader.Parse(StringIO.StringIO('''<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="2" source_lang_id="en-US" current_release="3">
@@ -92,7 +92,7 @@ class AdmGathererUnittest(unittest.TestCase):
grd = self.MakeGrd()
cliques = grd.children[0].children[0].children[0].GetCliques()
self.VerifyCliquesFromAdmFile(cliques)
-
+
def testFileIsOutput(self):
grd = self.MakeGrd()
dirname = tempfile.mkdtemp()
@@ -102,7 +102,7 @@ class AdmGathererUnittest(unittest.TestCase):
tool.output_directory = dirname
tool.res = grd
tool.Process()
-
+
self.failUnless(os.path.isfile(
os.path.join(dirname, 'de_GoogleDesktopSearch.adm')))
self.failUnless(os.path.isfile(
diff --git a/tools/grit/grit/gather/interface.py b/tools/grit/grit/gather/interface.py
index 984dea4..8a6532e 100644
--- a/tools/grit/grit/gather/interface.py
+++ b/tools/grit/grit/gather/interface.py
@@ -27,58 +27,58 @@ class GathererBase(object):
become part of the uberclique supplied by the user.
'''
self.uberclique = uberclique
-
+
def SetSkeleton(self, is_skeleton):
self.is_skeleton = is_skeleton
-
+
def IsSkeleton(self):
return self.is_skeleton
-
+
def Parse(self):
'''Parses the contents of what is being gathered.'''
raise NotImplementedError()
-
+
def GetText(self):
'''Returns the text of what is being gathered.'''
raise NotImplementedError()
-
+
def GetTextualIds(self):
'''Returns the mnemonic IDs that need to be defined for the resource
being gathered to compile correctly.'''
return []
-
+
def GetCliques(self):
'''Returns the MessageClique objects for all translateable portions.'''
return []
-
+
def Translate(self, lang, pseudo_if_not_available=True,
skeleton_gatherer=None, fallback_to_english=False):
'''Returns the resource being gathered, with translateable portions filled
with the translation for language 'lang'.
-
+
If pseudo_if_not_available is true, a pseudotranslation will be used for any
message that doesn't have a real translation available.
-
+
If no translation is available and pseudo_if_not_available is false,
fallback_to_english controls the behavior. If it is false, throw an error.
If it is true, use the English version of the message as its own
"translation".
-
+
If skeleton_gatherer is specified, the translation will use the nontranslateable
parts from the gatherer 'skeleton_gatherer', which must be of the same type
as 'self'.
-
- If fallback_to_english
-
+
+ If fallback_to_english
+
Args:
lang: 'en'
pseudo_if_not_available: True | False
skeleton_gatherer: other_gatherer
fallback_to_english: True | False
-
+
Return:
e.g. 'ID_THIS_SECTION TYPE\n...BEGIN\n "Translated message"\n......\nEND'
-
+
Raises:
grit.exception.NotReady() if used before Parse() has been successfully
called.
@@ -87,19 +87,19 @@ class GathererBase(object):
requested language.
'''
raise NotImplementedError()
-
+
def FromFile(rc_file, extkey=None, encoding = 'cp1252'):
'''Loads the resource from the file 'rc_file'. Optionally an external key
(which gets passed to the gatherer's constructor) can be specified.
-
+
If 'rc_file' is a filename, it will be opened for reading using 'encoding'.
Otherwise the 'encoding' parameter is ignored.
-
+
Args:
rc_file: file('') | 'filename.rc'
extkey: e.g. 'ID_MY_DIALOG'
encoding: 'utf-8'
-
+
Return:
grit.gather.interface.GathererBase subclass
'''
diff --git a/tools/grit/grit/gather/muppet_strings.py b/tools/grit/grit/gather/muppet_strings.py
index bade44f..545b129 100644
--- a/tools/grit/grit/gather/muppet_strings.py
+++ b/tools/grit/grit/gather/muppet_strings.py
@@ -24,7 +24,7 @@ PLACEHOLDER_RE = re.compile('(\[!\[|\]!\])')
class MuppetStringsContentHandler(xml.sax.handler.ContentHandler):
'''A very dumb parser for splitting the strings.xml file into translateable
and nontranslateable chunks.'''
-
+
def __init__(self, parent):
self.curr_elem = ''
self.curr_text = ''
@@ -32,11 +32,11 @@ class MuppetStringsContentHandler(xml.sax.handler.ContentHandler):
self.description = ''
self.meaning = ''
self.translateable = True
-
+
def startElement(self, name, attrs):
if (name != 'strings'):
self.curr_elem = name
-
+
attr_names = attrs.getQNames()
if 'desc' in attr_names:
self.description = attrs.getValueByQName('desc')
@@ -46,7 +46,7 @@ class MuppetStringsContentHandler(xml.sax.handler.ContentHandler):
value = attrs.getValueByQName('translateable')
if value.lower() not in ['true', 'yes']:
self.translateable = False
-
+
att_text = []
for attr_name in attr_names:
att_text.append(' ')
@@ -54,14 +54,14 @@ class MuppetStringsContentHandler(xml.sax.handler.ContentHandler):
att_text.append('=')
att_text.append(
xml.sax.saxutils.quoteattr(attrs.getValueByQName(attr_name)))
-
+
self.parent._AddNontranslateableChunk("<%s%s>" %
(name, ''.join(att_text)))
-
+
def characters(self, content):
if self.curr_elem != '':
self.curr_text += content
-
+
def endElement(self, name):
if name != 'strings':
self.parent.AddMessage(self.curr_text, self.description,
@@ -72,13 +72,13 @@ class MuppetStringsContentHandler(xml.sax.handler.ContentHandler):
self.description = ''
self.meaning = ''
self.translateable = True
-
+
def ignorableWhitespace(self, whitespace):
pass
class MuppetStrings(regexp.RegexpGatherer):
'''Supports the strings.xml format used by Muppet gadgets.'''
-
+
def __init__(self, text):
if util.IsExtraVerbose():
print text
@@ -87,9 +87,9 @@ class MuppetStrings(regexp.RegexpGatherer):
def AddMessage(self, msgtext, description, meaning, translateable):
if msgtext == '':
return
-
+
msg = tclib.Message(description=description, meaning=meaning)
-
+
unescaped_text = self.UnEscape(msgtext)
parts = PLACEHOLDER_RE.split(unescaped_text)
in_placeholder = False
@@ -106,15 +106,15 @@ class MuppetStrings(regexp.RegexpGatherer):
'(placeholder)'))
else:
msg.AppendText(part)
-
+
self.skeleton_.append(
self.uberclique.MakeClique(msg, translateable=translateable))
-
+
# if statement needed because this is supposed to be idempotent (so never
# set back to false)
if translateable:
self.translatable_chunk_ = True
-
+
# Although we use the RegexpGatherer base class, we do not use the
# _RegExpParse method of that class to implement Parse(). Instead, we
# parse using a SAX parser.
@@ -126,10 +126,10 @@ class MuppetStrings(regexp.RegexpGatherer):
handler = MuppetStringsContentHandler(self)
xml.sax.parse(stream, handler)
self._AddNontranslateableChunk(u'</strings>\n')
-
+
def Escape(self, text):
return util.EncodeCdata(text)
-
+
def FromFile(filename_or_stream, extkey=None, encoding='cp1252'):
if isinstance(filename_or_stream, types.StringTypes):
if util.IsVerbose():
diff --git a/tools/grit/grit/gather/muppet_strings_unittest.py b/tools/grit/grit/gather/muppet_strings_unittest.py
index 97b7eb1..434d9f8 100644
--- a/tools/grit/grit/gather/muppet_strings_unittest.py
+++ b/tools/grit/grit/gather/muppet_strings_unittest.py
@@ -21,7 +21,7 @@ class MuppetStringsUnittest(unittest.TestCase):
gatherer.Parse()
self.failUnless(len(gatherer.GetCliques()) == 2)
self.failUnless(gatherer.Translate('en').replace('\n', '') == original)
-
+
def testEscapingAndLinebreaks(self):
original = ('''\
<strings>
@@ -52,7 +52,7 @@ you?</LINEBREAK> <ESCAPED meaning="bingo">4 &lt; 6</ESCAPED>
ph = msg.GetPlaceholders()[0]
self.failUnless(ph.GetOriginal() == '[![USER]!]')
self.failUnless(ph.GetPresentation() == 'USER')
-
+
def testTranslateable(self):
original = "<strings><BINGO translateable='false'>Yo yo hi there</BINGO></strings>"
gatherer = muppet_strings.MuppetStrings(original)
diff --git a/tools/grit/grit/gather/rc.py b/tools/grit/grit/gather/rc.py
index e7cdf5d..f0af109 100644
--- a/tools/grit/grit/gather/rc.py
+++ b/tools/grit/grit/gather/rc.py
@@ -44,15 +44,15 @@ _UNESCAPE_CHARS = dict([[value, key] for key, value in _ESCAPE_CHARS.items()])
class Section(regexp.RegexpGatherer):
'''A section from a resource file.'''
-
+
def __init__(self, section_text):
'''Creates a new object.
-
+
Args:
section_text: 'ID_SECTION_ID SECTIONTYPE\n.....\nBEGIN\n.....\nEND'
'''
regexp.RegexpGatherer.__init__(self, section_text)
-
+
# static method
def Escape(text):
'''Returns a version of 'text' with characters escaped that need to be
@@ -61,26 +61,26 @@ class Section(regexp.RegexpGatherer):
return _ESCAPE_CHARS[match.group()]
return _NEED_ESCAPE.sub(Replace, text)
Escape = staticmethod(Escape)
-
- # static method
+
+ # static method
def UnEscape(text):
'''Returns a version of 'text' with escaped characters unescaped.'''
def Replace(match):
return _UNESCAPE_CHARS[match.group()]
return _NEED_UNESCAPE.sub(Replace, text)
UnEscape = staticmethod(UnEscape)
-
+
def _RegExpParse(self, rexp, text_to_parse):
'''Overrides _RegExpParse to add shortcut group handling. Otherwise
the same.
'''
regexp.RegexpGatherer._RegExpParse(self, rexp, text_to_parse)
-
+
if not self.IsSkeleton() and len(self.GetTextualIds()) > 0:
group_name = self.GetTextualIds()[0]
for c in self.GetCliques():
c.AddToShortcutGroup(group_name)
-
+
# Static method
def FromFileImpl(rc_file, extkey, encoding, type):
'''Implementation of FromFile. Need to keep separate so we can have
@@ -88,14 +88,14 @@ class Section(regexp.RegexpGatherer):
'''
if isinstance(rc_file, types.StringTypes):
rc_file = util.WrapInputStream(file(rc_file, 'r'), encoding)
-
+
out = ''
begin_count = 0
for line in rc_file.readlines():
if len(out) > 0 or (line.strip().startswith(extkey) and
line.strip().split()[0] == extkey):
out += line
-
+
# we stop once we reach the END for the outermost block.
begin_count_was = begin_count
if len(out) > 0 and line.strip() == 'BEGIN':
@@ -104,31 +104,31 @@ class Section(regexp.RegexpGatherer):
begin_count -= 1
if begin_count_was == 1 and begin_count == 0:
break
-
+
if len(out) == 0:
raise exception.SectionNotFound('%s in file %s' % (extkey, rc_file))
return type(out)
FromFileImpl = staticmethod(FromFileImpl)
-
+
# static method
def FromFile(rc_file, extkey, encoding='cp1252'):
'''Retrieves the section of 'rc_file' that has the key 'extkey'. This is
matched against the start of a line, and that line and the rest of that
section in the RC file is returned.
-
+
If 'rc_file' is a filename, it will be opened for reading using 'encoding'.
Otherwise the 'encoding' parameter is ignored.
-
+
This method instantiates an object of type 'type' with the text from the
file.
-
+
Args:
rc_file: file('') | 'filename.rc'
extkey: 'ID_MY_DIALOG'
encoding: 'utf-8'
type: class to instantiate with text of section
-
+
Return:
type(text_of_section)
'''
@@ -154,7 +154,7 @@ class Dialog(Section):
# CONTROL "Jack ""Black"" Daniels",IDC_RADIO1,"Button",
# BS_AUTORADIOBUTTON,46,51,84,10
# END
-
+
# We are using a sorted set of keys, and we assume that the
# group name used for descriptions (type) will come after the "text"
# group in alphabetical order. We also assume that there cannot be
@@ -184,11 +184,11 @@ class Dialog(Section):
# Lines for controls that have only an ID and then just numbers
\s+[A-Z]+\s+(?P<id4>[A-Z0-9_]*[A-Z][A-Z0-9_]*)\s*,
''', re.MULTILINE | re.VERBOSE)
-
+
def Parse(self):
'''Knows how to parse dialog resource sections.'''
self._RegExpParse(self.dialog_re_, self.text_)
-
+
# static method
def FromFile(rc_file, extkey, encoding = 'cp1252'):
return Section.FromFileImpl(rc_file, extkey, encoding, Dialog)
@@ -197,10 +197,10 @@ class Dialog(Section):
class Menu(Section):
'''A resource section that contains a menu resource.'''
-
+
# A typical menu resource section looks something like this:
#
- # IDC_KLONK MENU
+ # IDC_KLONK MENU
# BEGIN
# POPUP "&File"
# BEGIN
@@ -227,7 +227,7 @@ class Menu(Section):
'in the menu. Please make sure that no two items in the same menu share '
'the same shortcut.'
)
-
+
# A dandy regexp to suck all the IDs and translateables out of a menu
# resource
menu_re_ = re.compile('''
@@ -240,7 +240,7 @@ class Menu(Section):
# Match the caption & ID of a MENUITEM
MENUITEM\s+"(?P<text2>.*?([^"]|""))"\s*,\s*(?P<id2>[A-Z0-9_]+)
''', re.MULTILINE | re.VERBOSE)
-
+
def Parse(self):
'''Knows how to parse menu resource sections. Because it is important that
menu shortcuts are unique within the menu, we return each menu as a single
@@ -249,7 +249,7 @@ class Menu(Section):
with instructions for the translators.'''
self.single_message_ = tclib.Message(description=self.MENU_MESSAGE_DESCRIPTION)
self._RegExpParse(self.menu_re_, self.text_)
-
+
# static method
def FromFile(rc_file, extkey, encoding = 'cp1252'):
return Section.FromFileImpl(rc_file, extkey, encoding, Menu)
@@ -258,7 +258,7 @@ class Menu(Section):
class Version(Section):
'''A resource section that contains a VERSIONINFO resource.'''
-
+
# A typical version info resource can look like this:
#
# VS_VERSION_INFO VERSIONINFO
@@ -297,7 +297,7 @@ class Version(Section):
#
# In addition to the above fields, VALUE fields named "Comments" and
# "LegalTrademarks" may also be translateable.
-
+
version_re_ = re.compile('''
# Match the ID on the first line
^(?P<id1>[A-Z0-9_]+)\s+VERSIONINFO
@@ -309,7 +309,7 @@ class Version(Section):
ProductName|Comments|LegalTrademarks
)",\s+"(?P<text1>.*?([^"]|""))"\s
''', re.MULTILINE | re.VERBOSE)
-
+
def Parse(self):
'''Knows how to parse VERSIONINFO resource sections.'''
self._RegExpParse(self.version_re_, self.text_)
@@ -321,18 +321,18 @@ class Version(Section):
def FromFile(rc_file, extkey, encoding = 'cp1252'):
return Section.FromFileImpl(rc_file, extkey, encoding, Version)
FromFile = staticmethod(FromFile)
-
+
class RCData(Section):
'''A resource section that contains some data .'''
# A typical rcdataresource section looks like this:
#
# IDR_BLAH RCDATA { 1, 2, 3, 4 }
-
+
dialog_re_ = re.compile('''
^(?P<id1>[A-Z0-9_]+)\s+RCDATA\s+(DISCARDABLE)?\s+\{.*?\}
''', re.MULTILINE | re.VERBOSE | re.DOTALL)
-
+
def Parse(self):
'''Knows how to parse RCDATA resource sections.'''
self._RegExpParse(self.dialog_re_, self.text_)
@@ -343,14 +343,14 @@ class RCData(Section):
'''
if isinstance(rc_file, types.StringTypes):
rc_file = util.WrapInputStream(file(rc_file, 'r'), encoding)
-
+
out = ''
begin_count = 0
openbrace_count = 0
for line in rc_file.readlines():
if len(out) > 0 or line.strip().startswith(extkey):
out += line
-
+
# we stop once balance the braces (could happen on one line)
begin_count_was = begin_count
if len(out) > 0:
@@ -360,10 +360,10 @@ class RCData(Section):
if ((begin_count_was == 1 and begin_count == 0) or
(openbrace_count > 0 and begin_count == 0)):
break
-
+
if len(out) == 0:
raise exception.SectionNotFound('%s in file %s' % (extkey, rc_file))
-
+
return RCData(out)
FromFile = staticmethod(FromFile)
@@ -371,7 +371,7 @@ class RCData(Section):
class Accelerators(Section):
'''An ACCELERATORS table.
'''
-
+
# A typical ACCELERATORS section looks like this:
#
# IDR_ACCELERATOR1 ACCELERATORS
@@ -380,7 +380,7 @@ class Accelerators(Section):
# "^V", ID_ACCELERATOR32771, ASCII, NOINVERT
# VK_INSERT, ID_ACCELERATOR32772, VIRTKEY, CONTROL, NOINVERT
# END
-
+
accelerators_re_ = re.compile('''
# Match the ID on the first line
^(?P<id1>[A-Z0-9_]+)\s+ACCELERATORS\s+
@@ -391,11 +391,11 @@ class Accelerators(Section):
# Match accelerators specified as e.g. "^C"
\s+"[^"]*",\s+(?P<id3>[A-Z0-9_]+)\s*,
''', re.MULTILINE | re.VERBOSE)
-
+
def Parse(self):
'''Knows how to parse ACCELERATORS resource sections.'''
self._RegExpParse(self.accelerators_re_, self.text_)
-
+
# static method
def FromFile(rc_file, extkey, encoding = 'cp1252'):
return Section.FromFileImpl(rc_file, extkey, encoding, Accelerators)
diff --git a/tools/grit/grit/gather/rc_unittest.py b/tools/grit/grit/gather/rc_unittest.py
index 051b26f..636b421 100644
--- a/tools/grit/grit/gather/rc_unittest.py
+++ b/tools/grit/grit/gather/rc_unittest.py
@@ -20,7 +20,7 @@ from grit import util
class RcUnittest(unittest.TestCase):
- part_we_want = '''IDC_KLONKACC ACCELERATORS
+ part_we_want = '''IDC_KLONKACC ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT
"/", IDM_ABOUT, ASCII, ALT
@@ -41,7 +41,7 @@ END
''' % self.part_we_want
f = StringIO.StringIO(buf)
-
+
out = rc.Section.FromFile(f, 'IDC_KLONKACC')
self.failUnless(out.GetText() == self.part_we_want)
@@ -74,7 +74,7 @@ END
self.failUnless(len(dlg.GetCliques()) == 6)
self.failUnless(dlg.GetCliques()[1].GetMessage().GetRealContent() ==
'klonk Version "yibbee" 1.0')
-
+
transl = dlg.Translate('en')
self.failUnless(transl.strip() == dlg.GetText().strip())
@@ -89,7 +89,7 @@ BEGIN
END
''')
dlg.Parse()
-
+
alt_dlg = rc.Dialog('''IDD_ABOUTBOX DIALOGEX 040704, 17, 230, 75
STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "XXXXXXXXX"
@@ -100,14 +100,14 @@ BEGIN
END
''')
alt_dlg.Parse()
-
+
transl = dlg.Translate('en', skeleton_gatherer=alt_dlg)
self.failUnless(transl.count('040704') and
transl.count('110978'))
self.failUnless(transl.count('Yipee skippy'))
def testMenu(self):
- menu = rc.Menu('''IDC_KLONK MENU
+ menu = rc.Menu('''IDC_KLONK MENU
BEGIN
POPUP "&File """
BEGIN
@@ -117,7 +117,7 @@ BEGIN
BEGIN
MENUITEM "Klonk && is ""good""", ID_GONK_KLONKIS
END
- MENUITEM "This is a very long menu caption to try to see if we can make the ID go to a continuation line, blablabla blablabla bla blabla blablabla blablabla blablabla blablabla...",
+ MENUITEM "This is a very long menu caption to try to see if we can make the ID go to a continuation line, blablabla blablabla bla blabla blablabla blablabla blablabla blablabla...",
ID_FILE_THISISAVERYLONGMENUCAPTIONTOTRYTOSEEIFWECANMAKETHEIDGOTOACONTINUATIONLINE
END
POPUP "&Help"
@@ -125,13 +125,13 @@ BEGIN
MENUITEM "&About ...", IDM_ABOUT
END
END''')
-
+
menu.Parse()
self.failUnless(len(menu.GetTextualIds()) == 6)
self.failUnless(len(menu.GetCliques()) == 1)
self.failUnless(len(menu.GetCliques()[0].GetMessage().GetPlaceholders()) ==
9)
-
+
transl = menu.Translate('en')
self.failUnless(transl.strip() == menu.GetText().strip())
@@ -173,7 +173,7 @@ END
version.Parse()
self.failUnless(len(version.GetTextualIds()) == 1)
self.failUnless(len(version.GetCliques()) == 4)
-
+
transl = version.Translate('en')
self.failUnless(transl.strip() == version.GetText().strip())
@@ -200,8 +200,8 @@ BEGIN
END'''.strip())
dialog.Parse()
self.failUnless(len(dialog.GetTextualIds()) == 10)
-
-
+
+
def testRegressionDialogBox2(self):
dialog = rc.Dialog('''
IDD_SIDEBAR_EMAIL_PANEL_PROPPAGE DIALOG DISCARDABLE 0, 0, 264, 220
@@ -213,7 +213,7 @@ BEGIN
PUSHBUTTON "Add Filter...",IDC_SIDEBAR_EMAIL_ADD_FILTER,196,38,50,14
PUSHBUTTON "Remove",IDC_SIDEBAR_EMAIL_REMOVE,196,174,50,14
PUSHBUTTON "", IDC_SIDEBAR_EMAIL_HIDDEN, 200, 178, 5, 5, NOT WS_VISIBLE
- LISTBOX IDC_SIDEBAR_EMAIL_LIST,16,60,230,108,
+ LISTBOX IDC_SIDEBAR_EMAIL_LIST,16,60,230,108,
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
LTEXT "You can prevent certain emails from showing up in the sidebar with a filter.",
IDC_STATIC,16,18,234,18
@@ -221,7 +221,7 @@ END'''.strip())
dialog.Parse()
self.failUnless('IDC_SIDEBAR_EMAIL_HIDDEN' in dialog.GetTextualIds())
-
+
def testRegressionMenuId(self):
menu = rc.Menu('''
IDR_HYPERMENU_FOLDER MENU
@@ -247,7 +247,7 @@ END'''.strip())
transl = menu.Translate('en')
# Shouldn't find \\n (the \n shouldn't be changed to \\n)
self.failUnless(transl.find('\\\\n') == -1)
-
+
def testRegressionTabs(self):
menu = rc.Menu('''
IDR_HYPERMENU_FOLDER MENU
@@ -273,7 +273,7 @@ END'''.strip())
original = '..\\\\..\\\\trs\\\\res\\\\nav_first.gif'
unescaped = rc.Section.UnEscape(original)
self.failUnless(unescaped == '..\\..\\trs\\res\\nav_first.gif')
-
+
def testRegressionDialogItemsTextOnly(self):
dialog = rc.Dialog('''IDD_OPTIONS_SEARCH DIALOGEX 0, 0, 280, 292
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
@@ -294,7 +294,7 @@ END''')
for c in dialog.GetCliques()]
self.failUnless('Select search buttons and options' in translateables)
self.failUnless('Use Google site:' in translateables)
-
+
def testAccelerators(self):
acc = rc.Accelerators('''\
IDR_ACCELERATOR1 ACCELERATORS
@@ -315,7 +315,7 @@ END
def testRegressionEmptyString(self):
dlg = rc.Dialog('''\
IDD_CONFIRM_QUIT_GD_DLG DIALOGEX 0, 0, 267, 108
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
WS_CAPTION
EXSTYLE WS_EX_TOPMOST
CAPTION "Google Desktop"
@@ -326,15 +326,15 @@ BEGIN
ICON 32514,IDC_STATIC,7,9,21,20
EDITTEXT IDC_TEXTBOX,34,7,231,60,ES_MULTILINE | ES_READONLY | NOT WS_BORDER
CONTROL "",
- IDC_ENABLE_GD_AUTOSTART,"Button",BS_AUTOCHECKBOX |
+ IDC_ENABLE_GD_AUTOSTART,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,33,70,231,10
END''')
dlg.Parse()
-
+
def Check():
self.failUnless(transl.count('IDC_ENABLE_GD_AUTOSTART'))
self.failUnless(transl.count('END'))
-
+
transl = dlg.Translate('de', pseudo_if_not_available=True,
fallback_to_english=True)
Check()
diff --git a/tools/grit/grit/gather/regexp.py b/tools/grit/grit/gather/regexp.py
index c1e1a93..88c7413 100644
--- a/tools/grit/grit/gather/regexp.py
+++ b/tools/grit/grit/gather/regexp.py
@@ -30,7 +30,7 @@ class RegexpGatherer(interface.GathererBase):
'LTEXT': 'This is the text for a label',
'PUSHBUTTON': 'This is the text for a button',
}
-
+
def __init__(self, text):
interface.GathererBase.__init__(self)
# Original text of what we're parsing
@@ -53,38 +53,38 @@ class RegexpGatherer(interface.GathererBase):
# Number to use for the next placeholder name. Used only if single_message
# is not None
self.ph_counter_ = 1
-
+
def GetText(self):
'''Returns the original text of the section'''
return self.text_
-
+
def Escape(self, text):
'''Subclasses can override. Base impl is identity.
'''
return text
-
+
def UnEscape(self, text):
'''Subclasses can override. Base impl is identity.
'''
return text
-
+
def GetTextualIds(self):
'''Returns the list of textual IDs that need to be defined for this
resource section to compile correctly.'''
return self.ids_
-
+
def GetCliques(self):
'''Returns the message cliques for each translateable message in the
resource section.'''
return filter(lambda x: isinstance(x, clique.MessageClique), self.skeleton_)
-
+
def Translate(self, lang, pseudo_if_not_available=True,
skeleton_gatherer=None, fallback_to_english=False):
if len(self.skeleton_) == 0:
raise exception.NotReady()
if skeleton_gatherer:
assert len(skeleton_gatherer.skeleton_) == len(self.skeleton_)
-
+
out = []
for ix in range(len(self.skeleton_)):
if isinstance(self.skeleton_[ix], types.StringTypes):
@@ -101,7 +101,7 @@ class RegexpGatherer(interface.GathererBase):
msg = self.skeleton_[ix].MessageForLanguage(lang,
pseudo_if_not_available,
fallback_to_english)
-
+
def MyEscape(text):
return self.Escape(text)
text = msg.GetRealContent(escaping_function=MyEscape)
@@ -121,7 +121,7 @@ class RegexpGatherer(interface.GathererBase):
if (self.translatable_chunk_):
message = self.skeleton_[len(self.skeleton_) - 1].GetMessage()
message.SetDescription(description)
-
+
def Parse(self):
'''Parses the section. Implemented by subclasses. Idempotent.'''
raise NotImplementedError()
@@ -134,14 +134,14 @@ class RegexpGatherer(interface.GathererBase):
self.single_message_.AppendPlaceholder(ph)
else:
self.skeleton_.append(chunk)
-
+
def _AddTranslateableChunk(self, chunk):
'''Adds a translateable chunk. It will be unescaped before being added.'''
# We don't want empty messages since they are redundant and the TC
# doesn't allow them.
if chunk == '':
return
-
+
unescaped_text = self.UnEscape(chunk)
if self.single_message_:
self.single_message_.AppendText(unescaped_text)
@@ -149,23 +149,23 @@ class RegexpGatherer(interface.GathererBase):
self.skeleton_.append(self.uberclique.MakeClique(
tclib.Message(text=unescaped_text)))
self.translatable_chunk_ = True
-
+
def _AddTextualId(self, id):
self.ids_.append(id)
-
+
def _RegExpParse(self, regexp, text_to_parse):
'''An implementation of Parse() that can be used for resource sections that
can be parsed using a single multi-line regular expression.
-
+
All translateables must be in named groups that have names starting with
'text'. All textual IDs must be in named groups that have names starting
with 'id'. All type definitions that can be included in the description
field for contextualization purposes should have a name that starts with
'type'.
-
+
Args:
regexp: re.compile('...', re.MULTILINE)
- text_to_parse:
+ text_to_parse:
'''
if self.have_parsed_:
return
@@ -192,9 +192,9 @@ class RegexpGatherer(interface.GathererBase):
# group in alphabetical order. We also assume that there cannot be
# more than one description per regular expression match.
self.AddDescriptionElement(groups[group])
-
+
self._AddNontranslateableChunk(text_to_parse[chunk_start:])
-
+
if self.single_message_:
self.skeleton_.append(self.uberclique.MakeClique(self.single_message_))
diff --git a/tools/grit/grit/gather/tr_html.py b/tools/grit/grit/gather/tr_html.py
index 35c70b2..269e6f2 100644
--- a/tools/grit/grit/gather/tr_html.py
+++ b/tools/grit/grit/gather/tr_html.py
@@ -118,7 +118,7 @@ _NONTRANSLATEABLES = re.compile(r'''
|
<\s*[a-zA-Z_]+:.+?> # custom tag (open)
|
- <\s*/\s*[a-zA-Z_]+:.+?> # custom tag (close)
+ <\s*/\s*[a-zA-Z_]+:.+?> # custom tag (close)
|
<!\s*[A-Z]+\s*([^>]+|"[^"]+"|'[^']+')*?>
''', re.MULTILINE | re.DOTALL | re.VERBOSE | re.IGNORECASE)
@@ -202,13 +202,13 @@ class HtmlChunks(object):
chunks, where each chunk is either translateable or non-translateable.
The chunks are unmodified sections of the original document, so concatenating
the text of all chunks would result in the original document.'''
-
+
def InTranslateable(self):
return self.last_translateable != -1
-
+
def Rest(self):
return self.text_[self.current:]
-
+
def StartTranslateable(self):
assert not self.InTranslateable()
if self.current != 0:
@@ -220,7 +220,7 @@ class HtmlChunks(object):
self.chunk_start = self.last_nontranslateable + 1
self.last_translateable = self.current
self.last_nontranslateable = -1
-
+
def EndTranslateable(self):
assert self.InTranslateable()
# Append a translateable chunk
@@ -229,10 +229,10 @@ class HtmlChunks(object):
self.chunk_start = self.last_translateable + 1
self.last_translateable = -1
self.last_nontranslateable = self.current
-
+
def AdvancePast(self, match):
self.current += match.end()
-
+
def AddChunk(self, translateable, text):
'''Adds a chunk to self, removing linebreaks and duplicate whitespace
if appropriate.
@@ -242,68 +242,68 @@ class HtmlChunks(object):
text = text.replace('\r', ' ')
text = text.replace(' ', ' ')
text = text.replace(' ', ' ')
-
+
m = _DESCRIPTION_COMMENT.search(text)
if m:
self.last_description = m.group('description')
# remove the description from the output text
text = _DESCRIPTION_COMMENT.sub('', text)
-
+
if translateable:
description = self.last_description
self.last_description = ''
else:
description = ''
-
+
if text != '':
self.chunks_.append((translateable, text, description))
-
+
def Parse(self, text):
'''Parses self.text_ into an intermediate format stored in self.chunks_
which is translateable and nontranslateable chunks. Also returns
self.chunks_
-
+
Return:
[chunk1, chunk2, chunk3, ...] (instances of class Chunk)
'''
#
# Chunker state
#
-
+
self.text_ = text
-
+
# A list of tuples (is_translateable, text) which represents the document
# after chunking.
self.chunks_ = []
-
+
# Start index of the last chunk, whether translateable or not
self.chunk_start = 0
-
+
# Index of the last for-sure translateable character if we are parsing
# a translateable chunk, -1 to indicate we are not in a translateable chunk.
# This is needed so that we don't include trailing whitespace in the
# translateable chunk (whitespace is neutral).
self.last_translateable = -1
-
+
# Index of the last for-sure nontranslateable character if we are parsing
# a nontranslateable chunk, -1 if we are not in a nontranslateable chunk.
# This is needed to make sure we can group e.g. "<b>Hello</b> there"
# together instead of just "Hello</b> there" which would be much worse
# for translation.
self.last_nontranslateable = -1
-
+
# Index of the character we're currently looking at.
self.current = 0
-
+
# The name of the last block element parsed.
self.last_element_ = ''
-
+
# The last explicit description we found.
self.last_description = ''
-
+
while self.current < len(self.text_):
_DebugPrint('REST: %s' % self.text_[self.current:self.current+60])
-
+
# First try to match whitespace
m = _WHITESPACE.match(self.Rest())
if m:
@@ -319,7 +319,7 @@ class HtmlChunks(object):
self.last_nontranslateable = self.current + m.end() - 1
self.AdvancePast(m)
continue
-
+
# Then we try to match nontranslateables
m = _NONTRANSLATEABLES.match(self.Rest())
if m:
@@ -328,7 +328,7 @@ class HtmlChunks(object):
self.last_nontranslateable = self.current + m.end() - 1
self.AdvancePast(m)
continue
-
+
# Now match all other HTML element tags (opening, closing, or empty, we
# don't care).
m = _ELEMENT.match(self.Rest())
@@ -338,7 +338,7 @@ class HtmlChunks(object):
self.last_element_ = element_name
if self.InTranslateable():
self.EndTranslateable()
-
+
# Check for "special" elements, i.e. ones that have a translateable
# attribute, and handle them correctly. Note that all of the
# "special" elements are block tags, so no need to check for this
@@ -349,7 +349,7 @@ class HtmlChunks(object):
for group in sm.groupdict().keys():
if sm.groupdict()[group]:
break
-
+
# First make a nontranslateable chunk up to and including the
# quote before the translateable attribute value
self.AddChunk(False, self.text_[
@@ -358,7 +358,7 @@ class HtmlChunks(object):
self.AddChunk(True, self.Rest()[sm.start(group) : sm.end(group)])
# Finally correct the data invariant for the parser
self.chunk_start = self.current + sm.end(group)
-
+
self.last_nontranslateable = self.current + m.end() - 1
elif self.InTranslateable():
# We're in a translateable and the tag is an inline tag, so we
@@ -366,7 +366,7 @@ class HtmlChunks(object):
self.last_translateable = self.current + m.end() - 1
self.AdvancePast(m)
continue
-
+
# Anything else we find must be translateable, so we advance one character
# at a time until one of the above matches.
if not self.InTranslateable():
@@ -374,13 +374,13 @@ class HtmlChunks(object):
else:
self.last_translateable = self.current
self.current += 1
-
+
# Close the final chunk
if self.InTranslateable():
self.AddChunk(True, self.text_[self.chunk_start : ])
else:
self.AddChunk(False, self.text_[self.chunk_start : ])
-
+
return self.chunks_
@@ -388,14 +388,14 @@ def HtmlToMessage(html, include_block_tags=False, description=''):
'''Takes a bit of HTML, which must contain only "inline" HTML elements,
and changes it into a tclib.Message. This involves escaping any entities and
replacing any HTML code with placeholders.
-
+
If include_block_tags is true, no error will be given if block tags (e.g.
<p> or <br>) are included in the HTML.
-
+
Args:
html: 'Hello <b>[USERNAME]</b>, how&nbsp;<i>are</i> you?'
include_block_tags: False
-
+
Return:
tclib.Message('Hello START_BOLD1USERNAMEEND_BOLD, '
'howNBSPSTART_ITALICareEND_ITALIC you?',
@@ -408,26 +408,26 @@ def HtmlToMessage(html, include_block_tags=False, description=''):
# Approach is:
# - first placeholderize, finding <elements>, [REPLACEABLES] and &nbsp;
# - then escape all character entities in text in-between placeholders
-
+
parts = [] # List of strings (for text chunks) and tuples (ID, original)
# for placeholders
-
+
count_names = {} # Map of base names to number of times used
end_names = {} # Map of base names to stack of end tags (for correct nesting)
-
+
def MakeNameClosure(base, type = ''):
'''Returns a closure that can be called once all names have been allocated
to return the final name of the placeholder. This allows us to minimally
number placeholders for non-overlap.
-
+
Also ensures that END_XXX_Y placeholders have the same Y as the
corresponding BEGIN_XXX_Y placeholder when we have nested tags of the same
type.
-
+
Args:
base: 'phname'
type: '' | 'begin' | 'end'
-
+
Return:
Closure()
'''
@@ -439,7 +439,7 @@ def HtmlToMessage(html, include_block_tags=False, description=''):
count_names[name] += 1
else:
count_names[name] = 1
-
+
def MakeFinalName(name_ = name, index = count_names[name] - 1):
if (type.lower() == 'end' and
base in end_names.keys() and len(end_names[base])):
@@ -455,20 +455,20 @@ def HtmlToMessage(html, include_block_tags=False, description=''):
end_names[base].append(end_name)
else:
end_names[base] = [end_name]
-
+
return name_
-
+
return MakeFinalName
-
+
current = 0
-
+
while current < len(html):
m = _NBSP.match(html[current:])
if m:
parts.append((MakeNameClosure('SPACE'), m.group()))
current += m.end()
continue
-
+
m = _REPLACEABLE.match(html[current:])
if m:
# Replaceables allow - but placeholders don't, so replace - with _
@@ -476,7 +476,7 @@ def HtmlToMessage(html, include_block_tags=False, description=''):
parts.append((ph_name, m.group()))
current += m.end()
continue
-
+
m = _SPECIAL_ELEMENT.match(html[current:])
if m:
if not include_block_tags:
@@ -493,7 +493,7 @@ def HtmlToMessage(html, include_block_tags=False, description=''):
html[current + m.end(group) : current + m.end()]))
current += m.end()
continue
-
+
m = _ELEMENT.match(html[current:])
if m:
element_name = m.group('element').lower()
@@ -501,7 +501,7 @@ def HtmlToMessage(html, include_block_tags=False, description=''):
raise exception.BlockTagInTranslateableChunk(html[current:])
if element_name in _HTML_PLACEHOLDER_NAMES: # use meaningful names
element_name = _HTML_PLACEHOLDER_NAMES[element_name]
-
+
# Make a name for the placeholder
type = ''
if not m.group('empty'):
@@ -512,13 +512,13 @@ def HtmlToMessage(html, include_block_tags=False, description=''):
parts.append((MakeNameClosure(element_name, type), m.group()))
current += m.end()
continue
-
+
if len(parts) and isinstance(parts[-1], types.StringTypes):
parts[-1] += html[current]
else:
parts.append(html[current])
current += 1
-
+
msg_text = ''
placeholders = []
for part in parts:
@@ -529,36 +529,36 @@ def HtmlToMessage(html, include_block_tags=False, description=''):
placeholders.append(tclib.Placeholder(final_name, original, '(HTML code)'))
else:
msg_text += part
-
+
msg = tclib.Message(text=msg_text, placeholders=placeholders,
description=description)
content = msg.GetContent()
for ix in range(len(content)):
if isinstance(content[ix], types.StringTypes):
content[ix] = util.UnescapeHtml(content[ix], replace_nbsp=False)
-
+
return msg
class TrHtml(interface.GathererBase):
'''Represents a document or message in the template format used by
Total Recall for HTML documents.'''
-
+
def __init__(self, text):
'''Creates a new object that represents 'text'.
Args:
text: '<html>...</html>'
'''
super(type(self), self).__init__()
-
- self.text_ = text
+
+ self.text_ = text
self.have_parsed_ = False
self.skeleton_ = [] # list of strings and MessageClique objects
-
+
def GetText(self):
'''Returns the original text of the HTML document'''
return self.text_
-
+
def GetCliques(self):
'''Returns the message cliques for each translateable message in the
document.'''
@@ -568,14 +568,14 @@ class TrHtml(interface.GathererBase):
skeleton_gatherer=None, fallback_to_english=False):
'''Returns this document with translateable messages filled with
the translation for language 'lang'.
-
+
Args:
lang: 'en'
pseudo_if_not_available: True
-
+
Return:
'ID_THIS_SECTION TYPE\n...BEGIN\n "Translated message"\n......\nEND
-
+
Raises:
grit.exception.NotReady() if used before Parse() has been successfully
called.
@@ -584,9 +584,9 @@ class TrHtml(interface.GathererBase):
'''
if len(self.skeleton_) == 0:
raise exception.NotReady()
-
+
# TODO(joi) Implement support for skeleton gatherers here.
-
+
out = []
for item in self.skeleton_:
if isinstance(item, types.StringTypes):
@@ -602,21 +602,21 @@ class TrHtml(interface.GathererBase):
# We escape " characters to increase the chance that attributes
# will be properly escaped.
out.append(util.EscapeHtml(content, True))
-
+
return ''.join(out)
-
-
+
+
# Parsing is done in two phases: First, we break the document into
# translateable and nontranslateable chunks. Second, we run through each
# translateable chunk and insert placeholders for any HTML elements, unescape
# escaped characters, etc.
- def Parse(self):
+ def Parse(self):
if self.have_parsed_:
return
self.have_parsed_ = True
text = self.text_
-
+
# First handle the silly little [!]-prefixed header because it's not
# handled by our HTML parsers.
m = _SILLY_HEADER.match(text)
@@ -626,16 +626,16 @@ class TrHtml(interface.GathererBase):
tclib.Message(text=text[m.start('title'):m.end('title')])))
self.skeleton_.append(text[m.end('title') : m.end()])
text = text[m.end():]
-
+
chunks = HtmlChunks().Parse(text)
-
+
for chunk in chunks:
if chunk[0]: # Chunk is translateable
self.skeleton_.append(self.uberclique.MakeClique(
HtmlToMessage(chunk[1], description=chunk[2])))
else:
self.skeleton_.append(chunk[1])
-
+
# Go through the skeleton and change any messages that consist solely of
# placeholders and whitespace into nontranslateable strings.
for ix in range(len(self.skeleton_)):
@@ -649,20 +649,20 @@ class TrHtml(interface.GathererBase):
break
if not got_text:
self.skeleton_[ix] = msg.GetRealContent()
-
-
+
+
# Static method
def FromFile(html, extkey=None, encoding = 'utf-8'):
'''Creates a TrHtml object from the contents of 'html' which are decoded
using 'encoding'. Returns a new TrHtml object, upon which Parse() has not
been called.
-
+
Args:
html: file('') | 'filename.html'
extkey: ignored
encoding: 'utf-8' (note that encoding is ignored if 'html' is not a file
name but instead an open file or file-like object)
-
+
Return:
TrHtml(text_of_file)
'''
diff --git a/tools/grit/grit/gather/tr_html_unittest.py b/tools/grit/grit/gather/tr_html_unittest.py
index b02305d..e0c96ba 100644
--- a/tools/grit/grit/gather/tr_html_unittest.py
+++ b/tools/grit/grit/gather/tr_html_unittest.py
@@ -26,24 +26,24 @@ class ParserUnittest(unittest.TestCase):
self.failUnless(chunks == [
(False, '<p>', ''), (True, 'Hello <b>dear</b> how <i>are</i>you?', ''),
(False, '<p>', ''), (True, 'Fine!', '')])
-
+
chunks = p.Parse('<p> Hello <b>dear</b> how <i>are</i>you? <p>Fine!')
self.failUnless(chunks == [
(False, '<p> ', ''), (True, 'Hello <b>dear</b> how <i>are</i>you?', ''),
(False, ' <p>', ''), (True, 'Fine!', '')])
-
+
chunks = p.Parse('<p> Hello <b>dear how <i>are you? <p> Fine!')
self.failUnless(chunks == [
(False, '<p> ', ''), (True, 'Hello <b>dear how <i>are you?', ''),
(False, ' <p> ', ''), (True, 'Fine!', '')])
-
+
# Ensure translateable sections that start with inline tags contain
# the starting inline tag.
chunks = p.Parse('<b>Hello!</b> how are you?<p><i>I am fine.</i>')
self.failUnless(chunks == [
(True, '<b>Hello!</b> how are you?', ''), (False, '<p>', ''),
(True, '<i>I am fine.</i>', '')])
-
+
# Ensure translateable sections that end with inline tags contain
# the ending inline tag.
chunks = p.Parse("Hello! How are <b>you?</b><p><i>I'm fine!</i>")
@@ -65,14 +65,14 @@ class ParserUnittest(unittest.TestCase):
self.failUnless(chunks == [
(True, '<B>Hello!</B> how are you?', 'bi ngo !'), (False, '<P>', ''),
(True, '<I>I am fine.</I>', '')])
-
+
# In this case, because the explicit description appears after the first
# translateable, it will actually apply to the second translateable.
chunks = p.Parse('<B>Hello!</B> how are you?<!-- desc=bingo! --><P><I>I am fine.</I>')
self.failUnless(chunks == [
(True, '<B>Hello!</B> how are you?', ''), (False, '<P>', ''),
(True, '<I>I am fine.</I>', 'bingo!')])
-
+
# Check that replaceables within block tags (where attributes would go) are
# handled correctly.
chunks = p.Parse('<b>Hello!</b> how are you?<p [BINGO] [$~BONGO~$]>'
@@ -81,17 +81,17 @@ class ParserUnittest(unittest.TestCase):
(True, '<b>Hello!</b> how are you?', ''),
(False, '<p [BINGO] [$~BONGO~$]>', ''),
(True, '<i>I am fine.</i>', '')])
-
+
# Check that the contents of preformatted tags preserve line breaks.
chunks = p.Parse('<textarea>Hello\nthere\nhow\nare\nyou?</textarea>')
self.failUnless(chunks == [(False, '<textarea>', ''),
(True, 'Hello\nthere\nhow\nare\nyou?', ''), (False, '</textarea>', '')])
-
+
# ...and that other tags' line breaks are converted to spaces
chunks = p.Parse('<p>Hello\nthere\nhow\nare\nyou?</p>')
self.failUnless(chunks == [(False, '<p>', ''),
(True, 'Hello there how are you?', ''), (False, '</p>', '')])
-
+
def testTranslateableAttributes(self):
p = tr_html.HtmlChunks()
@@ -107,8 +107,8 @@ class ParserUnittest(unittest.TestCase):
(False, '"><input type="button" value="', ''), (True, 'hello', ''),
(False, '"><input type=\'text\' value=\'', ''), (True, 'Howdie', ''),
(False, '\'>', '')])
-
-
+
+
def testTranslateableHtmlToMessage(self):
msg = tr_html.HtmlToMessage(
'Hello <b>[USERNAME]</b>, &lt;how&gt;&nbsp;<i>are</i> you?')
@@ -116,13 +116,13 @@ class ParserUnittest(unittest.TestCase):
self.failUnless(pres ==
'Hello BEGIN_BOLDX_USERNAME_XEND_BOLD, '
'<how>&nbsp;BEGIN_ITALICareEND_ITALIC you?')
-
+
msg = tr_html.HtmlToMessage('<b>Hello</b><I>Hello</I><b>Hello</b>')
pres = msg.GetPresentableContent()
self.failUnless(pres ==
'BEGIN_BOLD_1HelloEND_BOLD_1BEGIN_ITALICHelloEND_ITALIC'
'BEGIN_BOLD_2HelloEND_BOLD_2')
-
+
# Check that nesting (of the <font> tags) is handled correctly - i.e. that
# the closing placeholder numbers match the opening placeholders.
msg = tr_html.HtmlToMessage(
@@ -135,11 +135,11 @@ class ParserUnittest(unittest.TestCase):
'BEGIN_FONT_1BEGIN_FONT_2Update!END_FONT_2 BEGIN_LINK'
'New FeaturesEND_LINK: Now search PDFs, MP3s, Firefox '
'web history, and moreEND_FONT_1')
-
+
msg = tr_html.HtmlToMessage('''<a href='[$~URL~$]'><b>[NUM][CAT]</b></a>''')
pres = msg.GetPresentableContent()
self.failUnless(pres == 'BEGIN_LINKBEGIN_BOLDX_NUM_XX_CAT_XEND_BOLDEND_LINK')
-
+
msg = tr_html.HtmlToMessage(
'''<font size=-1><a class=q onClick='return window.qs?qs(this):1' '''
'''href='http://[WEBSERVER][SEARCH_URI]'>Desktop</a></font>&nbsp;&nbsp;'''
@@ -147,20 +147,20 @@ class ParserUnittest(unittest.TestCase):
pres = msg.GetPresentableContent()
self.failUnless(pres ==
'''BEGIN_FONTBEGIN_LINKDesktopEND_LINKEND_FONTSPACE''')
-
+
msg = tr_html.HtmlToMessage(
'''<br><br><center><font size=-2>&copy;2005 Google </font></center>''', 1)
pres = msg.GetPresentableContent()
self.failUnless(pres ==
u'BEGIN_BREAK_1BEGIN_BREAK_2BEGIN_CENTERBEGIN_FONT\xa92005'
u' Google END_FONTEND_CENTER')
-
+
msg = tr_html.HtmlToMessage(
'''&nbsp;-&nbsp;<a class=c href=[$~CACHE~$]>Cached</a>''')
pres = msg.GetPresentableContent()
self.failUnless(pres ==
'&nbsp;-&nbsp;BEGIN_LINKCachedEND_LINK')
-
+
# Check that upper-case tags are handled correctly.
msg = tr_html.HtmlToMessage(
'''You can read the <A HREF='http://desktop.google.com/privacypolicy.'''
@@ -170,7 +170,7 @@ class ParserUnittest(unittest.TestCase):
self.failUnless(pres ==
'You can read the BEGIN_LINK_1Privacy PolicyEND_LINK_1 and '
'BEGIN_LINK_2Privacy FAQEND_LINK_2 online.')
-
+
# Check that tags with linebreaks immediately preceding them are handled
# correctly.
msg = tr_html.HtmlToMessage(
@@ -195,7 +195,7 @@ class TrHtmlUnittest(unittest.TestCase):
html.Parse()
self.failUnless(html.skeleton_[3].GetMessage().GetPresentableContent() ==
'BEGIN_LINKPreferences&nbsp;HelpEND_LINK')
-
+
def testSubmitAttribute(self):
html = tr_html.TrHtml('''</td>
<td class="header-element"><input type=submit value="Save Preferences"
@@ -204,7 +204,7 @@ name=submit2></td>
html.Parse()
self.failUnless(html.skeleton_[1].GetMessage().GetPresentableContent() ==
'Save Preferences')
-
+
def testWhitespaceAfterInlineTag(self):
'''Test that even if there is whitespace after an inline tag at the start
of a translateable section the inline tag will be included.
@@ -213,7 +213,7 @@ name=submit2></td>
html.Parse()
self.failUnless(html.skeleton_[1].GetMessage().GetRealContent() ==
'<font size=-1> Hello</font>')
-
+
def testSillyHeader(self):
html = tr_html.TrHtml('''[!]
title\tHello
@@ -229,16 +229,16 @@ bla
# Right after the translateable the nontranslateable should start with
# a linebreak (this catches a bug we had).
self.failUnless(html.skeleton_[2][0] == '\n')
-
-
+
+
def testExplicitDescriptions(self):
html = tr_html.TrHtml('Hello [USER]<br/><!-- desc=explicit --><input type="button">Go!</input>')
html.Parse()
msg = html.GetCliques()[1].GetMessage()
self.failUnless(msg.GetDescription() == 'explicit')
self.failUnless(msg.GetRealContent() == 'Go!')
-
-
+
+
def testRegressionInToolbarAbout(self):
html = tr_html.TrHtml.FromFile(
util.PathFromRoot(r'grit/test/data/toolbar_about.html'))
@@ -249,11 +249,11 @@ bla
if content.count('De parvis grandis acervus erit'):
self.failIf(content.count('$/translate'))
-
+
def HtmlFromFileWithManualCheck(self, f):
html = tr_html.TrHtml.FromFile(f)
html.Parse()
-
+
# For manual results inspection only...
list = []
for item in html.skeleton_:
@@ -261,40 +261,40 @@ bla
list.append(item)
else:
list.append(item.GetMessage().GetPresentableContent())
-
+
return html
def testPrivacyHtml(self):
html = self.HtmlFromFileWithManualCheck(
util.PathFromRoot(r'grit/test/data/privacy.html'))
-
+
self.failUnless(html.skeleton_[1].GetMessage().GetRealContent() ==
'Privacy and Google Desktop Search')
- self.failUnless(html.skeleton_[3].startswith('<'))
+ self.failUnless(html.skeleton_[3].startswith('<'))
self.failUnless(len(html.skeleton_) > 10)
def testPreferencesHtml(self):
html = self.HtmlFromFileWithManualCheck(
util.PathFromRoot(r'grit/test/data/preferences.html'))
-
+
# Verify that we don't get '[STATUS-MESSAGE]' as the original content of
# one of the MessageClique objects (it would be a placeholder-only message
# and we're supposed to have stripped those).
-
+
for item in filter(lambda x: isinstance(x, clique.MessageClique),
html.skeleton_):
if (item.GetMessage().GetRealContent() == '[STATUS-MESSAGE]' or
item.GetMessage().GetRealContent() == '[ADDIN-DO] [ADDIN-OPTIONS]'):
self.fail()
-
+
self.failUnless(len(html.skeleton_) > 100)
-
+
def AssertNumberOfTranslateables(self, files, num):
'''Fails if any of the files in files don't have exactly
num translateable sections.
-
+
Args:
files: ['file1', 'file2']
num: 3
@@ -303,14 +303,14 @@ bla
f = util.PathFromRoot(r'grit/test/data/%s' % f)
html = self.HtmlFromFileWithManualCheck(f)
self.failUnless(len(html.GetCliques()) == num)
-
+
def testFewTranslateables(self):
self.AssertNumberOfTranslateables(['browser.html', 'email_thread.html',
'header.html', 'mini.html',
'oneclick.html', 'script.html',
'time_related.html', 'versions.html'], 0)
self.AssertNumberOfTranslateables(['footer.html', 'hover.html'], 1)
-
+
def testOtherHtmlFilesForManualInspection(self):
files = [
'about.html', 'bad_browser.html', 'cache_prefix.html',
@@ -326,7 +326,7 @@ bla
for f in files:
self.HtmlFromFileWithManualCheck(
util.PathFromRoot(r'grit/test/data/%s' % f))
-
+
def testTranslate(self):
# Note that the English translation of documents that use character
# literals (e.g. &copy;) will not be the same as the original document
@@ -363,27 +363,27 @@ bla
trans = html.Translate('en')
if (html.GetText() != trans):
self.fail()
-
-
+
+
def testHtmlToMessageWithBlockTags(self):
msg = tr_html.HtmlToMessage(
'Hello<p>Howdie<img alt="bingo" src="image.gif">', True)
result = msg.GetPresentableContent()
self.failUnless(
result == 'HelloBEGIN_PARAGRAPHHowdieBEGIN_BLOCKbingoEND_BLOCK')
-
+
msg = tr_html.HtmlToMessage(
'Hello<p>Howdie<input type="button" value="bingo">', True)
result = msg.GetPresentableContent()
self.failUnless(
result == 'HelloBEGIN_PARAGRAPHHowdieBEGIN_BLOCKbingoEND_BLOCK')
-
-
+
+
def testHtmlToMessageRegressions(self):
msg = tr_html.HtmlToMessage(' - ', True)
result = msg.GetPresentableContent()
self.failUnless(result == ' - ')
-
+
def testEscapeUnescaped(self):
text = '&copy;&nbsp; & &quot;&lt;hello&gt;&quot;'
@@ -401,7 +401,7 @@ bla
html = self.HtmlFromFileWithManualCheck(util.PathFromRoot(
r'grit/test/data/ko_oem_enable_bug.html'))
self.failUnless(True)
-
+
def testRegressionCpuHang(self):
# If this regression occurs, the unit test will never return
html = tr_html.TrHtml(
diff --git a/tools/grit/grit/gather/txt.py b/tools/grit/grit/gather/txt.py
index 5452e9d..428c202 100644
--- a/tools/grit/grit/gather/txt.py
+++ b/tools/grit/grit/gather/txt.py
@@ -17,7 +17,7 @@ class TxtFile(interface.GathererBase):
'''A text file gatherer. Very simple, all text from the file becomes a
single clique.
'''
-
+
def __init__(self, contents):
super(type(self), self).__init__()
self.text_ = contents
@@ -26,24 +26,24 @@ class TxtFile(interface.GathererBase):
def Parse(self):
self.clique_ = self.uberclique.MakeClique(tclib.Message(text=self.text_))
pass
-
+
def GetText(self):
'''Returns the text of what is being gathered.'''
return self.text_
-
+
def GetTextualIds(self):
return []
-
+
def GetCliques(self):
'''Returns the MessageClique objects for all translateable portions.'''
return [self.clique_]
-
+
def Translate(self, lang, pseudo_if_not_available=True,
skeleton_gatherer=None, fallback_to_english=False):
return self.clique_.MessageForLanguage(lang,
pseudo_if_not_available,
fallback_to_english).GetRealContent()
-
+
def FromFile(filename_or_stream, extkey=None, encoding = 'cp1252'):
if isinstance(filename_or_stream, types.StringTypes):
filename_or_stream = util.WrapInputStream(file(filename_or_stream, 'rb'), encoding)
diff --git a/tools/grit/grit/grd_reader.py b/tools/grit/grit/grd_reader.py
index d1d2753..4f03fab1 100644
--- a/tools/grit/grit/grd_reader.py
+++ b/tools/grit/grit/grd_reader.py
@@ -34,10 +34,10 @@ class GrdContentHandler(xml.sax.handler.ContentHandler):
self.stack = []
self.stop_after = stop_after
self.debug = debug
-
+
def startElement(self, name, attrs):
assert not self.root or len(self.stack) > 0
-
+
if self.debug:
attr_list = []
for attr in attrs.getNames():
@@ -45,28 +45,28 @@ class GrdContentHandler(xml.sax.handler.ContentHandler):
if len(attr_list) == 0: attr_list = ['(none)']
attr_list = ' '.join(attr_list)
print "Starting parsing of element %s with attributes %r" % (name, attr_list)
-
+
typeattr = None
if 'type' in attrs.getNames():
typeattr = attrs.getValue('type')
-
+
node = mapping.ElementToClass(name, typeattr)()
-
+
if not self.root:
self.root = node
-
+
if len(self.stack) > 0:
self.stack[-1].AddChild(node)
node.StartParsing(name, self.stack[-1])
else:
node.StartParsing(name, None)
-
+
# Push
self.stack.append(node)
-
+
for attr in attrs.getNames():
node.HandleAttribute(attr, attrs.getValue(attr))
-
+
def endElement(self, name):
if self.debug:
print "End parsing of element %s" % name
@@ -76,11 +76,11 @@ class GrdContentHandler(xml.sax.handler.ContentHandler):
self.stack = self.stack[:-1]
if self.stop_after and name == self.stop_after:
raise StopParsingException()
-
+
def characters(self, content):
if self.stack[-1]:
self.stack[-1].AppendContent(content)
-
+
def ignorableWhitespace(self, whitespace):
# TODO(joi) This is not supported by expat. Should use a different XML parser?
pass
@@ -89,33 +89,33 @@ class GrdContentHandler(xml.sax.handler.ContentHandler):
def Parse(filename_or_stream, dir = None, flexible_root = False,
stop_after=None, debug=False):
'''Parses a GRD file into a tree of nodes (from grit.node).
-
+
If flexible_root is False, the root node must be a <grit> element. Otherwise
it can be any element. The "own" directory of the file will only be fixed up
if the root node is a <grit> element.
-
+
'dir' should point to the directory of the input file, or be the full path
to the input file (the filename will be stripped).
-
+
If 'stop_after' is provided, the parsing will stop once the first node
with this name has been fully parsed (including all its contents).
-
+
If 'debug' is true, lots of information about the parsing events will be
printed out during parsing of the file.
-
+
Args:
filename_or_stream: './bla.xml' (must be filename if dir is None)
dir: '.' or None (only if filename_or_stream is a filename)
flexible_root: True | False
stop_after: 'inputs'
debug: False
-
+
Return:
Subclass of grit.node.base.Node
-
+
Throws:
grit.exception.Parsing
- '''
+ '''
handler = GrdContentHandler(stop_after=stop_after, debug=debug)
try:
xml.sax.parse(filename_or_stream, handler)
diff --git a/tools/grit/grit/grd_reader_unittest.py b/tools/grit/grit/grd_reader_unittest.py
index 49c3e4a..4612bbf 100644
--- a/tools/grit/grit/grd_reader_unittest.py
+++ b/tools/grit/grit/grd_reader_unittest.py
@@ -75,7 +75,7 @@ class GrdReaderUnittest(unittest.TestCase):
# only an <outputs> child
self.failUnless(len(tree.children) == 1)
self.failUnless(tree.children[0].name == 'outputs')
-
+
def testLongLinesWithComments(self):
input = u'''<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
@@ -91,7 +91,7 @@ class GrdReaderUnittest(unittest.TestCase):
</grit>'''
pseudo_file = StringIO.StringIO(input)
tree = grd_reader.Parse(pseudo_file, '.')
-
+
greeting = tree.GetNodeById('IDS_GREETING')
self.failUnless(greeting.GetCliques()[0].GetMessage().GetRealContent() ==
'This is a very long line with no linebreaks yes yes it '
@@ -99,4 +99,4 @@ class GrdReaderUnittest(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
-
+
diff --git a/tools/grit/grit/grit_runner.py b/tools/grit/grit/grit_runner.py
index 723d701..d1ff9be 100644
--- a/tools/grit/grit/grit_runner.py
+++ b/tools/grit/grit/grit_runner.py
@@ -66,7 +66,7 @@ def PrintUsage():
for (tool, info) in _TOOLS:
if not _HIDDEN in info.keys():
tool_list += ' %-12s %s\n' % (tool, info[_CLASS]().ShortDescription())
-
+
# TODO(joi) Put these back into the usage when appropriate:
#
# -d Work disconnected. This causes GRIT not to attempt connections with
@@ -83,12 +83,12 @@ Global options:
named 'resource.grd' in the current working directory.
-v Print more verbose runtime information.
-
+
-x Print extremely verbose runtime information. Implies -v
-
+
-p FNAME Specifies that GRIT should profile its execution and output the
results to the file FNAME.
-
+
Tools:
TOOL can be one of the following:
@@ -100,7 +100,7 @@ Tools:
class Options(object):
'''Option storage and parsing.'''
-
+
def __init__(self):
self.disconnected = False
self.client = ''
@@ -109,7 +109,7 @@ class Options(object):
self.extra_verbose = False
self.output_stream = sys.stdout
self.profile_dest = None
-
+
def ReadOptions(self, args):
'''Reads options from the start of args and returns the remainder.'''
(opts, args) = getopt.getopt(args, 'g:dvxc:i:p:')
@@ -126,15 +126,15 @@ class Options(object):
self.extra_verbose = True
util.extra_verbose = True
elif key == '-p': self.profile_dest = val
-
+
if not self.input:
if 'GRIT_INPUT' in os.environ:
self.input = os.environ['GRIT_INPUT']
else:
self.input = 'resource.grd'
-
+
return args
-
+
def __repr__(self):
return '(disconnected: %d, verbose: %d, client: %s, input: %s)' % (
self.disconnected, self.verbose, self.client, self.input)
@@ -154,7 +154,7 @@ def Main(args):
'''Parses arguments and does the appropriate thing.'''
util.ChangeStdoutEncoding()
print _COPYRIGHT
-
+
if not len(args) or len(args) == 1 and args[0] == 'help':
PrintUsage()
return 0
@@ -163,7 +163,7 @@ def Main(args):
if not _GetToolInfo(tool):
print "No such tool. Try running 'grit help' for a list of tools."
return 2
-
+
print ("Help for 'grit %s' (for general help, run 'grit help'):\n"
% (tool))
print _GetToolInfo(tool)[_CLASS].__doc__
diff --git a/tools/grit/grit/grit_runner_unittest.py b/tools/grit/grit/grit_runner_unittest.py
index 057f646..39e1f23 100644
--- a/tools/grit/grit/grit_runner_unittest.py
+++ b/tools/grit/grit/grit_runner_unittest.py
@@ -21,10 +21,10 @@ class OptionArgsUnittest(unittest.TestCase):
self.buf = StringIO.StringIO()
self.old_stdout = sys.stdout
sys.stdout = self.buf
-
+
def tearDown(self):
sys.stdout = self.old_stdout
-
+
def testSimple(self):
grit.grit_runner.Main(['-i',
util.PathFromRoot('grit/test/data/simple-input.xml'),
diff --git a/tools/grit/grit/node/base.py b/tools/grit/grit/node/base.py
index 76739c3..b35c200 100644
--- a/tools/grit/grit/node/base.py
+++ b/tools/grit/grit/node/base.py
@@ -25,7 +25,7 @@ class Node(grit.format.interface.ItemFormatter):
_CONTENT_TYPE_NONE = 0 # No CDATA content but may have children
_CONTENT_TYPE_CDATA = 1 # Only CDATA, no children.
_CONTENT_TYPE_MIXED = 2 # CDATA and children, possibly intermingled
-
+
def __init__(self):
self.children = [] # A list of child elements
self.mixed_content = [] # A list of u'' and/or child elements (this
@@ -35,12 +35,12 @@ class Node(grit.format.interface.ItemFormatter):
self.attrs = {} # The set of attributes (keys to values)
self.parent = None # Our parent unless we are the root element.
self.uberclique = None # Allows overriding uberclique for parts of tree
-
+
def __iter__(self):
'''An in-order iteration through the tree that this node is the
root of.'''
return self.inorder()
-
+
def inorder(self):
'''Generator that generates first this node, then the same generator for
any child nodes.'''
@@ -48,14 +48,14 @@ class Node(grit.format.interface.ItemFormatter):
for child in self.children:
for iterchild in child.inorder():
yield iterchild
-
+
def GetRoot(self):
'''Returns the root Node in the tree this Node belongs to.'''
curr = self
while curr.parent:
curr = curr.parent
return curr
-
+
# TODO(joi) Use this (currently untested) optimization?:
#if hasattr(self, '_root'):
# return self._root
@@ -67,10 +67,10 @@ class Node(grit.format.interface.ItemFormatter):
#else:
# self._root = curr
#return self._root
-
+
def StartParsing(self, name, parent):
'''Called at the start of parsing.
-
+
Args:
name: u'elementname'
parent: grit.node.base.Node or subclass or None
@@ -111,13 +111,13 @@ class Node(grit.format.interface.ItemFormatter):
self.mixed_content.pop(index)
break
index += 1
-
+
def AppendContent(self, content):
'''Appends a chunk of text as content of this node.
-
+
Args:
content: u'hello'
-
+
Return:
None
'''
@@ -126,15 +126,15 @@ class Node(grit.format.interface.ItemFormatter):
self.mixed_content.append(content)
elif content.strip() != '':
raise exception.UnexpectedContent()
-
+
def HandleAttribute(self, attrib, value):
'''Informs the node of an attribute that was parsed out of the GRD file
for it.
-
+
Args:
attrib: 'name'
value: 'fooblat'
-
+
Return:
None
'''
@@ -144,10 +144,10 @@ class Node(grit.format.interface.ItemFormatter):
self.attrs[attrib] = value
else:
raise exception.UnexpectedAttribute(attrib)
-
+
def EndParsing(self):
'''Called at the end of parsing.'''
-
+
# TODO(joi) Rewrite this, it's extremely ugly!
if len(self.mixed_content):
if isinstance(self.mixed_content[0], types.StringTypes):
@@ -180,15 +180,15 @@ class Node(grit.format.interface.ItemFormatter):
isinstance(self.mixed_content[-1], types.StringTypes)):
if self.mixed_content[-1].endswith("'''"):
self.mixed_content[-1] = self.mixed_content[-1][:-3]
-
+
# Check that all mandatory attributes are there.
for node_mandatt in self.MandatoryAttributes():
- mandatt_list = []
+ mandatt_list = []
if node_mandatt.find('|') >= 0:
mandatt_list = node_mandatt.split('|')
else:
mandatt_list.append(node_mandatt)
-
+
mandatt_option_found = False
for mandatt in mandatt_list:
assert mandatt not in self.DefaultAttributes().keys()
@@ -197,34 +197,34 @@ class Node(grit.format.interface.ItemFormatter):
mandatt_option_found = True
else:
raise exception.MutuallyExclusiveMandatoryAttribute(mandatt)
-
- if not mandatt_option_found:
+
+ if not mandatt_option_found:
raise exception.MissingMandatoryAttribute(mandatt)
-
+
# Add default attributes if not specified in input file.
for defattr in self.DefaultAttributes():
if not defattr in self.attrs:
self.attrs[defattr] = self.DefaultAttributes()[defattr]
-
+
def GetCdata(self):
'''Returns all CDATA of this element, concatenated into a single
string. Note that this ignores any elements embedded in CDATA.'''
return ''.join(filter(lambda c: isinstance(c, types.StringTypes),
self.mixed_content))
-
+
def __unicode__(self):
'''Returns this node and all nodes below it as an XML document in a Unicode
string.'''
header = u'<?xml version="1.0" encoding="UTF-8"?>\n'
return header + self.FormatXml()
-
+
# Compliance with ItemFormatter interface.
def Format(self, item, lang_re = None, begin_item=True):
if not begin_item:
return ''
else:
return item.FormatXml()
-
+
def FormatXml(self, indent = u'', one_line = False):
'''Returns this node and all nodes below it as an XML
element in a Unicode string. This differs from __unicode__ in that it does
@@ -233,11 +233,11 @@ class Node(grit.format.interface.ItemFormatter):
whitespace.
'''
assert isinstance(indent, types.StringTypes)
-
+
content_one_line = (one_line or
self._ContentType() == self._CONTENT_TYPE_MIXED)
inside_content = self.ContentsAsXml(indent, content_one_line)
-
+
# Then the attributes for this node.
attribs = u' '
for (attrib, value) in self.attrs.iteritems():
@@ -247,7 +247,7 @@ class Node(grit.format.interface.ItemFormatter):
attribs += u'%s=%s ' % (attrib, saxutils.quoteattr(value))
attribs = attribs.rstrip() # if no attribs, we end up with '', otherwise
# we end up with a space-prefixed string
-
+
# Finally build the XML for our node and return it
if len(inside_content) > 0:
if one_line:
@@ -264,12 +264,12 @@ class Node(grit.format.interface.ItemFormatter):
indent, self.name)
else:
return u'%s<%s%s />' % (indent, self.name, attribs)
-
+
def ContentsAsXml(self, indent, one_line):
'''Returns the contents of this node (CDATA and child elements) in XML
format. If 'one_line' is true, the content will be laid out on one line.'''
assert isinstance(indent, types.StringTypes)
-
+
# Build the contents of the element.
inside_parts = []
last_item = None
@@ -291,7 +291,7 @@ class Node(grit.format.interface.ItemFormatter):
# trailing \n
if len(inside_parts) and inside_parts[-1] == '\n':
inside_parts = inside_parts[:-1]
-
+
# If the last item is a string (not a node) and ends with whitespace,
# we need to add the ''' delimiter.
if (isinstance(last_item, types.StringTypes) and
@@ -299,13 +299,13 @@ class Node(grit.format.interface.ItemFormatter):
inside_parts[-1] = inside_parts[-1] + u"'''"
return u''.join(inside_parts)
-
+
def RunGatherers(self, recursive=0, debug=False):
'''Runs all gatherers on this object, which may add to the data stored
by the object. If 'recursive' is true, will call RunGatherers() recursively
on all child nodes first. If 'debug' is True, will print out information
as it is running each nodes' gatherers.
-
+
Gatherers for <translations> child nodes will always be run after all other
child nodes have been gathered.
'''
@@ -318,14 +318,14 @@ class Node(grit.format.interface.ItemFormatter):
child.RunGatherers(recursive=recursive, debug=debug)
for child in process_last:
child.RunGatherers(recursive=recursive, debug=debug)
-
+
def ItemFormatter(self, type):
'''Returns an instance of the item formatter for this object of the
specified type, or None if not supported.
-
+
Args:
type: 'rc-header'
-
+
Return:
(object RcHeaderItemFormatter)
'''
@@ -333,12 +333,12 @@ class Node(grit.format.interface.ItemFormatter):
return self
else:
return None
-
+
def SatisfiesOutputCondition(self):
'''Returns true if this node is either not a child of an <if> element
or if it is a child of an <if> element and the conditions for it being
output are satisfied.
-
+
Used to determine whether to return item formatters for formats that
obey conditional output of resources (e.g. the RC formatters).
'''
@@ -359,7 +359,7 @@ class Node(grit.format.interface.ItemFormatter):
subclasses unless they have only mandatory attributes.'''
return (name in self.MandatoryAttributes() or
name in self.DefaultAttributes())
-
+
def _ContentType(self):
'''Returns the type of content this element can have. Overridden by
subclasses. The content type can be one of the _CONTENT_TYPE_XXX constants
@@ -368,7 +368,7 @@ class Node(grit.format.interface.ItemFormatter):
def MandatoryAttributes(self):
'''Returns a list of attribute names that are mandatory (non-optional)
- on the current element. One can specify a list of
+ on the current element. One can specify a list of
"mutually exclusive mandatory" attributes by specifying them as one
element in the list, separated by a "|" character.
'''
@@ -378,11 +378,11 @@ class Node(grit.format.interface.ItemFormatter):
'''Returns a dictionary of attribute names that have defaults, mapped to
the default value. Overridden by subclasses.'''
return {}
-
+
def GetCliques(self):
'''Returns all MessageClique objects belonging to this node. Overridden
by subclasses.
-
+
Return:
[clique1, clique2] or []
'''
@@ -392,10 +392,10 @@ class Node(grit.format.interface.ItemFormatter):
'''Returns a real path (which can be absolute or relative to the current
working directory), given a path that is relative to the base directory
set for the GRIT input file.
-
+
Args:
path_from_basedir: '..'
-
+
Return:
'resource'
'''
@@ -426,7 +426,7 @@ class Node(grit.format.interface.ItemFormatter):
if not node.uberclique:
node.uberclique = clique.UberClique()
return node.uberclique
-
+
def IsTranslateable(self):
'''Returns false if the node has contents that should not be translated,
otherwise returns false (even if the node has no contents).
@@ -451,12 +451,12 @@ class Node(grit.format.interface.ItemFormatter):
'''
if 'name' in self.attrs:
return [self.attrs['name']]
- return None
+ return None
def EvaluateCondition(self, expr):
'''Returns true if and only if the Python expression 'expr' evaluates
to true.
-
+
The expression is given a few local variables:
- 'lang' is the language currently being output
- 'defs' is a map of C preprocessor-style define names to their values
@@ -483,10 +483,10 @@ class Node(grit.format.interface.ItemFormatter):
'os': sys.platform,
'pp_ifdef' : pp_ifdef,
'pp_if' : pp_if})
-
+
def OnlyTheseTranslations(self, languages):
'''Turns off loading of translations for languages not in the provided list.
-
+
Attrs:
languages: ['fr', 'zh_cn']
'''
@@ -495,7 +495,7 @@ class Node(grit.format.interface.ItemFormatter):
node.IsTranslation() and
node.GetLang() not in languages):
node.DisableLoading()
-
+
def PseudoIsAllowed(self):
'''Returns true if this node is allowed to use pseudo-translations. This
is true by default, unless this node is within a <release> node that has
@@ -507,7 +507,7 @@ class Node(grit.format.interface.ItemFormatter):
return (p.attrs['allow_pseudo'].lower() == 'true')
p = p.parent
return True
-
+
def ShouldFallbackToEnglish(self):
'''Returns true iff this node should fall back to English when
pseudotranslations are disabled and no translation is available for a
diff --git a/tools/grit/grit/node/base_unittest.py b/tools/grit/grit/node/base_unittest.py
index dcbc4d6..958e715 100644
--- a/tools/grit/grit/node/base_unittest.py
+++ b/tools/grit/grit/node/base_unittest.py
@@ -36,7 +36,7 @@ class NodeUnittest(unittest.TestCase):
node.AppendContent(u" ''' two spaces ")
node.EndParsing()
self.failUnless(node.GetCdata() == u' two spaces')
-
+
node = message.MessageNode()
node.StartParsing(u'message', None)
node.HandleAttribute(u'name', u'bla')
@@ -66,7 +66,7 @@ class NodeUnittest(unittest.TestCase):
node.StartParsing(u'message', None)
node.HandleAttribute(u'name', u'name')
node.AppendContent(u'Hello <young> ')
-
+
ph = message.PhNode()
ph.StartParsing(u'ph', None)
ph.HandleAttribute(u'name', u'USERNAME')
@@ -77,15 +77,15 @@ class NodeUnittest(unittest.TestCase):
ex.EndParsing()
ph.AddChild(ex)
ph.EndParsing()
-
+
node.AddChild(ph)
node.EndParsing()
-
+
non_indented_xml = node.Format(node)
self.failUnless(non_indented_xml == u'<message name="name">\n Hello '
u'&lt;young&gt; <ph name="USERNAME">$1<ex>Joi</ex></ph>'
u'\n</message>')
-
+
indented_xml = node.FormatXml(u' ')
self.failUnless(indented_xml == u' <message name="name">\n Hello '
u'&lt;young&gt; <ph name="USERNAME">$1<ex>Joi</ex></ph>'
@@ -98,7 +98,7 @@ class NodeUnittest(unittest.TestCase):
node.StartParsing(u'message', None)
node.HandleAttribute(u'name', u'name')
node.AppendContent(u"''' Hello <young> ")
-
+
ph = message.PhNode()
ph.StartParsing(u'ph', None)
ph.HandleAttribute(u'name', u'USERNAME')
@@ -109,25 +109,25 @@ class NodeUnittest(unittest.TestCase):
ex.EndParsing()
ph.AddChild(ex)
ph.EndParsing()
-
+
node.AddChild(ph)
node.AppendContent(u" yessiree '''")
node.EndParsing()
-
+
non_indented_xml = node.Format(node)
self.failUnless(non_indented_xml ==
u"<message name=\"name\">\n ''' Hello"
u' &lt;young&gt; <ph name="USERNAME">$1<ex>Joi</ex></ph>'
u" yessiree '''\n</message>")
-
+
indented_xml = node.FormatXml(u' ')
self.failUnless(indented_xml ==
u" <message name=\"name\">\n ''' Hello"
u' &lt;young&gt; <ph name="USERNAME">$1<ex>Joi</ex></ph>'
u" yessiree '''\n </message>")
-
+
self.failUnless(node.GetNodeById('name'))
-
+
def testXmlFormatContentWithEntities(self):
'''Tests a bug where &nbsp; would not be escaped correctly.'''
from grit import tclib
@@ -140,7 +140,7 @@ class NodeUnittest(unittest.TestCase):
'BINGOBONGO')
xml = msg_node.FormatXml()
self.failUnless(xml.find('&nbsp;') == -1, 'should have no entities')
-
+
def testIter(self):
# First build a little tree of message and ph nodes.
node = message.MessageNode()
@@ -156,7 +156,7 @@ class NodeUnittest(unittest.TestCase):
node.AddChild(ph)
node.AddChild(message.PhNode())
node.AppendContent(u" space before two after '''")
-
+
order = [message.MessageNode, message.PhNode, message.ExNode, message.PhNode]
for n in node:
self.failUnless(type(n) == order[0])
diff --git a/tools/grit/grit/node/custom/__init__.py b/tools/grit/grit/node/custom/__init__.py
index 0a30448..f8479b9 100644
--- a/tools/grit/grit/node/custom/__init__.py
+++ b/tools/grit/grit/node/custom/__init__.py
@@ -6,4 +6,4 @@
'''Package 'grit.node.custom'
'''
-pass \ No newline at end of file
+pass
diff --git a/tools/grit/grit/node/custom/filename.py b/tools/grit/grit/node/custom/filename.py
index 8e2eb56..d6de1d0 100644
--- a/tools/grit/grit/node/custom/filename.py
+++ b/tools/grit/grit/node/custom/filename.py
@@ -14,16 +14,16 @@ class WindowsFilename(clique.CustomType):
'''Validates that messages can be used as Windows filenames, and strips
illegal characters out of translations.
'''
-
+
BANNED = re.compile('\+|:|\/|\\\\|\*|\?|\"|\<|\>|\|')
-
+
def Validate(self, message):
return not self.BANNED.search(message.GetPresentableContent())
-
+
def ValidateAndModify(self, lang, translation):
is_ok = self.Validate(translation)
self.ModifyEachTextPart(lang, translation)
return is_ok
-
+
def ModifyTextPart(self, lang, text):
return self.BANNED.sub(' ', text)
diff --git a/tools/grit/grit/node/custom/filename_unittest.py b/tools/grit/grit/node/custom/filename_unittest.py
index f3d9b48..69ac0bd 100644
--- a/tools/grit/grit/node/custom/filename_unittest.py
+++ b/tools/grit/grit/node/custom/filename_unittest.py
@@ -18,7 +18,7 @@ from grit import tclib
class WindowsFilenameUnittest(unittest.TestCase):
-
+
def testValidate(self):
factory = clique.UberClique()
msg = tclib.Message(text='Bingo bongo')
diff --git a/tools/grit/grit/node/empty.py b/tools/grit/grit/node/empty.py
index 95c2195..516bdde 100644
--- a/tools/grit/grit/node/empty.py
+++ b/tools/grit/grit/node/empty.py
@@ -36,7 +36,7 @@ class MessagesNode(GroupingNode):
'''The <messages> element.'''
def _IsValidChild(self, child):
return isinstance(child, (message.MessageNode, misc.IfNode))
-
+
def ItemFormatter(self, t):
'''Return the stringtable itemformatter if an RC is being formatted.'''
if t in ['rc_all', 'rc_translateable', 'rc_nontranslateable']:
diff --git a/tools/grit/grit/node/include.py b/tools/grit/grit/node/include.py
index e9ea31c..2175240 100644
--- a/tools/grit/grit/node/include.py
+++ b/tools/grit/grit/node/include.py
@@ -16,7 +16,7 @@ from grit import util
class IncludeNode(base.Node):
'''An <include> element.'''
-
+
def _IsValidChild(self, child):
return False
@@ -24,8 +24,8 @@ class IncludeNode(base.Node):
return ['name', 'type', 'file']
def DefaultAttributes(self):
- return {'translateable' : 'true',
- 'generateid': 'true',
+ return {'translateable' : 'true',
+ 'generateid': 'true',
'filenameonly': 'false',
'flattenhtml': 'false',
'relativepath': 'false',
@@ -36,13 +36,13 @@ class IncludeNode(base.Node):
return grit.format.rc_header.Item()
elif (t in ['rc_all', 'rc_translateable', 'rc_nontranslateable'] and
self.SatisfiesOutputCondition()):
- return grit.format.rc.RcInclude(self.attrs['type'].upper(),
+ return grit.format.rc.RcInclude(self.attrs['type'].upper(),
self.attrs['filenameonly'] == 'true',
self.attrs['relativepath'] == 'true',
self.attrs['flattenhtml'] == 'true')
else:
return super(type(self), self).ItemFormatter(t)
-
+
def FileForLanguage(self, lang, output_dir):
'''Returns the file for the specified language. This allows us to return
different files for different language variants of the include file.
@@ -68,7 +68,7 @@ class IncludeNode(base.Node):
return id, data
# static method
- def Construct(parent, name, type, file, translateable=True,
+ def Construct(parent, name, type, file, translateable=True,
filenameonly=False, relativepath=False):
'''Creates a new node which is a child of 'parent', with attributes set
by parameters of the same name.
@@ -77,7 +77,7 @@ class IncludeNode(base.Node):
translateable = util.BoolToString(translateable)
filenameonly = util.BoolToString(filenameonly)
relativepath = util.BoolToString(relativepath)
-
+
node = IncludeNode()
node.StartParsing('include', parent)
node.HandleAttribute('name', name)
diff --git a/tools/grit/grit/node/io.py b/tools/grit/grit/node/io.py
index 3de4e7f..81d2f4c 100644
--- a/tools/grit/grit/node/io.py
+++ b/tools/grit/grit/node/io.py
@@ -18,28 +18,28 @@ from grit import xtb_reader
class FileNode(base.Node):
'''A <file> element.'''
-
+
def __init__(self):
super(type(self), self).__init__()
self.re = None
self.should_load_ = True
-
+
def IsTranslation(self):
return True
-
+
def GetLang(self):
return self.attrs['lang']
-
+
def DisableLoading(self):
self.should_load_ = False
-
+
def MandatoryAttributes(self):
return ['path', 'lang']
-
+
def RunGatherers(self, recursive=False, debug=False):
if not self.should_load_:
return
-
+
xtb_file = file(self.GetFilePath())
try:
lang = xtb_reader.Parse(xtb_file,
@@ -51,22 +51,22 @@ class FileNode(base.Node):
assert lang == self.attrs['lang'], ('The XTB file you '
'reference must contain messages in the language specified\n'
'by the \'lang\' attribute.')
-
+
def GetFilePath(self):
return self.ToRealPath(os.path.expandvars(self.attrs['path']))
class OutputNode(base.Node):
'''An <output> element.'''
-
+
def MandatoryAttributes(self):
return ['filename', 'type']
-
+
def DefaultAttributes(self):
return { 'lang' : '', # empty lang indicates all languages
'language_section' : 'neutral' # defines a language neutral section
- }
-
+ }
+
def GetType(self):
return self.attrs['type']
@@ -98,9 +98,9 @@ class EmitNode(base.ContentNode):
def ItemFormatter(self, t):
if t == 'rc_header':
- return grit.format.rc_header.EmitAppender()
+ return grit.format.rc_header.EmitAppender()
else:
- return super(type(self), self).ItemFormatter(t)
-
+ return super(type(self), self).ItemFormatter(t)
+
diff --git a/tools/grit/grit/node/io_unittest.py b/tools/grit/grit/node/io_unittest.py
index d421045..853c985 100644
--- a/tools/grit/grit/node/io_unittest.py
+++ b/tools/grit/grit/node/io_unittest.py
@@ -36,11 +36,11 @@ class FileNodeUnittest(unittest.TestCase):
file_node.HandleAttribute(u'path', ur'flugel\kugel.pdf')
translations.AddChild(file_node)
root.EndParsing()
-
+
self.failUnless(file_node.GetFilePath() ==
util.normpath(
os.path.join(ur'../resource', ur'flugel/kugel.pdf')))
-
+
def testLoadTranslations(self):
grd = grd_reader.Parse(StringIO.StringIO('''<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
diff --git a/tools/grit/grit/node/mapping.py b/tools/grit/grit/node/mapping.py
index b02673d..6e6be93 100644
--- a/tools/grit/grit/node/mapping.py
+++ b/tools/grit/grit/node/mapping.py
@@ -44,11 +44,11 @@ _ELEMENT_TO_CLASS = {
def ElementToClass(name, typeattr):
'''Maps an element to a class that handles the element.
-
+
Args:
name: 'element' (the name of the element)
typeattr: 'type' (the value of the type attribute, if present, else None)
-
+
Return:
type
'''
diff --git a/tools/grit/grit/node/message.py b/tools/grit/grit/node/message.py
index 7086538..a6346b1 100644
--- a/tools/grit/grit/node/message.py
+++ b/tools/grit/grit/node/message.py
@@ -27,23 +27,23 @@ _WHITESPACE = re.compile('(?P<start>\s*)(?P<body>.+?)(?P<end>\s*)\Z',
class MessageNode(base.ContentNode):
'''A <message> element.'''
-
+
# For splitting a list of things that can be separated by commas or
# whitespace
_SPLIT_RE = re.compile('\s*,\s*|\s+')
-
+
def __init__(self):
super(type(self), self).__init__()
# Valid after EndParsing, this is the MessageClique that contains the
# source message and any translations of it that have been loaded.
self.clique = None
-
+
# We don't send leading and trailing whitespace into the translation
# console, but rather tack it onto the source message and any
# translations when formatting them into RC files or what have you.
self.ws_at_start = '' # Any whitespace characters at the start of the text
self.ws_at_end = '' # --"-- at the end of the text
-
+
# A list of "shortcut groups" this message is in. We check to make sure
# that shortcut keys (e.g. &J) within each shortcut group are unique.
self.shortcut_groups_ = []
@@ -59,10 +59,10 @@ class MessageNode(base.ContentNode):
if name == 'translateable' and value not in ['true', 'false']:
return False
return True
-
+
def MandatoryAttributes(self):
return ['name|offset']
-
+
def DefaultAttributes(self):
return {
'translateable' : 'true',
@@ -89,12 +89,12 @@ class MessageNode(base.ContentNode):
while grouping_parent and not isinstance(grouping_parent,
grit.node.empty.GroupingNode):
grouping_parent = grouping_parent.parent
-
+
assert 'first_id' in grouping_parent.attrs
return [grouping_parent.attrs['first_id'] + '_' + self.attrs['offset']]
else:
return super(type(self), self).GetTextualIds()
-
+
def IsTranslateable(self):
return self.attrs['translateable'] == 'true'
@@ -109,11 +109,11 @@ class MessageNode(base.ContentNode):
def EndParsing(self):
super(type(self), self).EndParsing()
-
+
# Make the text (including placeholder references) and list of placeholders,
# then strip and store leading and trailing whitespace and create the
# tclib.Message() and a clique to contain it.
-
+
text = ''
placeholders = []
for item in self.mixed_content:
@@ -127,16 +127,16 @@ class MessageNode(base.ContentNode):
ex = item.children[0].GetCdata()
original = item.GetCdata()
placeholders.append(tclib.Placeholder(presentation, original, ex))
-
+
m = _WHITESPACE.match(text)
if m:
self.ws_at_start = m.group('start')
self.ws_at_end = m.group('end')
text = m.group('body')
-
+
self.shortcut_groups_ = self._SPLIT_RE.split(self.attrs['shortcut_groups'])
self.shortcut_groups_ = [i for i in self.shortcut_groups_ if i != '']
-
+
description_or_id = self.attrs['desc']
if description_or_id == '' and 'name' in self.attrs:
description_or_id = 'ID: %s' % self.attrs['name']
@@ -157,13 +157,13 @@ class MessageNode(base.ContentNode):
elif self.attrs['validation_expr'] != '':
self.clique.SetCustomType(
clique.OneOffCustomType(self.attrs['validation_expr']))
-
+
def GetCliques(self):
if self.clique:
return [self.clique]
else:
return []
-
+
def Translate(self, lang):
'''Returns a translated version of this message.
'''
@@ -173,7 +173,7 @@ class MessageNode(base.ContentNode):
self.ShouldFallbackToEnglish()
).GetRealContent()
return msg.replace('[GRITLANGCODE]', lang)
-
+
def NameOrOffset(self):
if 'name' in self.attrs:
return self.attrs['name']
@@ -205,49 +205,49 @@ class MessageNode(base.ContentNode):
translateable = 'true'
else:
translateable = 'false'
-
+
node = MessageNode()
node.StartParsing('message', parent)
node.HandleAttribute('name', name)
node.HandleAttribute('desc', desc)
node.HandleAttribute('meaning', meaning)
node.HandleAttribute('translateable', translateable)
-
+
items = message.GetContent()
for ix in range(len(items)):
if isinstance(items[ix], types.StringTypes):
text = items[ix]
-
+
# Ensure whitespace at front and back of message is correctly handled.
if ix == 0:
text = "'''" + text
if ix == len(items) - 1:
text = text + "'''"
-
+
node.AppendContent(text)
else:
phnode = PhNode()
phnode.StartParsing('ph', node)
phnode.HandleAttribute('name', items[ix].GetPresentation())
phnode.AppendContent(items[ix].GetOriginal())
-
+
if len(items[ix].GetExample()) and items[ix].GetExample() != ' ':
exnode = ExNode()
exnode.StartParsing('ex', phnode)
exnode.AppendContent(items[ix].GetExample())
exnode.EndParsing()
phnode.AddChild(exnode)
-
+
phnode.EndParsing()
node.AddChild(phnode)
-
+
node.EndParsing()
return node
Construct = staticmethod(Construct)
class PhNode(base.ContentNode):
'''A <ph> element.'''
-
+
def _IsValidChild(self, child):
return isinstance(child, ExNode)
diff --git a/tools/grit/grit/node/message_unittest.py b/tools/grit/grit/node/message_unittest.py
index 5722927..4255dcb 100644
--- a/tools/grit/grit/node/message_unittest.py
+++ b/tools/grit/grit/node/message_unittest.py
@@ -28,7 +28,7 @@ class MessageUnittest(unittest.TestCase):
cliques = res.GetCliques()
content = cliques[0].GetMessage().GetPresentableContent()
self.failUnless(content == 'Hello USERNAME, how are you doing today?')
-
+
def testMessageWithWhitespace(self):
buf = StringIO.StringIO('<message name="IDS_BLA" desc="">'
'\'\'\' Hello there <ph name="USERNAME">%s</ph> \'\'\''
@@ -50,7 +50,7 @@ class MessageUnittest(unittest.TestCase):
self.failUnless(msg_node.children[1].children[0].GetCdata() == '11')
self.failUnless(msg_node.ws_at_start == ' ')
self.failUnless(msg_node.ws_at_end == '\t\t')
-
+
def testUnicodeConstruct(self):
text = u'Howdie \u00fe'
msg = tclib.Message(text=text)
diff --git a/tools/grit/grit/node/misc.py b/tools/grit/grit/node/misc.py
index 27f8b66..d3441f2 100644
--- a/tools/grit/grit/node/misc.py
+++ b/tools/grit/grit/node/misc.py
@@ -22,7 +22,7 @@ import grit.format.rc_header
class IfNode(base.Node):
'''A node for conditional inclusion of resources.
'''
-
+
def _IsValidChild(self, child):
from grit.node import empty
assert self.parent, '<if> node should never be root.'
@@ -37,10 +37,10 @@ class IfNode(base.Node):
return isinstance(child, structure.StructureNode)
else:
return False
-
+
def MandatoryAttributes(self):
return ['expr']
-
+
def IsConditionSatisfied(self):
'''Returns true if and only if the Python expression stored in attribute
'expr' evaluates to true.
@@ -55,7 +55,7 @@ class ReleaseNode(base.Node):
from grit.node import empty
return isinstance(child, (empty.IncludesNode, empty.MessagesNode,
empty.StructuresNode, empty.IdentifiersNode))
-
+
def _IsValidAttribute(self, name, value):
return (
(name == 'seq' and int(value) <= self.GetRoot().GetCurrentRelease()) or
@@ -64,10 +64,10 @@ class ReleaseNode(base.Node):
def MandatoryAttributes(self):
return ['seq']
-
+
def DefaultAttributes(self):
return { 'allow_pseudo' : 'true' }
-
+
def GetReleaseNumber():
'''Returns the sequence number of this release.'''
return self.attribs['seq']
@@ -81,17 +81,17 @@ class ReleaseNode(base.Node):
class GritNode(base.Node):
'''The <grit> root element.'''
-
+
def __init__(self):
base.Node.__init__(self)
self.output_language = ''
self.defines = {}
-
+
def _IsValidChild(self, child):
from grit.node import empty
return isinstance(child, (ReleaseNode, empty.TranslationsNode,
empty.OutputsNode))
-
+
def _IsValidAttribute(self, name, value):
if name not in ['base_dir', 'source_lang_id',
'latest_public_release', 'current_release',
@@ -101,10 +101,10 @@ class GritNode(base.Node):
'0123456789') != '':
return False
return True
-
+
def MandatoryAttributes(self):
return ['latest_public_release', 'current_release']
-
+
def DefaultAttributes(self):
return {
'base_dir' : '.',
@@ -119,9 +119,9 @@ class GritNode(base.Node):
> int(self.attrs['current_release'])):
raise exception.Parsing('latest_public_release cannot have a greater '
'value than current_release')
-
+
self.ValidateUniqueIds()
-
+
# Add the encoding check if it's not present (should ensure that it's always
# present in all .grd files generated by GRIT). If it's present, assert if
# it's not correct.
@@ -130,7 +130,7 @@ class GritNode(base.Node):
else:
assert self.attrs['enc_check'] == constants.ENCODING_CHECK, (
'Are you sure your .grd file is in the correct encoding (UTF-8)?')
-
+
def ValidateUniqueIds(self):
'''Validate that 'name' attribute is unique in all nodes in this tree
except for nodes that are children of <if> nodes.
@@ -140,55 +140,55 @@ class GritNode(base.Node):
for node in self:
if isinstance(node, message.PhNode):
continue # PhNode objects have a 'name' attribute which is not an ID
-
+
node_ids = node.GetTextualIds()
if node_ids:
for node_id in node_ids:
if util.SYSTEM_IDENTIFIERS.match(node_id):
continue # predefined IDs are sometimes used more than once
-
+
# Don't complain about duplicate IDs if they occur in a node that is
# inside an <if> node.
if (node_id in unique_names and node_id not in duplicate_names and
(not node.parent or not isinstance(node.parent, IfNode))):
duplicate_names.append(node_id)
unique_names[node_id] = 1
-
+
if len(duplicate_names):
raise exception.DuplicateKey(', '.join(duplicate_names))
-
+
def GetCurrentRelease(self):
'''Returns the current release number.'''
return int(self.attrs['current_release'])
-
+
def GetLatestPublicRelease(self):
'''Returns the latest public release number.'''
return int(self.attrs['latest_public_release'])
-
+
def GetSourceLanguage(self):
'''Returns the language code of the source language.'''
return self.attrs['source_lang_id']
-
+
def GetTcProject(self):
'''Returns the name of this project in the TranslationConsole, or
'NEED_TO_SET_tc_project_ATTRIBUTE' if it is not defined.'''
return self.attrs['tc_project']
-
+
def SetOwnDir(self, dir):
'''Informs the 'grit' element of the directory the file it is in resides.
This allows it to calculate relative paths from the input file, which is
what we desire (rather than from the current path).
-
+
Args:
dir: r'c:\bla'
-
+
Return:
None
'''
assert dir
self.base_dir = os.path.normpath(os.path.join(dir, self.attrs['base_dir']))
-
+
def GetBaseDir(self):
'''Returns the base directory, relative to the working directory. To get
the base directory as set in the .grd file, use GetOriginalBaseDir()
@@ -197,12 +197,12 @@ class GritNode(base.Node):
return self.base_dir
else:
return self.GetOriginalBaseDir()
-
+
def GetOriginalBaseDir(self):
'''Returns the base directory, as set in the .grd file.
'''
return self.attrs['base_dir']
-
+
def GetOutputFiles(self):
'''Returns the list of <file> nodes that are children of this node's
<outputs> child.'''
@@ -231,10 +231,10 @@ class IdentifierNode(base.Node):
header file, and be unique amongst all other resource identifiers, but don't
have any other attributes or reference any resources.
'''
-
+
def MandatoryAttributes(self):
return ['name']
-
+
def DefaultAttributes(self):
return { 'comment' : '', 'id' : '' }
@@ -247,8 +247,8 @@ class IdentifierNode(base.Node):
'''
if 'id' in self.attrs:
return self.attrs['id']
- return None
-
+ return None
+
# static method
def Construct(parent, name, id, comment):
'''Creates a new node which is a child of 'parent', with attributes set
diff --git a/tools/grit/grit/node/misc_unittest.py b/tools/grit/grit/node/misc_unittest.py
index b7e2c2e..b7ee4de 100644
--- a/tools/grit/grit/node/misc_unittest.py
+++ b/tools/grit/grit/node/misc_unittest.py
@@ -54,7 +54,7 @@ class IfNodeUnittest(unittest.TestCase):
</messages>
</release>
</grit>'''), dir='.')
-
+
messages_node = grd.children[0].children[0]
bingo_message = messages_node.children[0].children[0]
hello_message = messages_node.children[1].children[0]
@@ -62,18 +62,18 @@ class IfNodeUnittest(unittest.TestCase):
assert bingo_message.name == 'message'
assert hello_message.name == 'message'
assert french_message.name == 'message'
-
+
grd.SetOutputContext('fr', {'hello' : '1'})
self.failUnless(not bingo_message.SatisfiesOutputCondition())
self.failUnless(hello_message.SatisfiesOutputCondition())
self.failUnless(french_message.SatisfiesOutputCondition())
-
+
grd.SetOutputContext('en', {'bingo' : 1})
self.failUnless(bingo_message.SatisfiesOutputCondition())
self.failUnless(not hello_message.SatisfiesOutputCondition())
self.failUnless(not french_message.SatisfiesOutputCondition())
-
- grd.SetOutputContext('en', {'FORCE_FRENCH' : '1', 'bingo' : '1'})
+
+ grd.SetOutputContext('en', {'FORCE_FRENCH' : '1', 'bingo' : '1'})
self.failUnless(bingo_message.SatisfiesOutputCondition())
self.failUnless(not hello_message.SatisfiesOutputCondition())
self.failUnless(french_message.SatisfiesOutputCondition())
@@ -105,18 +105,18 @@ class ReleaseNodeUnittest(unittest.TestCase):
</release>
</grit>'''), util.PathFromRoot('grit/test/data'))
grd.RunGatherers(recursive=True)
-
+
hello = grd.GetNodeById('IDS_HELLO')
aboutbox = grd.GetNodeById('IDD_ABOUTBOX')
bingo = grd.GetNodeById('IDS_BINGO')
menu = grd.GetNodeById('IDC_KLONKMENU')
-
+
for node in [hello, aboutbox]:
self.failUnless(not node.PseudoIsAllowed())
-
+
for node in [bingo, menu]:
self.failUnless(node.PseudoIsAllowed())
-
+
for node in [hello, aboutbox]:
try:
formatter = node.ItemFormatter('rc_all')
@@ -124,7 +124,7 @@ class ReleaseNodeUnittest(unittest.TestCase):
self.fail('Should have failed during Format since pseudo is not allowed')
except:
pass # expected case
-
+
for node in [bingo, menu]:
try:
formatter = node.ItemFormatter('rc_all')
diff --git a/tools/grit/grit/node/structure.py b/tools/grit/grit/node/structure.py
index 30cfb6d..7058cd3 100644
--- a/tools/grit/grit/node/structure.py
+++ b/tools/grit/grit/node/structure.py
@@ -26,7 +26,7 @@ import grit.format.rc_header
# RTL languages
# TODO(jennyz): remove this fixed set of RTL language array
-# when generic expand_variable code is added by grit team.
+# when generic expand_variable code is added by grit team.
_RTL_LANGS = [
'ar',
'iw',
@@ -68,12 +68,12 @@ _RC_FORMATTERS = {
class StructureNode(base.Node):
'''A <structure> element.'''
-
+
def __init__(self):
base.Node.__init__(self)
self.gatherer = None
self.skeletons = {} # expressions to skeleton gatherers
-
+
def _IsValidChild(self, child):
return isinstance(child, variant.SkeletonNode)
@@ -95,10 +95,10 @@ class StructureNode(base.Node):
# dependencies.
'sconsdep' : 'false',
}
-
+
def IsExcludedFromRc(self):
return self.attrs['exclude_from_rc'] == 'true'
-
+
def GetLineEnd(self):
'''Returns the end-of-line character or characters for files output because
of this node ('\r\n', '\n', or '\r' depending on the 'line_end' attribute).
@@ -112,13 +112,13 @@ class StructureNode(base.Node):
else:
raise exception.UnexpectedAttribute(
"Attribute 'line_end' must be one of 'linux' (default), 'windows' or 'mac'")
-
+
def GetCliques(self):
if self.gatherer:
return self.gatherer.GetCliques()
else:
return []
-
+
def GetTextualIds(self):
if self.gatherer and self.attrs['type'] not in ['tr_html', 'admin_template', 'txt']:
return self.gatherer.GetTextualIds()
@@ -137,18 +137,18 @@ class StructureNode(base.Node):
def RunGatherers(self, recursive=False, debug=False):
if self.gatherer:
return # idempotent
-
+
gathertype = _GATHERERS[self.attrs['type']]
if debug:
print 'Running gatherer %s for file %s' % (str(gathertype), self.FilenameToOpen())
-
+
self.gatherer = gathertype.FromFile(self.FilenameToOpen(),
self.attrs['name'],
self.attrs['encoding'])
self.gatherer.SetUberClique(self.UberClique())
self.gatherer.Parse()
-
+
for child in self.children:
assert isinstance(child, variant.SkeletonNode)
skel = gathertype.FromFile(child.FilenameToOpen(),
@@ -158,7 +158,7 @@ class StructureNode(base.Node):
skel.SetSkeleton(True)
skel.Parse()
self.skeletons[child.attrs['expr']] = skel
-
+
def GetSkeletonGatherer(self):
'''Returns the gatherer for the alternate skeleton that should be used,
based on the expressions for selecting skeletons, or None if the skeleton
@@ -168,25 +168,25 @@ class StructureNode(base.Node):
if self.EvaluateCondition(expr):
return self.skeletons[expr]
return None
-
+
def GetFilePath(self):
return self.ToRealPath(self.attrs['file'])
-
+
def HasFileForLanguage(self):
return self.attrs['type'] in ['tr_html', 'admin_template', 'txt', 'muppet']
-
+
def FileForLanguage(self, lang, output_dir, create_file=True,
return_if_not_generated=True):
'''Returns the filename of the file associated with this structure,
for the specified language.
-
+
Args:
lang: 'fr'
output_dir: 'c:\temp'
create_file: True
'''
assert self.HasFileForLanguage()
- if (lang == self.GetRoot().GetSourceLanguage() and
+ if (lang == self.GetRoot().GetSourceLanguage() and
self.attrs['expand_variables'] != 'true'):
if return_if_not_generated:
return self.GetFilePath()
@@ -200,14 +200,14 @@ class StructureNode(base.Node):
assert len(filename)
filename = '%s_%s' % (lang, filename)
filename = os.path.join(output_dir, filename)
-
+
if create_file:
text = self.gatherer.Translate(
lang,
pseudo_if_not_available=self.PseudoIsAllowed(),
fallback_to_english=self.ShouldFallbackToEnglish(),
skeleton_gatherer=self.GetSkeletonGatherer())
-
+
file_object = util.WrapOutputStream(file(filename, 'wb'),
self._GetOutputEncoding())
file_contents = util.FixLineEnd(text, self.GetLineEnd())
@@ -224,9 +224,9 @@ class StructureNode(base.Node):
file_object.write(constants.BOM)
file_object.write(file_contents)
file_object.close()
-
+
return filename
-
+
def _GetOutputEncoding(self):
'''Python doesn't natively support UTF encodings with a BOM signature,
so we add support by allowing you to append '-sig' to the encoding name.
@@ -237,12 +237,12 @@ class StructureNode(base.Node):
return enc[0:len(enc) - len('-sig')]
else:
return enc
-
+
def _ShouldAddBom(self):
'''Returns true if output files should have the Unicode BOM prepended.
'''
return self.attrs['output_encoding'].endswith('-sig')
-
+
# static method
def Construct(parent, name, type, file, encoding='cp1252'):
'''Creates a new node which is a child of 'parent', with attributes set
diff --git a/tools/grit/grit/node/structure_unittest.py b/tools/grit/grit/node/structure_unittest.py
index a2ce9c2..0bb9757 100644
--- a/tools/grit/grit/node/structure_unittest.py
+++ b/tools/grit/grit/node/structure_unittest.py
@@ -34,15 +34,15 @@ class StructureUnittest(unittest.TestCase):
</grit>'''), dir=util.PathFromRoot('grit\\test\\data'))
grd.RunGatherers(recursive=True)
grd.output_language = 'fr'
-
+
node = grd.GetNodeById('IDD_ABOUTBOX')
formatter = node.ItemFormatter('rc_all')
self.failUnless(formatter)
transl = formatter.Format(node, 'fr')
-
+
self.failUnless(transl.count('040704') and transl.count('110978'))
self.failUnless(transl.count('2005",IDC_STATIC'))
-
+
def testOutputEncoding(self):
grd = grd_reader.Parse(StringIO.StringIO(
'''<?xml version="1.0" encoding="UTF-8"?>
diff --git a/tools/grit/grit/node/variant.py b/tools/grit/grit/node/variant.py
index d18b815..0249d17 100644
--- a/tools/grit/grit/node/variant.py
+++ b/tools/grit/grit/node/variant.py
@@ -12,13 +12,13 @@ from grit.node import base
class SkeletonNode(base.Node):
'''A <skeleton> element.'''
-
+
# TODO(joi) Support inline skeleton variants as CDATA instead of requiring
# a 'file' attribute.
-
+
def MandatoryAttributes(self):
return ['expr', 'variant_of_revision', 'file']
-
+
def DefaultAttributes(self):
'''If not specified, 'encoding' will actually default to the parent node's
encoding.
@@ -30,7 +30,7 @@ class SkeletonNode(base.Node):
return self._CONTENT_TYPE_NONE
else:
return self._CONTENT_TYPE_CDATA
-
+
def GetEncodingToUse(self):
if self.attrs['encoding'] == '':
return self.parent.attrs['encoding']
diff --git a/tools/grit/grit/pseudo.py b/tools/grit/grit/pseudo.py
index a6dc859..4c3db07 100644
--- a/tools/grit/grit/pseudo.py
+++ b/tools/grit/grit/pseudo.py
@@ -86,7 +86,7 @@ def PseudoString(str):
P-language.'''
if str in _existing_translations:
return _existing_translations[str]
-
+
outstr = u''
ix = 0
while ix < len(str):
@@ -104,27 +104,27 @@ def PseudoString(str):
outstr += changed_vowels
outstr += _QOF
outstr += changed_vowels
-
+
_existing_translations[str] = outstr
return outstr
def PseudoMessage(message):
'''Returns a pseudotranslation of the provided message.
-
+
Args:
message: tclib.Message()
-
+
Return:
tclib.Translation()
'''
transl = tclib.Translation()
-
+
for part in message.GetContent():
if isinstance(part, tclib.Placeholder):
transl.AppendPlaceholder(part)
else:
transl.AppendText(PseudoString(part))
-
+
return transl
diff --git a/tools/grit/grit/pseudo_unittest.py b/tools/grit/grit/pseudo_unittest.py
index 97d4538..6191b20 100644
--- a/tools/grit/grit/pseudo_unittest.py
+++ b/tools/grit/grit/pseudo_unittest.py
@@ -22,16 +22,16 @@ class PseudoUnittest(unittest.TestCase):
u'\u00e5b\u00e9b\u00efb\u00f4b\u00fcb\u00fd')
self.failUnless(pseudo.MapVowels('ABEBIBOBUBY') ==
u'\u00c5B\u00c9B\u00cfB\u00d4B\u00dcB\u00dd')
-
+
def testPseudoString(self):
out = pseudo.PseudoString('hello')
self.failUnless(out == pseudo.MapVowels(u'hePelloPo', True))
-
+
def testConsecutiveVowels(self):
out = pseudo.PseudoString("beautiful weather, ain't it?")
self.failUnless(out == pseudo.MapVowels(
u"beauPeautiPifuPul weaPeathePer, aiPain't iPit?", 1))
-
+
def testCapitals(self):
out = pseudo.PseudoString("HOWDIE DOODIE, DR. JONES")
self.failUnless(out == pseudo.MapVowels(
diff --git a/tools/grit/grit/shortcuts.py b/tools/grit/grit/shortcuts.py
index de18e09..c1f7fb1 100644
--- a/tools/grit/grit/shortcuts.py
+++ b/tools/grit/grit/shortcuts.py
@@ -26,7 +26,7 @@ class ShortcutGroup(object):
self.keys_by_lang = {}
# List of cliques in this group
self.cliques = []
-
+
def AddClique(self, c):
for existing_clique in self.cliques:
if existing_clique.GetId() == c.GetId():
@@ -34,13 +34,13 @@ class ShortcutGroup(object):
# <if expr1><structure 1></if> <if expr2><structure 2></if>
# where only one will really be included in the output.
return
-
+
self.cliques.append(c)
for (lang, msg) in c.clique.items():
if lang not in self.keys_by_lang:
self.keys_by_lang[lang] = {}
keymap = self.keys_by_lang[lang]
-
+
content = msg.GetRealContent()
keys = [groups[1] for groups in self.SHORTCUT_RE.findall(content)]
for key in keys:
@@ -49,7 +49,7 @@ class ShortcutGroup(object):
keymap[key] += 1
else:
keymap[key] = 1
-
+
def GenerateWarnings(self, tc_project):
# For any language that has more than one occurrence of any shortcut,
# make a list of the conflicting shortcuts.
@@ -60,7 +60,7 @@ class ShortcutGroup(object):
if lang not in problem_langs:
problem_langs[lang] = []
problem_langs[lang].append(key)
-
+
warnings = []
if len(problem_langs):
warnings.append("WARNING - duplicate keys exist in shortcut group %s" %
@@ -74,11 +74,11 @@ def GenerateDuplicateShortcutsWarnings(uberclique, tc_project):
'''Given an UberClique and a project name, will print out helpful warnings
if there are conflicting shortcuts within shortcut groups in the provided
UberClique.
-
+
Args:
uberclique: clique.UberClique()
tc_project: 'MyProjectNameInTheTranslationConsole'
-
+
Returns:
['warning line 1', 'warning line 2', ...]
'''
@@ -90,6 +90,6 @@ def GenerateDuplicateShortcutsWarnings(uberclique, tc_project):
groups[group] = ShortcutGroup(group)
groups[group].AddClique(c)
for group in groups.values():
- warnings += group.GenerateWarnings(tc_project)
+ warnings += group.GenerateWarnings(tc_project)
return warnings
diff --git a/tools/grit/grit/shortcuts_unittests.py b/tools/grit/grit/shortcuts_unittests.py
index 10c42eb..9517346 100644
--- a/tools/grit/grit/shortcuts_unittests.py
+++ b/tools/grit/grit/shortcuts_unittests.py
@@ -19,28 +19,28 @@ from grit import tclib
from grit.gather import rc
class ShortcutsUnittest(unittest.TestCase):
-
+
def setUp(self):
self.uq = clique.UberClique()
-
+
def testFunctionality(self):
c = self.uq.MakeClique(tclib.Message(text="Hello &there"))
c.AddToShortcutGroup('group_name')
c = self.uq.MakeClique(tclib.Message(text="Howdie &there partner"))
c.AddToShortcutGroup('group_name')
-
+
warnings = shortcuts.GenerateDuplicateShortcutsWarnings(self.uq, 'PROJECT')
self.failUnless(warnings)
-
+
def testAmpersandEscaping(self):
c = self.uq.MakeClique(tclib.Message(text="Hello &there"))
c.AddToShortcutGroup('group_name')
c = self.uq.MakeClique(tclib.Message(text="S&&T are the &letters S and T"))
c.AddToShortcutGroup('group_name')
-
+
warnings = shortcuts.GenerateDuplicateShortcutsWarnings(self.uq, 'PROJECT')
self.failUnless(len(warnings) == 0)
-
+
def testDialog(self):
dlg = rc.Dialog('''\
IDD_SIDEBAR_RSS_PANEL_PROPPAGE DIALOGEX 0, 0, 239, 221
@@ -52,14 +52,14 @@ BEGIN
PUSHBUTTON "&Remove",IDC_SIDEBAR_RSS_REMOVE,183,200,56,14
PUSHBUTTON "&Edit",IDC_SIDEBAR_RSS_EDIT,123,200,56,14
CONTROL "&Automatically add commonly viewed clips",
- IDC_SIDEBAR_RSS_AUTO_ADD,"Button",BS_AUTOCHECKBOX |
+ IDC_SIDEBAR_RSS_AUTO_ADD,"Button",BS_AUTOCHECKBOX |
BS_MULTILINE | WS_TABSTOP,0,200,120,17
PUSHBUTTON "",IDC_SIDEBAR_RSS_HIDDEN,179,208,6,6,NOT WS_VISIBLE
LTEXT "You can display clips from blogs, news sites, and other online sources.",
IDC_STATIC,0,0,239,10
- LISTBOX IDC_SIDEBAR_DISPLAYED_FEED_LIST,0,69,239,127,LBS_SORT |
- LBS_OWNERDRAWFIXED | LBS_HASSTRINGS |
- LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL |
+ LISTBOX IDC_SIDEBAR_DISPLAYED_FEED_LIST,0,69,239,127,LBS_SORT |
+ LBS_OWNERDRAWFIXED | LBS_HASSTRINGS |
+ LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL |
WS_TABSTOP
LTEXT "Add a clip from a recently viewed website by clicking Add Recent Clips.",
IDC_STATIC,0,13,141,19
@@ -70,7 +70,7 @@ BEGIN
END''')
dlg.SetUberClique(self.uq)
dlg.Parse()
-
+
warnings = shortcuts.GenerateDuplicateShortcutsWarnings(self.uq, 'PROJECT')
self.failUnless(len(warnings) == 0)
diff --git a/tools/grit/grit/tclib.py b/tools/grit/grit/tclib.py
index bfacb94..388c4b9 100644
--- a/tools/grit/grit/tclib.py
+++ b/tools/grit/grit/tclib.py
@@ -20,7 +20,7 @@ def Identity(i):
class BaseMessage(object):
'''Base class with methods shared by Message and Translation.
'''
-
+
def __init__(self, text='', placeholders=[], description='', meaning=''):
self.parts = []
self.placeholders = []
@@ -28,7 +28,7 @@ class BaseMessage(object):
self.meaning = meaning
self.dirty = True # True if self.id is (or might be) wrong
self.id = 0
-
+
if text != '':
if not placeholders or placeholders == []:
self.AppendText(text)
@@ -48,11 +48,11 @@ class BaseMessage(object):
self.AppendText(chunk)
for key in tag_map.keys():
assert tag_map[key][1] != 0
-
+
def GetRealContent(self, escaping_function=Identity):
'''Returns the original content, i.e. what your application and users
will see.
-
+
Specify a function to escape each translateable bit, if you like.
'''
bits = []
@@ -62,7 +62,7 @@ class BaseMessage(object):
else:
bits.append(item.GetOriginal())
return ''.join(bits)
-
+
def GetPresentableContent(self):
presentable_content = []
for part in self.parts:
@@ -71,7 +71,7 @@ class BaseMessage(object):
else:
presentable_content.append(part)
return ''.join(presentable_content)
-
+
def AppendPlaceholder(self, placeholder):
assert isinstance(placeholder, Placeholder)
dup = False
@@ -79,19 +79,19 @@ class BaseMessage(object):
if other.presentation == placeholder.presentation:
assert other.original == placeholder.original
dup = True
-
+
if not dup:
self.placeholders.append(placeholder)
self.parts.append(placeholder)
self.dirty = True
-
+
def AppendText(self, text):
assert isinstance(text, types.StringTypes)
assert text != ''
-
+
self.parts.append(text)
self.dirty = True
-
+
def GetContent(self):
'''Returns the parts of the message. You may modify parts if you wish.
Note that you must not call GetId() on this object until you have finished
@@ -99,34 +99,34 @@ class BaseMessage(object):
'''
self.dirty = True # user might modify content
return self.parts
-
+
def GetDescription(self):
return self.description
-
+
def SetDescription(self, description):
self.description = description
-
+
def GetMeaning(self):
return self.meaning
-
+
def GetId(self):
if self.dirty:
self.id = self.GenerateId()
self.dirty = False
return self.id
-
+
def GenerateId(self):
# Must use a UTF-8 encoded version of the presentable content, along with
# the meaning attribute, to match the TC.
return grit.extern.tclib.GenerateMessageId(
self.GetPresentableContent().encode('utf-8'), self.meaning)
-
+
def GetPlaceholders(self):
return self.placeholders
-
+
def FillTclibBaseMessage(self, msg):
msg.SetDescription(self.description.encode('utf-8'))
-
+
for part in self.parts:
if isinstance(part, Placeholder):
ph = grit.extern.tclib.Placeholder(
@@ -139,13 +139,13 @@ class BaseMessage(object):
class Message(BaseMessage):
- '''A message.'''
-
+ '''A message.'''
+
def __init__(self, text='', placeholders=[], description='', meaning='',
assigned_id=None):
BaseMessage.__init__(self, text, placeholders, description, meaning)
self.assigned_id = assigned_id
-
+
def ToTclibMessage(self):
msg = grit.extern.tclib.Message('utf-8', meaning=self.meaning)
self.FillTclibBaseMessage(msg)
@@ -161,18 +161,18 @@ class Message(BaseMessage):
class Translation(BaseMessage):
'''A translation.'''
-
+
def __init__(self, text='', id='', placeholders=[], description='', meaning=''):
BaseMessage.__init__(self, text, placeholders, description, meaning)
self.id = id
-
+
def GetId(self):
assert id != '', "ID has not been set."
return self.id
-
+
def SetId(self, id):
self.id = id
-
+
def ToTclibMessage(self):
msg = grit.extern.tclib.Message(
'utf-8', id=self.id, meaning=self.meaning)
@@ -183,13 +183,13 @@ class Translation(BaseMessage):
class Placeholder(grit.extern.tclib.Placeholder):
'''Modifies constructor to accept a Unicode string
'''
-
+
# Must match placeholder presentation names
_NAME_RE = re.compile('[A-Za-z0-9_]+')
-
+
def __init__(self, presentation, original, example):
'''Creates a new placeholder.
-
+
Args:
presentation: 'USERNAME'
original: '%s'
@@ -203,13 +203,13 @@ class Placeholder(grit.extern.tclib.Placeholder):
self.presentation = presentation
self.original = original
self.example = example
-
+
def GetPresentation(self):
return self.presentation
-
+
def GetOriginal(self):
return self.original
-
+
def GetExample(self):
return self.example
diff --git a/tools/grit/grit/tclib_unittest.py b/tools/grit/grit/tclib_unittest.py
index 352d917..0d20f1a 100644
--- a/tools/grit/grit/tclib_unittest.py
+++ b/tools/grit/grit/tclib_unittest.py
@@ -24,19 +24,19 @@ class TclibUnittest(unittest.TestCase):
msg = tclib.Message(text=u'Hello Earthlings')
self.failUnless(msg.GetPresentableContent() == 'Hello Earthlings')
self.failUnless(isinstance(msg.GetPresentableContent(), types.StringTypes))
-
+
def testGetAttr(self):
msg = tclib.Message()
msg.AppendText(u'Hello') # Tests __getattr__
self.failUnless(msg.GetPresentableContent() == 'Hello')
self.failUnless(isinstance(msg.GetPresentableContent(), types.StringTypes))
-
+
def testAll(self):
text = u'Howdie USERNAME'
phs = [tclib.Placeholder(u'USERNAME', u'%s', 'Joi')]
msg = tclib.Message(text=text, placeholders=phs)
self.failUnless(msg.GetPresentableContent() == 'Howdie USERNAME')
-
+
trans = tclib.Translation(text=text, placeholders=phs)
self.failUnless(trans.GetPresentableContent() == 'Howdie USERNAME')
self.failUnless(isinstance(trans.GetPresentableContent(), types.StringTypes))
@@ -47,7 +47,7 @@ class TclibUnittest(unittest.TestCase):
self.failUnless(msg.GetPresentableContent() == text)
from_list = msg.GetContent()[0]
self.failUnless(from_list == text)
-
+
def testRegressionTranslationInherited(self):
'''Regression tests a bug that was caused by grit.tclib.Translation
inheriting from the translation console's Translation object
@@ -62,7 +62,7 @@ class TclibUnittest(unittest.TestCase):
placeholders=msg.GetPlaceholders())
content = transl.GetContent()
self.failUnless(isinstance(content[3], types.UnicodeType))
-
+
def testFingerprint(self):
# This has Windows line endings. That is on purpose.
id = grit.extern.tclib.GenerateMessageId(
diff --git a/tools/grit/grit/test_suite_all.py b/tools/grit/grit/test_suite_all.py
index a94b160..83add26 100644
--- a/tools/grit/grit/test_suite_all.py
+++ b/tools/grit/grit/test_suite_all.py
@@ -45,7 +45,7 @@ class TestSuiteAll(unittest.TestSuite):
from grit import shortcuts_unittests
from grit.gather import muppet_strings_unittest
from grit.node.custom import filename_unittest
-
+
test_classes = [
base_unittest.NodeUnittest,
io_unittest.FileNodeUnittest,
diff --git a/tools/grit/grit/tool/build.py b/tools/grit/grit/tool/build.py
index a8488e8..a2683fd 100644
--- a/tools/grit/grit/tool/build.py
+++ b/tools/grit/grit/tool/build.py
@@ -47,7 +47,7 @@ Options:
-o OUTPUTDIR Specify what directory output paths are relative to.
Defaults to the current directory.
-
+
-D NAME[=VAL] Specify a C-preprocessor-like define NAME with optional
value VAL (defaults to 1) which will be used to control
conditional inclusion of resources.
@@ -90,7 +90,7 @@ are exported to translation interchange files (e.g. XMB files), etc.
# Default file-creation function is built-in file(). Only done to allow
# overriding by unit test.
self.fo_create = file
-
+
# key/value pairs of C-preprocessor like defines that are used for
# conditional output of resources
self.defines = {}
@@ -98,24 +98,24 @@ are exported to translation interchange files (e.g. XMB files), etc.
# self.res is a fully-populated resource tree if Run()
# has been called, otherwise None.
self.res = None
-
+
# Set to a list of filenames for the output nodes that are relative
# to the current working directory. They are in the same order as the
# output nodes in the file.
self.scons_targets = None
-
+
# static method
def ProcessNode(node, output_node, outfile):
'''Processes a node in-order, calling its formatter before and after
recursing to its children.
-
+
Args:
node: grit.node.base.Node subclass
output_node: grit.node.io.File
outfile: open filehandle
'''
base_dir = util.dirname(output_node.GetOutputFilename())
-
+
try:
formatter = node.ItemFormatter(output_node.GetType())
if formatter:
@@ -153,7 +153,7 @@ are exported to translation interchange files (e.g. XMB files), etc.
for output in self.res.GetOutputFiles():
output.output_filename = os.path.abspath(os.path.join(
self.output_directory, output.GetFilename()))
-
+
for output in self.res.GetOutputFiles():
self.VerboseOut('Creating %s...' % output.GetFilename())
@@ -173,25 +173,25 @@ are exported to translation interchange files (e.g. XMB files), etc.
if output.GetType() != 'data_package':
outfile = util.WrapOutputStream(outfile, encoding)
-
+
# Set the context, for conditional inclusion of resources
self.res.SetOutputContext(output.GetLanguage(), self.defines)
-
+
# TODO(joi) Handle this more gracefully
import grit.format.rc_header
grit.format.rc_header.Item.ids_ = {}
-
+
# Iterate in-order through entire resource tree, calling formatters on
# the entry into a node and on exit out of it.
self.ProcessNode(self.res, output, outfile)
outfile.close()
self.VerboseOut(' done.\n')
-
+
# Print warnings if there are any duplicate shortcuts.
print '\n'.join(shortcuts.GenerateDuplicateShortcutsWarnings(
self.res.UberClique(), self.res.GetTcProject()))
-
+
# Print out any fallback warnings, and missing translation errors, and
# exit with an error code if there are missing translations in a non-pseudo
# build
diff --git a/tools/grit/grit/tool/count.py b/tools/grit/grit/tool/count.py
index 5beaaa3..52e6bbe 100644
--- a/tools/grit/grit/tool/count.py
+++ b/tools/grit/grit/tool/count.py
@@ -26,19 +26,19 @@ class CountMessage(interface.Tool):
def ShortDescription(self):
return 'Exports all translateable messages into an XMB file.'
-
+
def Run(self, opts, args):
self.SetOptions(opts)
-
+
id = args[0]
res_tree = grd_reader.Parse(opts.input, debug=opts.extra_verbose)
res_tree.OnlyTheseTranslations([])
res_tree.RunGatherers(True)
-
+
count = 0
for c in res_tree.UberClique().AllCliques():
if c.GetId() == id:
count += 1
-
+
print "There are %d occurrences of message %s." % (count, id)
diff --git a/tools/grit/grit/tool/diff_structures.py b/tools/grit/grit/tool/diff_structures.py
index 55b144a..b4d6b624 100644
--- a/tools/grit/grit/tool/diff_structures.py
+++ b/tools/grit/grit/tool/diff_structures.py
@@ -37,7 +37,7 @@ for gatherer in structure._GATHERERS:
class DiffStructures(interface.Tool):
__doc__ = _class_doc
-
+
def __init__(self):
self.section = None
self.left_encoding = 'cp1252'
@@ -66,24 +66,24 @@ class DiffStructures(interface.Tool):
if len(args) != 2:
print "Incorrect usage - 'grit help sdiff' for usage details."
return 2
-
+
if 'P4DIFF' not in os.environ:
print "Environment variable P4DIFF not set; defaulting to 'windiff'."
diff_program = 'windiff'
else:
diff_program = os.environ['P4DIFF']
-
+
left_trans = self.MakeStaticTranslation(args[0], self.left_encoding)
try:
try:
right_trans = self.MakeStaticTranslation(args[1], self.right_encoding)
-
+
os.system('%s %s %s' % (diff_program, left_trans, right_trans))
finally:
os.unlink(right_trans)
finally:
os.unlink(left_trans)
-
+
def MakeStaticTranslation(self, original_filename, encoding):
"""Given the name of the structure type (self.structure_type), the filename
of the file holding the original structure, and optionally the "section" key
@@ -92,10 +92,10 @@ class DiffStructures(interface.Tool):
(i.e. one where all translateable parts have been replaced with "TTTTTT")
and returns the temporary file name. It is the caller's responsibility to
delete the file when finished.
-
+
Args:
original_filename: 'c:\\bingo\\bla.rc'
-
+
Return:
'c:\\temp\\werlkjsdf334.tmp'
"""
@@ -103,12 +103,12 @@ class DiffStructures(interface.Tool):
original_filename, extkey=self.section, encoding=encoding)
original.Parse()
translated = original.Translate(constants.CONSTANT_LANGUAGE, False)
-
+
fname = tempfile.mktemp()
fhandle = file(fname, 'w')
writer = util.WrapOutputStream(fhandle)
writer.write("Original filename: %s\n=============\n\n" % original_filename)
writer.write(translated) # write in UTF-8
fhandle.close()
-
+
return fname
diff --git a/tools/grit/grit/tool/interface.py b/tools/grit/grit/tool/interface.py
index 0223db0..8470b37 100644
--- a/tools/grit/grit/tool/interface.py
+++ b/tools/grit/grit/tool/interface.py
@@ -20,14 +20,14 @@ class Tool(object):
def ShortDescription(self):
'''Returns a short description of the functionality of the tool.'''
raise NotImplementedError()
-
+
def Run(self, global_options, my_arguments):
'''Runs the tool.
-
+
Args:
global_options: object grit_runner.Options
my_arguments: [arg1 arg2 ...]
-
+
Return:
0 for success, non-0 for error
'''
@@ -36,22 +36,22 @@ class Tool(object):
#
# Base class implementation
#
-
+
def __init__(self):
self.o = None
-
+
def SetOptions(self, opts):
self.o = opts
-
+
def Out(self, text):
'''Always writes out 'text'.'''
self.o.output_stream.write(text)
-
+
def VerboseOut(self, text):
'''Writes out 'text' if the verbose option is on.'''
if self.o.verbose:
self.o.output_stream.write(text)
-
+
def ExtraVerboseOut(self, text):
'''Writes out 'text' if the extra-verbose option is on.
'''
diff --git a/tools/grit/grit/tool/menu_from_parts.py b/tools/grit/grit/tool/menu_from_parts.py
index 370678e..7fa77b6 100644
--- a/tools/grit/grit/tool/menu_from_parts.py
+++ b/tools/grit/grit/tool/menu_from_parts.py
@@ -29,18 +29,18 @@ to being one message for the whole menu.'''
def ShortDescription(self):
return ('Create translations of whole menus from existing translations of '
'menu items.')
-
+
def Run(self, globopt, args):
self.SetOptions(globopt)
assert len(args) == 2, "Need exactly two arguments, the XTB file and the output file"
-
+
xtb_file = args[0]
output_file = args[1]
-
+
grd = grd_reader.Parse(self.o.input, debug=self.o.extra_verbose)
grd.OnlyTheseTranslations([]) # don't load translations
grd.RunGatherers(recursive = True)
-
+
xtb = {}
def Callback(msg_id, parts):
msg = []
@@ -55,14 +55,14 @@ to being one message for the whole menu.'''
f = file(xtb_file)
xtb_reader.Parse(f, Callback)
f.close()
-
+
translations = [] # list of translations as per transl2tc.WriteTranslations
for node in grd:
if node.name == 'structure' and node.attrs['type'] == 'menu':
assert len(node.GetCliques()) == 1
message = node.GetCliques()[0].GetMessage()
translation = []
-
+
contents = message.GetContent()
for part in contents:
if isinstance(part, types.StringTypes):
@@ -74,10 +74,10 @@ to being one message for the whole menu.'''
translation.append(xtb[id])
else:
translation.append(part.GetPresentation())
-
+
if len(translation):
translations.append([message.GetId(), ''.join(translation)])
-
+
f = util.WrapOutputStream(file(output_file, 'w'))
transl2tc.TranslationToTc.WriteTranslations(f, translations)
f.close()
diff --git a/tools/grit/grit/tool/newgrd.py b/tools/grit/grit/tool/newgrd.py
index c5db92b..060f29b 100644
--- a/tools/grit/grit/tool/newgrd.py
+++ b/tools/grit/grit/tool/newgrd.py
@@ -59,7 +59,7 @@ where in the file.'''
def ShortDescription(self):
return 'Create a new empty .grd file.'
-
+
def Run(self, global_options, my_arguments):
if not len(my_arguments) == 1:
print 'This tool requires exactly one argument, the name of the output file.'
diff --git a/tools/grit/grit/tool/postprocess_interface.py b/tools/grit/grit/tool/postprocess_interface.py
index 7f057a6..c0381ee 100644
--- a/tools/grit/grit/tool/postprocess_interface.py
+++ b/tools/grit/grit/tool/postprocess_interface.py
@@ -21,9 +21,9 @@ class PostProcessor(object):
Args:
rctext: string containing the contents of the RC file being processed.
rcpath: the path used to access the file.
- grdtext: the root node of the grd xml data generated by
+ grdtext: the root node of the grd xml data generated by
the rc2grd tool.
-
+
Return:
The root node of the processed GRD tree.
'''
diff --git a/tools/grit/grit/tool/postprocess_unittest.py b/tools/grit/grit/tool/postprocess_unittest.py
index 92bbbed..e408e74 100644
--- a/tools/grit/grit/tool/postprocess_unittest.py
+++ b/tools/grit/grit/tool/postprocess_unittest.py
@@ -21,28 +21,28 @@ from grit.tool import rc2grd
class PostProcessingUnittest(unittest.TestCase):
-
+
def testPostProcessing(self):
rctext = '''STRINGTABLE
BEGIN
DUMMY_STRING_1 "String 1"
- // Some random description
+ // Some random description
DUMMY_STRING_2 "This text was added during preprocessing"
-END
+END
'''
tool = rc2grd.Rc2Grd()
class DummyOpts(object):
verbose = False
extra_verbose = False
- tool.o = DummyOpts()
+ tool.o = DummyOpts()
tool.post_process = 'grit.tool.postprocess_unittest.DummyPostProcessor'
result = tool.Process(rctext, '.\resource.rc')
-
+
self.failUnless(
result.children[2].children[2].children[0].attrs['name'] == 'SMART_STRING_1')
self.failUnless(
result.children[2].children[2].children[1].attrs['name'] == 'SMART_STRING_2')
-
+
class DummyPostProcessor(grit.tool.postprocess_interface.PostProcessor):
'''
Post processing replaces all message name attributes containing "DUMMY" to
@@ -56,7 +56,7 @@ class DummyPostProcessor(grit.tool.postprocess_interface.PostProcessor):
m = smarter.search(name_attr)
if m:
node.attrs['name'] = 'SMART' + m.group(2)
- return grdnode
+ return grdnode
if __name__ == '__main__':
unittest.main()
diff --git a/tools/grit/grit/tool/preprocess_interface.py b/tools/grit/grit/tool/preprocess_interface.py
index 0efc329..6d4166a 100644
--- a/tools/grit/grit/tool/preprocess_interface.py
+++ b/tools/grit/grit/tool/preprocess_interface.py
@@ -19,7 +19,7 @@ class PreProcessor(object):
Args:
rctext: string containing the contents of the RC file being processed
rcpath: the path used to access the file.
-
+
Return:
The processed text.
'''
diff --git a/tools/grit/grit/tool/preprocess_unittest.py b/tools/grit/grit/tool/preprocess_unittest.py
index 6fe55fb..ff9ad39 100644
--- a/tools/grit/grit/tool/preprocess_unittest.py
+++ b/tools/grit/grit/tool/preprocess_unittest.py
@@ -20,27 +20,27 @@ from grit.tool import rc2grd
class PreProcessingUnittest(unittest.TestCase):
-
+
def testPreProcessing(self):
tool = rc2grd.Rc2Grd()
class DummyOpts(object):
verbose = False
extra_verbose = False
- tool.o = DummyOpts()
+ tool.o = DummyOpts()
tool.pre_process = 'grit.tool.preprocess_unittest.DummyPreProcessor'
result = tool.Process('', '.\resource.rc')
-
+
self.failUnless(
result.children[2].children[2].children[0].attrs['name'] == 'DUMMY_STRING_1')
-
+
class DummyPreProcessor(grit.tool.preprocess_interface.PreProcessor):
def Process(self, rctext, rcpath):
rctext = '''STRINGTABLE
BEGIN
DUMMY_STRING_1 "String 1"
- // Some random description
+ // Some random description
DUMMY_STRING_2 "This text was added during preprocessing"
-END
+END
'''
return rctext
diff --git a/tools/grit/grit/tool/rc2grd.py b/tools/grit/grit/tool/rc2grd.py
index ac7b90b..638ca2f 100644
--- a/tools/grit/grit/tool/rc2grd.py
+++ b/tools/grit/grit/tool/rc2grd.py
@@ -101,7 +101,7 @@ cleaned up manually.
OPTIONS may be any of the following:
-e ENCODING Specify the ENCODING of the .rc file. Default is 'cp1252'.
-
+
-h TYPE Specify the TYPE attribute for HTML structures.
Default is 'tr_html'.
@@ -139,10 +139,10 @@ is #if 0-ed out it will still be included in the output of this tool
Therefore, if your .rc file contains sections like this, you should run the
C preprocessor on the .rc file or manually edit it before using this tool.
'''
-
+
def ShortDescription(self):
return 'A tool for converting .rc source files to .grd files.'
-
+
def __init__(self):
self.input_encoding = 'cp1252'
self.html_type = 'tr_html'
@@ -151,7 +151,7 @@ C preprocessor on the .rc file or manually edit it before using this tool.
self.role_model = None
self.pre_process = None
self.post_process = None
-
+
def ParseOptions(self, args):
'''Given a list of arguments, set this object's options and return
all non-option arguments.
@@ -181,32 +181,32 @@ C preprocessor on the .rc file or manually edit it before using this tool.
'.rc file to process.')
return 2
self.SetOptions(opts)
-
+
path = args[0]
out_path = os.path.join(util.dirname(path),
os.path.splitext(os.path.basename(path))[0] + '.grd')
-
+
rcfile = util.WrapInputStream(file(path, 'r'), self.input_encoding)
rctext = rcfile.read()
-
+
grd_text = unicode(self.Process(rctext, path))
rcfile.close()
-
+
outfile = util.WrapOutputStream(file(out_path, 'w'), 'utf-8')
outfile.write(grd_text)
outfile.close()
-
+
print 'Wrote output file %s.\nPlease check for TODO items in the file.' % out_path
-
+
def Process(self, rctext, rc_path):
'''Processes 'rctext' and returns a resource tree corresponding to it.
-
+
Args:
rctext: complete text of the rc file
rc_path: 'resource\resource.rc'
-
+
Return:
grit.node.base.Node subclass
'''
@@ -239,15 +239,15 @@ C preprocessor on the .rc file or manually edit it before using this tool.
assert (isinstance(includes, grit.node.empty.IncludesNode) and
isinstance(structures, grit.node.empty.StructuresNode) and
isinstance(messages, grit.node.empty.MessagesNode))
-
+
self.AddIncludes(rctext, includes)
self.AddStructures(rctext, structures, os.path.basename(rc_path))
self.AddMessages(rctext, messages)
-
+
self.VerboseOut('Validating that all IDs are unique...\n')
root.ValidateUniqueIds()
self.ExtraVerboseOut('Done validating that all IDs are unique.\n')
-
+
if self.post_process:
postprocess_class = util.NewClassInstance(self.post_process,
postprocess_interface.PostProcessor)
@@ -271,8 +271,8 @@ C preprocessor on the .rc file or manually edit it before using this tool.
if type != 'HTML':
self.VerboseOut('Processing %s with ID %s (filename: %s)\n' % (type, id, fname))
node.AddChild(include.IncludeNode.Construct(node, id, type, fname))
-
-
+
+
def AddStructures(self, rctext, node, rc_filename):
'''Scans 'rctext' for structured resources (e.g. menus, dialogs, version
information resources and HTML templates) and adds each as a <structure>
@@ -285,7 +285,7 @@ C preprocessor on the .rc file or manually edit it before using this tool.
if type == 'HTML':
node.AddChild(structure.StructureNode.Construct(
node, id, self.html_type, fname, self.html_encoding))
-
+
# Then add all RC includes
def AddStructure(type, id):
self.VerboseOut('Processing %s with ID %s\n' % (type, id))
@@ -298,8 +298,8 @@ C preprocessor on the .rc file or manually edit it before using this tool.
AddStructure('dialog', m.group('id'))
for m in _VERSIONINFO.finditer(rctext):
AddStructure('version', m.group('id'))
-
-
+
+
def AddMessages(self, rctext, node):
'''Scans 'rctext' for all messages in string tables, preprocesses them as
much as possible for placeholders (e.g. messages containing $1, $2 or %s, %d
@@ -314,27 +314,27 @@ C preprocessor on the .rc file or manually edit it before using this tool.
for cm in _COMMENT_TEXT.finditer(comment_block):
comment_text.append(cm.group('text'))
comment_text = ' '.join(comment_text)
-
+
id = mm.group('id')
text = rc.Section.UnEscape(mm.group('text'))
-
+
self.VerboseOut('Processing message %s (text: "%s")\n' % (id, text))
-
+
msg_obj = self.Placeholderize(text)
-
+
# Messages that contain only placeholders do not need translation.
is_translateable = False
for item in msg_obj.GetContent():
if isinstance(item, types.StringTypes):
if not _WHITESPACE_ONLY.match(item):
is_translateable = True
-
+
if self.not_localizable_re.search(comment_text):
is_translateable = False
-
+
message_meaning = ''
internal_comment = ''
-
+
# If we have a "role model" (existing GRD file) and this node exists
# in the role model, use the description, meaning and translateable
# attributes from the role model.
@@ -345,29 +345,29 @@ C preprocessor on the .rc file or manually edit it before using this tool.
message_meaning = role_node.attrs['meaning']
comment_text = role_node.attrs['desc']
internal_comment = role_node.attrs['internal_comment']
-
+
# For nontranslateable messages, we don't want the complexity of
# placeholderizing everything.
if not is_translateable:
msg_obj = tclib.Message(text=text)
-
+
msg_node = message.MessageNode.Construct(node, msg_obj, id,
desc=comment_text,
translateable=is_translateable,
meaning=message_meaning)
msg_node.attrs['internal_comment'] = internal_comment
-
+
node.AddChild(msg_node)
self.ExtraVerboseOut('Done processing message %s\n' % id)
-
-
+
+
def Placeholderize(self, text):
'''Creates a tclib.Message object from 'text', attempting to recognize
a few different formats of text that can be automatically placeholderized
(HTML code, printf-style format strings, and FormatMessage-style format
strings).
'''
-
+
try:
# First try HTML placeholderizing.
# TODO(joi) Allow use of non-TotalRecall flavors of HTML placeholderizing
@@ -375,7 +375,7 @@ C preprocessor on the .rc file or manually edit it before using this tool.
for item in msg.GetContent():
if not isinstance(item, types.StringTypes):
return msg # Contained at least one placeholder, so we're done
-
+
# HTML placeholderization didn't do anything, so try to find printf or
# FormatMessage format specifiers and change them into placeholders.
msg = tclib.Message()
@@ -388,14 +388,14 @@ C preprocessor on the .rc file or manually edit it before using this tool.
todo_counter += 1
elif part != '':
msg.AppendText(part)
-
+
if self.role_model and len(parts) > 1: # there are TODO placeholders
role_model_msg = self.role_model.UberClique().BestCliqueByOriginalText(
msg.GetRealContent(), '')
if role_model_msg:
# replace wholesale to get placeholder names and examples
msg = role_model_msg
-
+
return msg
except:
print 'Exception processing message with text "%s"' % text
diff --git a/tools/grit/grit/tool/rc2grd_unittest.py b/tools/grit/grit/tool/rc2grd_unittest.py
index ab3f884..836d196 100644
--- a/tools/grit/grit/tool/rc2grd_unittest.py
+++ b/tools/grit/grit/tool/rc2grd_unittest.py
@@ -27,7 +27,7 @@ class Rc2GrdUnittest(unittest.TestCase):
msg = tool.Placeholderize(original)
self.failUnless(msg.GetPresentableContent() == "Hello TODO_0001, how are you? I'm TODO_0002 years old!")
self.failUnless(msg.GetRealContent() == original)
-
+
def testHtmlPlaceholderize(self):
tool = rc2grd.Rc2Grd()
original = "Hello <b>[USERNAME]</b>, how are you? I'm [AGE] years old!"
@@ -35,7 +35,7 @@ class Rc2GrdUnittest(unittest.TestCase):
self.failUnless(msg.GetPresentableContent() ==
"Hello BEGIN_BOLDX_USERNAME_XEND_BOLD, how are you? I'm X_AGE_X years old!")
self.failUnless(msg.GetRealContent() == original)
-
+
def testMenuWithoutWhitespaceRegression(self):
# There was a problem in the original regular expression for parsing out
# menu sections, that would parse the following block of text as a single
@@ -72,11 +72,11 @@ END
extra_verbose = False
tool.not_localizable_re = re.compile('')
tool.o = DummyNode()
-
+
rc_text = '''STRINGTABLE\nBEGIN\nID_BINGO "<SPAN id=hp style='BEHAVIOR: url(#default#homepage)'></SPAN><script>if (!hp.isHomePage('[$~HOMEPAGE~$]')) {document.write(""<a href=\\""[$~SETHOMEPAGEURL~$]\\"" >Set As Homepage</a> - "");}</script>"\nEND\n'''
tool.AddMessages(rc_text, tool.o)
self.failUnless(tool.o.node.GetCdata().find('Set As Homepage') != -1)
-
+
# TODO(joi) Improve the HTML parser to support translateables inside
# <script> blocks?
self.failUnless(tool.o.node.attrs['translateable'] == 'false')
@@ -111,7 +111,7 @@ The installation will not proceed if you choose to cancel.
</messages>
</release>
</grit>'''), dir='.')
-
+
# test rig
class DummyOpts(object):
verbose = False
diff --git a/tools/grit/grit/tool/resize.py b/tools/grit/grit/tool/resize.py
index 23451fd..93e3c1c 100644
--- a/tools/grit/grit/tool/resize.py
+++ b/tools/grit/grit/tool/resize.py
@@ -170,7 +170,7 @@ near the top of the file, before you open it in Visual Studio.
# TODO(joi) It would be cool to have this tool note the Perforce revision
# of the original RC file somewhere, such that the <skeleton> node could warn
# if the original RC file gets updated without the skeleton file being updated.
-
+
# TODO(joi) Would be cool to have option to add the files to Perforce
def __init__(self):
@@ -179,7 +179,7 @@ near the top of the file, before you open it in Visual Studio.
self.base_folder = '.'
self.codepage_number = 1252
self.codepage_number_specified_explicitly = False
-
+
def SetLanguage(self, lang):
'''Sets the language code to output things in.
'''
@@ -196,10 +196,10 @@ near the top of the file, before you open it in Visual Studio.
def ShortDescription(self):
return 'Generate a file where you can resize a given dialog.'
-
+
def Run(self, opts, args):
self.SetOptions(opts)
-
+
own_opts, args = getopt.getopt(args, 'l:f:c:D:')
for key, val in own_opts:
if key == '-l':
@@ -212,11 +212,11 @@ near the top of the file, before you open it in Visual Studio.
if key == '-D':
name, val = build.ParseDefine(val)
self.defines[name] = val
-
+
res_tree = grd_reader.Parse(opts.input, debug=opts.extra_verbose)
res_tree.OnlyTheseTranslations([self.lang])
res_tree.RunGatherers(True)
-
+
# Dialog IDs are either explicitly listed, or we output all dialogs from the
# .grd file
dialog_ids = args
@@ -224,31 +224,31 @@ near the top of the file, before you open it in Visual Studio.
for node in res_tree:
if node.name == 'structure' and node.attrs['type'] == 'dialog':
dialog_ids.append(node.attrs['name'])
-
+
self.Process(res_tree, dialog_ids)
-
+
def Process(self, grd, dialog_ids):
'''Outputs an RC file and header file for the dialog 'dialog_id' stored in
resource tree 'grd', to self.base_folder, as discussed in this class's
documentation.
-
+
Arguments:
grd: grd = grd_reader.Parse(...); grd.RunGatherers()
dialog_ids: ['IDD_MYDIALOG', 'IDD_OTHERDIALOG']
'''
grd.SetOutputContext(self.lang, self.defines)
-
+
project_name = dialog_ids[0]
-
+
dir_path = os.path.join(self.base_folder, project_name)
if not os.path.isdir(dir_path):
os.mkdir(dir_path)
-
+
# If this fails then we're not on Windows (or you don't have the required
# win32all Python libraries installed), so what are you doing mucking
# about with RC files anyway? :)
import pythoncom
-
+
# Create the .vcproj file
project_text = PROJECT_TEMPLATE.replace(
'[[PROJECT_GUID]]', str(pythoncom.CreateGuid())
@@ -256,7 +256,7 @@ near the top of the file, before you open it in Visual Studio.
fname = os.path.join(dir_path, '%s.vcproj' % project_name)
self.WriteFile(fname, project_text)
print "Wrote %s" % fname
-
+
# Create the .rc file
# Output all <include> nodes since the dialogs might depend on them (e.g.
# for icons and bitmaps).
@@ -269,7 +269,7 @@ near the top of the file, before you open it in Visual Studio.
rc_text = RC_TEMPLATE.replace('[[CODEPAGE_NUM]]',
str(self.codepage_number))
rc_text = rc_text.replace('[[INCLUDES]]', ''.join(include_items))
-
+
# Then output the dialogs we have been asked to output.
dialogs = []
for dialog_id in dialog_ids:
@@ -278,11 +278,11 @@ near the top of the file, before you open it in Visual Studio.
formatter = node.ItemFormatter('rc_all')
dialogs.append(formatter.Format(node, self.lang))
rc_text = rc_text.replace('[[DIALOGS]]', ''.join(dialogs))
-
+
fname = os.path.join(dir_path, '%s.rc' % project_name)
self.WriteFile(fname, rc_text, self.GetEncoding())
print "Wrote %s" % fname
-
+
# Create the resource.h file
header_defines = []
for node in grd:
@@ -293,7 +293,7 @@ near the top of the file, before you open it in Visual Studio.
fname = os.path.join(dir_path, 'resource.h')
self.WriteFile(fname, header_text)
print "Wrote %s" % fname
-
+
def WriteFile(self, filename, contents, encoding='cp1252'):
f = util.WrapOutputStream(file(filename, 'wb'), encoding)
f.write(contents)
diff --git a/tools/grit/grit/tool/test.py b/tools/grit/grit/tool/test.py
index 92e387c..aa02c4a 100644
--- a/tools/grit/grit/tool/test.py
+++ b/tools/grit/grit/tool/test.py
@@ -10,10 +10,10 @@ class TestTool(interface.Tool):
tool-specific arguments that it receives. It is intended only for testing,
hence the name :)
'''
-
+
def ShortDescription(self):
return 'A do-nothing tool for testing command-line parsing.'
-
+
def Run(self, global_options, my_arguments):
print 'NOTE This tool is only for testing the parsing of global options and'
print 'tool-specific arguments that it receives. You may have intended to'
diff --git a/tools/grit/grit/tool/toolbar_postprocess.py b/tools/grit/grit/tool/toolbar_postprocess.py
index 5fb2fae..3408985 100644
--- a/tools/grit/grit/tool/toolbar_postprocess.py
+++ b/tools/grit/grit/tool/toolbar_postprocess.py
@@ -28,16 +28,16 @@ class ToolbarPostProcessor(postprocess_interface.PostProcessor):
Args:
rctext: string containing the contents of the RC file being processed.
rcpath: the path used to access the file.
- grdnode: the root node of the grd xml data generated by
+ grdnode: the root node of the grd xml data generated by
the rc2grd tool.
-
+
Return:
The root node of the processed GRD tree.
'''
release = grdnode.children[2]
messages = release.children[2]
-
+
identifiers = grit.node.empty.IdentifiersNode()
identifiers.StartParsing('identifiers', release)
identifiers.EndParsing()
@@ -97,8 +97,8 @@ class ToolbarPostProcessor(postprocess_interface.PostProcessor):
previous_name_attr = name_attr
previous_node = node
-
- self.AddIdentifiers(rctext, identifiers)
+
+ self.AddIdentifiers(rctext, identifiers)
return grdnode
def ConstructNewMessages(self, parent):
diff --git a/tools/grit/grit/tool/toolbar_preprocess.py b/tools/grit/grit/tool/toolbar_preprocess.py
index e453059..ee566f6 100644
--- a/tools/grit/grit/tool/toolbar_preprocess.py
+++ b/tools/grit/grit/tool/toolbar_preprocess.py
@@ -15,7 +15,7 @@ import sys
import codecs
class ToolbarPreProcessor(preprocess_interface.PreProcessor):
- ''' Toolbar PreProcessing class.
+ ''' Toolbar PreProcessing class.
'''
_IDS_COMMAND_MACRO = re.compile(r'(.*IDS_COMMAND)\s*\(([a-zA-Z0-9_]*)\s*,\s*([a-zA-Z0-9_]*)\)(.*)')
@@ -29,7 +29,7 @@ class ToolbarPreProcessor(preprocess_interface.PreProcessor):
Args:
rctext: string containing the contents of the RC file being processed
rcpath: the path used to access the file.
-
+
Return:
The processed text.
'''
@@ -45,8 +45,8 @@ class ToolbarPreProcessor(preprocess_interface.PreProcessor):
mm = self._COMMENT.search(line)
if mm:
line = '%s//' % mm.group(1)
-
- else:
+
+ else:
# Replace $lf by the right linefeed character
line = self._LINE_FEED_PH.sub(r'\\n', line)
@@ -54,8 +54,8 @@ class ToolbarPreProcessor(preprocess_interface.PreProcessor):
mo = self._IDS_COMMAND_MACRO.search(line)
if mo:
line = '%s_%s_%s%s' % (mo.group(1), mo.group(2), mo.group(3), mo.group(4))
-
- ret += (line + '\n')
+
+ ret += (line + '\n')
return ret
diff --git a/tools/grit/grit/tool/transl2tc.py b/tools/grit/grit/tool/transl2tc.py
index 833f415..d0602af 100644
--- a/tools/grit/grit/tool/transl2tc.py
+++ b/tools/grit/grit/tool/transl2tc.py
@@ -48,10 +48,10 @@ refer to, and match together the source messages and translated messages. It
will output a file (OUTPUT_FILE) you can import directly into the TC using the
Bulk Translation Upload tool.
'''
-
+
def ShortDescription(self):
return 'Import existing translations in RC format into the TC'
-
+
def Setup(self, globopt, args):
'''Sets the instance up for use.
'''
@@ -65,20 +65,20 @@ Bulk Translation Upload tool.
limit_file.close()
args = args[2:]
return self.rc2grd.ParseOptions(args)
-
+
def Run(self, globopt, args):
args = self.Setup(globopt, args)
-
+
if len(args) != 3:
self.Out('This tool takes exactly three arguments:\n'
' 1. The path to the original RC file\n'
' 2. The path to the translated RC file\n'
' 3. The output file path.\n')
return 2
-
+
grd = grd_reader.Parse(self.o.input, debug=self.o.extra_verbose)
grd.RunGatherers(recursive = True)
-
+
source_rc = util.WrapInputStream(file(args[0], 'r'), self.rc2grd.input_encoding)
transl_rc = util.WrapInputStream(file(args[1], 'r'), self.rc2grd.input_encoding)
translations = self.ExtractTranslations(grd,
@@ -90,26 +90,26 @@ Bulk Translation Upload tool.
output_file = util.WrapOutputStream(file(args[2], 'w'))
self.WriteTranslations(output_file, translations.items())
output_file.close()
-
+
self.Out('Wrote output file %s' % args[2])
-
+
def ExtractTranslations(self, current_grd, source_rc, source_path, transl_rc, transl_path):
'''Extracts translations from the translated RC file, matching them with
translations in the source RC file to calculate their ID, and correcting
placeholders, limiting output to translateables, etc. using the supplied
.grd file which is the current .grd file for your project.
-
+
If this object's 'limits' attribute is not None but a list, the output of
this function will be further limited to include only messages that have
message IDs in the 'limits' list.
-
+
Args:
current_grd: grit.node.base.Node child, that has had RunGatherers(True) run on it
source_rc: Complete text of source RC file
source_path: Path to the source RC file
transl_rc: Complete text of translated RC file
transl_path: Path to the translated RC file
-
+
Return:
{ id1 : text1, '12345678' : 'Hello USERNAME, howzit?' }
'''
@@ -120,7 +120,7 @@ Bulk Translation Upload tool.
self.VerboseOut('Read %s into GRIT format, running gatherers.\n' % transl_path)
transl_grd.RunGatherers(recursive=True, debug=self.o.extra_verbose)
self.VerboseOut('Done running gatherers for %s.\n' % transl_path)
-
+
# Proceed to create a map from ID to translation, getting the ID from the
# source GRD and the translation from the translated GRD.
id2transl = {}
@@ -128,12 +128,12 @@ Bulk Translation Upload tool.
source_cliques = source_node.GetCliques()
if not len(source_cliques):
continue
-
+
assert 'name' in source_node.attrs, 'All nodes with cliques should have an ID'
node_id = source_node.attrs['name']
self.ExtraVerboseOut('Processing node %s\n' % node_id)
transl_node = transl_grd.GetNodeById(node_id)
-
+
if transl_node:
transl_cliques = transl_node.GetCliques()
if not len(transl_cliques) == len(source_cliques):
@@ -144,7 +144,7 @@ Bulk Translation Upload tool.
else:
self.Out('Warning: No translation for %s, skipping.\n' % node_id)
continue
-
+
if source_node.name == 'message':
# Fixup placeholders as well as possible based on information from
# the current .grd file if they are 'TODO_XXXX' placeholders. We need
@@ -154,10 +154,10 @@ Bulk Translation Upload tool.
current_node = current_grd.GetNodeById(node_id)
if current_node:
assert len(source_cliques) == 1 and len(current_node.GetCliques()) == 1
-
+
source_msg = source_cliques[0].GetMessage()
current_msg = current_node.GetCliques()[0].GetMessage()
-
+
# Only do this for messages whose source version has not changed.
if (source_msg.GetRealContent() != current_msg.GetRealContent()):
self.VerboseOut('Info: Message %s has changed; skipping\n' % node_id)
@@ -166,7 +166,7 @@ Bulk Translation Upload tool.
transl_content = transl_msg.GetContent()
current_content = current_msg.GetContent()
source_content = source_msg.GetContent()
-
+
ok_to_fixup = True
if (len(transl_content) != len(current_content)):
# message structure of translation is different, don't try fixup
@@ -185,7 +185,7 @@ Bulk Translation Upload tool.
if isinstance(current_content[ix], tclib.Placeholder):
ok_to_fixup = False # placeholders have likely been reordered
break
-
+
if not ok_to_fixup:
self.VerboseOut(
'Info: Structure of message %s has changed; skipping.\n' % node_id)
@@ -199,7 +199,7 @@ Bulk Translation Upload tool.
for ix in range(len(transl_content)):
Fixup(transl_content, ix)
Fixup(source_content, ix)
-
+
# Only put each translation once into the map. Warn if translations
# for the same message are different.
for ix in range(len(transl_cliques)):
@@ -207,7 +207,7 @@ Bulk Translation Upload tool.
source_msg.GenerateId() # needed to refresh ID based on new placeholders
message_id = source_msg.GetId()
translated_content = transl_cliques[ix].GetMessage().GetPresentableContent()
-
+
if message_id in id2transl:
existing_translation = id2transl[message_id]
if existing_translation != translated_content:
@@ -218,7 +218,7 @@ Bulk Translation Upload tool.
(original_text, existing_translation, translated_content))
else:
id2transl[message_id] = translated_content
-
+
# Remove translations for messages that do not occur in the current .grd
# or have been marked as not translateable, or do not occur in the 'limits'
# list (if it has been set).
@@ -228,19 +228,19 @@ Bulk Translation Upload tool.
not current_grd.UberClique().BestClique(message_id).IsTranslateable() or
(self.limits and message_id not in self.limits)):
del id2transl[message_id]
-
+
return id2transl
-
+
# static method
def WriteTranslations(output_file, translations):
'''Writes the provided list of translations to the provided output file
in the format used by the TC's Bulk Translation Upload tool. The file
must be UTF-8 encoded.
-
+
Args:
output_file: util.WrapOutputStream(file('bingo.out', 'w'))
translations: [ [id1, text1], ['12345678', 'Hello USERNAME, howzit?'] ]
-
+
Return:
None
'''
diff --git a/tools/grit/grit/tool/transl2tc_unittest.py b/tools/grit/grit/tool/transl2tc_unittest.py
index 4205de2..cc65020 100644
--- a/tools/grit/grit/tool/transl2tc_unittest.py
+++ b/tools/grit/grit/tool/transl2tc_unittest.py
@@ -25,7 +25,7 @@ def MakeOptions():
class TranslationToTcUnittest(unittest.TestCase):
-
+
def testOutput(self):
buf = StringIO.StringIO()
tool = transl2tc.TranslationToTc()
@@ -85,12 +85,12 @@ how are you?
</release>
</grit>'''), path)
current_grd.RunGatherers(recursive=True)
-
+
source_rc_path = util.PathFromRoot('grit/test/data/source.rc')
source_rc = file(source_rc_path).read()
transl_rc_path = util.PathFromRoot('grit/test/data/transl.rc')
transl_rc = file(transl_rc_path).read()
-
+
tool = transl2tc.TranslationToTc()
output_buf = StringIO.StringIO()
globopts = MakeOptions()
@@ -100,10 +100,10 @@ how are you?
translations = tool.ExtractTranslations(current_grd,
source_rc, source_rc_path,
transl_rc, transl_rc_path)
-
+
values = translations.values()
output = output_buf.getvalue()
-
+
self.failUnless('Ein' in values)
self.failUnless('NUMBIRDS Vogeln' in values)
self.failUnless('ITEM von COUNT' in values)
@@ -114,11 +114,11 @@ how are you?
self.failIf('Nicht verwendet' in values)
self.failUnless(('Howdie' in values or 'Hallo sagt man' in values) and not
('Howdie' in values and 'Hallo sagt man' in values))
-
+
self.failUnless('XX01XX&SkraXX02XX&HaettaXX03XXThetta er "Klonk" sem eg fylaXX04XXgonkurinnXX05XXKlonk && er "gott"XX06XX&HjalpXX07XX&Um...XX08XX' in values)
-
+
self.failUnless('I lagi' in values)
-
+
self.failUnless(output.count('Structure of message IDS_REORDERED_PLACEHOLDERS has changed'))
self.failUnless(output.count('Message IDS_CHANGED has changed'))
self.failUnless(output.count('Structure of message IDS_LONGER_TRANSLATED has changed'))
diff --git a/tools/grit/grit/tool/unit.py b/tools/grit/grit/tool/unit.py
index ba424dd..7eb94ba 100644
--- a/tools/grit/grit/tool/unit.py
+++ b/tools/grit/grit/tool/unit.py
@@ -16,10 +16,10 @@ class UnitTestTool(interface.Tool):
'''By using this tool (e.g. 'grit unit') you run all the unit tests for GRIT.
This happens in the environment that is set up by the basic GRIT runner, i.e.
whether to run disconnected has been specified, etc.'''
-
+
def ShortDescription(self):
return 'Use this tool to run all the unit tests for GRIT.'
-
+
def Run(self, opts, args):
return unittest.TextTestRunner(verbosity=2).run(
grit.test_suite_all.TestSuiteAll())
diff --git a/tools/grit/grit/util.py b/tools/grit/grit/util.py
index b837d52..a0aac74 100644
--- a/tools/grit/grit/util.py
+++ b/tools/grit/grit/util.py
@@ -24,9 +24,9 @@ _root_dir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
SYSTEM_IDENTIFIERS = re.compile(
r'''\bIDOK\b | \bIDCANCEL\b | \bIDC_STATIC\b | \bIDYES\b | \bIDNO\b |
\bID_FILE_NEW\b | \bID_FILE_OPEN\b | \bID_FILE_CLOSE\b | \bID_FILE_SAVE\b |
- \bID_FILE_SAVE_AS\b | \bID_FILE_PAGE_SETUP\b | \bID_FILE_PRINT_SETUP\b |
- \bID_FILE_PRINT\b | \bID_FILE_PRINT_DIRECT\b | \bID_FILE_PRINT_PREVIEW\b |
- \bID_FILE_UPDATE\b | \bID_FILE_SAVE_COPY_AS\b | \bID_FILE_SEND_MAIL\b |
+ \bID_FILE_SAVE_AS\b | \bID_FILE_PAGE_SETUP\b | \bID_FILE_PRINT_SETUP\b |
+ \bID_FILE_PRINT\b | \bID_FILE_PRINT_DIRECT\b | \bID_FILE_PRINT_PREVIEW\b |
+ \bID_FILE_UPDATE\b | \bID_FILE_SAVE_COPY_AS\b | \bID_FILE_SEND_MAIL\b |
\bID_FILE_MRU_FIRST\b | \bID_FILE_MRU_LAST\b |
\bID_EDIT_CLEAR\b | \bID_EDIT_CLEAR_ALL\b | \bID_EDIT_COPY\b |
\bID_EDIT_CUT\b | \bID_EDIT_FIND\b | \bID_EDIT_PASTE\b | \bID_EDIT_PASTE_LINK\b |
@@ -87,7 +87,7 @@ def UnescapeHtml(text, replace_nbsp=True):
'''Returns 'text' with all HTML character entities (both named character
entities and those specified by decimal or hexadecimal Unicode ordinal)
replaced by their Unicode characters (or latin1 characters if possible).
-
+
The only exception is that &nbsp; will not be escaped if 'replace_nbsp' is
False.
'''
@@ -106,7 +106,7 @@ def UnescapeHtml(text, replace_nbsp=True):
return unichr(htmlentitydefs.name2codepoint[name])
else:
return match.group() # Unknown HTML character entity - don't replace
-
+
out = _HTML_ENTITY.sub(Replace, text)
return out
@@ -115,10 +115,10 @@ def EncodeCdata(cdata):
'''Returns the provided cdata in either escaped format or <![CDATA[xxx]]>
format, depending on which is more appropriate for easy editing. The data
is escaped for inclusion in an XML element's body.
-
+
Args:
cdata: 'If x < y and y < z then x < z'
-
+
Return:
'<![CDATA[If x < y and y < z then x < z]]>'
'''
@@ -132,12 +132,12 @@ def FixupNamedParam(function, param_name, param_value):
'''Returns a closure that is identical to 'function' but ensures that the
named parameter 'param_name' is always set to 'param_value' unless explicitly
set by the caller.
-
+
Args:
function: callable
param_name: 'bingo'
param_value: 'bongo' (any type)
-
+
Return:
callable
'''
@@ -152,10 +152,10 @@ def PathFromRoot(path):
'''Takes a path relative to the root directory for GRIT (the one that grit.py
resides in) and returns a path that is either absolute or relative to the
current working directory (i.e .a path you can use to open the file).
-
+
Args:
path: 'rel_dir\file.ext'
-
+
Return:
'c:\src\tools\rel_dir\file.ext
'''
@@ -200,10 +200,10 @@ _LANGUAGE_SPLIT_RE = re.compile('-|_|/')
def CanonicalLanguage(code):
'''Canonicalizes two-part language codes by using a dash and making the
second part upper case. Returns one-part language codes unchanged.
-
+
Args:
code: 'zh_cn'
-
+
Return:
code: 'zh-CN'
'''
@@ -237,12 +237,12 @@ _LANG_TO_CODEPAGE = {
def LanguageToCodepage(lang):
'''Returns the codepage _number_ that can be used to represent 'lang', which
may be either in formats such as 'en', 'pt_br', 'pt-BR', etc.
-
+
The codepage returned will be one of the 'cpXXXX' codepage numbers.
-
+
Args:
lang: 'de'
-
+
Return:
1252
'''
@@ -266,7 +266,7 @@ def NewClassInstance(class_name, class_type):
'''
lastdot = class_name.rfind('.')
module_name = ''
- if lastdot >= 0:
+ if lastdot >= 0:
module_name = class_name[0:lastdot]
if module_name:
class_name = class_name[lastdot+1:]
@@ -276,7 +276,7 @@ def NewClassInstance(class_name, class_type):
class_instance = class_()
if isinstance(class_instance, class_type):
return class_instance
- return None
+ return None
def FixLineEnd(text, line_end):
@@ -293,7 +293,7 @@ def BoolToString(bool):
return 'true'
else:
return 'false'
-
+
verbose = False
extra_verbose = False
diff --git a/tools/grit/grit/util_unittest.py b/tools/grit/grit/util_unittest.py
index 54104d0..cd8c97b 100644
--- a/tools/grit/grit/util_unittest.py
+++ b/tools/grit/grit/util_unittest.py
@@ -19,17 +19,17 @@ from grit import util
class UtilUnittest(unittest.TestCase):
''' Tests functions from util
'''
-
+
def testNewClassInstance(self):
# Test short class name with no fully qualified package name
# Should fail, it is not supported by the function now (as documented)
cls = util.NewClassInstance('grit.util.TestClassToLoad',
TestBaseClassToLoad)
self.failUnless(cls == None)
-
+
# Test non existent class name
cls = util.NewClassInstance('grit.util_unittest.NotExistingClass',
- TestBaseClassToLoad)
+ TestBaseClassToLoad)
self.failUnless(cls == None)
# Test valid class name and valid base class
@@ -41,7 +41,7 @@ class UtilUnittest(unittest.TestCase):
cls = util.NewClassInstance('grit.util_unittest.TestClassNoBase',
TestBaseClassToLoad)
self.failUnless(cls == None)
-
+
def testCanonicalLanguage(self):
self.failUnless(util.CanonicalLanguage('en') == 'en')
self.failUnless(util.CanonicalLanguage('pt_br') == 'pt-BR')
diff --git a/tools/grit/grit/xtb_reader.py b/tools/grit/grit/xtb_reader.py
index 3d1a42a..f785879 100644
--- a/tools/grit/grit/xtb_reader.py
+++ b/tools/grit/grit/xtb_reader.py
@@ -15,7 +15,7 @@ class XtbContentHandler(xml.sax.handler.ContentHandler):
'''A content handler that calls a given callback function for each
translation in the XTB file.
'''
-
+
def __init__(self, callback, debug=False):
self.callback = callback
self.debug = debug
@@ -28,7 +28,7 @@ class XtbContentHandler(xml.sax.handler.ContentHandler):
self.current_structure = []
# Set to the language ID when we see the <translationbundle> node.
self.language = ''
-
+
def startElement(self, name, attrs):
if name == 'translation':
assert self.current_id == 0 and len(self.current_structure) == 0, (
@@ -61,10 +61,10 @@ class XtbContentHandler(xml.sax.handler.ContentHandler):
class XtbErrorHandler(xml.sax.handler.ErrorHandler):
def error(self, exception):
pass
-
+
def fatalError(self, exception):
raise exception
-
+
def warning(self, exception):
pass
@@ -72,16 +72,16 @@ class XtbErrorHandler(xml.sax.handler.ErrorHandler):
def Parse(xtb_file, callback_function, debug=False):
'''Parse xtb_file, making a call to callback_function for every translation
in the XTB file.
-
+
The callback function must have the signature as described below. The 'parts'
parameter is a list of tuples (is_placeholder, text). The 'text' part is
either the raw text (if is_placeholder is False) or the name of the placeholder
(if is_placeholder is True).
-
+
Args:
xtb_file: file('fr.xtb')
callback_function: def Callback(msg_id, parts): pass
-
+
Return:
The language of the XTB, e.g. 'fr'
'''
@@ -91,7 +91,7 @@ def Parse(xtb_file, callback_function, debug=False):
# XTB files somehow?
front_of_file = xtb_file.read(1024)
xtb_file.seek(front_of_file.find('<translationbundle'))
-
+
handler = XtbContentHandler(callback=callback_function, debug=debug)
xml.sax.parse(xtb_file, handler)
assert handler.language != ''
diff --git a/tools/grit/grit/xtb_reader_unittest.py b/tools/grit/grit/xtb_reader_unittest.py
index 16e701e..f978876 100644
--- a/tools/grit/grit/xtb_reader_unittest.py
+++ b/tools/grit/grit/xtb_reader_unittest.py
@@ -36,7 +36,7 @@ and another
and another after a blank line.</translation>
</translationbundle>''')
-
+
messages = []
def Callback(id, structure):
messages.append((id, structure))
@@ -52,19 +52,19 @@ and another after a blank line.</translation>
<message name="ID_MEGA">Fantastic!</message>
<message name="ID_HELLO_USER">Hello <ph name="USERNAME">%s<ex>Joi</ex></ph></message>
</messages>'''), dir='.', flexible_root=True)
-
+
clique_mega = grd.children[0].GetCliques()[0]
msg_mega = clique_mega.GetMessage()
clique_hello_user = grd.children[1].GetCliques()[0]
msg_hello_user = clique_hello_user.GetMessage()
-
+
xtb_file = StringIO.StringIO('''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE translationbundle>
<translationbundle lang="is">
<translation id="%s">Meirihattar!</translation>
<translation id="%s">Saelir <ph name="USERNAME"/></translation>
</translationbundle>''' % (msg_mega.GetId(), msg_hello_user.GetId()))
-
+
xtb_reader.Parse(xtb_file, grd.UberClique().GenerateXtbParserCallback('is'))
self.failUnless(clique_mega.MessageForLanguage('is').GetRealContent() ==
'Meirihattar!')
diff --git a/tools/measure_page_load_time/ie_bho/MeasurePageLoadTime.cpp b/tools/measure_page_load_time/ie_bho/MeasurePageLoadTime.cpp
index 55f4de2..bb2fa51 100644
--- a/tools/measure_page_load_time/ie_bho/MeasurePageLoadTime.cpp
+++ b/tools/measure_page_load_time/ie_bho/MeasurePageLoadTime.cpp
@@ -55,7 +55,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpRes
{
DisableThreadLibraryCalls(hInstance);
}
- return _AtlModule.DllMain(dwReason, lpReserved);
+ return _AtlModule.DllMain(dwReason, lpReserved);
}
#ifdef _MANAGED
diff --git a/tools/measure_page_load_time/ie_bho/MeasurePageLoadTimeBHO.cpp b/tools/measure_page_load_time/ie_bho/MeasurePageLoadTimeBHO.cpp
index 7e9d5c0..a88f1bf 100644
--- a/tools/measure_page_load_time/ie_bho/MeasurePageLoadTimeBHO.cpp
+++ b/tools/measure_page_load_time/ie_bho/MeasurePageLoadTimeBHO.cpp
@@ -38,7 +38,7 @@
#define MAX_URL 1024 // size of URL buffer
#define MAX_PAGELOADTIME (4*60*1000) // assume all pages take < 4 minutes
-#define PORT 42492 // port to listen on. Also jhaas's
+#define PORT 42492 // port to listen on. Also jhaas's
// old MSFT employee number
@@ -99,7 +99,7 @@ STDMETHODIMP CMeasurePageLoadTimeBHO::SetSite(IUnknown* pUnkSite)
void STDMETHODCALLTYPE CMeasurePageLoadTimeBHO::OnDocumentComplete(IDispatch *pDisp, VARIANT *pvarURL)
{
- if (pDisp == m_spWebBrowser)
+ if (pDisp == m_spWebBrowser)
{
// Fire the event when the page is done loading
// to unblock the other thread.
@@ -108,7 +108,7 @@ void STDMETHODCALLTYPE CMeasurePageLoadTimeBHO::OnDocumentComplete(IDispatch *pD
}
-void CMeasurePageLoadTimeBHO::ProcessPageTimeRequests()
+void CMeasurePageLoadTimeBHO::ProcessPageTimeRequests()
{
CoInitialize(NULL);
@@ -205,7 +205,7 @@ void CMeasurePageLoadTimeBHO::ProcessPageTimeRequests()
fReceivedCR = true;
}
- // The below call will not block, since we determined with
+ // The below call will not block, since we determined with
// MSG_PEEK that at least cbRead bytes are in the TCP receive buffer
recv(m_sockTransport, pbBuffer, cbRead, 0);
pbBuffer[cbRead] = '\0';
@@ -250,8 +250,8 @@ void CMeasurePageLoadTimeBHO::ProcessPageTimeRequests()
);
// The main browser thread will call OnDocumentComplete() when
- // the page is done loading, which will in turn trigger
- // m_hEvent. Wait here until then; the event will reset itself
+ // the page is done loading, which will in turn trigger
+ // m_hEvent. Wait here until then; the event will reset itself
// once this thread is released
if (WaitForSingleObject(m_hEvent, MAX_PAGELOADTIME) == WAIT_TIMEOUT)
{
@@ -297,7 +297,7 @@ void CMeasurePageLoadTimeBHO::ProcessPageTimeRequests()
void CMeasurePageLoadTimeBHO::ErrorExit()
{
- // Unlink from IE, close the sockets, then terminate this
+ // Unlink from IE, close the sockets, then terminate this
// thread
SetSite(NULL);
@@ -314,4 +314,4 @@ void CMeasurePageLoadTimeBHO::ErrorExit()
}
TerminateThread(GetCurrentThread(), -1);
-} \ No newline at end of file
+}
diff --git a/tools/measure_page_load_time/ie_bho/MeasurePageLoadTimeBHO.h b/tools/measure_page_load_time/ie_bho/MeasurePageLoadTimeBHO.h
index b6e518a..8fe07ac 100644
--- a/tools/measure_page_load_time/ie_bho/MeasurePageLoadTimeBHO.h
+++ b/tools/measure_page_load_time/ie_bho/MeasurePageLoadTimeBHO.h
@@ -50,7 +50,7 @@ BEGIN_SINK_MAP(CMeasurePageLoadTimeBHO)
END_SINK_MAP()
// DWebBrowserEvents2
- void STDMETHODCALLTYPE OnDocumentComplete(IDispatch *pDisp, VARIANT *pvarURL);
+ void STDMETHODCALLTYPE OnDocumentComplete(IDispatch *pDisp, VARIANT *pvarURL);
STDMETHOD(SetSite)(IUnknown *pUnkSite);
DECLARE_PROTECT_FINAL_CONSTRUCT()
@@ -70,7 +70,7 @@ END_SINK_MAP()
private:
CComPtr<IWebBrowser2> m_spWebBrowser;
- BOOL m_fAdvised;
+ BOOL m_fAdvised;
// Handle to global interface table
DWORD m_dwCookie;
diff --git a/tools/measure_page_load_time/ie_bho/resource.h b/tools/measure_page_load_time/ie_bho/resource.h
index a8004dc..38dc825 100644
--- a/tools/measure_page_load_time/ie_bho/resource.h
+++ b/tools/measure_page_load_time/ie_bho/resource.h
@@ -7,7 +7,7 @@
#define IDR_MEASUREPAGELOADTIMEBHO 102
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 201
diff --git a/tools/measure_page_load_time/ie_bho/stdafx.h b/tools/measure_page_load_time/ie_bho/stdafx.h
index 3f26087..a2727ce 100644
--- a/tools/measure_page_load_time/ie_bho/stdafx.h
+++ b/tools/measure_page_load_time/ie_bho/stdafx.h
@@ -14,9 +14,9 @@
#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
-#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
-#endif
+#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
@@ -36,4 +36,4 @@
#include <atlbase.h>
#include <atlcom.h>
-using namespace ATL; \ No newline at end of file
+using namespace ATL;
diff --git a/tools/memory_watcher/ia32_modrm_map.cc b/tools/memory_watcher/ia32_modrm_map.cc
index eaae07c..c2f9625 100644
--- a/tools/memory_watcher/ia32_modrm_map.cc
+++ b/tools/memory_watcher/ia32_modrm_map.cc
@@ -1,10 +1,10 @@
/* Copyright (c) 2007, Google Inc.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -48,7 +48,7 @@ const ModrmEntry MiniDisassembler::s_ia16_modrm_map_[] = {
/* r/m == 100 */ { false, false, OS_ZERO },
/* r/m == 101 */ { false, false, OS_ZERO },
/* r/m == 110 */ { true, false, OS_WORD },
- /* r/m == 111 */ { false, false, OS_ZERO },
+ /* r/m == 111 */ { false, false, OS_ZERO },
// mod == 01
/* r/m == 000 */ { true, false, OS_BYTE },
/* r/m == 001 */ { true, false, OS_BYTE },
@@ -57,7 +57,7 @@ const ModrmEntry MiniDisassembler::s_ia16_modrm_map_[] = {
/* r/m == 100 */ { true, false, OS_BYTE },
/* r/m == 101 */ { true, false, OS_BYTE },
/* r/m == 110 */ { true, false, OS_BYTE },
- /* r/m == 111 */ { true, false, OS_BYTE },
+ /* r/m == 111 */ { true, false, OS_BYTE },
// mod == 10
/* r/m == 000 */ { true, false, OS_WORD },
/* r/m == 001 */ { true, false, OS_WORD },
@@ -66,7 +66,7 @@ const ModrmEntry MiniDisassembler::s_ia16_modrm_map_[] = {
/* r/m == 100 */ { true, false, OS_WORD },
/* r/m == 101 */ { true, false, OS_WORD },
/* r/m == 110 */ { true, false, OS_WORD },
- /* r/m == 111 */ { true, false, OS_WORD },
+ /* r/m == 111 */ { true, false, OS_WORD },
// mod == 11
/* r/m == 000 */ { false, false, OS_ZERO },
/* r/m == 001 */ { false, false, OS_ZERO },
@@ -87,7 +87,7 @@ const ModrmEntry MiniDisassembler::s_ia32_modrm_map_[] = {
/* r/m == 100 */ { false, true, OS_ZERO },
/* r/m == 101 */ { true, false, OS_DOUBLE_WORD },
/* r/m == 110 */ { false, false, OS_ZERO },
- /* r/m == 111 */ { false, false, OS_ZERO },
+ /* r/m == 111 */ { false, false, OS_ZERO },
// mod == 01
/* r/m == 000 */ { true, false, OS_BYTE },
/* r/m == 001 */ { true, false, OS_BYTE },
@@ -96,7 +96,7 @@ const ModrmEntry MiniDisassembler::s_ia32_modrm_map_[] = {
/* r/m == 100 */ { true, true, OS_BYTE },
/* r/m == 101 */ { true, false, OS_BYTE },
/* r/m == 110 */ { true, false, OS_BYTE },
- /* r/m == 111 */ { true, false, OS_BYTE },
+ /* r/m == 111 */ { true, false, OS_BYTE },
// mod == 10
/* r/m == 000 */ { true, false, OS_DOUBLE_WORD },
/* r/m == 001 */ { true, false, OS_DOUBLE_WORD },
@@ -105,7 +105,7 @@ const ModrmEntry MiniDisassembler::s_ia32_modrm_map_[] = {
/* r/m == 100 */ { true, true, OS_DOUBLE_WORD },
/* r/m == 101 */ { true, false, OS_DOUBLE_WORD },
/* r/m == 110 */ { true, false, OS_DOUBLE_WORD },
- /* r/m == 111 */ { true, false, OS_DOUBLE_WORD },
+ /* r/m == 111 */ { true, false, OS_DOUBLE_WORD },
// mod == 11
/* r/m == 000 */ { false, false, OS_ZERO },
/* r/m == 001 */ { false, false, OS_ZERO },
diff --git a/tools/memory_watcher/ia32_opcode_map.cc b/tools/memory_watcher/ia32_opcode_map.cc
index df57b2a..aa10efa 100644
--- a/tools/memory_watcher/ia32_opcode_map.cc
+++ b/tools/memory_watcher/ia32_opcode_map.cc
@@ -1,10 +1,10 @@
/* Copyright (c) 2007, Google Inc.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -262,10 +262,10 @@ const Opcode s_first_opcode_byte[] = {
/* 0xD5 */ { 0, IT_GENERIC, AM_I | OT_B, AM_NOT_USED, AM_NOT_USED, "aad", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
/* 0xD6 */ { 0, IT_UNUSED, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
/* 0xD7 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "xlat", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
-
+
// The following 8 lines would be references to the FPU tables, but we currently
// do not support the FPU instructions in this disassembler.
-
+
/* 0xD8 */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
/* 0xD9 */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
/* 0xDA */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
@@ -274,8 +274,8 @@ const Opcode s_first_opcode_byte[] = {
/* 0xDD */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
/* 0xDE */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
/* 0xDF */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
-
-
+
+
/* 0xE0 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "loopnz", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
/* 0xE1 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "loopz", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
/* 0xE2 */ { 0, IT_JUMP, AM_J | OT_B, AM_NOT_USED, AM_NOT_USED, "loop", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
@@ -587,7 +587,7 @@ const Opcode s_opcode_byte_after_0f[] = {
/* F3h */ { 0 },
/* 66h */ { 0, IT_GENERIC, AM_V | OT_DQ, AM_W | OT_DQ, AM_NOT_USED, "pcmpeqd" } },
/* 0x77 */ { 0, IT_GENERIC, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, "emms", false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
-
+
// The following six opcodes are escapes into the MMX stuff, which this disassembler does not support.
/* 0x78 */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
/* 0x79 */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
@@ -595,7 +595,7 @@ const Opcode s_opcode_byte_after_0f[] = {
/* 0x7B */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
/* 0x7C */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
/* 0x7D */ { 0, IT_UNKNOWN, AM_NOT_USED, AM_NOT_USED, AM_NOT_USED, 0, false, /* F2h */ { 0 }, /* F3h */ { 0 }, /* 66h */ { 0 } },
-
+
/* 0x7E */ { 0, IT_GENERIC, AM_E | OT_D, AM_P | OT_D, AM_NOT_USED, "movd", true,
/* F2h */ { 0 },
/* F3h */ { 0, IT_GENERIC, AM_V | OT_Q, AM_W | OT_Q, AM_NOT_USED, "movq" },
@@ -1160,27 +1160,27 @@ const OpcodeTable MiniDisassembler::s_ia32_opcode_map_[]={
/* 1 */ {s_opcode_byte_after_0f, 0, 0xff, 0, 0xff},
// Start of tables for opcodes using ModR/M bits as extension
/* 2 */ {s_opcode_byte_after_80, 3, 0x07, 0, 0x07},
- /* 3 */ {s_opcode_byte_after_81, 3, 0x07, 0, 0x07},
- /* 4 */ {s_opcode_byte_after_82, 3, 0x07, 0, 0x07},
- /* 5 */ {s_opcode_byte_after_83, 3, 0x07, 0, 0x07},
- /* 6 */ {s_opcode_byte_after_c0, 3, 0x07, 0, 0x07},
- /* 7 */ {s_opcode_byte_after_c1, 3, 0x07, 0, 0x07},
- /* 8 */ {s_opcode_byte_after_d0, 3, 0x07, 0, 0x07},
- /* 9 */ {s_opcode_byte_after_d1, 3, 0x07, 0, 0x07},
- /* 10 */ {s_opcode_byte_after_d2, 3, 0x07, 0, 0x07},
- /* 11 */ {s_opcode_byte_after_d3, 3, 0x07, 0, 0x07},
- /* 12 */ {s_opcode_byte_after_f6, 3, 0x07, 0, 0x07},
- /* 13 */ {s_opcode_byte_after_f7, 3, 0x07, 0, 0x07},
- /* 14 */ {s_opcode_byte_after_fe, 3, 0x07, 0, 0x01},
- /* 15 */ {s_opcode_byte_after_ff, 3, 0x07, 0, 0x07},
- /* 16 */ {s_opcode_byte_after_0f00, 3, 0x07, 0, 0x07},
- /* 17 */ {s_opcode_byte_after_0f01, 3, 0x07, 0, 0x07},
- /* 18 */ {s_opcode_byte_after_0f18, 3, 0x07, 0, 0x07},
- /* 19 */ {s_opcode_byte_after_0f71, 3, 0x07, 0, 0x07},
- /* 20 */ {s_opcode_byte_after_0f72, 3, 0x07, 0, 0x07},
- /* 21 */ {s_opcode_byte_after_0f73, 3, 0x07, 0, 0x07},
- /* 22 */ {s_opcode_byte_after_0fae, 3, 0x07, 0, 0x07},
- /* 23 */ {s_opcode_byte_after_0fba, 3, 0x07, 0, 0x07},
+ /* 3 */ {s_opcode_byte_after_81, 3, 0x07, 0, 0x07},
+ /* 4 */ {s_opcode_byte_after_82, 3, 0x07, 0, 0x07},
+ /* 5 */ {s_opcode_byte_after_83, 3, 0x07, 0, 0x07},
+ /* 6 */ {s_opcode_byte_after_c0, 3, 0x07, 0, 0x07},
+ /* 7 */ {s_opcode_byte_after_c1, 3, 0x07, 0, 0x07},
+ /* 8 */ {s_opcode_byte_after_d0, 3, 0x07, 0, 0x07},
+ /* 9 */ {s_opcode_byte_after_d1, 3, 0x07, 0, 0x07},
+ /* 10 */ {s_opcode_byte_after_d2, 3, 0x07, 0, 0x07},
+ /* 11 */ {s_opcode_byte_after_d3, 3, 0x07, 0, 0x07},
+ /* 12 */ {s_opcode_byte_after_f6, 3, 0x07, 0, 0x07},
+ /* 13 */ {s_opcode_byte_after_f7, 3, 0x07, 0, 0x07},
+ /* 14 */ {s_opcode_byte_after_fe, 3, 0x07, 0, 0x01},
+ /* 15 */ {s_opcode_byte_after_ff, 3, 0x07, 0, 0x07},
+ /* 16 */ {s_opcode_byte_after_0f00, 3, 0x07, 0, 0x07},
+ /* 17 */ {s_opcode_byte_after_0f01, 3, 0x07, 0, 0x07},
+ /* 18 */ {s_opcode_byte_after_0f18, 3, 0x07, 0, 0x07},
+ /* 19 */ {s_opcode_byte_after_0f71, 3, 0x07, 0, 0x07},
+ /* 20 */ {s_opcode_byte_after_0f72, 3, 0x07, 0, 0x07},
+ /* 21 */ {s_opcode_byte_after_0f73, 3, 0x07, 0, 0x07},
+ /* 22 */ {s_opcode_byte_after_0fae, 3, 0x07, 0, 0x07},
+ /* 23 */ {s_opcode_byte_after_0fba, 3, 0x07, 0, 0x07},
/* 24 */ {s_opcode_byte_after_0fc7, 3, 0x07, 0, 0x01}
};
diff --git a/tools/memory_watcher/memory_watcher.cc b/tools/memory_watcher/memory_watcher.cc
index d5e11db..9b6e3ed 100644
--- a/tools/memory_watcher/memory_watcher.cc
+++ b/tools/memory_watcher/memory_watcher.cc
@@ -99,7 +99,7 @@ void MemoryWatcher::OnTrack(HANDLE heap, int32 id, int32 size) {
AutoLock lock(block_map_lock_);
- // Ideally, we'd like to verify that the block being added
+ // Ideally, we'd like to verify that the block being added
// here is not already in our list of tracked blocks. However,
// the lookup in our hash table is expensive and slows us too
// much. Uncomment this line if you think you need it.
@@ -175,7 +175,7 @@ void MemoryWatcher::OnUntrack(HANDLE heap, int32 id, int32 size) {
void MemoryWatcher::SetLogName(char* log_name) {
if (!log_name)
return;
-
+
log_name_ = log_name;
}
diff --git a/tools/memory_watcher/memory_watcher.h b/tools/memory_watcher/memory_watcher.h
index f6281b5..d5a1d10 100644
--- a/tools/memory_watcher/memory_watcher.h
+++ b/tools/memory_watcher/memory_watcher.h
@@ -33,7 +33,7 @@ class MemoryWatcher : MemoryObserver {
// MemoryObserver interface.
virtual void OnTrack(HANDLE heap, int32 id, int32 size);
virtual void OnUntrack(HANDLE heap, int32 id, int32 size);
-
+
// Sets a name that appears in the generated file name.
void SetLogName(char* log_name);
diff --git a/tools/memory_watcher/mini_disassembler.cc b/tools/memory_watcher/mini_disassembler.cc
index 6b1dec8..a5fcf54 100644
--- a/tools/memory_watcher/mini_disassembler.cc
+++ b/tools/memory_watcher/mini_disassembler.cc
@@ -1,10 +1,10 @@
/* Copyright (c) 2007, Google Inc.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -110,7 +110,7 @@ void MiniDisassembler::Initialize() {
InstructionType MiniDisassembler::ProcessPrefixes(unsigned char* start_byte,
unsigned int& size) {
- InstructionType instruction_type = IT_GENERIC;
+ InstructionType instruction_type = IT_GENERIC;
const Opcode& opcode = s_ia32_opcode_map_[0].table_[*start_byte];
switch (opcode.type_) {
@@ -121,14 +121,14 @@ InstructionType MiniDisassembler::ProcessPrefixes(unsigned char* start_byte,
operand_is_32_bits_ = !operand_default_is_32_bits_;
nochangeoperand:
case IT_PREFIX:
-
+
if (0xF2 == (*start_byte))
got_f2_prefix_ = true;
else if (0xF3 == (*start_byte))
got_f3_prefix_ = true;
else if (0x66 == (*start_byte))
got_66_prefix_ = true;
-
+
instruction_type = opcode.type_;
size ++;
// we got a prefix, so add one and check next byte
@@ -146,7 +146,7 @@ InstructionType MiniDisassembler::ProcessOpcode(unsigned char* start_byte,
const OpcodeTable& table = s_ia32_opcode_map_[table_index]; // Get our table
unsigned char current_byte = (*start_byte) >> table.shift_;
current_byte = current_byte & table.mask_; // Mask out the bits we will use
-
+
// Check whether the byte we have is inside the table we have.
if (current_byte < table.min_lim_ || current_byte > table.max_lim_) {
instruction_type_ = IT_UNKNOWN;
@@ -234,10 +234,10 @@ bool MiniDisassembler::ProcessOperand(int flag_operand) {
case AM_F: // EFLAGS register
case AM_X: // Memory addressed by the DS:SI register pair
case AM_Y: // Memory addressed by the ES:DI register pair
- case AM_IMPLICIT: // Parameter is implicit, occupies no space in
+ case AM_IMPLICIT: // Parameter is implicit, occupies no space in
// instruction
break;
-
+
// There is a ModR/M byte but it does not necessarily need
// to be decoded.
case AM_C: // reg field of ModR/M selects a control register
@@ -250,20 +250,20 @@ bool MiniDisassembler::ProcessOperand(int flag_operand) {
case AM_V: // reg field of ModR/M selects a 128-bit XMM register
have_modrm_ = true;
break;
-
+
// In these addressing modes, there is a ModR/M byte and it needs to be
// decoded. No other (e.g. immediate) params than indicated in ModR/M.
- case AM_E: // Operand is either a general-purpose register or memory,
+ case AM_E: // Operand is either a general-purpose register or memory,
// specified by ModR/M byte
case AM_M: // ModR/M byte will refer only to memory
- case AM_Q: // Operand is either an MMX register or memory (complex
+ case AM_Q: // Operand is either an MMX register or memory (complex
// evaluation), specified by ModR/M byte
- case AM_W: // Operand is either a 128-bit XMM register or memory (complex
+ case AM_W: // Operand is either a 128-bit XMM register or memory (complex
// eval), specified by ModR/M byte
have_modrm_ = true;
should_decode_modrm_ = true;
break;
-
+
// These addressing modes specify an immediate or an offset value
// directly, so we need to look at the operand type to see how many
// bytes.
@@ -286,7 +286,7 @@ bool MiniDisassembler::ProcessOperand(int flag_operand) {
case OT_DQ: // Double-quadword, regardless of operand-size attribute.
operand_bytes_ += OS_DOUBLE_QUAD_WORD;
break;
- case OT_P: // 32-bit or 48-bit pointer, depending on operand-size
+ case OT_P: // 32-bit or 48-bit pointer, depending on operand-size
// attribute.
if (operand_is_32_bits_)
operand_bytes_ += OS_48_BIT_POINTER;
@@ -307,9 +307,9 @@ bool MiniDisassembler::ProcessOperand(int flag_operand) {
operand_bytes_ += OS_DOUBLE_PRECISION_FLOATING;
break;
case OT_SS:
- // Scalar element of a 128-bit packed single-precision
+ // Scalar element of a 128-bit packed single-precision
// floating data.
- // We simply return enItUnknown since we don't have to support
+ // We simply return enItUnknown since we don't have to support
// floating point
succeeded = false;
break;
@@ -322,19 +322,19 @@ bool MiniDisassembler::ProcessOperand(int flag_operand) {
case OT_W: // Word, regardless of operand-size attribute.
operand_bytes_ += OS_WORD;
break;
-
+
// Can safely ignore these.
- case OT_A: // Two one-word operands in memory or two double-word
+ case OT_A: // Two one-word operands in memory or two double-word
// operands in memory
case OT_PI: // Quadword MMX technology register (e.g. mm0)
case OT_SI: // Doubleword integer register (e.g., eax)
break;
-
+
default:
break;
}
break;
-
+
default:
break;
}
@@ -342,7 +342,7 @@ bool MiniDisassembler::ProcessOperand(int flag_operand) {
return succeeded;
}
-bool MiniDisassembler::ProcessModrm(unsigned char* start_byte,
+bool MiniDisassembler::ProcessModrm(unsigned char* start_byte,
unsigned int& size) {
// If we don't need to decode, we just return the size of the ModR/M
// byte (there is never a SIB byte in this case).
@@ -372,7 +372,7 @@ bool MiniDisassembler::ProcessModrm(unsigned char* start_byte,
// Invariant: modrm_entry points to information that we need to decode
// the ModR/M byte.
-
+
// Add to the count of operand bytes, if the ModR/M byte indicates
// that some operands are encoded in the instruction.
if (modrm_entry->is_encoded_in_instruction_)
@@ -389,8 +389,8 @@ bool MiniDisassembler::ProcessModrm(unsigned char* start_byte,
}
}
-bool MiniDisassembler::ProcessSib(unsigned char* start_byte,
- unsigned char mod,
+bool MiniDisassembler::ProcessSib(unsigned char* start_byte,
+ unsigned char mod,
unsigned int& size) {
// get the mod field from the 2..0 bits of the SIB byte
unsigned char sib_base = (*start_byte) & 0x07;
diff --git a/tools/memory_watcher/mini_disassembler.h b/tools/memory_watcher/mini_disassembler.h
index 8af2c42..1a75c54 100644
--- a/tools/memory_watcher/mini_disassembler.h
+++ b/tools/memory_watcher/mini_disassembler.h
@@ -1,10 +1,10 @@
/* Copyright (c) 2007, Google Inc.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -51,8 +51,8 @@ namespace sidestep {
//
// The limitations include at least the following:
// -# No support for coprocessor opcodes, MMX, etc.
-// -# No machine-readable identification of opcodes or decoding of
-// assembly parameters. The name of the opcode (as a string) is given,
+// -# No machine-readable identification of opcodes or decoding of
+// assembly parameters. The name of the opcode (as a string) is given,
// however, to aid debugging.
//
// You may ask what this little disassembler actually does, then? The answer is
@@ -115,8 +115,8 @@ class MiniDisassembler {
// Sets the flag for whether we have ModR/M, and increments
// operand_bytes_ if any are specifies by the opcode directly.
// @return Number of opcode bytes.
- InstructionType ProcessOpcode(unsigned char * start,
- unsigned int table,
+ InstructionType ProcessOpcode(unsigned char * start,
+ unsigned int table,
unsigned int& size);
// Checks the type of the supplied operand. Increments
diff --git a/tools/memory_watcher/mini_disassembler_types.h b/tools/memory_watcher/mini_disassembler_types.h
index 3abc85d..d4fef2a 100644
--- a/tools/memory_watcher/mini_disassembler_types.h
+++ b/tools/memory_watcher/mini_disassembler_types.h
@@ -1,10 +1,10 @@
/* Copyright (c) 2007, Google Inc.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -81,7 +81,7 @@ enum OperandSize {
// is a mask for the rest. The other enumeration values are named for the
// names given to the addressing methods in the manual, e.g. enAm_D is for
// the D addressing method.
-//
+//
// The reason we use a full 4 bytes and a mask, is that we need to combine
// these flags with the enOperandType to store the details
// on the operand in a single integer.
@@ -137,7 +137,7 @@ enum OperandType {
OT_W = 0x0E000000,
OT_SD = 0x0F000000, // scalar double-precision floating-point value
OT_PD = 0x10000000, // double-precision floating point
- // dummy "operand type" for address mode M - which doesn't specify
+ // dummy "operand type" for address mode M - which doesn't specify
// operand type
OT_ADDRESS_MODE_M = 0x80000000
};
@@ -147,7 +147,7 @@ enum OperandType {
struct SpecificOpcode {
// Index to continuation table, or 0 if this is the last
// byte in the opcode.
- int table_index_;
+ int table_index_;
// The opcode type
InstructionType type_;
@@ -168,7 +168,7 @@ struct SpecificOpcode {
struct Opcode {
// Index to continuation table, or 0 if this is the last
// byte in the opcode.
- int table_index_;
+ int table_index_;
// The opcode type
InstructionType type_;
diff --git a/tools/memory_watcher/preamble_patcher.cc b/tools/memory_watcher/preamble_patcher.cc
index 2beb555..78dbc7e 100644
--- a/tools/memory_watcher/preamble_patcher.cc
+++ b/tools/memory_watcher/preamble_patcher.cc
@@ -1,10 +1,10 @@
/* Copyright (c) 2007, Google Inc.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -64,9 +64,9 @@ SideStepError PreamblePatcher::RawPatchWithStubAndProtections(
return SIDESTEP_ACCESS_DENIED;
}
- SideStepError error_code = RawPatchWithStub(target_function,
- replacement_function,
- preamble_stub,
+ SideStepError error_code = RawPatchWithStub(target_function,
+ replacement_function,
+ preamble_stub,
stub_size,
bytes_needed);
if (SIDESTEP_SUCCESS != error_code) {
@@ -76,9 +76,9 @@ SideStepError PreamblePatcher::RawPatchWithStubAndProtections(
// Restore the protection of the first MAX_PREAMBLE_STUB_SIZE bytes of
// pTargetFunction to what they were before we started goofing around.
- succeeded = ::VirtualProtect(reinterpret_cast<void*>(target_function),
- MAX_PREAMBLE_STUB_SIZE,
- old_target_function_protect,
+ succeeded = ::VirtualProtect(reinterpret_cast<void*>(target_function),
+ MAX_PREAMBLE_STUB_SIZE,
+ old_target_function_protect,
&old_target_function_protect);
if (!succeeded) {
ASSERT(false, "Failed to restore protection to target function.");
@@ -94,8 +94,8 @@ SideStepError PreamblePatcher::RawPatchWithStubAndProtections(
// XP machines. I'm not sure why this is so, but it is, yet I want to keep the
// call to the API here for correctness in case there is a difference in
// some variants of Windows/hardware.
- succeeded = ::FlushInstructionCache(::GetCurrentProcess(),
- target_function,
+ succeeded = ::FlushInstructionCache(::GetCurrentProcess(),
+ target_function,
MAX_PREAMBLE_STUB_SIZE);
if (!succeeded) {
ASSERT(false, "Failed to flush instruction cache.");
@@ -116,9 +116,9 @@ SideStepError PreamblePatcher::RawPatch(void* target_function,
return SIDESTEP_INVALID_PARAMETER;
}
- // @see MAX_PREAMBLE_STUB_SIZE for an explanation of how we arrives at
+ // @see MAX_PREAMBLE_STUB_SIZE for an explanation of how we arrives at
// this size
- unsigned char* preamble_stub =
+ unsigned char* preamble_stub =
reinterpret_cast<unsigned char*>(
MemoryHook::Alloc(sizeof(unsigned char) * MAX_PREAMBLE_STUB_SIZE));
if (!preamble_stub) {
@@ -139,9 +139,9 @@ SideStepError PreamblePatcher::RawPatch(void* target_function,
return SIDESTEP_ACCESS_DENIED;
}
- SideStepError error_code = RawPatchWithStubAndProtections(target_function,
- replacement_function,
- preamble_stub,
+ SideStepError error_code = RawPatchWithStubAndProtections(target_function,
+ replacement_function,
+ preamble_stub,
MAX_PREAMBLE_STUB_SIZE,
NULL);
if (SIDESTEP_SUCCESS != error_code) {
@@ -149,14 +149,14 @@ SideStepError PreamblePatcher::RawPatch(void* target_function,
delete[] preamble_stub;
return error_code;
}
-
+
*original_function_stub = reinterpret_cast<void*>(preamble_stub);
- // NOTE: For hooking malloc/free, we don't want to use streams which
- // allocate. Basically, we've hooked malloc, but not necessarily
+ // NOTE: For hooking malloc/free, we don't want to use streams which
+ // allocate. Basically, we've hooked malloc, but not necessarily
// hooked free yet. To do anything which uses the heap could crash
// with a mismatched malloc/free!
- //LOG(INFO) << "PreamblePatcher::RawPatch successfully patched 0x" <<
+ //LOG(INFO) << "PreamblePatcher::RawPatch successfully patched 0x" <<
// target_function;
return SIDESTEP_SUCCESS;
@@ -175,7 +175,7 @@ SideStepError PreamblePatcher::Unpatch(void* target_function,
MiniDisassembler disassembler;
unsigned int preamble_bytes = 0;
while (preamble_bytes < 5) {
- InstructionType instruction_type =
+ InstructionType instruction_type =
disassembler.Disassemble(
reinterpret_cast<unsigned char*>(original_function_stub) + preamble_bytes,
preamble_bytes);
@@ -234,17 +234,17 @@ SideStepError PreamblePatcher::Unpatch(void* target_function,
// Restore the protection of the first MAX_PREAMBLE_STUB_SIZE bytes of
// target to what they were before we started goofing around.
- succeeded = ::VirtualProtect(reinterpret_cast<void*>(target),
- MAX_PREAMBLE_STUB_SIZE,
- old_target_function_protect,
+ succeeded = ::VirtualProtect(reinterpret_cast<void*>(target),
+ MAX_PREAMBLE_STUB_SIZE,
+ old_target_function_protect,
&old_target_function_protect);
// Flush the instruction cache to make sure the processor doesn't execute the
// old version of the instructions (before our patch).
//
// See comment on FlushInstructionCache elsewhere in this file.
- succeeded = ::FlushInstructionCache(::GetCurrentProcess(),
- target,
+ succeeded = ::FlushInstructionCache(::GetCurrentProcess(),
+ target,
MAX_PREAMBLE_STUB_SIZE);
if (!succeeded) {
ASSERT(false, "Failed to flush instruction cache.");
diff --git a/tools/memory_watcher/preamble_patcher.h b/tools/memory_watcher/preamble_patcher.h
index eafe88a..ccacb72 100644
--- a/tools/memory_watcher/preamble_patcher.h
+++ b/tools/memory_watcher/preamble_patcher.h
@@ -1,10 +1,10 @@
/* Copyright (c) 2007, Google Inc.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -46,7 +46,7 @@
// bytes of the function. Considering the worst case scenario, we need 4
// bytes + the max instruction size + 5 more bytes for our jump back to
// the original code. With that in mind, 32 is a good number :)
-#define MAX_PREAMBLE_STUB_SIZE (32)
+#define MAX_PREAMBLE_STUB_SIZE (32)
namespace sidestep {
@@ -77,28 +77,28 @@ enum SideStepError {
// See the TODO in preamble_patcher_with_stub.cc for instructions on what
// we need to do before using it in production code; it's fairly simple
// but unnecessary for now since we only intend to use it in unit tests.
-//
+//
// To patch a function, use either of the typesafe Patch() methods. You
// can unpatch a function using Unpatch().
-//
+//
// Typical usage goes something like this:
// @code
// typedef int (*MyTypesafeFuncPtr)(int x);
// MyTypesafeFuncPtr original_func_stub;
// int MyTypesafeFunc(int x) { return x + 1; }
// int HookMyTypesafeFunc(int x) { return 1 + original_func_stub(x); }
-//
+//
// void MyPatchInitializingFunction() {
// original_func_stub = PreamblePatcher::Patch(
// MyTypesafeFunc, HookMyTypesafeFunc);
// if (!original_func_stub) {
// // ... error handling ...
// }
-//
+//
// // ... continue - you have patched the function successfully ...
// }
// @endcode
-//
+//
// Note that there are a number of ways that this method of patching can
// fail. The most common are:
// - If there is a jump (jxx) instruction in the first 5 bytes of
@@ -113,7 +113,7 @@ enum SideStepError {
// - If there is another thread currently executing within the bytes
// that are copied to the preamble stub, it will crash in an undefined
// way.
-//
+//
// If you get any other error than the above, you're either pointing the
// patcher at an invalid instruction (e.g. into the middle of a multi-
// byte instruction, or not at memory containing executable instructions)
@@ -286,9 +286,9 @@ class PreamblePatcher {
// exactly the same calling convention and parameters as the original
// function.
//
- // @param preamble_stub A pointer to a buffer where the preamble stub
+ // @param preamble_stub A pointer to a buffer where the preamble stub
// should be copied. The size of the buffer should be sufficient to
- // hold the preamble bytes.
+ // hold the preamble bytes.
//
// @param stub_size Size in bytes of the buffer allocated for the
// preamble_stub
@@ -298,19 +298,19 @@ class PreamblePatcher {
// not interested.
//
// @return An error code indicating the result of patching.
- static SideStepError RawPatchWithStubAndProtections(void* target_function,
- void *replacement_function,
- unsigned char* preamble_stub,
- unsigned long stub_size,
+ static SideStepError RawPatchWithStubAndProtections(void* target_function,
+ void *replacement_function,
+ unsigned char* preamble_stub,
+ unsigned long stub_size,
unsigned long* bytes_needed);
// A helper function used by RawPatchWithStubAndProtections -- it does
// everything but the VirtualProtect wsork. Defined in
// preamble_patcher_with_stub.cc.
- static SideStepError RawPatchWithStub(void* target_function,
- void *replacement_function,
- unsigned char* preamble_stub,
- unsigned long stub_size,
+ static SideStepError RawPatchWithStub(void* target_function,
+ void *replacement_function,
+ unsigned char* preamble_stub,
+ unsigned long stub_size,
unsigned long* bytes_needed);
};
diff --git a/tools/memory_watcher/preamble_patcher_with_stub.cc b/tools/memory_watcher/preamble_patcher_with_stub.cc
index d2ce6af..dc38872 100644
--- a/tools/memory_watcher/preamble_patcher_with_stub.cc
+++ b/tools/memory_watcher/preamble_patcher_with_stub.cc
@@ -1,10 +1,10 @@
/* Copyright (c) 2007, Google Inc.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/tools/purify/chrome_tests.py b/tools/purify/chrome_tests.py
index 6831fa06..a9ce16c 100644
--- a/tools/purify/chrome_tests.py
+++ b/tools/purify/chrome_tests.py
@@ -66,7 +66,7 @@ class ChromeTests:
# On the buildbot, we archive to a specific location on chrome-web
# with a directory based on the test name and the current svn revision.
# NOTE: These modules are located in trunk/tools/buildbot, which is not
- # in the default config. You'll need to check this out and add
+ # in the default config. You'll need to check this out and add
# scripts/* to your PYTHONPATH to test outside of the buildbot.
import slave_utils
import chromium_config
@@ -79,7 +79,7 @@ class ChromeTests:
os.makedirs(self._report_dir)
purify_test = os.path.join(script_dir, "purify_test.py")
- self._command_preamble = ["python.exe", purify_test, "--echo_to_stdout",
+ self._command_preamble = ["python.exe", purify_test, "--echo_to_stdout",
"--source_dir=%s" % (self._source_dir),
"--save_cache"]
@@ -131,7 +131,7 @@ class ChromeTests:
''' Runs the test specified by command-line argument --test '''
logging.info("running test %s" % (self._test))
return self._test_list[self._test]()
-
+
def _ReadGtestFilterFile(self, name, cmd):
'''Read a file which is a list of tests to filter out with --gtest_filter
and append the command-line option to cmd.
@@ -170,13 +170,13 @@ class ChromeTests:
def ScriptedTest(self, module, exe, name, script, multi=False, cmd_args=None,
out_dir_extra=None):
- '''Purify a target exe, which will be executed one or more times via a
+ '''Purify a target exe, which will be executed one or more times via a
script or driver program.
Args:
module - which top level component this test is from (webkit, base, etc.)
exe - the name of the exe (it's assumed to exist in build_dir)
name - the name of this test (used to name output files)
- script - the driver program or script. If it's python.exe, we use
+ script - the driver program or script. If it's python.exe, we use
search-path behavior to execute, otherwise we assume that it is in
build_dir.
multi - a boolean hint that the exe will be run multiple times, generating
@@ -227,7 +227,7 @@ class ChromeTests:
def TestIpc(self):
return self.SimpleTest("chrome", "ipc_tests.exe")
-
+
def TestNet(self):
return self.SimpleTest("net", "net_unittests.exe")
@@ -245,8 +245,8 @@ class ChromeTests:
# runs a slice of the layout tests of size chunk_size that increments with
# each run. Since tests can be added and removed from the layout tests at
# any time, this is not going to give exact coverage, but it will allow us
- # to continuously run small slices of the layout tests under purify rather
- # than having to run all of them in one shot.
+ # to continuously run small slices of the layout tests under purify rather
+ # than having to run all of them in one shot.
chunk_num = 0
# Tests currently seem to take about 20-30s each.
chunk_size = 120 # so about 40-60 minutes per run
@@ -265,7 +265,7 @@ class ChromeTests:
chunk_num = 0
f.close()
except IOError, (errno, strerror):
- logging.error("error reading from file %s (%d, %s)" % (chunk_file,
+ logging.error("error reading from file %s (%d, %s)" % (chunk_file,
errno, strerror))
script = os.path.join(self._source_dir, "webkit", "tools", "layout_tests",
@@ -282,7 +282,7 @@ class ChromeTests:
script_cmd.append("--test-list=%s" % self._args[0])
else:
script_cmd.extend(self._args)
-
+
if run_all:
ret = self.ScriptedTest("webkit", "test_shell.exe", "layout",
script_cmd, multi=True, cmd_args=["--timeout=0"])
@@ -323,7 +323,7 @@ class ChromeTests:
instrumentation_error = self.InstrumentDll()
if instrumentation_error:
return instrumentation_error
- return self.ScriptedTest("chrome", "chrome.exe", "ui_tests",
+ return self.ScriptedTest("chrome", "chrome.exe", "ui_tests",
["ui_tests.exe",
"--single-process",
"--ui-test-timeout=180000",
@@ -351,7 +351,7 @@ def _main(argv):
help="Don't force a re-instrumentation for ui_tests")
parser.add_option("", "--run-singly", action="store_true", default=False,
help="run tests independently of each other so that they "
- "don't interfere with each other and so that errors "
+ "don't interfere with each other and so that errors "
"can be accurately attributed to their source");
parser.add_option("", "--report_dir",
help="path where report files are saved")
diff --git a/tools/purify/common.py b/tools/purify/common.py
index 9bd55ae..102c4af6 100644
--- a/tools/purify/common.py
+++ b/tools/purify/common.py
@@ -10,17 +10,17 @@ running of Rational Purify and Quantify in a consistent manner.
"""
# Purify and Quantify have a front-end (e.g. quantifyw.exe) which talks to a
-# back-end engine (e.g. quantifye.exe). The back-end seems to handle
-# instrumentation, while the front-end controls program execution and
+# back-end engine (e.g. quantifye.exe). The back-end seems to handle
+# instrumentation, while the front-end controls program execution and
# measurement. The front-end will dynamically launch the back-end if
-# instrumentation is needed (sometimes in the middle of a run if a dll is
+# instrumentation is needed (sometimes in the middle of a run if a dll is
# loaded dynamically).
# In an ideal world, this script would simply execute the front-end and check
# the output. However, purify is not the most reliable or well-documented app
# on the planet, and my attempts to get it to run this way led to the back-end
# engine hanging during instrumentation. The workaround to this was to run two
-# passes, first running the engine to do instrumentation rather than letting
-# the front-end do it for you, then running the front-end to actually do the
+# passes, first running the engine to do instrumentation rather than letting
+# the front-end do it for you, then running the front-end to actually do the
# run. Each time through we're deleting all of the instrumented files in the
# cache to ensure that we're testing that instrumentation works from scratch.
# (although this can be changed with an option)
@@ -60,7 +60,7 @@ def _print_line(line, flush=True):
def RunSubprocess(proc, timeout=0, detach=False):
""" Runs a subprocess, until it finishes or |timeout| is exceeded and the
process is killed with taskkill. A |timeout| <= 0 means no timeout.
-
+
Args:
proc: list of process components (exe + args)
timeout: how long to wait before killing, <= 0 means wait forever
@@ -156,13 +156,13 @@ class Rational(object):
common argument parsing as well as the general program flow of Instrument,
Execute, Analyze.
'''
-
+
def __init__(self):
google.logging_utils.config_root()
self._out_file = None
def Run(self):
- '''Call this to run through the whole process:
+ '''Call this to run through the whole process:
Setup, Instrument, Execute, Analyze'''
start = datetime.datetime.now()
retcode = -1
@@ -208,7 +208,7 @@ class Rational(object):
parser.add_option("-o", "--out_file", dest="out_file", metavar="OUTFILE",
default="",
help="output data is written to OUTFILE")
- parser.add_option("-s", "--save_cache",
+ parser.add_option("-s", "--save_cache",
dest="save_cache", action="store_true", default=False,
help="don't delete instrumentation cache")
parser.add_option("-c", "--cache_dir", dest="cache_dir", metavar="CACHEDIR",
@@ -231,10 +231,10 @@ class Rational(object):
if self.ParseArgv():
logging.info("instrumentation cache in %s" % self._cache_dir)
logging.info("output saving to %s" % self._out_file)
- # Ensure that Rational's common dir and cache dir are in the front of the
+ # Ensure that Rational's common dir and cache dir are in the front of the
# path. The common dir is required for purify to run in any case, and
# the cache_dir is required when using the /Replace=yes option.
- os.environ["PATH"] = (COMMON_PATH + ";" + self._cache_dir + ";" +
+ os.environ["PATH"] = (COMMON_PATH + ";" + self._cache_dir + ";" +
os.environ["PATH"])
# clear the cache to make sure we're starting clean
self.__ClearInstrumentationCache()
@@ -262,7 +262,7 @@ class Rational(object):
return False
def Execute(self, proc):
- ''' Execute the app to be tested after successful instrumentation.
+ ''' Execute the app to be tested after successful instrumentation.
Full execution command-line provided by subclassers via proc.'''
logging.info("starting execution...")
# note that self._args begins with the exe to be run
@@ -330,5 +330,5 @@ class Rational(object):
try:
os.remove(file)
except:
- logging.warning("unable to delete file %s: %s" % (file,
+ logging.warning("unable to delete file %s: %s" % (file,
sys.exc_info()[0]))
diff --git a/tools/purify/purify_analyze.py b/tools/purify/purify_analyze.py
index 70a3610..2c02b0c 100644
--- a/tools/purify/purify_analyze.py
+++ b/tools/purify/purify_analyze.py
@@ -70,7 +70,7 @@ class MemoryTreeNode(object):
return root
def __init__(self, function, bytes, blocks):
- '''
+ '''
Args:
function: A string representing a unique method or function.
bytes: initial number of bytes allocated in this node
@@ -105,15 +105,15 @@ class MemoryTreeNode(object):
(other._bytes, other._blocks, other._function))
def __str__(self):
- return "(%d bytes, %d blocks, %d allocs) %s" % (
+ return "(%d bytes, %d blocks, %d allocs) %s" % (
self._bytes, self._blocks, self._allocs, self._function)
def PrintRecursive(self, padding="", byte_filter=0):
'''Print the tree and all of its children recursively (depth-first). All
nodes at a given level of the tree are sorted in descending order by size.
-
+
Args:
- padding: Printed at the front of the line. Each recursive call adds a
+ padding: Printed at the front of the line. Each recursive call adds a
single space character.
byte_filter: a number of bytes below which we'll prune the tree
'''
@@ -174,7 +174,7 @@ class PurifyAnalyze:
# A symbolic name for the run being analyzed, often the name of the
# exe which was purified.
self._name = name
-
+
# The top of the source code tree of the code we're analyzing.
# This prefix is stripped from all filenames in stacks for normalization.
if source_dir:
@@ -224,7 +224,7 @@ class PurifyAnalyze:
return False
# check ignore patterns against title and top-most visible stack frames
- strings = [msg._title]
+ strings = [msg._title]
err = msg.GetErrorStack()
if err:
line = err.GetTopVisibleStackLine().get('function', None)
@@ -403,7 +403,7 @@ class PurifyAnalyze:
# Purify output should never end with a real message
if message:
logging.error("Unexpected message at end of file %s" % file)
-
+
return fatal_errors == 0
def GetMessageList(self, key):
@@ -433,13 +433,13 @@ class PurifyAnalyze:
count = 0
for msg in all:
count += msg._count
- self._PrintAndSave("%s(%s) unique:%d total:%d" % (self._name,
+ self._PrintAndSave("%s(%s) unique:%d total:%d" % (self._name,
purify_message.GetMessageType(key), len(unique), count), file)
if key not in ["MIU"]:
ignore_file = "%s_%s_ignore.txt" % (self._name, key)
ignore_hashes = self._MessageHashesFromFile(ignore_file)
ignored = 0
-
+
groups = list.UniqueMessageGroups()
group_keys = groups.keys()
group_keys.sort(cmp=lambda x,y: len(groups[y]) - len(groups[x]))
@@ -449,11 +449,11 @@ class PurifyAnalyze:
ignored += len(groups[group]) - len(kept_msgs)
groups[group] = kept_msgs
if ignored:
- self._PrintAndSave("%s(%s) ignored:%d" % (self._name,
+ self._PrintAndSave("%s(%s) ignored:%d" % (self._name,
purify_message.GetMessageType(key), ignored), file)
total = reduce(lambda x, y: x + len(groups[y]), group_keys, 0)
if total:
- self._PrintAndSave("%s(%s) group summary:" % (self._name,
+ self._PrintAndSave("%s(%s) group summary:" % (self._name,
purify_message.GetMessageType(key)), file)
self._PrintAndSave(" TOTAL: %d" % total, file)
for group in group_keys:
@@ -491,7 +491,7 @@ class PurifyAnalyze:
for sublist in sublists:
tree = MemoryTreeNode.CreateTree(sublist)
trees.append(tree)
-
+
# while the tree is a hierarchical assignment from the root/bottom of the
# stack down, the summary is simply adding the total of the top-most
# stack item from our code
@@ -550,7 +550,7 @@ class PurifyAnalyze:
sys.stderr.flush()
sys.stdout.flush()
logging.info("summary of Purify bugs:")
-
+
# This is a specialized set of counters for unit tests, with some
# unfortunate hard-coded knowledge.
test_counts = {}
@@ -596,7 +596,7 @@ class PurifyAnalyze:
prog_args = prog.split(" ")
arg_prefix = "--test-name="
test_name = "UNKNOWN"
- for arg in prog_args:
+ for arg in prog_args:
index = arg.find(arg_prefix)
if index >= 0:
test_name = arg[len(arg_prefix):]
@@ -636,7 +636,7 @@ class PurifyAnalyze:
def SaveStrings(self, string_list, key, fname_extra=""):
'''Output a list of strings to a file in the report dir.
'''
- out = os.path.join(self._report_dir,
+ out = os.path.join(self._report_dir,
"%s_%s%s.txt" % (self._name, key, fname_extra))
logging.info("saving %s" % (out))
try:
@@ -778,7 +778,7 @@ class PurifyAnalyze:
# type of message which is used to generate filenames and descriptive
# error messages
type_name = "%s_%s" % (self._name, type)
-
+
# open the baseline file to compare against
baseline_file = "%s.txt" % type_name
baseline_hashes = self._MessageHashesFromFile(baseline_file)
@@ -795,7 +795,7 @@ class PurifyAnalyze:
current_list = self.GetMessageList(type)
if current_list:
# Since we're looking at the list of unique messages,
- # if the number of occurrances of a given unique message
+ # if the number of occurrances of a given unique message
# changes, it won't show up as an error.
current_messages = current_list.UniqueMessages()
else:
@@ -825,10 +825,10 @@ class PurifyAnalyze:
len(type_errors), len(type_fixes)))
if len(type_errors):
- strs = [current_hashes[x].NormalizedStr(verbose=True)
+ strs = [current_hashes[x].NormalizedStr(verbose=True)
for x in type_errors]
logging.error("%d new '%s(%s)' errors found\n%s" % (len(type_errors),
- purify_message.GetMessageType(type), type,
+ purify_message.GetMessageType(type), type,
'\n'.join(strs)))
strs = [current_hashes[x].NormalizedStr() for x in type_errors]
self.SaveStrings(strs, type, "_NEW")
@@ -838,7 +838,7 @@ class PurifyAnalyze:
# we don't have access to the original message, so all we can do is log
# the non-verbose normalized text
logging.warning("%d new '%s(%s)' unexpected fixes found\n%s" % (
- len(type_fixes), purify_message.GetMessageType(type),
+ len(type_fixes), purify_message.GetMessageType(type),
type, '\n'.join(type_fixes)))
self.SaveStrings(type_fixes, type, "_FIXED")
fixes += len(type_fixes)
@@ -872,10 +872,10 @@ def _main():
parser = optparse.OptionParser("usage: %prog [options] <files to analyze>")
parser.add_option("-b", "--baseline", action="store_true", default=False,
help="save output to baseline files")
- parser.add_option("-m", "--memory_in_use",
+ parser.add_option("-m", "--memory_in_use",
action="store_true", default=False,
help="print memory in use summary")
- parser.add_option("", "--validate",
+ parser.add_option("", "--validate",
action="store_true", default=False,
help="validate results vs. baseline")
parser.add_option("-e", "--echo_to_stdout",
@@ -908,7 +908,7 @@ def _main():
google.logging_utils.config_root(level=logging.DEBUG)
else:
google.logging_utils.config_root(level=logging.INFO)
- pa = PurifyAnalyze(filenames, options.echo_to_stdout, options.name,
+ pa = PurifyAnalyze(filenames, options.echo_to_stdout, options.name,
options.source_dir, options.data_dir, options.report_dir)
execute_crash = not pa.ReadFile()
if options.bug_report:
@@ -934,6 +934,6 @@ def _main():
sys.exit(retcode)
if __name__ == "__main__":
- _main()
+ _main()
diff --git a/tools/purify/purify_coverage.py b/tools/purify/purify_coverage.py
index e2fef1c..e88af50 100644
--- a/tools/purify/purify_coverage.py
+++ b/tools/purify/purify_coverage.py
@@ -43,16 +43,16 @@ class PurifyCoverage(common.Rational):
self._name = os.path.basename(self._exe)
# _out_file can be set in common.Rational.ParseArgv
if not self._out_file:
- self._out_file = os.path.join(self._latest_dir,
+ self._out_file = os.path.join(self._latest_dir,
"%s_coverage.txt" % (self._name))
self._source_dir = self._options.source_dir
return True
return False
-
+
def _PurifyCommand(self):
- cmd = [common.PURIFYW_PATH, "/CacheDir=" + self._cache_dir,
+ cmd = [common.PURIFYW_PATH, "/CacheDir=" + self._cache_dir,
"/ShowInstrumentationProgress=no", "/ShowLoadLibraryProgress=no",
- "/AllocCallStackLength=30", "/Coverage",
+ "/AllocCallStackLength=30", "/Coverage",
"/CoverageDefaultInstrumentationType=line"]
return cmd
@@ -62,7 +62,7 @@ class PurifyCoverage(common.Rational):
cmd.append("/Run=no")
cmd.append(os.path.abspath(self._exe))
return common.Rational.Instrument(self, cmd)
-
+
def Execute(self):
cmd = self._PurifyCommand()
cmd.append("/SaveTextData=" + self._out_file)
diff --git a/tools/purify/purify_inuse.py b/tools/purify/purify_inuse.py
index ed708a7..12d13f2 100644
--- a/tools/purify/purify_inuse.py
+++ b/tools/purify/purify_inuse.py
@@ -50,9 +50,9 @@ class PurifyInUse(common.Rational):
self._byte_filter = int(self._options.byte_filter)
return True
return False
-
+
def _PurifyCommand(self):
- cmd = [common.PURIFYW_PATH, "/CacheDir=" + self._cache_dir,
+ cmd = [common.PURIFYW_PATH, "/CacheDir=" + self._cache_dir,
"/ShowInstrumentationProgress=no", "/ShowLoadLibraryProgress=no",
"/AllocCallStackLength=30", "/ErrorCallStackLength=30",
"/LeaksAtExit=no", "/InUseAtExit=yes"]
@@ -64,7 +64,7 @@ class PurifyInUse(common.Rational):
cmd.append("/Run=no")
cmd.append(os.path.abspath(self._exe))
return common.Rational.Instrument(self, cmd)
-
+
def Execute(self):
cmd = self._PurifyCommand()
cmd.append("/SaveTextData=" + self._out_file)
@@ -74,7 +74,7 @@ class PurifyInUse(common.Rational):
if not os.path.isfile(self._out_file):
logging.info("no output file %s" % self._out_file)
return -1
- pa = purify_analyze.PurifyAnalyze(self._out_file, False,
+ pa = purify_analyze.PurifyAnalyze(self._out_file, False,
self._name, self._source_dir)
if not pa.ReadFile():
logging.warning("inuse summary suspect due to fatal error during run")
diff --git a/tools/purify/purify_message.py b/tools/purify/purify_message.py
index 9ff107f..83ed039 100644
--- a/tools/purify/purify_message.py
+++ b/tools/purify/purify_message.py
@@ -117,7 +117,7 @@ class Stack:
# if functions match the following, elide them from the stack
pat_func_elide = (re.compile('^std::'), re.compile('^new\('))
# if files match the following, elide them from the stack
- pat_file_elide = (re.compile('.*platformsdk_win2008.*'),
+ pat_file_elide = (re.compile('.*platformsdk_win2008.*'),
re.compile('.*.(dll|DLL)$'),
# bug 1069902
re.compile('webkit/pending/wtf/fastmalloc\.h'),
@@ -162,7 +162,7 @@ class Stack:
(e.g. group.subgroup.subsubgroup)
'''
return self._group;
-
+
def _ComputeStackLine(self, line):
line = line.lstrip()
m = Stack.pat_stack_line.match(line)
@@ -249,7 +249,7 @@ class Stack:
self._stack.append(stack_line)
self._eliding = False
self._all_external = False
-
+
# when we reach one of the known common stack entry points, truncate
# the stack to avoid printing overly redundant information
if len(self._stack) > 1:
@@ -313,7 +313,7 @@ class Stack:
len_self = len(self._stack)
len_other = len(other._stack)
min_len = min(len_self, len_other)
- # sort stacks from the bottom up
+ # sort stacks from the bottom up
for i in range(-1, -(min_len + 1), -1):
# compare file, then func, but omit line number
ret = cmp((self._stack[i]['file'], self._stack[i]['function']),
@@ -530,11 +530,11 @@ class MessageList:
self._unique_messages = None
self._sublists = None
self._bytes = 0
-
+
def GetType(self):
return self._type
- def BeginNewSublist(self):
+ def BeginNewSublist(self):
'''Some message types are logically grouped into sets of messages which
should not be mixed in the same list. Specifically, Memory In Use (MIU),
Memory Leak (MLK) and Potential Memory Leak (MPK) are generated in a set
@@ -547,7 +547,7 @@ class MessageList:
When the caller determines that one list of messages of a type has ended
and a new list has begun, it calls BeginNewSublist() which takes the current
set of messages, puts them into a new MessageList and puts that into the
- sublists array. Later, when the caller needs to get at these messages,
+ sublists array. Later, when the caller needs to get at these messages,
GetSublists() should be called.
'''
if len(self._messages):
@@ -584,7 +584,7 @@ class MessageList:
return self._messages
def UniqueMessages(self):
- '''Returns an array of the unique normalized Message objects in this
+ '''Returns an array of the unique normalized Message objects in this
MessageList.
'''
# the list is lazily computed since we have to create a sorted list,
diff --git a/tools/purify/purify_test.py b/tools/purify/purify_test.py
index 1928df5..ae74738 100644
--- a/tools/purify/purify_test.py
+++ b/tools/purify/purify_test.py
@@ -6,9 +6,9 @@
# purify_test.py
'''Runs an exe through Purify and verifies that Purify was
-able to successfully instrument and run it. The original purpose was
-to be able to identify when a change to our code breaks our ability to Purify
-the app. This can happen with seemingly innocuous changes to code due to bugs
+able to successfully instrument and run it. The original purpose was
+to be able to identify when a change to our code breaks our ability to Purify
+the app. This can happen with seemingly innocuous changes to code due to bugs
in Purify, and is notoriously difficult to track down when it does happen.
Perhaps more importantly in the long run, this can also automate detection of
leaks and other memory bugs. It also may be useful to allow people to run
@@ -117,7 +117,7 @@ class Purify(common.Rational):
# seems to lose its mind, and we have a number of tests that use
# much larger than the default of 5.
"option -number-of-puts=30",
- # With our large pdbs, purify's default timeout (30) isn't always
+ # With our large pdbs, purify's default timeout (30) isn't always
# enough. If this isn't enough, -1 means no timeout.
"option -server-comm-timeout=120",
# check stack memory loads for UMRs, etc.
@@ -224,7 +224,7 @@ class Purify(common.Rational):
if self._instrument_only:
return
cmd = self._PurifyCommand()
- # undo the /Replace=yes that was done in Instrument(), which means to
+ # undo the /Replace=yes that was done in Instrument(), which means to
# remove the instrumented exe, and then rename exe.Original back to exe.
cmd.append("/UndoReplace")
cmd.append(os.path.abspath(self._exe))
diff --git a/tools/purify/quantify_test.py b/tools/purify/quantify_test.py
index 29691578..0c8a700 100644
--- a/tools/purify/quantify_test.py
+++ b/tools/purify/quantify_test.py
@@ -5,9 +5,9 @@
# quantify_test.py
-'''Runs an app through Quantify and verifies that Quantify was able to
+'''Runs an app through Quantify and verifies that Quantify was able to
successfully instrument and run it. The original purpose was to allow people
-to run Quantify in a consistent manner without having to worry about broken
+to run Quantify in a consistent manner without having to worry about broken
PATHs, corrupt instrumentation, or other per-machine flakiness that Quantify is
sometimes subject to. Unlike purify_test, the output from quantify_test is
a binary file, which is much more useful in manual analysis. As such, this
@@ -23,7 +23,7 @@ import common
class Quantify(common.Rational):
def __init__(self):
common.Rational.__init__(self)
-
+
def CreateOptionParser(self):
common.Rational.CreateOptionParser(self)
self._parser.description = __doc__
@@ -42,11 +42,11 @@ class Quantify(common.Rational):
"/CacheDir=" + self._cache_dir,
"-first-search-dir=" + self._exe_dir, self._exe]
return common.Rational.Instrument(self, proc)
-
+
def Execute(self):
# TODO(erikkay): add an option to also do /SaveTextData and add an
# Analyze method for automated analysis of that data.
- proc = [common.QUANTIFYW_PATH, "/CacheDir=" + self._cache_dir,
+ proc = [common.QUANTIFYW_PATH, "/CacheDir=" + self._cache_dir,
"/ShowInstrumentationProgress=no", "/ShowLoadLibraryProgress=no",
"/SaveData=" + self._out_file]
return common.Rational.Execute(self, proc)
@@ -57,5 +57,5 @@ if __name__ == "__main__":
if rational.Run():
retcode = 0
sys.exit(retcode)
-
+
diff --git a/tools/python/google/httpd_utils.py b/tools/python/google/httpd_utils.py
index 0281228..28952ed 100644
--- a/tools/python/google/httpd_utils.py
+++ b/tools/python/google/httpd_utils.py
@@ -32,7 +32,7 @@ def GetCygserverPath(start_dir, apache2=False):
'cygwin', 'usr', 'sbin')
return cygserver_path
-
+
def StartServer(document_root=None, output_dir=None, apache2=False):
"""Starts a local server on port 8000 using the basic configuration files.
diff --git a/tools/python/google/logging_utils.py b/tools/python/google/logging_utils.py
index 673097b..5fd95d3 100644
--- a/tools/python/google/logging_utils.py
+++ b/tools/python/google/logging_utils.py
@@ -26,11 +26,11 @@ class StdoutStderrHandler(logging.Handler):
sys.stdout
'''
logging.Handler.__init__(self)
- self._err = logging.StreamHandler(err)
+ self._err = logging.StreamHandler(err)
self._out = logging.StreamHandler(out)
self._threshold = threshold
self._last_was_err = False
-
+
def setLevel(self, lvl):
logging.Handler.setLevel(self, lvl)
self._err.setLevel(lvl)
@@ -62,17 +62,17 @@ class StdoutStderrHandler(logging.Handler):
FORMAT = "%(asctime)s %(filename)s [%(levelname)s] %(message)s"
DATEFMT = "%H:%M:%S"
-def config_root(level=logging.INFO, threshold=logging.WARNING, format=FORMAT,
+def config_root(level=logging.INFO, threshold=logging.WARNING, format=FORMAT,
datefmt=DATEFMT):
''' Configure the root logger to use a StdoutStderrHandler and some default
- formatting.
+ formatting.
Args:
level: messages below this level are ignored
threshold: below this logging level messages are sent to stdout,
otherwise they are sent to stderr
format: format for log messages, see logger.Format
datefmt: format for date in log messages
-
+
'''
# to set the handler of the root logging object, we need to do setup
# manually rather than using basicConfig
diff --git a/tools/python/google/path_utils.py b/tools/python/google/path_utils.py
index 751cfb5..6f94a84 100644
--- a/tools/python/google/path_utils.py
+++ b/tools/python/google/path_utils.py
@@ -12,7 +12,7 @@ import os
import sys
class PathNotFound(Exception): pass
-
+
def ScriptDir():
"""Get the full path to the directory containing the current script."""
script_filename = os.path.abspath(sys.argv[0])
@@ -20,7 +20,7 @@ def ScriptDir():
def FindAncestor(start_dir, ancestor):
"""Finds an ancestor dir in a path.
-
+
For example, FindAncestor('c:\foo\bar\baz', 'bar') would return
'c:\foo\bar'. Unlike FindUpward*, this only looks at direct path ancestors.
"""
diff --git a/tools/python/google/platform_utils_win.py b/tools/python/google/platform_utils_win.py
index 45419d7..eef2b50 100644
--- a/tools/python/google/platform_utils_win.py
+++ b/tools/python/google/platform_utils_win.py
@@ -157,7 +157,7 @@ class PlatformUtility(object):
' -C \'ServerRoot "%(server_root)s"\''
)
if apache2:
- httpd_cmd_string = ('export CYGWIN=server;' + httpd_cmd_string +
+ httpd_cmd_string = ('export CYGWIN=server;' + httpd_cmd_string +
' -c \'SSLCertificateFile "%(ssl_certificate_file)s"\'')
if document_root:
httpd_cmd_string += ' -C \'DocumentRoot "%(document_root)s"\''
diff --git a/tools/site_compare/command_line.py b/tools/site_compare/command_line.py
index b474abf..2c87fb9 100644
--- a/tools/site_compare/command_line.py
+++ b/tools/site_compare/command_line.py
@@ -56,11 +56,11 @@ class Command(object):
"""Encapsulates an argument to a command."""
VALID_TYPES = ['string', 'readfile', 'int', 'flag', 'coords']
TYPES_WITH_VALUES = ['string', 'readfile', 'int', 'coords']
-
+
def __init__(self, names, helptext, type, metaname,
required, default, positional):
"""Command-line argument to a command.
-
+
Args:
names: argument name, or list of synonyms
helptext: brief description of the argument
@@ -76,28 +76,28 @@ class Command(object):
required: True if argument must be specified
default: Default value if not specified
positional: Argument specified by location, not name
-
+
Raises:
ValueError: the argument name is invalid for some reason
"""
if type not in Command.Argument.VALID_TYPES:
raise ValueError("Invalid type: %r" % type)
-
+
if required and default is not None:
raise ValueError("required and default are mutually exclusive")
-
+
if required and type == 'flag':
raise ValueError("A required flag? Give me a break.")
-
+
if metaname and type not in Command.Argument.TYPES_WITH_VALUES:
raise ValueError("Type %r can't have a metaname" % type)
-
+
# If no metaname is provided, infer it: use the alphabetical characters
# of the last provided name
if not metaname and type in Command.Argument.TYPES_WITH_VALUES:
metaname = (
names[-1].lstrip(string.punctuation + string.whitespace).upper())
-
+
self.names = names
self.helptext = helptext
self.type = type
@@ -105,31 +105,31 @@ class Command(object):
self.default = default
self.positional = positional
self.metaname = metaname
-
+
self.mutex = [] # arguments that are mutually exclusive with
# this one
self.depends = [] # arguments that must be present for this
# one to be valid
self.present = False # has this argument been specified?
-
+
def AddDependency(self, arg):
"""Makes this argument dependent on another argument.
-
+
Args:
arg: name of the argument this one depends on
"""
if arg not in self.depends:
self.depends.append(arg)
-
+
def AddMutualExclusion(self, arg):
"""Makes this argument invalid if another is specified.
-
+
Args:
arg: name of the mutually exclusive argument.
"""
if arg not in self.mutex:
self.mutex.append(arg)
-
+
def GetUsageString(self):
"""Returns a brief string describing the argument's usage."""
if not self.positional:
@@ -138,49 +138,49 @@ class Command(object):
string += "="+self.metaname
else:
string = self.metaname
-
+
if not self.required:
string = "["+string+"]"
-
+
return string
-
+
def GetNames(self):
"""Returns a string containing a list of the arg's names."""
if self.positional:
return self.metaname
else:
return ", ".join(self.names)
-
+
def GetHelpString(self, width=80, indent=5, names_width=20, gutter=2):
"""Returns a help string including help for all the arguments."""
names = [" "*indent + line +" "*(names_width-len(line)) for line in
textwrap.wrap(self.GetNames(), names_width)]
-
+
helpstring = textwrap.wrap(self.helptext, width-indent-names_width-gutter)
-
+
if len(names) < len(helpstring):
names += [" "*(indent+names_width)]*(len(helpstring)-len(names))
-
+
if len(helpstring) < len(names):
helpstring += [""]*(len(names)-len(helpstring))
-
+
return "\n".join([name_line + " "*gutter + help_line for
name_line, help_line in zip(names, helpstring)])
-
+
def __repr__(self):
if self.present:
string = '= %r' % self.value
else:
string = "(absent)"
-
+
return "Argument %s '%s'%s" % (self.type, self.names[0], string)
-
+
# end of nested class Argument
-
+
def AddArgument(self, names, helptext, type="string", metaname=None,
required=False, default=None, positional=False):
"""Command-line argument to a command.
-
+
Args:
names: argument name, or list of synonyms
helptext: brief description of the argument
@@ -189,82 +189,82 @@ class Command(object):
required: True if argument must be specified
default: Default value if not specified
positional: Argument specified by location, not name
-
+
Raises:
ValueError: the argument already exists or is invalid
-
+
Returns:
The newly-created argument
"""
if IsString(names): names = [names]
-
+
names = [name.lower() for name in names]
-
+
for name in names:
if name in self.arg_dict:
raise ValueError("%s is already an argument"%name)
-
+
if (positional and required and
[arg for arg in self.args if arg.positional] and
not [arg for arg in self.args if arg.positional][-1].required):
raise ValueError(
"A required positional argument may not follow an optional one.")
-
+
arg = Command.Argument(names, helptext, type, metaname,
required, default, positional)
-
+
self.args.append(arg)
-
+
for name in names:
self.arg_dict[name] = arg
-
+
return arg
-
+
def GetArgument(self, name):
"""Return an argument from a name."""
return self.arg_dict[name.lower()]
-
+
def AddMutualExclusion(self, args):
"""Specifies that a list of arguments are mutually exclusive."""
if len(args) < 2:
raise ValueError("At least two arguments must be specified.")
-
+
args = [arg.lower() for arg in args]
-
+
for index in xrange(len(args)-1):
for index2 in xrange(index+1, len(args)):
self.arg_dict[args[index]].AddMutualExclusion(self.arg_dict[args[index2]])
-
+
def AddDependency(self, dependent, depends_on):
"""Specifies that one argument may only be present if another is.
-
+
Args:
dependent: the name of the dependent argument
depends_on: the name of the argument on which it depends
"""
self.arg_dict[dependent.lower()].AddDependency(
self.arg_dict[depends_on.lower()])
-
+
def AddMutualDependency(self, args):
"""Specifies that a list of arguments are all mutually dependent."""
if len(args) < 2:
raise ValueError("At least two arguments must be specified.")
-
+
args = [arg.lower() for arg in args]
-
+
for (arg1, arg2) in [(arg1, arg2) for arg1 in args for arg2 in args]:
if arg1 == arg2: continue
self.arg_dict[arg1].AddDependency(self.arg_dict[arg2])
-
+
def AddRequiredGroup(self, args):
"""Specifies that at least one of the named arguments must be present."""
if len(args) < 2:
raise ValueError("At least two arguments must be in a required group.")
-
+
args = [self.arg_dict[arg.lower()] for arg in args]
-
+
self.required_groups.append(args)
-
+
def ParseArguments(self):
"""Given a command line, parse and validate the arguments."""
@@ -272,70 +272,70 @@ class Command(object):
for arg in self.args:
arg.present = False
arg.value = None
-
+
self.parse_errors = []
-
+
# look for arguments remaining on the command line
while len(self.cmdline.rargs):
try:
self.ParseNextArgument()
except ParseError, e:
self.parse_errors.append(e.args[0])
-
+
# after all the arguments are parsed, check for problems
for arg in self.args:
if not arg.present and arg.required:
self.parse_errors.append("'%s': required parameter was missing"
% arg.names[0])
-
+
if not arg.present and arg.default:
arg.present = True
arg.value = arg.default
-
+
if arg.present:
for mutex in arg.mutex:
if mutex.present:
self.parse_errors.append(
"'%s', '%s': arguments are mutually exclusive" %
(arg.argstr, mutex.argstr))
-
+
for depend in arg.depends:
if not depend.present:
self.parse_errors.append("'%s': '%s' must be specified as well" %
(arg.argstr, depend.names[0]))
-
+
# check for required groups
for group in self.required_groups:
if not [arg for arg in group if arg.present]:
self.parse_errors.append("%s: at least one must be present" %
(", ".join(["'%s'" % arg.names[-1] for arg in group])))
-
+
# if we have any validators, invoke them
if not self.parse_errors and self.validator:
try:
self.validator(self)
except ParseError, e:
self.parse_errors.append(e.args[0])
-
+
# Helper methods so you can treat the command like a dict
def __getitem__(self, key):
arg = self.arg_dict[key.lower()]
-
+
if arg.type == 'flag':
return arg.present
else:
return arg.value
-
+
def __iter__(self):
return [arg for arg in self.args if arg.present].__iter__()
-
+
def ArgumentPresent(self, key):
"""Tests if an argument exists and has been specified."""
return key.lower() in self.arg_dict and self.arg_dict[key.lower()].present
-
+
def __contains__(self, key):
return self.ArgumentPresent(key)
-
+
def ParseNextArgument(self):
"""Find the next argument in the command line and parse it."""
arg = None
@@ -348,26 +348,26 @@ class Command(object):
if arg.type in Command.Argument.TYPES_WITH_VALUES:
if len(self.cmdline.rargs):
value = self.cmdline.rargs.pop(0)
-
+
# Second check: is this of the form "arg=val" or "arg:val"?
if arg is None:
delimiter_pos = -1
-
+
for delimiter in [':', '=']:
pos = argstr.find(delimiter)
if pos >= 0:
if delimiter_pos < 0 or pos < delimiter_pos:
delimiter_pos = pos
-
+
if delimiter_pos >= 0:
testarg = argstr[:delimiter_pos]
testval = argstr[delimiter_pos+1:]
-
+
if testarg.lower() in self.arg_dict:
arg = self.arg_dict[testarg.lower()]
argstr = testarg
value = testval
-
+
# Third check: does this begin an argument?
if arg is None:
for key in self.arg_dict.iterkeys():
@@ -377,7 +377,7 @@ class Command(object):
value = argstr[len(key):]
argstr = argstr[:len(key)]
arg = self.arg_dict[argstr]
-
+
# Fourth check: do we have any positional arguments available?
if arg is None:
for positional_arg in [
@@ -391,40 +391,40 @@ class Command(object):
# Push the retrieved argument/value onto the largs stack
if argstr: self.cmdline.largs.append(argstr)
if value: self.cmdline.largs.append(value)
-
+
# If we've made it this far and haven't found an arg, give up
if arg is None:
raise ParseError("Unknown argument: '%s'" % argstr)
-
+
# Convert the value, if necessary
if arg.type in Command.Argument.TYPES_WITH_VALUES and value is None:
raise ParseError("Argument '%s' requires a value" % argstr)
-
+
if value is not None:
value = self.StringToValue(value, arg.type, argstr)
arg.argstr = argstr
arg.value = value
arg.present = True
-
+
# end method ParseNextArgument
-
+
def StringToValue(self, value, type, argstr):
"""Convert a string from the command line to a value type."""
try:
if type == 'string':
pass # leave it be
-
+
elif type == 'int':
try:
value = int(value)
except ValueError:
raise ParseError
-
+
elif type == 'readfile':
if not os.path.isfile(value):
raise ParseError("'%s': '%s' does not exist" % (argstr, value))
-
+
elif type == 'coords':
try:
value = [int(val) for val in
@@ -432,10 +432,10 @@ class Command(object):
groups()]
except AttributeError:
raise ParseError
-
+
else:
raise ValueError("Unknown type: '%s'" % type)
-
+
except ParseError, e:
# The bare exception is raised in the generic case; more specific errors
# will arrive with arguments and should just be reraised
@@ -443,23 +443,23 @@ class Command(object):
e = ParseError("'%s': unable to convert '%s' to type '%s'" %
(argstr, value, type))
raise e
-
+
return value
-
+
def SortArgs(self):
"""Returns a method that can be passed to sort() to sort arguments."""
-
+
def ArgSorter(arg1, arg2):
"""Helper for sorting arguments in the usage string.
-
+
Positional arguments come first, then required arguments,
then optional arguments. Pylint demands this trivial function
have both Args: and Returns: sections, sigh.
-
+
Args:
arg1: the first argument to compare
arg2: the second argument to compare
-
+
Returns:
-1 if arg1 should be sorted first, +1 if it should be sorted second,
and 0 if arg1 and arg2 have the same sort level.
@@ -467,56 +467,56 @@ class Command(object):
return ((arg2.positional-arg1.positional)*2 +
(arg2.required-arg1.required))
return ArgSorter
-
+
def GetUsageString(self, width=80, name=None):
"""Gets a string describing how the command is used."""
if name is None: name = self.names[0]
-
+
initial_indent = "Usage: %s %s " % (self.cmdline.prog, name)
subsequent_indent = " " * len(initial_indent)
-
+
sorted_args = self.args[:]
sorted_args.sort(self.SortArgs())
-
+
return textwrap.fill(
" ".join([arg.GetUsageString() for arg in sorted_args]), width,
initial_indent=initial_indent,
subsequent_indent=subsequent_indent)
-
+
def GetHelpString(self, width=80):
"""Returns a list of help strings for all this command's arguments."""
sorted_args = self.args[:]
sorted_args.sort(self.SortArgs())
-
+
return "\n".join([arg.GetHelpString(width) for arg in sorted_args])
-
+
# end class Command
-
-
+
+
class CommandLine(object):
"""Parse a command line, extracting a command and its arguments."""
-
+
def __init__(self):
self.commands = []
self.cmd_dict = {}
-
+
# Add the help command to the parser
help_cmd = self.AddCommand(["help", "--help", "-?", "-h"],
"Displays help text for a command",
ValidateHelpCommand,
DoHelpCommand)
-
+
help_cmd.AddArgument(
"command", "Command to retrieve help for", positional=True)
help_cmd.AddArgument(
"--width", "Width of the output", type='int', default=80)
-
+
self.Exit = sys.exit # override this if you don't want the script to halt
# on error or on display of help
-
+
self.out = sys.stdout # override these if you want to redirect
self.err = sys.stderr # output or error messages
-
+
def AddCommand(self, names, helptext, validator=None, impl=None):
"""Add a new command to the parser.
@@ -525,56 +525,56 @@ class CommandLine(object):
helptext: brief string description of the command
validator: method to validate a command's arguments
impl: callable to be invoked when command is called
-
+
Raises:
ValueError: raised if command already added
-
+
Returns:
The new command
"""
if IsString(names): names = [names]
-
+
for name in names:
if name in self.cmd_dict:
raise ValueError("%s is already a command"%name)
-
+
cmd = Command(names, helptext, validator, impl)
cmd.cmdline = self
-
+
self.commands.append(cmd)
for name in names:
self.cmd_dict[name.lower()] = cmd
-
+
return cmd
-
+
def GetUsageString(self):
"""Returns simple usage instructions."""
return "Type '%s help' for usage." % self.prog
-
+
def ParseCommandLine(self, argv=None, prog=None, execute=True):
"""Does the work of parsing a command line.
-
+
Args:
argv: list of arguments, defaults to sys.args[1:]
prog: name of the command, defaults to the base name of the script
execute: if false, just parse, don't invoke the 'impl' member
-
+
Returns:
The command that was executed
"""
if argv is None: argv = sys.argv[1:]
if prog is None: prog = os.path.basename(sys.argv[0]).split('.')[0]
-
+
# Store off our parameters, we may need them someday
self.argv = argv
self.prog = prog
-
+
# We shouldn't be invoked without arguments, that's just lame
if not len(argv):
self.out.writelines(self.GetUsageString())
self.Exit()
return None # in case the client overrides Exit
-
+
# Is it a valid command?
self.command_string = argv[0].lower()
if not self.command_string in self.cmd_dict:
@@ -582,33 +582,33 @@ class CommandLine(object):
self.out.write(self.GetUsageString())
self.Exit()
return None # in case the client overrides Exit
-
+
self.command = self.cmd_dict[self.command_string]
-
+
# "rargs" = remaining (unparsed) arguments
# "largs" = already parsed, "left" of the read head
self.rargs = argv[1:]
self.largs = []
-
+
# let the command object do the parsing
self.command.ParseArguments()
-
+
if self.command.parse_errors:
# there were errors, output the usage string and exit
self.err.write(self.command.GetUsageString()+"\n\n")
self.err.write("\n".join(self.command.parse_errors))
self.err.write("\n\n")
-
+
self.Exit()
-
+
elif execute and self.command.impl:
self.command.impl(self.command)
-
+
return self.command
-
+
def __getitem__(self, key):
return self.cmd_dict[key]
-
+
def __iter__(self):
return self.cmd_dict.__iter__()
@@ -618,25 +618,25 @@ def ValidateHelpCommand(command):
if 'command' in command and command['command'] not in command.cmdline:
raise ParseError("'%s': unknown command" % command['command'])
-
+
def DoHelpCommand(command):
"""Executed when the command is 'help'."""
out = command.cmdline.out
width = command['--width']
-
+
if 'command' not in command:
out.write(command.GetUsageString())
out.write("\n\n")
-
+
indent = 5
gutter = 2
-
+
command_width = (
max([len(cmd.names[0]) for cmd in command.cmdline.commands]) + gutter)
-
+
for cmd in command.cmdline.commands:
cmd_name = cmd.names[0]
-
+
initial_indent = (" "*indent + cmd_name + " "*
(command_width+gutter-len(cmd_name)))
subsequent_indent = " "*(indent+command_width+gutter)
@@ -645,9 +645,9 @@ def DoHelpCommand(command):
initial_indent=initial_indent,
subsequent_indent=subsequent_indent))
out.write("\n")
-
+
out.write("\n")
-
+
else:
help_cmd = command.cmdline[command['command']]
@@ -657,21 +657,21 @@ def DoHelpCommand(command):
out.write("\n\n")
out.write(help_cmd.GetHelpString(width=width))
out.write("\n")
-
+
command.cmdline.Exit()
-
+
if __name__ == "__main__":
# If we're invoked rather than imported, run some tests
cmdline = CommandLine()
-
+
# Since we're testing, override Exit()
def TestExit():
pass
cmdline.Exit = TestExit
-
+
# Actually, while we're at it, let's override error output too
cmdline.err = open(os.path.devnull, "w")
-
+
test = cmdline.AddCommand(["test", "testa", "testb"], "test command")
test.AddArgument(["-i", "--int", "--integer", "--optint", "--optionalint"],
"optional integer parameter", type='int')
@@ -688,25 +688,25 @@ if __name__ == "__main__":
test.AddArgument("--mutdep2", "mutually dependent parameter 2")
test.AddArgument("--mutdep3", "mutually dependent parameter 3")
test.AddMutualDependency(["--mutdep1", "--mutdep2", "--mutdep3"])
-
+
# mutually exclusive arguments
test.AddArgument("--mutex1", "mutually exclusive parameter 1")
test.AddArgument("--mutex2", "mutually exclusive parameter 2")
test.AddArgument("--mutex3", "mutually exclusive parameter 3")
test.AddMutualExclusion(["--mutex1", "--mutex2", "--mutex3"])
-
+
# dependent argument
test.AddArgument("--dependent", "dependent argument")
test.AddDependency("--dependent", "--int")
-
+
# other argument types
test.AddArgument("--file", "filename argument", type='readfile')
test.AddArgument("--coords", "coordinate argument", type='coords')
test.AddArgument("--flag", "flag argument", type='flag')
-
+
test.AddArgument("--req1", "part of a required group", type='flag')
test.AddArgument("--req2", "part 2 of a required group", type='flag')
-
+
test.AddRequiredGroup(["--req1", "--req2"])
# a few failure cases
@@ -742,7 +742,7 @@ if __name__ == "__main__":
# Let's do some parsing! first, the minimal success line:
MIN = "test --reqint 123 param1 --req1 "
-
+
# tuples of (command line, expected error count)
test_lines = [
("test --int 3 foo --req1", 1), # missing required named parameter
@@ -781,19 +781,19 @@ if __name__ == "__main__":
(MIN+"--coords (123,456)", 0), # finally!
("test --int 123 --reqint=456 foo bar --coords(42,88) baz --req1", 0)
]
-
+
badtests = 0
-
+
for (test, expected_failures) in test_lines:
cmdline.ParseCommandLine([x.strip() for x in test.strip().split(" ")])
-
+
if not len(cmdline.command.parse_errors) == expected_failures:
print "FAILED:\n issued: '%s'\n expected: %d\n received: %d\n\n" % (
test, expected_failures, len(cmdline.command.parse_errors))
badtests += 1
-
+
print "%d failed out of %d tests" % (badtests, len(test_lines))
-
+
cmdline.ParseCommandLine(["help", "test"])
diff --git a/tools/site_compare/commands/compare2.py b/tools/site_compare/commands/compare2.py
index e970c24..045141b 100644
--- a/tools/site_compare/commands/compare2.py
+++ b/tools/site_compare/commands/compare2.py
@@ -29,7 +29,7 @@ def CreateCommand(cmdline):
"Compares the output of two browsers on the same URL or list of URLs",
ValidateCompare2,
ExecuteCompare2)
-
+
cmd.AddArgument(
["-b1", "--browser1"], "Full path to first browser's executable",
type="readfile", metaname="PATH", required=True)
@@ -81,7 +81,7 @@ def CreateCommand(cmdline):
cmd.AddArgument(
["-d", "--diffdir"], "Path to hold the difference of comparisons that fail")
-
+
def ValidateCompare2(command):
"""Validate the arguments to compare2. Raises ParseError if failed."""
executables = [".exe", ".com", ".bat"]
@@ -102,68 +102,68 @@ def ExecuteCompare2(command):
endline = command["--endline"]
url_list = [url.strip() for url in
open(command["--list"], "r").readlines()[startline:endline]]
-
+
log_file = open(command["--logfile"], "w")
outdir = command["--outdir"]
if not outdir: outdir = tempfile.gettempdir()
-
+
scrape_info_list = []
-
+
class ScrapeInfo(object):
"""Helper class to hold information about a scrape."""
__slots__ = ["browser_path", "scraper", "outdir", "result"]
-
+
for index in xrange(1, 3):
scrape_info = ScrapeInfo()
scrape_info.browser_path = command["--browser%d" % index]
scrape_info.scraper = scrapers.GetScraper(
(command["--browser"], command["--browser%dver" % index]))
-
+
if command["--browser%dname" % index]:
scrape_info.outdir = os.path.join(outdir,
command["--browser%dname" % index])
else:
scrape_info.outdir = os.path.join(outdir, str(index))
-
+
drivers.windowing.PreparePath(scrape_info.outdir)
scrape_info_list.append(scrape_info)
-
+
compare = operators.GetOperator("equals_with_mask")
-
+
for url in url_list:
success = True
-
+
for scrape_info in scrape_info_list:
scrape_info.result = scrape_info.scraper.Scrape(
[url], scrape_info.outdir, command["--size"], (0, 0),
command["--timeout"], path=scrape_info.browser_path)
-
+
if not scrape_info.result:
scrape_info.result = "success"
else:
success = False
-
+
result = "unknown"
-
+
if success:
result = "equal"
-
+
file1 = drivers.windowing.URLtoFilename(
url, scrape_info_list[0].outdir, ".bmp")
file2 = drivers.windowing.URLtoFilename(
url, scrape_info_list[1].outdir, ".bmp")
-
+
comparison_result = compare.Compare(file1, file2,
maskdir=command["--maskdir"])
-
+
if comparison_result is not None:
result = "not-equal"
-
+
if command["--diffdir"]:
comparison_result[1].save(
drivers.windowing.URLtoFilename(url, command["--diffdir"], ".bmp"))
-
+
# TODO(jhaas): maybe use the logging module rather than raw file writes
log_file.write("%s %s %s %s\n" % (url,
scrape_info_list[0].result,
diff --git a/tools/site_compare/commands/maskmaker.py b/tools/site_compare/commands/maskmaker.py
index a5bf6e4..73b732c 100644
--- a/tools/site_compare/commands/maskmaker.py
+++ b/tools/site_compare/commands/maskmaker.py
@@ -96,7 +96,7 @@ def ValidateMaskmaker(command):
def ExecuteMaskmaker(command):
"""Performs automatic mask generation."""
-
+
# Get the list of URLs to generate masks for
class MaskmakerURL(object):
"""Helper class for holding information about a URL passed to maskmaker."""
@@ -105,7 +105,7 @@ def ExecuteMaskmaker(command):
self.url = url
self.consecutive_successes = 0
self.errors = 0
-
+
if command["--url"]:
url_list = [MaskmakerURL(command["--url"])]
else:
@@ -116,22 +116,22 @@ def ExecuteMaskmaker(command):
endline = command["--endline"]
url_list = [MaskmakerURL(url.strip()) for url in
open(command["--list"], "r").readlines()[startline:endline]]
-
+
complete_list = []
error_list = []
-
+
outdir = command["--outdir"]
scrapes = command["--scrapes"]
errors = command["--errors"]
size = command["--size"]
scrape_pass = 0
-
+
scrapedir = command["--scrapedir"]
if not scrapedir: scrapedir = tempfile.gettempdir()
-
+
# Get the scraper
scraper = scrapers.GetScraper((command["--browser"], command["--browserver"]))
-
+
# Repeatedly iterate through the list of URLs until either every URL has
# a successful mask or too many errors, or we've exceeded the giveup limit
while url_list and scrape_pass < command["--giveup"]:
@@ -157,31 +157,31 @@ def ExecuteMaskmaker(command):
print " %r does not exist, creating" % mask_filename
mask = Image.new("1", size, 1)
mask.save(mask_filename)
-
+
# Find the stored scrape path
mask_scrape_dir = os.path.join(
scrapedir, os.path.splitext(os.path.basename(mask_filename))[0])
drivers.windowing.PreparePath(mask_scrape_dir)
-
+
# Find the baseline image
mask_scrapes = os.listdir(mask_scrape_dir)
mask_scrapes.sort()
-
+
if not mask_scrapes:
print " No baseline image found, mask will not be updated"
baseline = None
else:
baseline = Image.open(os.path.join(mask_scrape_dir, mask_scrapes[0]))
-
+
mask_scrape_filename = os.path.join(mask_scrape_dir,
time.strftime("%y%m%d-%H%M%S.bmp"))
-
+
# Do the scrape
result = scraper.Scrape(
[url.url], mask_scrape_dir, size, (0, 0),
command["--timeout"], path=command["--browserpath"],
filename=mask_scrape_filename)
-
+
if result:
# Return value other than None means an error
print " Scrape failed with error '%r'" % result
@@ -189,16 +189,16 @@ def ExecuteMaskmaker(command):
if url.errors >= errors:
print " ** Exceeded maximum error count for this URL, giving up"
continue
-
+
# Load the new scrape
scrape = Image.open(mask_scrape_filename)
-
+
# Calculate the difference between the new scrape and the baseline,
# subject to the current mask
if baseline:
diff = ImageChops.multiply(ImageChops.difference(scrape, baseline),
mask.convert(scrape.mode))
-
+
# If the difference is none, there's nothing to update
if max(diff.getextrema()) == (0, 0):
print " Scrape identical to baseline, no change in mask"
@@ -221,10 +221,10 @@ def ExecuteMaskmaker(command):
# a monochrome bitmap. If the original RGB image were converted
# directly to monochrome, PIL would dither it.
diff = diff.convert("L").point([255]+[0]*255, "1")
-
+
# count the number of different pixels
diff_pixels = diff.getcolors()[0][0]
-
+
# is this too much?
diff_pixel_percent = diff_pixels * 100.0 / (mask.size[0]*mask.size[1])
if diff_pixel_percent > command["--threshhold"]:
@@ -234,10 +234,10 @@ def ExecuteMaskmaker(command):
print " Scrape differed in %d pixels, updating mask" % diff_pixels
mask = ImageChops.multiply(mask, diff)
mask.save(mask_filename)
-
+
# reset the number of consecutive "good" scrapes
url.consecutive_successes = 0
-
+
# Remove URLs whose mask is deemed done
complete_list.extend(
[url for url in url_list if url.consecutive_successes >= scrapes])
@@ -247,16 +247,16 @@ def ExecuteMaskmaker(command):
url for url in url_list if
url.consecutive_successes < scrapes and
url.errors < errors]
-
+
scrape_pass += 1
print "**Done with scrape pass %d\n" % scrape_pass
-
+
if scrape_pass >= command["--giveup"]:
print "**Exceeded giveup threshhold. Giving up."
else:
print "Waiting %d seconds..." % command["--wait"]
time.sleep(command["--wait"])
-
+
print
print "*** MASKMAKER COMPLETE ***"
print "Summary report:"
diff --git a/tools/site_compare/commands/measure.py b/tools/site_compare/commands/measure.py
index 1815a3d2..086fcbe 100644
--- a/tools/site_compare/commands/measure.py
+++ b/tools/site_compare/commands/measure.py
@@ -40,14 +40,14 @@ def CreateCommand(cmdline):
def ExecuteMeasure(command):
"""Executes the Measure command."""
-
+
def LogResult(url, proc, wnd, result):
"""Write the result of the browse to the log file."""
log_file.write(result)
log_file = open(command["--logfile"], "w")
- browser_iterate.Iterate(command, LogResult)
+ browser_iterate.Iterate(command, LogResult)
# Close the log file and return. We're done.
log_file.close()
diff --git a/tools/site_compare/commands/scrape.py b/tools/site_compare/commands/scrape.py
index 21a00ce..1c47cab 100644
--- a/tools/site_compare/commands/scrape.py
+++ b/tools/site_compare/commands/scrape.py
@@ -41,7 +41,7 @@ def CreateCommand(cmdline):
def ExecuteScrape(command):
"""Executes the Scrape command."""
-
+
def ScrapeResult(url, proc, wnd, result):
"""Capture and save the scrape."""
if log_file: log_file.write(result)
@@ -49,12 +49,12 @@ def ExecuteScrape(command):
# Scrape the page
image = windowing.ScrapeWindow(wnd)
filename = windowing.URLtoFilename(url, command["--outdir"], ".bmp")
- image.save(filename)
+ image.save(filename)
if command["--logfile"]: log_file = open(command["--logfile"], "w")
else: log_file = None
- browser_iterate.Iterate(command, ScrapeResult)
+ browser_iterate.Iterate(command, ScrapeResult)
# Close the log file and return. We're done.
if log_file: log_file.close()
diff --git a/tools/site_compare/commands/timeload.py b/tools/site_compare/commands/timeload.py
index 554d3b6..ca5b0db 100644
--- a/tools/site_compare/commands/timeload.py
+++ b/tools/site_compare/commands/timeload.py
@@ -6,7 +6,7 @@
"""SiteCompare command to time page loads
Loads a series of URLs in a series of browsers (and browser versions)
-and measures how long the page takes to load in each. Outputs a
+and measures how long the page takes to load in each. Outputs a
comma-delimited file. The first line is "URL,[browser names", each
additional line is a URL follored by comma-delimited times (in seconds),
or the string "timeout" or "crashed".
@@ -67,44 +67,44 @@ def CreateCommand(cmdline):
cmd.AddArgument(
["-sz", "--size"], "Browser window size", default=(800, 600), type="coords")
-
+
def ExecuteTimeLoad(command):
"""Executes the TimeLoad command."""
browsers = command["--browsers"].split(",")
num_browsers = len(browsers)
-
+
if command["--browserversions"]:
browser_versions = command["--browserversions"].split(",")
else:
browser_versions = [None] * num_browsers
-
+
if command["--browserpaths"]:
browser_paths = command["--browserpaths"].split(",")
else:
browser_paths = [None] * num_browsers
-
+
if len(browser_versions) != num_browsers:
raise ValueError(
"--browserversions must be same length as --browser_paths")
if len(browser_paths) != num_browsers:
raise ValueError(
"--browserversions must be same length as --browser_paths")
-
+
if [b for b in browsers if b not in ["chrome", "ie", "firefox"]]:
raise ValueError("unknown browsers: %r" % b)
-
+
scraper_list = []
-
+
for b in xrange(num_browsers):
version = browser_versions[b]
if not version: version = None
-
+
scraper = scrapers.GetScraper( (browsers[b], version) )
if not scraper:
- raise ValueError("could not find scraper for (%r, %r)" %
+ raise ValueError("could not find scraper for (%r, %r)" %
(browsers[b], version))
scraper_list.append(scraper)
-
+
if command["--url"]:
url_list = [command["--url"]]
else:
@@ -115,32 +115,32 @@ def ExecuteTimeLoad(command):
endline = command["--endline"]
url_list = [url.strip() for url in
open(command["--list"], "r").readlines()[startline:endline]]
-
+
log_file = open(command["--logfile"], "w")
-
+
log_file.write("URL")
for b in xrange(num_browsers):
log_file.write(",%s" % browsers[b])
-
+
if browser_versions[b]: log_file.write(" %s" % browser_versions[b])
log_file.write("\n")
-
+
results = {}
for url in url_list:
results[url] = [None] * num_browsers
-
+
for b in xrange(num_browsers):
result = scraper_list[b].Time(url_list, command["--size"],
command["--timeout"],
path=browser_paths[b])
-
+
for (url, time) in result:
results[url][b] = time
-
+
# output the results
for url in url_list:
log_file.write(url)
for b in xrange(num_browsers):
log_file.write(",%r" % results[url][b])
-
+
diff --git a/tools/site_compare/drivers/__init__.py b/tools/site_compare/drivers/__init__.py
index befc1353..fa9f1c2 100644
--- a/tools/site_compare/drivers/__init__.py
+++ b/tools/site_compare/drivers/__init__.py
@@ -9,7 +9,7 @@ __author__ = 'jhaas@google.com (Jonathan Haas)'
import sys
platform_dir = sys.platform
-
+
keyboard = __import__(platform_dir+".keyboard", globals(), locals(), [''])
mouse = __import__(platform_dir+".mouse", globals(), locals(), [''])
windowing = __import__(platform_dir+".windowing", globals(), locals(), [''])
diff --git a/tools/site_compare/drivers/win32/keyboard.py b/tools/site_compare/drivers/win32/keyboard.py
index a25df5e..246e14c 100644
--- a/tools/site_compare/drivers/win32/keyboard.py
+++ b/tools/site_compare/drivers/win32/keyboard.py
@@ -25,45 +25,45 @@ import win32con # Windows constants
def PressKey(down, key):
"""Presses or unpresses a key.
-
+
Uses keybd_event to simulate either depressing or releasing
a key
-
+
Args:
down: Whether the key is to be pressed or released
key: Virtual key code of key to press or release
"""
-
- # keybd_event injects key events at a very low level (it's the
+
+ # keybd_event injects key events at a very low level (it's the
# Windows API keyboard device drivers call) so this is a very
# reliable way of simulating user input
win32api.keybd_event(key, 0, (not down) * win32con.KEYEVENTF_KEYUP)
-
-
+
+
def TypeKey(key, keystroke_time=0):
"""Simulate a keypress of a virtual key.
-
+
Args:
key: which key to press
keystroke_time: length of time (in seconds) to "hold down" the key
Note that zero works just fine
-
+
Returns:
None
"""
-
+
# This just wraps a pair of PressKey calls with an intervening delay
PressKey(True, key)
time.sleep(keystroke_time)
PressKey(False, key)
-
+
def TypeString(string_to_type,
use_modifiers=False,
keystroke_time=0,
time_between_keystrokes=0):
"""Simulate typing a string on the keyboard.
-
+
Args:
string_to_type: the string to print
use_modifiers: specifies whether the following modifier characters
@@ -79,27 +79,27 @@ def TypeString(string_to_type,
nonprintable keys (F-keys, ESC, arrow keys, etc),
support for explicit control of left vs. right ALT or SHIFT,
support for Windows key
-
+
keystroke_time: length of time (in secondes) to "hold down" the key
time_between_keystrokes: length of time (seconds) to pause between keys
-
+
Returns:
None
"""
-
+
shift_held = win32api.GetAsyncKeyState(win32con.VK_SHIFT ) < 0
ctrl_held = win32api.GetAsyncKeyState(win32con.VK_CONTROL) < 0
alt_held = win32api.GetAsyncKeyState(win32con.VK_MENU ) < 0
-
+
next_escaped = False
escape_chars = {
'a': '\a', 'b': '\b', 'f': '\f', 'n': '\n', 'r': '\r', 't': '\t', 'v': '\v'}
-
+
for char in string_to_type:
vk = None
handled = False
-
- # Check to see if this is the start or end of a modified block (that is,
+
+ # Check to see if this is the start or end of a modified block (that is,
# {abc} for ALT-modified keys or [abc] for CTRL-modified keys
if use_modifiers and not next_escaped:
handled = True
@@ -117,17 +117,17 @@ def TypeString(string_to_type,
PressKey(False, win32con.VK_CONTROL)
else:
handled = False
-
+
# If this is an explicitly-escaped character, replace it with the
# appropriate code
if next_escaped and char in escape_chars: char = escape_chars[char]
-
+
# If this is \p, pause for one second.
if next_escaped and char == 'p':
time.sleep(1)
next_escaped = False
handled = True
-
+
# If this is \(d), press F key
if next_escaped and char.isdigit():
fkey = int(char)
@@ -139,28 +139,28 @@ def TypeString(string_to_type,
if not next_escaped and char == "\\":
next_escaped = True
handled = True
-
+
# If we make it here, it's not a special character, or it's an
# escaped special character which should be treated as a literal
if not handled:
next_escaped = False
if not vk: vk = win32api.VkKeyScan(char)
-
+
# VkKeyScan() returns the scan code in the low byte. The upper
# byte specifies modifiers necessary to produce the given character
# from the given scan code. The only one we're concerned with at the
- # moment is Shift. Determine the shift state and compare it to the
+ # moment is Shift. Determine the shift state and compare it to the
# current state... if it differs, press or release the shift key.
new_shift_held = bool(vk & (1<<8))
-
+
if new_shift_held != shift_held:
PressKey(new_shift_held, win32con.VK_SHIFT)
shift_held = new_shift_held
-
+
# Type the key with the specified length, then wait the specified delay
TypeKey(vk & 0xFF, keystroke_time)
time.sleep(time_between_keystrokes)
-
+
# Release the modifier keys, if held
if shift_held: PressKey(False, win32con.VK_SHIFT)
if ctrl_held: PressKey(False, win32con.VK_CONTROL)
@@ -168,18 +168,18 @@ def TypeString(string_to_type,
if __name__ == "__main__":
# We're being invoked rather than imported. Let's do some tests
-
+
# Press command-R to bring up the Run dialog
PressKey(True, win32con.VK_LWIN)
TypeKey(ord('R'))
PressKey(False, win32con.VK_LWIN)
-
+
# Wait a sec to make sure it comes up
time.sleep(1)
-
+
# Invoke Notepad through the Run dialog
TypeString("wordpad\n")
-
+
# Wait another sec, then start typing
time.sleep(1)
TypeString("This is a test of SiteCompare's Keyboard.py module.\n\n")
@@ -194,5 +194,5 @@ if __name__ == "__main__":
use_modifiers=True,
keystroke_time=0.05,
time_between_keystrokes=0.05)
-
-
+
+
diff --git a/tools/site_compare/drivers/win32/mouse.py b/tools/site_compare/drivers/win32/mouse.py
index afdb2ea..bd16272 100644
--- a/tools/site_compare/drivers/win32/mouse.py
+++ b/tools/site_compare/drivers/win32/mouse.py
@@ -19,25 +19,25 @@ import win32gui # for window functions
def ScreenToMouse(pt):
"""Convert a value in screen coordinates to mouse coordinates.
-
+
Mouse coordinates are specified as a percentage of screen dimensions,
normalized to 16 bits. 0 represents the far left/top of the screen,
65535 represents the far right/bottom. This function assumes that
the size of the screen is fixed at module load time and does not change
-
+
Args:
pt: the point of the coords to convert
-
+
Returns:
the converted point
"""
-
+
# Initialize the screen dimensions on first execution. Note that this
# function assumes that the screen dimensions do not change during run.
if not ScreenToMouse._SCREEN_DIMENSIONS:
desktop = win32gui.GetClientRect(win32gui.GetDesktopWindow())
ScreenToMouse._SCREEN_DIMENSIONS = (desktop[2], desktop[3])
-
+
return ((65535 * pt[0]) / ScreenToMouse._SCREEN_DIMENSIONS[0],
(65535 * pt[1]) / ScreenToMouse._SCREEN_DIMENSIONS[1])
@@ -46,11 +46,11 @@ ScreenToMouse._SCREEN_DIMENSIONS = None
def PressButton(down, button='left'):
"""Simulate a mouse button press or release at the current mouse location.
-
+
Args:
down: whether the button is pressed or released
button: which button is pressed
-
+
Returns:
None
"""
@@ -61,127 +61,127 @@ def PressButton(down, button='left'):
'middle': (win32con.MOUSEEVENTF_MIDDLEUP, win32con.MOUSEEVENTF_MIDDLEDOWN),
'right': (win32con.MOUSEEVENTF_RIGHTUP, win32con.MOUSEEVENTF_RIGHTDOWN)
}
-
+
# hit the button
win32api.mouse_event(flags[button][down], 0, 0)
-
+
def ClickButton(button='left', click_time=0):
"""Press and release a mouse button at the current mouse location.
-
+
Args:
button: which button to click
click_time: duration between press and release
-
+
Returns:
None
"""
PressButton(True, button)
time.sleep(click_time)
PressButton(False, button)
-
-
+
+
def DoubleClickButton(button='left', click_time=0, time_between_clicks=0):
"""Double-click a mouse button at the current mouse location.
-
+
Args:
button: which button to click
click_time: duration between press and release
time_between_clicks: time to pause between clicks
-
+
Returns:
None
"""
ClickButton(button, click_time)
time.sleep(time_between_clicks)
ClickButton(button, click_time)
-
+
def MoveToLocation(pos, duration=0, tick=0.01):
"""Move the mouse cursor to a specified location, taking the specified time.
-
+
Args:
pos: position (in screen coordinates) to move to
duration: amount of time the move should take
tick: amount of time between successive moves of the mouse
-
+
Returns:
None
"""
# calculate the number of moves to reach the destination
num_steps = (duration/tick)+1
-
+
# get the current and final mouse position in mouse coords
current_location = ScreenToMouse(win32gui.GetCursorPos())
end_location = ScreenToMouse(pos)
-
+
# Calculate the step size
step_size = ((end_location[0]-current_location[0])/num_steps,
(end_location[1]-current_location[1])/num_steps)
step = 0
-
+
while step < num_steps:
# Move the mouse one step
current_location = (current_location[0]+step_size[0],
current_location[1]+step_size[1])
-
+
# Coerce the coords to int to avoid a warning from pywin32
win32api.mouse_event(
win32con.MOUSEEVENTF_MOVE|win32con.MOUSEEVENTF_ABSOLUTE,
int(current_location[0]), int(current_location[1]))
-
+
step += 1
time.sleep(tick)
-
-
+
+
def ClickAtLocation(pos, button='left', click_time=0):
"""Simulate a mouse click in a particular location, in screen coordinates.
-
+
Args:
pos: position in screen coordinates (x,y)
button: which button to click
click_time: duration of the click
-
+
Returns:
None
"""
MoveToLocation(pos)
ClickButton(button, click_time)
-
+
def ClickInWindow(hwnd, offset=None, button='left', click_time=0):
"""Simulate a user mouse click in the center of a window.
-
+
Args:
hwnd: handle of the window to click in
offset: where to click, defaults to dead center
button: which button to click
click_time: duration of the click
-
+
Returns:
Nothing
"""
-
+
rect = win32gui.GetClientRect(hwnd)
if offset is None: offset = (rect[2]/2, rect[3]/2)
# get the screen coordinates of the window's center
pos = win32gui.ClientToScreen(hwnd, offset)
-
+
ClickAtLocation(pos, button, click_time)
-
+
def DoubleClickInWindow(
hwnd, offset=None, button='left', click_time=0, time_between_clicks=0.1):
"""Simulate a user mouse double click in the center of a window.
-
+
Args:
hwnd: handle of the window to click in
offset: where to click, defaults to dead center
button: which button to click
click_time: duration of the clicks
time_between_clicks: length of time to pause between clicks
-
+
Returns:
Nothing
"""
@@ -191,13 +191,13 @@ def DoubleClickInWindow(
if __name__ == "__main__":
# We're being invoked rather than imported. Let's do some tests
-
+
screen_size = win32gui.GetClientRect(win32gui.GetDesktopWindow())
screen_size = (screen_size[2], screen_size[3])
-
+
# move the mouse (instantly) to the upper right corner
MoveToLocation((screen_size[0], 0))
-
+
# move the mouse (over five seconds) to the lower left corner
MoveToLocation((0, screen_size[1]), 5)
@@ -209,10 +209,10 @@ if __name__ == "__main__":
# wait a bit, then click the right button to open the context menu
time.sleep(3)
ClickButton('right')
-
+
# move the mouse away and then click the left button to dismiss the
# context menu
MoveToLocation((screen_size[0]/2, screen_size[1]/2), 3)
MoveToLocation((0, 0), 3)
ClickButton()
-
+
diff --git a/tools/site_compare/drivers/win32/windowing.py b/tools/site_compare/drivers/win32/windowing.py
index 5bc37f8..fe77c56 100644
--- a/tools/site_compare/drivers/win32/windowing.py
+++ b/tools/site_compare/drivers/win32/windowing.py
@@ -24,7 +24,7 @@ import win32process
def FindChildWindows(hwnd, path):
"""Find a set of windows through a path specification.
-
+
Args:
hwnd: Handle of the parent window
path: Path to the window to find. Has the following form:
@@ -32,12 +32,12 @@ def FindChildWindows(hwnd, path):
The slashes specify the "path" to the child window.
The text is the window class, a pipe (if present) is a title.
* is a wildcard and will find all child windows at that level
-
+
Returns:
A list of the windows that were found
"""
windows_to_check = [hwnd]
-
+
# The strategy will be to take windows_to_check and use it
# to find a list of windows that match the next specification
# in the path, then repeat with the list of found windows as the
@@ -45,7 +45,7 @@ def FindChildWindows(hwnd, path):
for segment in path.split("/"):
windows_found = []
check_values = segment.split("|")
-
+
# check_values is now a list with the first element being
# the window class, the second being the window caption.
# If the class is absent (or wildcarded) set it to None
@@ -53,7 +53,7 @@ def FindChildWindows(hwnd, path):
# If the window caption is also absent, force it to None as well
if len(check_values) == 1: check_values.append(None)
-
+
# Loop through the list of windows to check
for window_check in windows_to_check:
window_found = None
@@ -70,26 +70,26 @@ def FindChildWindows(hwnd, path):
window_found = 0
else:
raise e
-
+
# If FindWindowEx struck gold, add to our list of windows found
if window_found: windows_found.append(window_found)
-
+
# The windows we found become the windows to check for the next segment
windows_to_check = windows_found
-
+
return windows_found
def FindChildWindow(hwnd, path):
"""Find a window through a path specification.
-
+
This method is a simple wrapper for FindChildWindows() for the
case (the majority case) where you expect to find a single window
-
+
Args:
hwnd: Handle of the parent window
path: Path to the window to find. See FindChildWindows()
-
+
Returns:
The window that was found
"""
@@ -98,36 +98,36 @@ def FindChildWindow(hwnd, path):
def ScrapeWindow(hwnd, rect=None):
"""Scrape a visible window and return its contents as a bitmap.
-
+
Args:
hwnd: handle of the window to scrape
rect: rectangle to scrape in client coords, defaults to the whole thing
If specified, it's a 4-tuple of (left, top, right, bottom)
-
+
Returns:
An Image containing the scraped data
"""
# Activate the window
SetForegroundWindow(hwnd)
-
+
# If no rectangle was specified, use the fill client rectangle
if not rect: rect = win32gui.GetClientRect(hwnd)
-
+
upper_left = win32gui.ClientToScreen(hwnd, (rect[0], rect[1]))
lower_right = win32gui.ClientToScreen(hwnd, (rect[2], rect[3]))
rect = upper_left+lower_right
-
+
return PIL.ImageGrab.grab(rect)
-
+
def SetForegroundWindow(hwnd):
"""Bring a window to the foreground."""
win32gui.SetForegroundWindow(hwnd)
-
-
+
+
def InvokeAndWait(path, cmdline="", timeout=10, tick=1.):
"""Invoke an application and wait for it to bring up a window.
-
+
Args:
path: full path to the executable to invoke
cmdline: command line to pass to executable
@@ -138,7 +138,7 @@ def InvokeAndWait(path, cmdline="", timeout=10, tick=1.):
A tuple of handles to the process and the application's window,
or (None, None) if it timed out waiting for the process
"""
-
+
def EnumWindowProc(hwnd, ret):
"""Internal enumeration func, checks for visibility and proper PID."""
if win32gui.IsWindowVisible(hwnd): # don't bother even checking hidden wnds
@@ -147,12 +147,12 @@ def InvokeAndWait(path, cmdline="", timeout=10, tick=1.):
ret[1] = hwnd
return 0 # 0 means stop enumeration
return 1 # 1 means continue enumeration
-
+
# We don't need to change anything about the startupinfo structure
# (the default is quite sufficient) but we need to create it just the
# same.
sinfo = win32process.STARTUPINFO()
-
+
proc = win32process.CreateProcess(
path, # path to new process's executable
cmdline, # application's command line
@@ -168,16 +168,16 @@ def InvokeAndWait(path, cmdline="", timeout=10, tick=1.):
# some point we may care about the other members, but for now, all
# we're after is the pid
pid = proc[2]
-
+
# Enumeration APIs can take an arbitrary integer, usually a pointer,
# to be passed to the enumeration function. We'll pass a pointer to
# a structure containing the PID we're looking for, and an empty out
# parameter to hold the found window ID
ret = [pid, None]
-
+
tries_until_timeout = timeout/tick
num_tries = 0
-
+
# Enumerate top-level windows, look for one with our PID
while num_tries < tries_until_timeout and ret[1] is None:
try:
@@ -186,7 +186,7 @@ def InvokeAndWait(path, cmdline="", timeout=10, tick=1.):
# error 0 isn't an error, it just meant the enumeration was
# terminated early
if e[0]: raise e
-
+
time.sleep(tick)
num_tries += 1
@@ -197,11 +197,11 @@ def InvokeAndWait(path, cmdline="", timeout=10, tick=1.):
def WaitForProcessExit(proc, timeout=None):
"""Waits for a given process to terminate.
-
+
Args:
proc: handle to process
timeout: timeout (in seconds). None = wait indefinitely
-
+
Returns:
True if process ended, False if timed out
"""
@@ -210,26 +210,26 @@ def WaitForProcessExit(proc, timeout=None):
else:
# convert sec to msec
timeout *= 1000
-
+
return (win32event.WaitForSingleObject(proc, timeout) ==
win32event.WAIT_OBJECT_0)
def WaitForThrobber(hwnd, rect=None, timeout=20, tick=0.1, done=10):
"""Wait for a browser's "throbber" (loading animation) to complete.
-
+
Args:
hwnd: window containing the throbber
rect: rectangle of the throbber, in client coords. If None, whole window
timeout: if the throbber is still throbbing after this long, give up
tick: how often to check the throbber
done: how long the throbber must be unmoving to be considered done
-
+
Returns:
Number of seconds waited, -1 if timed out
"""
if not rect: rect = win32gui.GetClientRect(hwnd)
-
+
# last_throbber will hold the results of the preceding scrape;
# we'll compare it against the current scrape to see if we're throbbing
last_throbber = ScrapeWindow(hwnd, rect)
@@ -239,7 +239,7 @@ def WaitForThrobber(hwnd, rect=None, timeout=20, tick=0.1, done=10):
while time.clock() < timeout_clock:
time.sleep(tick)
-
+
current_throbber = ScrapeWindow(hwnd, rect)
if current_throbber.tostring() != last_throbber.tostring():
last_throbber = current_throbber
@@ -247,27 +247,27 @@ def WaitForThrobber(hwnd, rect=None, timeout=20, tick=0.1, done=10):
else:
if time.clock() - last_changed_clock > done:
return last_changed_clock - start_clock
-
+
return -1
def MoveAndSizeWindow(wnd, position=None, size=None, child=None):
"""Moves and/or resizes a window.
-
+
Repositions and resizes a window. If a child window is provided,
the parent window is resized so the child window has the given size
-
+
Args:
wnd: handle of the frame window
position: new location for the frame window
size: new size for the frame window (or the child window)
child: handle of the child window
-
+
Returns:
None
"""
rect = win32gui.GetWindowRect(wnd)
-
+
if position is None: position = (rect[0], rect[1])
if size is None:
size = (rect[2]-rect[0], rect[3]-rect[1])
@@ -276,7 +276,7 @@ def MoveAndSizeWindow(wnd, position=None, size=None, child=None):
slop = (rect[2]-rect[0]-child_rect[2]+child_rect[0],
rect[3]-rect[1]-child_rect[3]+child_rect[1])
size = (size[0]+slop[0], size[1]+slop[1])
-
+
win32gui.MoveWindow(wnd, # window to move
position[0], # new x coord
position[1], # new y coord
@@ -287,46 +287,46 @@ def MoveAndSizeWindow(wnd, position=None, size=None, child=None):
def EndProcess(proc, code=0):
"""Ends a process.
-
+
Wraps the OS TerminateProcess call for platform-independence
-
+
Args:
proc: process ID
code: process exit code
-
+
Returns:
None
"""
win32process.TerminateProcess(proc, code)
-
-
+
+
def URLtoFilename(url, path=None, extension=None):
"""Converts a URL to a filename, given a path.
-
+
This in theory could cause collisions if two URLs differ only
in unprintable characters (eg. http://www.foo.com/?bar and
http://www.foo.com/:bar. In practice this shouldn't be a problem.
-
+
Args:
url: The URL to convert
path: path to the directory to store the file
extension: string to append to filename
-
+
Returns:
filename
"""
trans = string.maketrans(r'\/:*?"<>|', '_________')
-
+
if path is None: path = ""
if extension is None: extension = ""
if len(path) > 0 and path[-1] != '\\': path += '\\'
url = url.translate(trans)
return "%s%s%s" % (path, url, extension)
-
+
def PreparePath(path):
"""Ensures that a given path exists, making subdirectories if necessary.
-
+
Args:
path: fully-qualified path of directory to ensure exists
@@ -341,11 +341,11 @@ def PreparePath(path):
if __name__ == "__main__":
PreparePath(r"c:\sitecompare\scrapes\ie7")
# We're being invoked rather than imported. Let's do some tests
-
+
# Hardcode IE's location for the purpose of this test
(proc, wnd) = InvokeAndWait(
r"c:\program files\internet explorer\iexplore.exe")
-
+
# Find the browser pane in the IE window
browser = FindChildWindow(
wnd, "TabWindowClass/Shell DocObject View/Internet Explorer_Server")
@@ -355,8 +355,8 @@ if __name__ == "__main__":
# Take a screenshot
i = ScrapeWindow(browser)
-
+
i.show()
-
+
EndProcess(proc, 0)
diff --git a/tools/site_compare/operators/__init__.py b/tools/site_compare/operators/__init__.py
index 02eac07..f60e8e8 100644
--- a/tools/site_compare/operators/__init__.py
+++ b/tools/site_compare/operators/__init__.py
@@ -9,18 +9,18 @@ __author__ = 'jhaas@google.com (Jonathan Haas)'
def GetOperator(operator):
"""Given an operator by name, returns its module.
-
+
Args:
operator: string describing the comparison
-
+
Returns:
module
"""
-
+
# TODO(jhaas): come up with a happy way of integrating multiple operators
# with different, possibly divergent and possibly convergent, operators.
-
+
module = __import__(operator, globals(), locals(), [''])
-
+
return module
diff --git a/tools/site_compare/operators/equals.py b/tools/site_compare/operators/equals.py
index c7654e9..4054fa6 100644
--- a/tools/site_compare/operators/equals.py
+++ b/tools/site_compare/operators/equals.py
@@ -11,31 +11,31 @@ from PIL import ImageChops
def Compare(file1, file2, **kwargs):
"""Compares two images to see if they're identical.
-
+
Args:
file1: path to first image to compare
file2: path to second image to compare
kwargs: unused for this operator
-
+
Returns:
None if the images are identical
A tuple of (errorstring, image) if they're not
"""
kwargs = kwargs # unused parameter
-
+
im1 = Image.open(file1)
im2 = Image.open(file2)
-
+
if im1.size != im2.size:
return ("The images are of different size (%s vs %s)" %
(im1.size, im2.size), im1)
diff = ImageChops.difference(im1, im2)
-
+
if max(diff.getextrema()) != (0, 0):
return ("The images differ", diff)
else:
return None
-
-
-
+
+
+
diff --git a/tools/site_compare/operators/equals_with_mask.py b/tools/site_compare/operators/equals_with_mask.py
index fd4000b..d6abd53 100644
--- a/tools/site_compare/operators/equals_with_mask.py
+++ b/tools/site_compare/operators/equals_with_mask.py
@@ -13,49 +13,49 @@ import os.path
def Compare(file1, file2, **kwargs):
"""Compares two images to see if they're identical subject to a mask.
-
+
An optional directory containing masks is supplied. If a mask exists
which matches file1's name, areas under the mask where it's black
are ignored.
-
+
Args:
file1: path to first image to compare
file2: path to second image to compare
kwargs: ["maskdir"] contains the directory holding the masks
-
+
Returns:
None if the images are identical
A tuple of (errorstring, image) if they're not
"""
-
+
maskdir = None
if "maskdir" in kwargs:
maskdir = kwargs["maskdir"]
-
+
im1 = Image.open(file1)
im2 = Image.open(file2)
-
+
if im1.size != im2.size:
return ("The images are of different size (%r vs %r)" %
(im1.size, im2.size), im1)
diff = ImageChops.difference(im1, im2)
-
+
if maskdir:
maskfile = os.path.join(maskdir, os.path.basename(file1))
if os.path.exists(maskfile):
mask = Image.open(maskfile)
-
+
if mask.size != im1.size:
return ("The mask is of a different size than the images (%r vs %r)" %
(mask.size, im1.size), mask)
-
+
diff = ImageChops.multiply(diff, mask.convert(diff.mode))
-
+
if max(diff.getextrema()) != (0, 0):
return ("The images differ", diff)
else:
return None
-
-
-
+
+
+
diff --git a/tools/site_compare/scrapers/__init__.py b/tools/site_compare/scrapers/__init__.py
index 08790aa..cb82b2b 100644
--- a/tools/site_compare/scrapers/__init__.py
+++ b/tools/site_compare/scrapers/__init__.py
@@ -12,23 +12,23 @@ import types
def GetScraper(browser):
"""Given a browser and an optional version, returns the scraper module.
-
+
Args:
browser: either a string (browser name) or a tuple (name, version)
-
+
Returns:
module
"""
-
+
if type(browser) == types.StringType: browser = (browser, None)
-
+
package = __import__(browser[0], globals(), locals(), [''])
module = package.GetScraper(browser[1])
if browser[1] is not None: module.version = browser[1]
-
+
return module
# if invoked rather than imported, do some tests
if __name__ == "__main__":
print GetScraper("IE")
- \ No newline at end of file
+
diff --git a/tools/site_compare/scrapers/chrome/__init__.py b/tools/site_compare/scrapers/chrome/__init__.py
index 2ba76c4..6342525 100644
--- a/tools/site_compare/scrapers/chrome/__init__.py
+++ b/tools/site_compare/scrapers/chrome/__init__.py
@@ -5,19 +5,19 @@
"""Selects the appropriate scraper for Chrome."""
__author__ = 'jhaas@google.com (Jonathan Haas)'
-
+
def GetScraper(version):
"""Returns the scraper module for the given version.
-
+
Args:
version: version string of Chrome, or None for most recent
-
+
Returns:
scrape module for given version
"""
if version is None:
version = "0.1.101.0"
-
+
parsed_version = [int(x) for x in version.split(".")]
if (parsed_version[0] > 0 or
@@ -29,10 +29,10 @@ def GetScraper(version):
scraper_version = "chrome01970"
return __import__(scraper_version, globals(), locals(), [''])
-
+
# if invoked rather than imported, test
if __name__ == "__main__":
version = "0.1.101.0"
-
+
print GetScraper(version).version
- \ No newline at end of file
+
diff --git a/tools/site_compare/scrapers/chrome/chrome011010.py b/tools/site_compare/scrapers/chrome/chrome011010.py
index 3d62d07..b4f816f 100644
--- a/tools/site_compare/scrapers/chrome/chrome011010.py
+++ b/tools/site_compare/scrapers/chrome/chrome011010.py
@@ -19,7 +19,7 @@ def GetChromeRenderPane(wnd):
def Scrape(urls, outdir, size, pos, timeout=20, **kwargs):
"""Invoke a browser, send it to a series of URLs, and save its output.
-
+
Args:
urls: list of URLs to scrape
outdir: directory to place output
@@ -27,18 +27,18 @@ def Scrape(urls, outdir, size, pos, timeout=20, **kwargs):
pos: position of browser window
timeout: amount of time to wait for page to load
kwargs: miscellaneous keyword args
-
+
Returns:
None if succeeded, else an error code
"""
chromebase.GetChromeRenderPane = GetChromeRenderPane
-
+
return chromebase.Scrape(urls, outdir, size, pos, timeout, kwargs)
def Time(urls, size, timeout, **kwargs):
"""Forwards the Time command to chromebase."""
chromebase.GetChromeRenderPane = GetChromeRenderPane
-
+
return chromebase.Time(urls, size, timeout, kwargs)
diff --git a/tools/site_compare/scrapers/chrome/chrome01970.py b/tools/site_compare/scrapers/chrome/chrome01970.py
index c1ef79f..54bc670 100644
--- a/tools/site_compare/scrapers/chrome/chrome01970.py
+++ b/tools/site_compare/scrapers/chrome/chrome01970.py
@@ -19,7 +19,7 @@ def GetChromeRenderPane(wnd):
def Scrape(urls, outdir, size, pos, timeout=20, **kwargs):
"""Invoke a browser, send it to a series of URLs, and save its output.
-
+
Args:
urls: list of URLs to scrape
outdir: directory to place output
@@ -27,18 +27,18 @@ def Scrape(urls, outdir, size, pos, timeout=20, **kwargs):
pos: position of browser window
timeout: amount of time to wait for page to load
kwargs: miscellaneous keyword args
-
+
Returns:
None if succeeded, else an error code
"""
chromebase.GetChromeRenderPane = GetChromeRenderPane
-
+
return chromebase.Scrape(urls, outdir, size, pos, timeout, kwargs)
-
+
def Time(urls, size, timeout, **kwargs):
"""Forwards the Time command to chromebase."""
chromebase.GetChromeRenderPane = GetChromeRenderPane
-
+
return chromebase.Time(urls, size, timeout, kwargs)
-
+
diff --git a/tools/site_compare/scrapers/chrome/chromebase.py b/tools/site_compare/scrapers/chrome/chromebase.py
index 085f376..aba17c1 100644
--- a/tools/site_compare/scrapers/chrome/chromebase.py
+++ b/tools/site_compare/scrapers/chrome/chromebase.py
@@ -18,17 +18,17 @@ DEFAULT_PATH = r"k:\chrome.exe"
def InvokeBrowser(path):
"""Invoke the Chrome browser.
-
+
Args:
path: full path to browser
-
+
Returns:
A tuple of (main window, process handle, address bar, render pane)
"""
-
+
# Reuse an existing instance of the browser if we can find one. This
# may not work correctly, especially if the window is behind other windows.
-
+
# TODO(jhaas): make this work with Vista
wnds = windowing.FindChildWindows(0, "Chrome_XPFrame")
if len(wnds):
@@ -37,17 +37,17 @@ def InvokeBrowser(path):
else:
# Invoke Chrome
(proc, wnd) = windowing.InvokeAndWait(path)
-
+
# Get windows we'll need
address_bar = windowing.FindChildWindow(wnd, "Chrome_AutocompleteEdit")
render_pane = GetChromeRenderPane(wnd)
-
+
return (wnd, proc, address_bar, render_pane)
-
+
def Scrape(urls, outdir, size, pos, timeout, kwargs):
"""Invoke a browser, send it to a series of URLs, and save its output.
-
+
Args:
urls: list of URLs to scrape
outdir: directory to place output
@@ -55,39 +55,39 @@ def Scrape(urls, outdir, size, pos, timeout, kwargs):
pos: position of browser window
timeout: amount of time to wait for page to load
kwargs: miscellaneous keyword args
-
+
Returns:
None if success, else an error string
"""
if "path" in kwargs and kwargs["path"]: path = kwargs["path"]
else: path = DEFAULT_PATH
-
+
(wnd, proc, address_bar, render_pane) = InvokeBrowser(path)
-
+
# Resize and reposition the frame
windowing.MoveAndSizeWindow(wnd, pos, size, render_pane)
-
+
# Visit each URL we're given
if type(urls) in types.StringTypes: urls = [urls]
timedout = False
-
+
for url in urls:
# Double-click in the address bar, type the name, and press Enter
mouse.ClickInWindow(address_bar)
keyboard.TypeString(url, 0.1)
keyboard.TypeString("\n")
-
+
# Wait for the page to finish loading
load_time = windowing.WaitForThrobber(wnd, (20, 16, 36, 32), timeout)
timedout = load_time < 0
-
+
if timedout:
break
-
+
# Scrape the page
image = windowing.ScrapeWindow(render_pane)
-
+
# Save to disk
if "filename" in kwargs:
if callable(kwargs["filename"]):
@@ -97,68 +97,68 @@ def Scrape(urls, outdir, size, pos, timeout, kwargs):
else:
filename = windowing.URLtoFilename(url, outdir, ".bmp")
image.save(filename)
-
+
if proc:
windowing.SetForegroundWindow(wnd)
-
+
# Send Alt-F4, then wait for process to end
keyboard.TypeString(r"{\4}", use_modifiers=True)
if not windowing.WaitForProcessExit(proc, timeout):
windowing.EndProcess(proc)
return "crashed"
-
+
if timedout:
return "timeout"
-
+
return None
def Time(urls, size, timeout, kwargs):
"""Measure how long it takes to load each of a series of URLs
-
+
Args:
urls: list of URLs to time
size: size of browser window to use
timeout: amount of time to wait for page to load
kwargs: miscellaneous keyword args
-
+
Returns:
A list of tuples (url, time). "time" can be "crashed" or "timeout"
"""
if "path" in kwargs and kwargs["path"]: path = kwargs["path"]
else: path = DEFAULT_PATH
proc = None
-
+
# Visit each URL we're given
if type(urls) in types.StringTypes: urls = [urls]
-
+
ret = []
for url in urls:
try:
# Invoke the browser if necessary
if not proc:
(wnd, proc, address_bar, render_pane) = InvokeBrowser(path)
-
+
# Resize and reposition the frame
windowing.MoveAndSizeWindow(wnd, (0,0), size, render_pane)
-
+
# Double-click in the address bar, type the name, and press Enter
mouse.ClickInWindow(address_bar)
keyboard.TypeString(url, 0.1)
keyboard.TypeString("\n")
-
+
# Wait for the page to finish loading
load_time = windowing.WaitForThrobber(wnd, (20, 16, 36, 32), timeout)
-
+
timedout = load_time < 0
-
+
if timedout:
load_time = "timeout"
-
+
# Send an alt-F4 to make the browser close; if this times out,
# we've probably got a crash
windowing.SetForegroundWindow(wnd)
-
+
keyboard.TypeString(r"{\4}", use_modifiers=True)
if not windowing.WaitForProcessExit(proc, timeout):
windowing.EndProcess(proc)
@@ -167,10 +167,10 @@ def Time(urls, size, timeout, kwargs):
except pywintypes.error:
proc = None
load_time = "crashed"
-
+
ret.append( (url, load_time) )
- if proc:
+ if proc:
windowing.SetForegroundWindow(wnd)
keyboard.TypeString(r"{\4}", use_modifiers=True)
if not windowing.WaitForProcessExit(proc, timeout):
@@ -183,7 +183,7 @@ if __name__ == "__main__":
# We're being invoked rather than imported, so run some tests
path = r"c:\sitecompare\scrapes\chrome\0.1.97.0"
windowing.PreparePath(path)
-
+
# Scrape three sites and save the results
Scrape([
"http://www.microsoft.com",
diff --git a/tools/site_compare/scrapers/firefox/__init__.py b/tools/site_compare/scrapers/firefox/__init__.py
index 255dc4b..7eb9291 100644
--- a/tools/site_compare/scrapers/firefox/__init__.py
+++ b/tools/site_compare/scrapers/firefox/__init__.py
@@ -3,29 +3,29 @@
# Copyright 2007 Google Inc. All Rights Reserved.
"""Selects the appropriate scraper for Firefox."""
-
+
__author__ = 'jhaas@google.com (Jonathan Haas)'
def GetScraper(version):
"""Returns the scraper module for the given version.
-
+
Args:
version: version string of IE, or None for most recent
-
+
Returns:
scrape module for given version
"""
-
+
# Pychecker will warn that the parameter is unused; we only
# support one version of Firefox at this time
-
+
# We only have one version of the Firefox scraper for now
return __import__("firefox2", globals(), locals(), [''])
-
+
# if invoked rather than imported, test
if __name__ == "__main__":
version = "2.0.0.6"
-
+
print GetScraper("2.0.0.6").version
- \ No newline at end of file
+
diff --git a/tools/site_compare/scrapers/firefox/firefox2.py b/tools/site_compare/scrapers/firefox/firefox2.py
index 0fdec98..fa0d620 100644
--- a/tools/site_compare/scrapers/firefox/firefox2.py
+++ b/tools/site_compare/scrapers/firefox/firefox2.py
@@ -29,29 +29,29 @@ def GetBrowser(path):
Args:
path: full path to browser
-
+
Returns:
A tuple of (process handle, render pane)
"""
if not path: path = DEFAULT_PATH
-
+
# Invoke Firefox
(proc, wnd) = windowing.InvokeAndWait(path)
-
+
# Get the content pane
render_pane = windowing.FindChildWindow(
wnd,
"MozillaWindowClass/MozillaWindowClass/MozillaWindowClass")
-
+
return (proc, wnd, render_pane)
def InvokeBrowser(path):
"""Invoke the Firefox browser.
-
+
Args:
path: full path to browser
-
+
Returns:
A tuple of (main window, process handle, render pane)
"""
@@ -64,18 +64,18 @@ def InvokeBrowser(path):
else:
# Invoke Firefox
(proc, wnd) = windowing.InvokeAndWait(path)
-
+
# Get the content pane
render_pane = windowing.FindChildWindow(
wnd,
"MozillaWindowClass/MozillaWindowClass/MozillaWindowClass")
-
+
return (wnd, proc, render_pane)
-
+
def Scrape(urls, outdir, size, pos, timeout=20, **kwargs):
"""Invoke a browser, send it to a series of URLs, and save its output.
-
+
Args:
urls: list of URLs to scrape
outdir: directory to place output
@@ -83,7 +83,7 @@ def Scrape(urls, outdir, size, pos, timeout=20, **kwargs):
pos: position of browser window
timeout: amount of time to wait for page to load
kwargs: miscellaneous keyword args
-
+
Returns:
None if success, else an error string
"""
@@ -91,28 +91,28 @@ def Scrape(urls, outdir, size, pos, timeout=20, **kwargs):
else: path = DEFAULT_PATH
(wnd, proc, render_pane) = InvokeBrowser(path)
-
+
# Resize and reposition the frame
windowing.MoveAndSizeWindow(wnd, pos, size, render_pane)
-
+
time.sleep(3)
-
+
# Firefox is a bit of a pain: it doesn't use standard edit controls,
- # and it doesn't display a throbber when there's no tab. Let's make
+ # and it doesn't display a throbber when there's no tab. Let's make
# sure there's at least one tab, then select the first one
-
+
mouse.ClickInWindow(wnd)
keyboard.TypeString("[t]", True)
mouse.ClickInWindow(wnd, (30, 115))
time.sleep(2)
timedout = False
-
+
# Visit each URL we're given
if type(urls) in types.StringTypes: urls = [urls]
-
+
for url in urls:
-
+
# Use keyboard shortcuts
keyboard.TypeString("{d}", True)
keyboard.TypeString(url)
@@ -124,10 +124,10 @@ def Scrape(urls, outdir, size, pos, timeout=20, **kwargs):
if timedout:
break
-
+
# Scrape the page
image = windowing.ScrapeWindow(render_pane)
-
+
# Save to disk
if "filename" in kwargs:
if callable(kwargs["filename"]):
@@ -137,58 +137,58 @@ def Scrape(urls, outdir, size, pos, timeout=20, **kwargs):
else:
filename = windowing.URLtoFilename(url, outdir, ".bmp")
image.save(filename)
-
+
# Close all the tabs, cheesily
mouse.ClickInWindow(wnd)
-
+
while len(windowing.FindChildWindows(0, "MozillaUIWindowClass")):
keyboard.TypeString("[w]", True)
time.sleep(1)
-
+
if timedout:
return "timeout"
def Time(urls, size, timeout, **kwargs):
"""Measure how long it takes to load each of a series of URLs
-
+
Args:
urls: list of URLs to time
size: size of browser window to use
timeout: amount of time to wait for page to load
kwargs: miscellaneous keyword args
-
+
Returns:
A list of tuples (url, time). "time" can be "crashed" or "timeout"
"""
if "path" in kwargs and kwargs["path"]: path = kwargs["path"]
else: path = DEFAULT_PATH
proc = None
-
+
# Visit each URL we're given
if type(urls) in types.StringTypes: urls = [urls]
-
+
ret = []
for url in urls:
try:
# Invoke the browser if necessary
if not proc:
(wnd, proc, render_pane) = InvokeBrowser(path)
-
+
# Resize and reposition the frame
windowing.MoveAndSizeWindow(wnd, (0,0), size, render_pane)
time.sleep(3)
-
+
# Firefox is a bit of a pain: it doesn't use standard edit controls,
- # and it doesn't display a throbber when there's no tab. Let's make
+ # and it doesn't display a throbber when there's no tab. Let's make
# sure there's at least one tab, then select the first one
-
+
mouse.ClickInWindow(wnd)
keyboard.TypeString("[t]", True)
mouse.ClickInWindow(wnd, (30, 115))
time.sleep(2)
-
+
# Use keyboard shortcuts
keyboard.TypeString("{d}", True)
keyboard.TypeString(url)
@@ -197,34 +197,34 @@ def Time(urls, size, timeout, **kwargs):
# Wait for the page to finish loading
load_time = windowing.WaitForThrobber(wnd, (10, 96, 26, 112), timeout)
timedout = load_time < 0
-
+
if timedout:
load_time = "timeout"
-
+
# Try to close the browser; if this fails it's probably a crash
mouse.ClickInWindow(wnd)
-
+
count = 0
- while (len(windowing.FindChildWindows(0, "MozillaUIWindowClass"))
+ while (len(windowing.FindChildWindows(0, "MozillaUIWindowClass"))
and count < 5):
keyboard.TypeString("[w]", True)
time.sleep(1)
count = count + 1
-
+
if len(windowing.FindChildWindows(0, "MozillaUIWindowClass")):
windowing.EndProcess(proc)
load_time = "crashed"
-
+
proc = None
except pywintypes.error:
proc = None
load_time = "crashed"
-
+
ret.append( (url, load_time) )
-
+
if proc:
count = 0
- while (len(windowing.FindChildWindows(0, "MozillaUIWindowClass"))
+ while (len(windowing.FindChildWindows(0, "MozillaUIWindowClass"))
and count < 5):
keyboard.TypeString("[w]", True)
time.sleep(1)
@@ -236,7 +236,7 @@ if __name__ == "__main__":
# We're being invoked rather than imported, so run some tests
path = r"c:\sitecompare\scrapes\Firefox\2.0.0.6"
windowing.PreparePath(path)
-
+
# Scrape three sites and save the results
Scrape(
["http://www.microsoft.com", "http://www.google.com",
diff --git a/tools/site_compare/scrapers/ie/__init__.py b/tools/site_compare/scrapers/ie/__init__.py
index 4b8949b..8fb95db 100644
--- a/tools/site_compare/scrapers/ie/__init__.py
+++ b/tools/site_compare/scrapers/ie/__init__.py
@@ -9,23 +9,23 @@ __author__ = 'jhaas@google.com (Jonathan Haas)'
def GetScraper(version):
"""Returns the scraper module for the given version.
-
+
Args:
version: version string of IE, or None for most recent
-
+
Returns:
scrape module for given version
"""
# Pychecker will warn that the parameter is unused; we only
# support one version of IE at this time
-
+
# We only have one version of the IE scraper for now
return __import__("ie7", globals(), locals(), [''])
-
+
# if invoked rather than imported, test
if __name__ == "__main__":
version = "7.0.5370.1"
-
+
print GetScraper(version).version
- \ No newline at end of file
+
diff --git a/tools/site_compare/scrapers/ie/ie7.py b/tools/site_compare/scrapers/ie/ie7.py
index f5d7583..da26d9b 100644
--- a/tools/site_compare/scrapers/ie/ie7.py
+++ b/tools/site_compare/scrapers/ie/ie7.py
@@ -23,29 +23,29 @@ def GetBrowser(path):
Args:
path: full path to browser
-
+
Returns:
A tuple of (process handle, render pane)
"""
if not path: path = DEFAULT_PATH
-
+
(iewnd, ieproc, address_bar, render_pane, tab_window) = InvokeBrowser(path)
return (ieproc, iewnd, render_pane)
def InvokeBrowser(path):
"""Invoke the IE browser.
-
+
Args:
path: full path to browser
-
+
Returns:
A tuple of (main window, process handle, address bar,
render_pane, tab_window)
"""
# Invoke IE
(ieproc, iewnd) = windowing.InvokeAndWait(path)
-
+
# Get windows we'll need
for tries in xrange(10):
try:
@@ -60,13 +60,13 @@ def InvokeBrowser(path):
time.sleep(1)
continue
break
-
+
return (iewnd, ieproc, address_bar, render_pane, tab_window)
def Scrape(urls, outdir, size, pos, timeout=20, **kwargs):
"""Invoke a browser, send it to a series of URLs, and save its output.
-
+
Args:
urls: list of URLs to scrape
outdir: directory to place output
@@ -74,32 +74,32 @@ def Scrape(urls, outdir, size, pos, timeout=20, **kwargs):
pos: position of browser window
timeout: amount of time to wait for page to load
kwargs: miscellaneous keyword args
-
+
Returns:
None if success, else an error string
"""
path = r"c:\program files\internet explorer\iexplore.exe"
-
+
if "path" in kwargs and kwargs["path"]: path = kwargs["path"]
(iewnd, ieproc, address_bar, render_pane, tab_window) = (
InvokeBrowser(path) )
-
+
# Resize and reposition the frame
windowing.MoveAndSizeWindow(iewnd, pos, size, render_pane)
-
+
# Visit each URL we're given
if type(urls) in types.StringTypes: urls = [urls]
-
+
timedout = False
-
+
for url in urls:
-
+
# Double-click in the address bar, type the name, and press Enter
mouse.DoubleClickInWindow(address_bar)
keyboard.TypeString(url)
keyboard.TypeString("\n")
-
+
# Wait for the page to finish loading
load_time = windowing.WaitForThrobber(
tab_window, (6, 8, 22, 24), timeout)
@@ -107,10 +107,10 @@ def Scrape(urls, outdir, size, pos, timeout=20, **kwargs):
if timedout:
break
-
+
# Scrape the page
image = windowing.ScrapeWindow(render_pane)
-
+
# Save to disk
if "filename" in kwargs:
if callable(kwargs["filename"]):
@@ -120,55 +120,55 @@ def Scrape(urls, outdir, size, pos, timeout=20, **kwargs):
else:
filename = windowing.URLtoFilename(url, outdir, ".bmp")
image.save(filename)
-
+
windowing.EndProcess(ieproc)
-
+
if timedout:
return "timeout"
-
-
+
+
def Time(urls, size, timeout, **kwargs):
"""Measure how long it takes to load each of a series of URLs
-
+
Args:
urls: list of URLs to time
size: size of browser window to use
timeout: amount of time to wait for page to load
kwargs: miscellaneous keyword args
-
+
Returns:
A list of tuples (url, time). "time" can be "crashed" or "timeout"
"""
if "path" in kwargs and kwargs["path"]: path = kwargs["path"]
else: path = DEFAULT_PATH
proc = None
-
+
# Visit each URL we're given
if type(urls) in types.StringTypes: urls = [urls]
-
+
ret = []
for url in urls:
try:
# Invoke the browser if necessary
if not proc:
(wnd, proc, address_bar, render_pane, tab_window) = InvokeBrowser(path)
-
+
# Resize and reposition the frame
windowing.MoveAndSizeWindow(wnd, (0,0), size, render_pane)
-
+
# Double-click in the address bar, type the name, and press Enter
mouse.DoubleClickInWindow(address_bar)
keyboard.TypeString(url)
keyboard.TypeString("\n")
-
+
# Wait for the page to finish loading
load_time = windowing.WaitForThrobber(
tab_window, (6, 8, 22, 24), timeout)
timedout = load_time < 0
-
+
if timedout:
load_time = "timeout"
-
+
# Send an alt-F4 to make the browser close; if this times out,
# we've probably got a crash
keyboard.TypeString(r"{\4}", use_modifiers=True)
@@ -179,9 +179,9 @@ def Time(urls, size, timeout, **kwargs):
except pywintypes.error:
load_time = "crashed"
proc = None
-
+
ret.append( (url, load_time) )
-
+
# Send an alt-F4 to make the browser close; if this times out,
# we've probably got a crash
if proc:
@@ -191,7 +191,7 @@ def Time(urls, size, timeout, **kwargs):
return ret
-
+
if __name__ == "__main__":
# We're being invoked rather than imported, so run some tests
path = r"c:\sitecompare\scrapes\ie7\7.0.5380.11"
diff --git a/tools/site_compare/site_compare.py b/tools/site_compare/site_compare.py
index 976f0ef..15359fa 100644
--- a/tools/site_compare/site_compare.py
+++ b/tools/site_compare/site_compare.py
@@ -37,7 +37,7 @@ import commands.scrape # scrape a URL or series of URLs to a bitmap
def Scrape(browsers, urls, window_size=(1024, 768),
window_pos=(0, 0), timeout=20, save_path=None, **kwargs):
"""Invoke one or more browsers over one or more URLs, scraping renders.
-
+
Args:
browsers: browsers to invoke with optional version strings
urls: URLs to visit
@@ -49,43 +49,43 @@ def Scrape(browsers, urls, window_size=(1024, 768),
kwargs: miscellaneous keyword args, passed to scraper
Returns:
None
-
+
@TODO(jhaas): more parameters, or perhaps an indefinite dictionary
parameter, for things like length of time to wait for timeout, speed
of mouse clicks, etc. Possibly on a per-browser, per-URL, or
per-browser-per-URL basis
"""
-
+
if type(browsers) in types.StringTypes: browsers = [browsers]
-
+
if save_path is None:
# default save path is "scrapes" off the current root
save_path = os.path.join(os.path.split(__file__)[0], "Scrapes")
-
+
for browser in browsers:
# Browsers should be tuples of (browser, version)
if type(browser) in types.StringTypes: browser = (browser, None)
scraper = scrapers.GetScraper(browser)
-
+
full_path = os.path.join(save_path, browser[0], scraper.version)
drivers.windowing.PreparePath(full_path)
-
+
scraper.Scrape(urls, full_path, window_size, window_pos, timeout, kwargs)
-
-
+
+
def Compare(base, compare, ops, root_path=None, out_path=None):
"""Compares a series of scrapes using a series of operators.
-
+
Args:
base: (browser, version) tuple of version to consider the baseline
compare: (browser, version) tuple of version to compare to
ops: list of operators plus operator arguments
root_path: root of the scrapes
out_path: place to put any output from the operators
-
+
Returns:
None
-
+
@TODO(jhaas): this method will likely change, to provide a robust and
well-defined way of chaining operators, applying operators conditionally,
and full-featured scripting of the operator chain. There also needs
@@ -95,28 +95,28 @@ def Compare(base, compare, ops, root_path=None, out_path=None):
if root_path is None:
# default save path is "scrapes" off the current root
root_path = os.path.join(os.path.split(__file__)[0], "Scrapes")
-
+
if out_path is None:
out_path = os.path.join(os.path.split(__file__)[0], "Compares")
-
+
if type(base) in types.StringTypes: base = (base, None)
if type(compare) in types.StringTypes: compare = (compare, None)
if type(ops) in types.StringTypes: ops = [ops]
-
+
base_dir = os.path.join(root_path, base[0])
compare_dir = os.path.join(root_path, compare[0])
-
+
if base[1] is None:
# base defaults to earliest capture
base = (base[0], max(os.listdir(base_dir)))
-
+
if compare[1] is None:
# compare defaults to latest capture
compare = (compare[0], min(os.listdir(compare_dir)))
-
+
out_path = os.path.join(out_path, base[0], base[1], compare[0], compare[1])
drivers.windowing.PreparePath(out_path)
-
+
# TODO(jhaas): right now we're just dumping output to a log file
# (and the console), which works as far as it goes but isn't nearly
# robust enough. Change this after deciding exactly what we want to
@@ -126,10 +126,10 @@ def Compare(base, compare, ops, root_path=None, out_path=None):
(base[0], base[1], compare[0], compare[1]))
out_file.write(description_string)
print description_string
-
+
base_dir = os.path.join(base_dir, base[1])
compare_dir = os.path.join(compare_dir, compare[1])
-
+
for filename in os.listdir(base_dir):
out_file.write("%s: " % filename)
@@ -137,15 +137,15 @@ def Compare(base, compare, ops, root_path=None, out_path=None):
out_file.write("Does not exist in target directory\n")
print "File %s does not exist in target directory" % filename
continue
-
+
base_filename = os.path.join(base_dir, filename)
compare_filename = os.path.join(compare_dir, filename)
-
+
for op in ops:
if type(op) in types.StringTypes: op = (op, None)
-
+
module = operators.GetOperator(op[0])
-
+
ret = module.Compare(base_filename, compare_filename)
if ret is None:
print "%s: OK" % (filename,)
@@ -154,24 +154,24 @@ def Compare(base, compare, ops, root_path=None, out_path=None):
print "%s: %s" % (filename, ret[0])
out_file.write("%s\n" % (ret[0]))
ret[1].save(os.path.join(out_path, filename))
-
+
out_file.close()
def main():
"""Main executable. Parse the command line and invoke the command."""
cmdline = command_line.CommandLine()
-
+
# The below two commands are currently unstable so have been disabled
# commands.compare2.CreateCommand(cmdline)
# commands.maskmaker.CreateCommand(cmdline)
commands.measure.CreateCommand(cmdline)
commands.scrape.CreateCommand(cmdline)
-
+
cmdline.ParseCommandLine()
if __name__ == "__main__":
main()
-
+
diff --git a/tools/site_compare/utils/browser_iterate.py b/tools/site_compare/utils/browser_iterate.py
index 50ed411..6ea4e5f 100644
--- a/tools/site_compare/utils/browser_iterate.py
+++ b/tools/site_compare/utils/browser_iterate.py
@@ -32,7 +32,7 @@ PORT = 42492
def SetupIterationCommandLine(cmd):
"""Adds the necessary flags for iteration to a command.
-
+
Args:
cmd: an object created by cmdline.AddCommand
"""
@@ -71,15 +71,15 @@ def SetupIterationCommandLine(cmd):
def Iterate(command, iteration_func):
"""Iterates over a list of URLs, calling a function on each.
-
+
Args:
command: the command line containing the iteration flags
iteration_func: called for each URL with (proc, wnd, url, result)
"""
-
+
# Retrieve the browser scraper to use to invoke the browser
scraper = scrapers.GetScraper((command["--browser"], command["--browserver"]))
-
+
def AttachToBrowser(path, timeout):
"""Invoke the browser process and connect to the socket."""
(proc, frame, wnd) = scraper.GetBrowser(path)
@@ -106,7 +106,7 @@ def Iterate(command, iteration_func):
if command["--size"]:
# Resize and reposition the frame
windowing.MoveAndSizeWindow(frame, (0, 0), command["--size"], wnd)
-
+
s.settimeout(timeout)
Iterate.proc = proc
@@ -133,7 +133,7 @@ def Iterate(command, iteration_func):
browser = command["--browserpath"]
else:
browser = None
-
+
# Read the URLs from the file
if command["--url"]:
url_list = [command["--url"]]
@@ -174,13 +174,13 @@ def Iterate(command, iteration_func):
try:
recv = Iterate.s.recv(MAX_URL)
response = response + recv
-
+
# Workaround for an oddity: when Firefox closes
# gracefully, somehow Python doesn't detect it.
# (Telnet does)
- if not recv:
+ if not recv:
raise socket.error
-
+
except socket.timeout:
response = url + ",hang\n"
DetachFromBrowser()
@@ -192,10 +192,10 @@ def Iterate(command, iteration_func):
# If we received a timeout response, restart the browser
if response[-9:] == ",timeout\n":
DetachFromBrowser()
-
+
# Invoke the iteration function
iteration_func(url, Iterate.proc, Iterate.wnd, response)
- # We're done
+ # We're done
DetachFromBrowser()
diff --git a/tools/traceline/traceline/assembler.h b/tools/traceline/traceline/assembler.h
index 32f12bc4..232fb36 100755
--- a/tools/traceline/traceline/assembler.h
+++ b/tools/traceline/traceline/assembler.h
@@ -536,7 +536,7 @@ class CodeBuffer {
void stosd() {
emit(0xab);
}
-
+
void sysenter() {
emit(0x0f); emit(0x34);
}
diff --git a/tools/traceline/traceline/main.cc b/tools/traceline/traceline/main.cc
index d0e220b..f149853 100755
--- a/tools/traceline/traceline/main.cc
+++ b/tools/traceline/traceline/main.cc
@@ -67,9 +67,9 @@ class Playground {
: stack_unwind_depth_(0),
log_heap_(false),
log_lock_(false),
- vista_(false) { }
+ vista_(false) { }
+
-
// The maximum amount of frames we should unwind from the call stack.
int stack_unwind_depth() { return stack_unwind_depth_; }
void set_stack_unwind_depth(int depth) { stack_unwind_depth_ = depth; }
@@ -102,7 +102,7 @@ class Playground {
// fields that we expect to be zero. TODO this could be a lot better.
memset(buf_, 0, sizeof(buf_));
}
-
+
void AllocateInRemote() {
// Try to get something out of the way and easy to debug.
static void* kPlaygroundAddr = reinterpret_cast<void*>(0x66660000);
@@ -276,7 +276,7 @@ class Playground {
(remote_addr_ + stub_offset + cb->size() + 5);
cb->jmp_rel(off);
}
-
+
// Makes a call to NtQueryPerformanceCounter, writing the timestamp to the
// buffer pointed to by EDI. EDI it not incremented. EAX is not preserved.
void AssembleQueryPerformanceCounter(CodeBuffer* cb) {
@@ -682,7 +682,7 @@ class Playground {
cb.mov(EDX, ESP);
cb.sysenter();
- if (cb.size() > 200) {
+ if (cb.size() > 200) {
NOTREACHED("code too big: %d", cb.size());
}
}
@@ -718,7 +718,7 @@ class Playground {
cb.pop(EDI); // restore EDI that was saved in the record
cb.ret(); // jmp back to the real ret ...
- if (cb.size() > 56) {
+ if (cb.size() > 56) {
NOTREACHED("ug");
}
}
@@ -742,7 +742,7 @@ class Playground {
// can the same lock have multiple different copies, I would assume not.
{
CodeBuffer cb(buf_ + kStubOffset);
-
+
// Set up an additional frame so that we capture the return.
// TODO use memory instructions instead of using registers.
cb.pop(EAX); // return address
@@ -760,7 +760,7 @@ class Playground {
{
CodeBuffer cb(buf_ + kStubOffset + 40);
-
+
cb.push(ESI);
cb.mov(ESI, ESP);
cb.push(EAX);
@@ -789,7 +789,7 @@ class Playground {
{
CodeBuffer cb(buf_ + kStubOffset);
-
+
// Set up an additional frame so that we capture the return.
// TODO use memory instructions instead of using registers.
cb.pop(EAX); // return address
@@ -806,7 +806,7 @@ class Playground {
{
CodeBuffer cb(buf_ + kStubOffset + 40);
-
+
cb.push(ESI);
cb.mov(ESI, ESP);
cb.push(EDI);
@@ -836,7 +836,7 @@ class Playground {
std::string moved_instructions = PatchPreamble(kFuncName, kStubOffset);
CodeBuffer cb(buf_ + kStubOffset);
-
+
// TODO use memory instructions instead of using registers.
cb.pop(EDX); // return address
cb.pop(EAX); // first argument (critical section pointer)
diff --git a/tools/traceline/traceline/sym_resolver.h b/tools/traceline/traceline/sym_resolver.h
index 53948b0..c3d93c2 100755
--- a/tools/traceline/traceline/sym_resolver.h
+++ b/tools/traceline/traceline/sym_resolver.h
@@ -17,7 +17,7 @@
#include <string>
#include <map>
-static BOOL CALLBACK SymEnumer(PCSTR name, DWORD64 base, PVOID context) {
+static BOOL CALLBACK SymEnumer(PCSTR name, DWORD64 base, PVOID context) {
reinterpret_cast<std::vector<DWORD64>*>(context)->push_back(base);
return TRUE;
}
@@ -153,7 +153,7 @@ class SymResolver {
NOTREACHED("SymCleanup failed: %d", GetLastError());
}
}
-
+
private:
HANDLE proc_;
ULONG64 base_;
diff --git a/webkit/activex_shim/activex_plugin.h b/webkit/activex_shim/activex_plugin.h
index 9c3d3de..2053c5d 100644
--- a/webkit/activex_shim/activex_plugin.h
+++ b/webkit/activex_shim/activex_plugin.h
@@ -57,7 +57,7 @@ class ActiveXPlugin : public DispatchObject {
private:
// Process parameters passed in from browser.
void ProcessParams(int16 argc, char* argn[], char* argv[]);
- // For handling wmp mime type, we need to initialize params differently
+ // For handling wmp mime type, we need to initialize params differently
// (change src to corresponding param for wmp control), and set clsid to wmp.
void ConvertForEmbeddedWmp();
diff --git a/webkit/activex_shim/activex_shared.cc b/webkit/activex_shim/activex_shared.cc
index ee146b9..965429bc 100644
--- a/webkit/activex_shim/activex_shared.cc
+++ b/webkit/activex_shim/activex_shared.cc
@@ -23,8 +23,8 @@ struct ActiveXAttribute {
// - "*" will match any sites.
// - "file" matches file url starts with "file://"
// - anything else matches the last part of the host.
- // e.g. "95559.com;ecitic.com" allows controls running from 95559.com and
- // ecitic.com.
+ // e.g. "95559.com;ecitic.com" allows controls running from 95559.com and
+ // ecitic.com.
// See MatchUrlForSinglePattern for details.
const char* allowed_sites;
const char* allowed_codebase_sites;
@@ -117,7 +117,7 @@ bool IsCodebaseAllowed(const std::string& clsid, const std::string& codebase) {
return false;
if (attr->allowed_codebase_sites == NULL)
return false;
- return MatchUrlForPatterns(url, attr->allowed_codebase_sites);
+ return MatchUrlForPatterns(url, attr->allowed_codebase_sites);
}
bool GetClsidFromClassidAttribute(const std::string& classid,
@@ -137,7 +137,7 @@ std::string GetVersionFromCodebaseAttribute(const std::string& codebase) {
std::string version;
size_t pos = codebase.find('#');
if (pos == std::string::npos)
- return version;
+ return version;
std::string rest = codebase.substr(pos + 1);
std::string version_prefix = "version=";
if (!StartsWithASCII(rest, "version=", false))
@@ -188,7 +188,7 @@ bool IsActiveXInstalled(const std::string& combined_clsid) {
DWORD requested_version_ms = 0;
DWORD requested_version_ls = 0;
if (!ParseVersionFromCodebase(version,
- &requested_version_ms,
+ &requested_version_ms,
&requested_version_ls))
return true;
// Get the path to the dll.
diff --git a/webkit/activex_shim/activex_util.cc b/webkit/activex_shim/activex_util.cc
index 7624e88..fbb9125 100644
--- a/webkit/activex_shim/activex_util.cc
+++ b/webkit/activex_shim/activex_util.cc
@@ -139,7 +139,7 @@ static bool DispGetFuncDesc(IDispatch* disp, const wchar_t* name,
bool DispIsMethodOrProperty(IDispatch* disp, const wchar_t* name,
bool checkmethod) {
FUNCDESC funcdesc;
- if (DispGetFuncDesc(disp, name, &funcdesc)) {
+ if (DispGetFuncDesc(disp, name, &funcdesc)) {
// If it has multiple params, for PROPERTYGET, we have to treat it like a
// method, because the scripting engine will not handle properties with
// parameters.
diff --git a/webkit/activex_shim/web_activex_site.h b/webkit/activex_shim/web_activex_site.h
index 149d148..74ca89b 100644
--- a/webkit/activex_shim/web_activex_site.h
+++ b/webkit/activex_shim/web_activex_site.h
@@ -192,7 +192,7 @@ class WebActiveXSite : public MinimumIDispatchImpl,
friend ActiveXPlugin;
private:
- // Call IOleObject::SetExtent to change the size of the control. width and
+ // Call IOleObject::SetExtent to change the size of the control. width and
// height should be in pixels.
HRESULT SetExtent(int width, int height);
diff --git a/webkit/build/JavaScriptCore/pthread.h b/webkit/build/JavaScriptCore/pthread.h
index 84cb9a8..1c6b337 100644
--- a/webkit/build/JavaScriptCore/pthread.h
+++ b/webkit/build/JavaScriptCore/pthread.h
@@ -55,7 +55,7 @@ inline int pthread_mutex_unlock(pthread_mutex_t* mutex) {
#define PTHREAD_MUTEX_INITIALIZER 0
-//
+//
// pthread_cond_t
typedef int pthread_cond_t;
diff --git a/webkit/build/precompiled_webkit.cc b/webkit/build/precompiled_webkit.cc
index 6c56adf..e8b969b 100644
--- a/webkit/build/precompiled_webkit.cc
+++ b/webkit/build/precompiled_webkit.cc
@@ -5,4 +5,4 @@
// the PCH file here asserts that the /FI option is indeed correctly set.
//
// "/FI [header file]" means force include. The specified include file will be
-// included before each compilation unit (.c/.cc file). \ No newline at end of file
+// included before each compilation unit (.c/.cc file).
diff --git a/webkit/build/precompiled_webkit_c.c b/webkit/build/precompiled_webkit_c.c
index ad33662..b20420c 100644
--- a/webkit/build/precompiled_webkit_c.c
+++ b/webkit/build/precompiled_webkit_c.c
@@ -10,4 +10,4 @@
// Why a second .c file (in addition to a .cc file) ? Well, PCH for C and C++
// are not intermixable and it happens that some projects have a lot of C files.
// Also, the base name of the file must be different because MSVC has some
-// trouble with having more than one source file with the same base name. \ No newline at end of file
+// trouble with having more than one source file with the same base name.
diff --git a/webkit/build/webkit_version.py b/webkit/build/webkit_version.py
index 7f64238..9f8fbab 100755
--- a/webkit/build/webkit_version.py
+++ b/webkit/build/webkit_version.py
@@ -59,5 +59,5 @@ def main():
if __name__ == "__main__":
main()
-
-
+
+
diff --git a/webkit/default_plugin/install_dialog.cc b/webkit/default_plugin/install_dialog.cc
index 590742b..cd8e33a 100644
--- a/webkit/default_plugin/install_dialog.cc
+++ b/webkit/default_plugin/install_dialog.cc
@@ -84,7 +84,7 @@ HWND PluginInstallDialog::Create(HWND parent_window, LPARAM init_param) {
dialog_template_struct = rtl_layout_dialog_template_struct;
}
- HWND dialog_window =
+ HWND dialog_window =
CreateDialogIndirectParam(
instance_handle,
reinterpret_cast<DLGTEMPLATE*>(dialog_template_struct),
diff --git a/webkit/default_plugin/plugin_database_handler.h b/webkit/default_plugin/plugin_database_handler.h
index 5112d83..cc37c90 100644
--- a/webkit/default_plugin/plugin_database_handler.h
+++ b/webkit/default_plugin/plugin_database_handler.h
@@ -38,7 +38,7 @@ struct _xmlNode;
// The format of the plugins databse file is as below:-
// <plugins>
// <plugin>
-// <mime_types> </mime_types> (semicolon separated list of mime types
+// <mime_types> </mime_types> (semicolon separated list of mime types
// supported by the plugin)
// <lang> </lang> (Supported language)
// <url> </url> (Link to the plugin installer)
diff --git a/webkit/default_plugin/plugin_impl.h b/webkit/default_plugin/plugin_impl.h
index a1fe5a9..1bf9558 100644
--- a/webkit/default_plugin/plugin_impl.h
+++ b/webkit/default_plugin/plugin_impl.h
@@ -1,11 +1,11 @@
// 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.
-
-#if defined(OS_WIN)
-#include "webkit/default_plugin/plugin_impl_win.h"
-#elif defined (OS_MACOSX)
-#include "webkit/default_plugin/plugin_impl_mac.h"
-#elif defined (OS_LINUX)
-#include "webkit/default_plugin/plugin_impl_gtk.h"
-#endif
+
+#if defined(OS_WIN)
+#include "webkit/default_plugin/plugin_impl_win.h"
+#elif defined (OS_MACOSX)
+#include "webkit/default_plugin/plugin_impl_mac.h"
+#elif defined (OS_LINUX)
+#include "webkit/default_plugin/plugin_impl_gtk.h"
+#endif
diff --git a/webkit/glue/alt_404_page_resource_fetcher.cc b/webkit/glue/alt_404_page_resource_fetcher.cc
index 66f1843..89dc157 100644
--- a/webkit/glue/alt_404_page_resource_fetcher.cc
+++ b/webkit/glue/alt_404_page_resource_fetcher.cc
@@ -29,7 +29,7 @@ Alt404PageResourceFetcher::Alt404PageResourceFetcher(
const GURL& url)
: webframeloaderclient_(webframeloaderclient),
doc_loader_(doc_loader) {
-
+
fetcher_.reset(new ResourceFetcherWithTimeout(url, frame,
kDownloadTimeoutSec, this));
}
diff --git a/webkit/glue/cache_manager.cc b/webkit/glue/cache_manager.cc
index 8f499f2..aaf9c94 100644
--- a/webkit/glue/cache_manager.cc
+++ b/webkit/glue/cache_manager.cc
@@ -48,7 +48,7 @@ void CacheManager::GetUsageStats(UsageStats* result) {
DCHECK(result);
WebCore::Cache* cache = WebCore::cache();
-
+
if (cache) {
result->min_dead_capacity = cache->m_minDeadCapacity;
result->max_dead_capacity = cache->m_maxDeadCapacity;
diff --git a/webkit/glue/context_menu_client_impl.cc b/webkit/glue/context_menu_client_impl.cc
index 79ee0a4..64222c2 100644
--- a/webkit/glue/context_menu_client_impl.cc
+++ b/webkit/glue/context_menu_client_impl.cc
@@ -46,16 +46,16 @@ bool IsASingleWord(const std::wstring& text) {
return false;
}
}
-
+
// Check for 0 words.
if (!word_count)
return false;
-
+
// Has a single word.
return true;
}
-// Helper function to get misspelled word on which context menu
+// Helper function to get misspelled word on which context menu
// is to be evolked. This function also sets the word on which context menu
// has been evoked to be the selected word, as required.
std::wstring GetMisspelledWord(const WebCore::ContextMenu* default_menu,
@@ -68,7 +68,7 @@ std::wstring GetMisspelledWord(const WebCore::ContextMenu* default_menu,
false);
// Don't provide suggestions for multiple words.
- if (!misspelled_word_string.empty() &&
+ if (!misspelled_word_string.empty() &&
!IsASingleWord(misspelled_word_string))
return L"";
@@ -83,16 +83,16 @@ std::wstring GetMisspelledWord(const WebCore::ContextMenu* default_menu,
selection = WebCore::VisibleSelection(pos);
selection.expandUsingGranularity(WebCore::WordGranularity);
}
-
- if (selection.isRange()) {
+
+ if (selection.isRange()) {
selected_frame->setSelectionGranularity(WebCore::WordGranularity);
}
-
+
if (selected_frame->shouldChangeSelection(selection))
selected_frame->selection()->setSelection(selection);
-
+
misspelled_word_string = CollapseWhitespace(
- webkit_glue::StringToStdWString(selected_frame->selectedText()),
+ webkit_glue::StringToStdWString(selected_frame->selectedText()),
false);
// If misspelled word is empty, then that portion should not be selected.
@@ -140,7 +140,7 @@ WebCore::PlatformMenuDescription
ContextMenuClientImpl::getCustomMenuFromDefaultItems(
WebCore::ContextMenu* default_menu) {
// Displaying the context menu in this function is a big hack as we don't
- // have context, i.e. whether this is being invoked via a script or in
+ // have context, i.e. whether this is being invoked via a script or in
// response to user input (Mouse event WM_RBUTTONDOWN,
// Keyboard events KeyVK_APPS, Shift+F10). Check if this is being invoked
// in response to the above input events before popping up the context menu.
@@ -172,7 +172,7 @@ WebCore::PlatformMenuDescription
GURL frame_url;
GURL page_url;
std::string security_info;
-
+
std::wstring frame_encoding;
// Send the frame and page URLs in any case.
ContextNode frame_node = ContextNode(ContextNode::NONE);
@@ -203,7 +203,7 @@ WebCore::PlatformMenuDescription
selected_frame);
}
}
-
+
if (node.type == ContextNode::NONE) {
if (selected_frame != webview_->main_frame()->frame()) {
node = frame_node;
diff --git a/webkit/glue/context_menu_unittest.cc b/webkit/glue/context_menu_unittest.cc
index 3508a05..7886a5a 100644
--- a/webkit/glue/context_menu_unittest.cc
+++ b/webkit/glue/context_menu_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Tests for displaying context menus in corner cases (and swallowing context
+// Tests for displaying context menus in corner cases (and swallowing context
// menu events when appropriate)
#include <vector>
@@ -41,8 +41,8 @@ TEST_F(ContextMenuCapturing, ContextMenuCapturing) {
std::wstring test_url = GetTestURL(iframes_data_dir_, L"testiframe.html");
test_shell_->LoadURL(test_url.c_str());
test_shell_->WaitTestFinished();
-
- // Create a right click in the center of the iframe. (I'm hoping this will
+
+ // Create a right click in the center of the iframe. (I'm hoping this will
// make this a bit more robust in case of some other formatting or other bug.)
WebMouseEvent mouse_event;
mouse_event.type = WebInputEvent::MOUSE_DOWN;
@@ -59,7 +59,7 @@ TEST_F(ContextMenuCapturing, ContextMenuCapturing) {
webview->HandleInputEvent(&mouse_event);
// Now simulate the corresponding up event which should display the menu
- mouse_event.type = WebInputEvent::MOUSE_UP;
+ mouse_event.type = WebInputEvent::MOUSE_UP;
webview->HandleInputEvent(&mouse_event);
EXPECT_EQ(1U, test_delegate->captured_context_menu_events().size());
diff --git a/webkit/glue/cpp_binding_example.cc b/webkit/glue/cpp_binding_example.cc
index 551e404..a469788 100644
--- a/webkit/glue/cpp_binding_example.cc
+++ b/webkit/glue/cpp_binding_example.cc
@@ -20,7 +20,7 @@ CppBindingExample::CppBindingExample() {
BindMethod("echoValue", &CppBindingExample::echoValue);
BindMethod("echoType", &CppBindingExample::echoType);
BindMethod("plus", &CppBindingExample::plus);
-
+
// The fallback method is called when a nonexistent method is called on an
// object. If none is specified, calling a nonexistent method causes an
// exception to be thrown and the JavaScript execution is stopped.
@@ -39,12 +39,12 @@ void CppBindingExample::echoValue(const CppArgumentList& args,
result->Set(args[0]);
}
-void CppBindingExample::echoType(const CppArgumentList& args,
- CppVariant* result) {
+void CppBindingExample::echoType(const CppArgumentList& args,
+ CppVariant* result) {
if (args.size() < 1) {
result->SetNull();
return;
- }
+ }
// Note that if args[0] is a string, the following assignment implicitly
// makes a copy of that string, which may have an undesirable impact on
// performance.
@@ -59,7 +59,7 @@ void CppBindingExample::echoType(const CppArgumentList& args,
result->Set("Success!");
}
-void CppBindingExample::plus(const CppArgumentList& args,
+void CppBindingExample::plus(const CppArgumentList& args,
CppVariant* result) {
if (args.size() < 2) {
result->SetNull();
diff --git a/webkit/glue/cpp_binding_example.h b/webkit/glue/cpp_binding_example.h
index a4f763b..c6ec610 100644
--- a/webkit/glue/cpp_binding_example.h
+++ b/webkit/glue/cpp_binding_example.h
@@ -3,12 +3,12 @@
// found in the LICENSE file.
/*
- CppBindingExample class:
+ CppBindingExample class:
This provides an example of how to use the CppBoundClass to create methods
and properties that can be exposed to JavaScript by an appropriately built
embedding client. It is also used by the CppBoundClass unit test.
- Typically, a class intended to be bound to JavaScript will define a
+ Typically, a class intended to be bound to JavaScript will define a
constructor, any methods and properties to be exposed, and optionally a
destructor. An embedding client can then bind the class to a JavaScript
object in a frame's window using the CppBoundClass::BindToJavascript() method,
diff --git a/webkit/glue/cpp_bound_class_unittest.cc b/webkit/glue/cpp_bound_class_unittest.cc
index 1f412cc..2579d0f 100644
--- a/webkit/glue/cpp_bound_class_unittest.cc
+++ b/webkit/glue/cpp_bound_class_unittest.cc
@@ -63,8 +63,8 @@ class ExampleTestShell : public TestShell {
// We use the layoutTestController binding for notifyDone.
TestShell::BindJSObjectsToWindow(frame);
}
-
- // This is a public interface to TestShell's protected method, so it
+
+ // This is a public interface to TestShell's protected method, so it
// can be called by our CreateEmptyWindow.
bool PublicInitialize(const std::wstring& startingURL) {
return Initialize(startingURL);
@@ -111,7 +111,7 @@ class CppBoundClassTest : public TestShellTest {
ExecuteJavaScript(javascript);
EXPECT_EQ(L"SUCCESS", webkit_glue::DumpDocumentText(webframe_));
}
-
+
// Executes the specified JavaScript and checks that the resulting document
// text is empty.
void CheckJavaScriptFailure(const std::string& javascript) {
@@ -132,8 +132,8 @@ class CppBoundClassTest : public TestShellTest {
"if (leftval == rightval) {" +
" document.writeln('SUCCESS');" +
"} else {" +
- " document.writeln(\"" +
- left + " [\" + leftval + \"] != " +
+ " document.writeln(\"" +
+ left + " [\" + leftval + \"] != " +
right + " [\" + rightval + \"]\");" +
"}";
}
@@ -246,9 +246,9 @@ TEST_F(CppBoundClassTest, InvokeMethods) {
CheckJavaScriptSuccess(js);
}
-// Tests that invoking a nonexistent method with no fallback method stops the
+// Tests that invoking a nonexistent method with no fallback method stops the
// script's execution
-TEST_F(CppBoundClassTest,
+TEST_F(CppBoundClassTest,
InvokeNonexistentMethodNoFallback) {
std::string js = "example.nonExistentMethod();document.writeln('SUCCESS');";
CheckJavaScriptFailure(js);
@@ -256,7 +256,7 @@ TEST_F(CppBoundClassTest,
// Ensures existent methods can be invoked successfully when the fallback method
// is used
-TEST_F(CppBoundClassWithFallbackMethodTest,
+TEST_F(CppBoundClassWithFallbackMethodTest,
InvokeExistentMethodsWithFallback) {
std::string js = BuildJSCondition("example.echoValue(34)", "34");
CheckJavaScriptSuccess(js);
diff --git a/webkit/glue/cpp_variant.cc b/webkit/glue/cpp_variant.cc
index 076998f..c0827c6 100644
--- a/webkit/glue/cpp_variant.cc
+++ b/webkit/glue/cpp_variant.cc
@@ -129,7 +129,7 @@ void CppVariant::Set(const NPVariant& new_value) {
}
}
-void CppVariant::SetNull() {
+void CppVariant::SetNull() {
FreeData();
type = NPVariantType_Null;
}
@@ -250,7 +250,7 @@ std::vector<std::wstring> CppVariant::ToStringVector() const {
return wstring_vector;
}
-bool CppVariant::Invoke(const std::string& method, const CppVariant* args,
+bool CppVariant::Invoke(const std::string& method, const CppVariant* args,
uint32 arg_count, CppVariant& result) const {
DCHECK(isObject());
NPIdentifier method_name = NPN_GetStringIdentifier(method.c_str());
diff --git a/webkit/glue/cpp_variant.h b/webkit/glue/cpp_variant.h
index f8a4c2e..2cf9e8f 100644
--- a/webkit/glue/cpp_variant.h
+++ b/webkit/glue/cpp_variant.h
@@ -99,11 +99,11 @@ class CppVariant : public NPVariant {
std::vector<std::wstring> ToStringVector() const;
// Invoke method of the given name on an object with the supplied arguments.
- // The first argument should be the object on which the method is to be
+ // The first argument should be the object on which the method is to be
// invoked. Returns whether the method was successfully invoked. If the
- // method was invoked successfully, any return value is stored in the
+ // method was invoked successfully, any return value is stored in the
// CppVariant specified by result.
- bool Invoke(const std::string& method, const CppVariant* args,
+ bool Invoke(const std::string& method, const CppVariant* args,
uint32 arg_count, CppVariant& result) const;
};
diff --git a/webkit/glue/cpp_variant_unittest.cc b/webkit/glue/cpp_variant_unittest.cc
index 8933b85..f80651d 100644
--- a/webkit/glue/cpp_variant_unittest.cc
+++ b/webkit/glue/cpp_variant_unittest.cc
@@ -75,9 +75,9 @@ void MockNPDeallocate(NPObject* npobj) {
free(npobj);
}
-static NPClass void_class = { NP_CLASS_STRUCT_VERSION,
- MockNPAllocate,
- MockNPDeallocate,
+static NPClass void_class = { NP_CLASS_STRUCT_VERSION,
+ MockNPAllocate,
+ MockNPDeallocate,
0, 0, 0, 0, 0, 0, 0, 0, 0 };
NPObject* MakeVoidObject() {
@@ -118,7 +118,7 @@ TEST(CppVariantTest, CopyConstructorIncrementsRefCount) {
source.Set(object);
// 2 references so far.
EXPECT_EQ(2U, source.value.objectValue->referenceCount);
-
+
CppVariant dest = source;
EXPECT_EQ(3U, dest.value.objectValue->referenceCount);
EXPECT_EQ(1, g_allocate_call_count);
@@ -153,7 +153,7 @@ TEST(CppVariantTest, AssignmentIncrementsRefCount) {
dest = source;
EXPECT_EQ(3U, dest.value.objectValue->referenceCount);
EXPECT_EQ(1, g_allocate_call_count);
-
+
NPN_ReleaseObject(object);
source.SetNull();
CheckObject(dest);
@@ -188,7 +188,7 @@ TEST(CppVariantTest, CopiesTypeAndValueToNPVariant) {
EXPECT_EQ(cpp.value.boolValue, np.value.boolValue);
NPN_ReleaseVariantValue(&np);
- cpp.Set(17);
+ cpp.Set(17);
cpp.CopyToNPVariant(&np);
EXPECT_EQ(cpp.type, np.type);
EXPECT_EQ(cpp.value.intValue, np.value.intValue);
diff --git a/webkit/glue/dom_operations.cc b/webkit/glue/dom_operations.cc
index e77e375..4773812 100644
--- a/webkit/glue/dom_operations.cc
+++ b/webkit/glue/dom_operations.cc
@@ -283,8 +283,8 @@ bool FillFormToUploadFile(WebView* view, const FileUploadData& data) {
// Internal implementation of FillForm API.
static bool FillFormImpl(FormElements* fe, const FormData& data, bool submit) {
if (!fe->form_element->autoComplete())
- return false;
-
+ return false;
+
FormValueMap data_map;
for (unsigned int i = 0; i < data.elements.size(); i++) {
data_map[data.elements[i]] = data.values[i];
@@ -327,10 +327,10 @@ static bool FindFormInputElements(WebCore::HTMLFormElement* fe,
FormElements* result) {
Vector<RefPtr<WebCore::Node> > temp_elements;
// Loop through the list of elements we need to find on the form in
- // order to autofill it. If we don't find any one of them, abort
+ // order to autofill it. If we don't find any one of them, abort
// processing this form; it can't be the right one.
for (size_t j = 0; j < data.elements.size(); j++, temp_elements.clear()) {
- fe->getNamedElements(StdWStringToString(data.elements[j]),
+ fe->getNamedElements(StdWStringToString(data.elements[j]),
temp_elements);
if (temp_elements.isEmpty()) {
// We didn't find a required element. This is not the right form.
@@ -370,7 +370,7 @@ static void FindFormElements(WebView* view,
// Loop through each frame.
for (WebCore::Frame* f = frame; f; f = f->tree()->traverseNext()) {
WebCore::Document* doc = f->document();
- if (!doc->isHTMLDocument())
+ if (!doc->isHTMLDocument())
continue;
GURL full_origin(StringToStdString(doc->documentURI()));
@@ -380,9 +380,9 @@ static void FindFormElements(WebView* view,
WebCore::FrameLoader* loader = f->loader();
if (loader == NULL)
continue;
-
+
PassRefPtr<WebCore::HTMLCollection> forms = doc->forms();
- for (size_t i = 0; i < forms->length(); ++i) {
+ for (size_t i = 0; i < forms->length(); ++i) {
WebCore::HTMLFormElement* fe =
static_cast<WebCore::HTMLFormElement*>(forms->item(i));
@@ -409,7 +409,7 @@ bool FillForm(WebView* view, const FormData& data) {
bool success = false;
if (!forms.empty())
success = FillFormImpl(forms[0], data, false);
-
+
// TODO(timsteele): Move STLDeleteElements to base/ and have FormElementsList
// use that.
FormElementsList::iterator iter;
@@ -422,7 +422,7 @@ void FillPasswordForm(WebView* view,
const PasswordFormDomManager::FillData& data) {
FormElementsList forms;
// We own the FormElements* in forms.
- FindFormElements(view, data.basic_data, &forms);
+ FindFormElements(view, data.basic_data, &forms);
FormElementsList::iterator iter;
for (iter = forms.begin(); iter != forms.end(); ++iter) {
// TODO(timsteele): Move STLDeleteElements to base/ and have
diff --git a/webkit/glue/dom_serializer.cc b/webkit/glue/dom_serializer.cc
index 8aa2310..c535e73 100644
--- a/webkit/glue/dom_serializer.cc
+++ b/webkit/glue/dom_serializer.cc
@@ -19,7 +19,7 @@
// Problem:
// This way can not handle the following situation:
// the base tag is written by JavaScript.
-// For example. The page "www.yahoo.com" use
+// For example. The page "www.yahoo.com" use
// "document.write('<base href="http://www.yahoo.com/"...');" to setup base URL
// of page when loading page. So when saving page as completed-HTML, we assume
// that we save "www.yahoo.com" to "c:\yahoo.htm". After then we load the saved
diff --git a/webkit/glue/dragclient_impl.cc b/webkit/glue/dragclient_impl.cc
index d9b7896..c3e7865 100644
--- a/webkit/glue/dragclient_impl.cc
+++ b/webkit/glue/dragclient_impl.cc
@@ -42,7 +42,7 @@ void DragClientImpl::willPerformDragSourceAction(
WebCore::DragDestinationAction DragClientImpl::actionMaskForDrag(
WebCore::DragData*) {
- return WebCore::DragDestinationActionAny;
+ return WebCore::DragDestinationActionAny;
}
WebCore::DragSourceAction DragClientImpl::dragSourceActionMaskForPoint(
diff --git a/webkit/glue/dragclient_impl.h b/webkit/glue/dragclient_impl.h
index 8673301..151a261 100644
--- a/webkit/glue/dragclient_impl.h
+++ b/webkit/glue/dragclient_impl.h
@@ -35,7 +35,7 @@ public:
virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*);
virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(
const WebCore::IntPoint& window_point);
-
+
virtual void startDrag(WebCore::DragImageRef drag_image,
const WebCore::IntPoint& drag_image_origin,
const WebCore::IntPoint& event_pos,
@@ -43,8 +43,8 @@ public:
WebCore::Frame* frame,
bool is_link_drag = false);
virtual WebCore::DragImageRef createDragImageForLink(
- WebCore::KURL&, const WebCore::String& label, WebCore::Frame*);
-
+ WebCore::KURL&, const WebCore::String& label, WebCore::Frame*);
+
virtual void dragControllerDestroyed();
private:
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc
index 7e60c4e..3c25b5a 100644
--- a/webkit/glue/editor_client_impl.cc
+++ b/webkit/glue/editor_client_impl.cc
@@ -145,7 +145,7 @@ bool EditorClientImpl::isContinuousSpellCheckingEnabled() {
return false;
else if (spell_check_this_field_status_ == SPELLCHECK_FORCED_ON)
return true;
- else
+ else
return ShouldSpellcheckByDefault();
}
@@ -213,9 +213,9 @@ bool EditorClientImpl::shouldInsertText(const WebCore::String& text,
WebViewDelegate* d = web_view_->delegate();
if (d) {
std::wstring wstr = webkit_glue::StringToStdWString(text);
- return d->ShouldInsertText(web_view_,
- wstr,
- Describe(range),
+ return d->ShouldInsertText(web_view_,
+ wstr,
+ Describe(range),
Describe(action));
}
}
@@ -232,23 +232,23 @@ bool EditorClientImpl::shouldDeleteRange(WebCore::Range* range) {
return true;
}
-bool EditorClientImpl::shouldChangeSelectedRange(WebCore::Range* from_range,
- WebCore::Range* to_range,
- WebCore::EAffinity affinity,
+bool EditorClientImpl::shouldChangeSelectedRange(WebCore::Range* from_range,
+ WebCore::Range* to_range,
+ WebCore::EAffinity affinity,
bool still_selecting) {
if (use_editor_delegate_) {
WebViewDelegate* d = web_view_->delegate();
if (d) {
- return d->ShouldChangeSelectedRange(web_view_,
- Describe(from_range),
- Describe(to_range),
- Describe(affinity),
+ return d->ShouldChangeSelectedRange(web_view_,
+ Describe(from_range),
+ Describe(to_range),
+ Describe(affinity),
still_selecting);
}
}
return true;
}
-
+
bool EditorClientImpl::shouldApplyStyle(WebCore::CSSStyleDeclaration* style,
WebCore::Range* range) {
if (use_editor_delegate_) {
@@ -381,7 +381,7 @@ void EditorClientImpl::redo() {
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
static const unsigned CtrlKey = 1 << 0;
@@ -414,7 +414,7 @@ static const KeyDownEntry keyDownEntries[] = {
{ WebCore::VKEY_LEFT, ShiftKey, "MoveLeftAndModifySelection" },
#if defined(OS_MACOSX)
{ WebCore::VKEY_LEFT, OptionKey, "MoveWordLeft" },
- { WebCore::VKEY_LEFT, OptionKey | ShiftKey,
+ { WebCore::VKEY_LEFT, OptionKey | ShiftKey,
"MoveWordLeftAndModifySelection" },
#else
{ WebCore::VKEY_LEFT, CtrlKey, "MoveWordLeft" },
@@ -450,7 +450,7 @@ static const KeyDownEntry keyDownEntries[] = {
#if defined(OS_MACOSX)
{ WebCore::VKEY_UP, CommandKey, "MoveToBeginningOfDocument" },
{ WebCore::VKEY_UP, CommandKey | ShiftKey,
- "MoveToBeginningOfDocumentAndModifySelection" },
+ "MoveToBeginningOfDocumentAndModifySelection" },
#else
{ WebCore::VKEY_HOME, CtrlKey, "MoveToBeginningOfDocument" },
{ WebCore::VKEY_HOME, CtrlKey | ShiftKey,
@@ -552,7 +552,7 @@ const char* EditorClientImpl::interpretKeyEvent(
for (unsigned i = 0; i < arraysize(keyPressEntries); i++) {
keyPressCommandsMap->set(
- keyPressEntries[i].modifiers << 16 | keyPressEntries[i].charCode,
+ keyPressEntries[i].modifiers << 16 | keyPressEntries[i].charCode,
keyPressEntries[i].name);
}
}
@@ -780,7 +780,7 @@ void EditorClientImpl::checkSpellingOfString(const UChar* str, int length,
int spell_length = 0;
WebViewDelegate* d = web_view_->delegate();
if (isContinuousSpellCheckingEnabled() && d) {
- std::wstring word =
+ std::wstring word =
webkit_glue::StringToStdWString(WebCore::String(str, length));
d->SpellCheck(word, spell_location, spell_length);
} else {
@@ -837,7 +837,7 @@ void EditorClientImpl::setInputMethodState(bool enabled) {
}
-std::wstring EditorClientImpl::DescribeOrError(int number,
+std::wstring EditorClientImpl::DescribeOrError(int number,
WebCore::ExceptionCode ec) {
if (ec)
return L"ERROR";
@@ -845,7 +845,7 @@ std::wstring EditorClientImpl::DescribeOrError(int number,
return IntToWString(number);
}
-std::wstring EditorClientImpl::DescribeOrError(WebCore::Node* node,
+std::wstring EditorClientImpl::DescribeOrError(WebCore::Node* node,
WebCore::ExceptionCode ec) {
if (ec)
return L"ERROR";
diff --git a/webkit/glue/editor_client_impl.h b/webkit/glue/editor_client_impl.h
index daef0fb..be75830 100644
--- a/webkit/glue/editor_client_impl.h
+++ b/webkit/glue/editor_client_impl.h
@@ -50,9 +50,9 @@ class EditorClientImpl : public WebCore::EditorClient {
virtual bool shouldInsertText(const WebCore::String& text, WebCore::Range* range,
WebCore::EditorInsertAction action);
virtual bool shouldDeleteRange(WebCore::Range* range);
- virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange,
- WebCore::Range* toRange,
- WebCore::EAffinity affinity,
+ virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange,
+ WebCore::Range* toRange,
+ WebCore::EAffinity affinity,
bool stillSelecting);
virtual bool shouldApplyStyle(WebCore::CSSStyleDeclaration* style,
WebCore::Range* range);
@@ -109,9 +109,9 @@ class EditorClientImpl : public WebCore::EditorClient {
// It would be better to add these methods to the objects they describe, but
// those are in WebCore and therefore inaccessible.
- virtual std::wstring DescribeOrError(int number,
+ virtual std::wstring DescribeOrError(int number,
WebCore::ExceptionCode ec);
- virtual std::wstring DescribeOrError(WebCore::Node* node,
+ virtual std::wstring DescribeOrError(WebCore::Node* node,
WebCore::ExceptionCode ec);
virtual std::wstring Describe(WebCore::Range* range);
virtual std::wstring Describe(WebCore::Node* node);
@@ -157,14 +157,14 @@ class EditorClientImpl : public WebCore::EditorClient {
// whether or not it is a <textarea> element or an element whose
// contenteditable attribute is true.
// TODO(hbono): Bug 740540: This code just implements the default behavior
- // proposed in this issue. We should also retrieve "spellcheck" attributes
+ // proposed in this issue. We should also retrieve "spellcheck" attributes
// for text fields and create a flag to over-write the default behavior.
bool ShouldSpellcheckByDefault();
// Whether the last entered key was a backspace.
bool backspace_pressed_;
- // This flag is set to false if spell check for this editor is manually
+ // This flag is set to false if spell check for this editor is manually
// turned off. The default setting is SPELLCHECK_AUTOMATIC.
enum {
SPELLCHECK_AUTOMATIC,
diff --git a/webkit/glue/event_conversion.cc b/webkit/glue/event_conversion.cc
index 548bfa5..21259ff 100644
--- a/webkit/glue/event_conversion.cc
+++ b/webkit/glue/event_conversion.cc
@@ -189,7 +189,7 @@ void MakePlatformKeyboardEvent::SetKeyType(Type type) {
// Please refer to bug http://b/issue?id=961192, which talks about Webkit
// keyboard event handling changes. It also mentions the list of keys
-// which don't have associated character events.
+// which don't have associated character events.
bool MakePlatformKeyboardEvent::IsCharacterKey() const {
switch (windowsVirtualKeyCode()) {
case VKEY_BACK:
diff --git a/webkit/glue/glue_serialize.cc b/webkit/glue/glue_serialize.cc
index ba2d9a9..ceac8ef 100644
--- a/webkit/glue/glue_serialize.cc
+++ b/webkit/glue/glue_serialize.cc
@@ -158,7 +158,7 @@ inline String ReadString(const SerializeObject* obj) {
// In version 2, the length field was the length in UChars.
// In version 1 and 3 it is the length in bytes.
int bytes = ((obj->version == 2) ? length * sizeof(UChar) : length);
-
+
const void* data;
if (!ReadBytes(obj, &data, bytes))
return String();
diff --git a/webkit/glue/localized_strings.cc b/webkit/glue/localized_strings.cc
index 9a508b7..2df1b8c 100644
--- a/webkit/glue/localized_strings.cc
+++ b/webkit/glue/localized_strings.cc
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
diff --git a/webkit/glue/media_player_private_impl.cc b/webkit/glue/media_player_private_impl.cc
index 5435ebb..19dc2da 100644
--- a/webkit/glue/media_player_private_impl.cc
+++ b/webkit/glue/media_player_private_impl.cc
@@ -34,8 +34,8 @@ static inline webkit_glue::WebMediaPlayerDelegate* AsDelegate(void* data) {
}
// We can't create the delegate here because m_player->frameView is null at
-// this moment. Although we can static_cast the MediaPlayerClient to
-// HTMLElement and get the frame from there, but creating the delegate from
+// this moment. Although we can static_cast the MediaPlayerClient to
+// HTMLElement and get the frame from there, but creating the delegate from
// load() seems to be a better idea.
MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
: m_player(player),
@@ -57,7 +57,7 @@ void MediaPlayerPrivate::load(const String& url) {
delete AsDelegate(m_data);
m_data = NULL;
- webkit_glue::WebMediaPlayer* media_player =
+ webkit_glue::WebMediaPlayer* media_player =
new webkit_glue::WebMediaPlayerImpl(this);
WebViewDelegate* d = media_player->GetWebFrame()->GetView()->GetDelegate();
@@ -158,7 +158,7 @@ float MediaPlayerPrivate::currentTime() const {
}
void MediaPlayerPrivate::seek(float time) {
- if (m_data) {
+ if (m_data) {
AsDelegate(m_data)->Seek(time);
}
}
@@ -202,7 +202,7 @@ MediaPlayer::NetworkState MediaPlayerPrivate::networkState() const {
return MediaPlayer::LoadFailed;
case webkit_glue::WebMediaPlayer::LOADED_META_DATA:
return MediaPlayer::LoadedMetaData;
- case webkit_glue::WebMediaPlayer::LOADED_FIRST_FRAME:
+ case webkit_glue::WebMediaPlayer::LOADED_FIRST_FRAME:
return MediaPlayer::LoadedFirstFrame;
default:
return MediaPlayer::Empty;
diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc
index 58e8152..9e8e67d 100644
--- a/webkit/glue/multipart_response_delegate.cc
+++ b/webkit/glue/multipart_response_delegate.cc
@@ -42,7 +42,7 @@ MultipartResponseDelegate::MultipartResponseDelegate(
}
void MultipartResponseDelegate::OnReceivedData(const char* data, int data_len) {
- // stop_sending_ means that we've already received the final boundary token.
+ // stop_sending_ means that we've already received the final boundary token.
// The server should stop sending us data at this point, but if it does, we
// just throw it away.
if (stop_sending_)
@@ -63,7 +63,7 @@ void MultipartResponseDelegate::OnReceivedData(const char* data, int data_len) {
int pos = PushOverLine(data_, 0);
if (pos)
data_ = data_.substr(pos);
-
+
if (data_.length() < boundary_.length() + 2) {
// We don't have enough data yet to make a boundary token. Just wait
// until the next chunk of data arrives.
@@ -216,7 +216,7 @@ bool MultipartResponseDelegate::ParseHeaders() {
}
// Send the response!
client_->didReceiveResponse(job_, response);
-
+
return true;
}
@@ -256,11 +256,11 @@ bool MultipartResponseDelegate::ReadMultipartBoundary(
content_type_as_string.find(';', boundary_start_offset);
if (boundary_end_offset == std::string::npos)
- boundary_end_offset = content_type_as_string.length();
+ boundary_end_offset = content_type_as_string.length();
size_t boundary_length = boundary_end_offset - boundary_start_offset;
- *multipart_boundary =
+ *multipart_boundary =
content_type_as_string.substr(boundary_start_offset, boundary_length);
// The byte range response can have quoted boundary strings. This is legal
// as per MIME specifications. Individual data fragements however don't
@@ -274,7 +274,7 @@ bool MultipartResponseDelegate::ReadContentRanges(
int* content_range_lower_bound,
int* content_range_upper_bound) {
- std::string content_range =
+ std::string content_range =
webkit_glue::StringToStdString(
response.httpHeaderField("Content-Range"));
@@ -293,7 +293,7 @@ bool MultipartResponseDelegate::ReadContentRanges(
return false;
}
- size_t byte_range_lower_bound_characters =
+ size_t byte_range_lower_bound_characters =
byte_range_lower_bound_end_offset - byte_range_lower_bound_start_offset;
std::string byte_range_lower_bound =
content_range.substr(byte_range_lower_bound_start_offset,
diff --git a/webkit/glue/multipart_response_delegate_unittest.cc b/webkit/glue/multipart_response_delegate_unittest.cc
index c70f55a..6a02c75 100644
--- a/webkit/glue/multipart_response_delegate_unittest.cc
+++ b/webkit/glue/multipart_response_delegate_unittest.cc
@@ -44,7 +44,7 @@ class MockResourceHandleClient : public ResourceHandleClient {
++received_data_;
data_.append(data, data_length);
}
-
+
void Reset() {
received_response_ = received_data_ = 0;
data_.clear();
@@ -139,7 +139,7 @@ TEST(MultipartResponseTest, Functions) {
EXPECT_EQ(webkit_glue::StringToStdWString(
client.resource_response_.httpHeaderField(String("foo"))),
wstring(L"Bar"));
-
+
// FindBoundary tests
struct {
const char* boundary;
@@ -276,7 +276,7 @@ void VariousChunkSizesTest(const TestChunk chunks[], int chunks_size, int respon
String());
MockResourceHandleClient client;
MultipartResponseDelegate delegate(&client, NULL, response, "bound");
-
+
for (int i = 0; i < chunks_size; ++i) {
ASSERT(chunks[i].start_pos < chunks[i].end_pos);
string chunk = data.substr(chunks[i].start_pos,
@@ -373,7 +373,7 @@ TEST(MultipartResponseTest, BreakInData) {
};
VariousChunkSizesTest(data2, arraysize(data2),
2, 2, "foofoofoofoofoo");
-
+
// Incomplete send
const TestChunk data3[] = {
{ 0, 35, 1, 0, "" },
@@ -389,7 +389,7 @@ TEST(MultipartResponseTest, MultipleBoundaries) {
String());
MockResourceHandleClient client;
MultipartResponseDelegate delegate(&client, NULL, response, "bound");
-
+
string data("--bound\r\n\r\n--bound\r\n\r\nfoofoo--bound--");
delegate.OnReceivedData(data.c_str(), static_cast<int>(data.length()));
EXPECT_EQ(2,
@@ -488,7 +488,7 @@ TEST(MultipartResponseTest, MultipartContentRangesTest) {
response1.setHTTPHeaderField(
String("Content-Range"),
String("bytes 1000-1050/5000"));
-
+
int content_range_lower_bound = 0;
int content_range_upper_bound = 0;
@@ -506,7 +506,7 @@ TEST(MultipartResponseTest, MultipartContentRangesTest) {
response2.setHTTPHeaderField(
String("Content-Range"),
String("bytes 1000/1050"));
-
+
content_range_lower_bound = 0;
content_range_upper_bound = 0;
diff --git a/webkit/glue/password_autocomplete_listener.cc b/webkit/glue/password_autocomplete_listener.cc
index 2a96ae4..3c5351a 100644
--- a/webkit/glue/password_autocomplete_listener.cc
+++ b/webkit/glue/password_autocomplete_listener.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// This file provides the implementaiton of the password manager's autocomplete
+// This file provides the implementaiton of the password manager's autocomplete
// component.
#include "webkit/glue/password_autocomplete_listener.h"
diff --git a/webkit/glue/password_autocomplete_listener_unittest.cc b/webkit/glue/password_autocomplete_listener_unittest.cc
index 8e58c11..ef5a4b1 100644
--- a/webkit/glue/password_autocomplete_listener_unittest.cc
+++ b/webkit/glue/password_autocomplete_listener_unittest.cc
@@ -204,7 +204,7 @@ TEST_F(PasswordManagerAutocompleteTests, OnInlineAutocompleteNeeded) {
TEST_F(PasswordManagerAutocompleteTests, TestWaitUsername) {
TestHTMLInputDelegate* username_delegate = new TestHTMLInputDelegate();
TestHTMLInputDelegate* password_delegate = new TestHTMLInputDelegate();
-
+
// If we had an action authority mismatch (for example), we don't want to
// automatically autofill anything without some user interaction first.
// We require an explicit blur on the username field, and that a valid
@@ -228,14 +228,14 @@ TEST_F(PasswordManagerAutocompleteTests, TestWaitUsername) {
listener->OnInlineAutocompleteNeeded(NULL, L"alice");
EXPECT_EQ(empty, username_delegate->value());
EXPECT_EQ(empty, password_delegate->value());
-
+
listener->OnBlur(NULL, L"a");
EXPECT_EQ(empty, username_delegate->value());
EXPECT_EQ(empty, password_delegate->value());
listener->OnBlur(NULL, L"ali");
EXPECT_EQ(empty, username_delegate->value());
EXPECT_EQ(empty, password_delegate->value());
-
+
// Blur with 'alice' should allow password autofill.
listener->OnBlur(NULL, L"alice");
EXPECT_EQ(empty, username_delegate->value());
diff --git a/webkit/glue/password_form.h b/webkit/glue/password_form.h
index aa577e3..4629189 100644
--- a/webkit/glue/password_form.h
+++ b/webkit/glue/password_form.h
@@ -53,7 +53,7 @@ struct PasswordForm {
// The URL (minus query parameters) containing the form. This is the primary
// data used by the PasswordManager to decide (in longest matching prefix
// fashion) whether or not a given PasswordForm result from the database is a
- // good fit for a particular form on a page, so it must not be empty.
+ // good fit for a particular form on a page, so it must not be empty.
GURL origin;
// The action target of the form. This is the primary data used by the
@@ -76,7 +76,7 @@ struct PasswordForm {
std::wstring submit_element;
// The name of the username input element. Optional (improves scoring).
- //
+ //
// When parsing an HTML form, this must always be set.
std::wstring username_element;
@@ -133,9 +133,9 @@ struct PasswordForm {
bool blacklisted_by_user;
PasswordForm()
- : scheme(SCHEME_HTML),
- ssl_valid(false),
- preferred(false),
+ : scheme(SCHEME_HTML),
+ ssl_valid(false),
+ preferred(false),
blacklisted_by_user(false) {
}
};
diff --git a/webkit/glue/password_form_dom_manager.cc b/webkit/glue/password_form_dom_manager.cc
index 4a372e8..c680c41 100644
--- a/webkit/glue/password_form_dom_manager.cc
+++ b/webkit/glue/password_form_dom_manager.cc
@@ -56,15 +56,15 @@ PasswordForm* PasswordFormDomManager::CreatePasswordForm(
if (!LocateSpecificPasswords(&fields, &password, &old_password))
return NULL;
- return AssemblePasswordFormResult(full_origin, full_action,
+ return AssemblePasswordFormResult(full_origin, full_action,
fields.submit, fields.username,
old_password, password);
}
// static
void PasswordFormDomManager::InitFillData(
- const PasswordForm& form_on_page,
- const PasswordFormMap& matches,
+ const PasswordForm& form_on_page,
+ const PasswordFormMap& matches,
const PasswordForm* const preferred_match,
bool wait_for_username_before_autofill,
PasswordFormDomManager::FillData* result) {
@@ -82,7 +82,7 @@ void PasswordFormDomManager::InitFillData(
// Copy additional username/value pairs.
PasswordFormMap::const_iterator iter;
for (iter = matches.begin(); iter != matches.end(); iter++) {
- if (iter->second != preferred_match)
+ if (iter->second != preferred_match)
result->additional_logins[iter->first] = iter->second->password_value;
}
}
@@ -113,12 +113,12 @@ bool PasswordFormDomManager::LocateSpecificPasswords(
fields->passwords[0]->value() == fields->passwords[2]->value()) {
// All three passwords the same? Just treat as one and hope.
*password = fields->passwords[0];
- } else if (fields->passwords[0]->value() ==
+ } else if (fields->passwords[0]->value() ==
fields->passwords[1]->value()) {
- // Two the same and one different -> old password is duplicated one.
+ // Two the same and one different -> old password is duplicated one.
*old_password = fields->passwords[0];
*password = fields->passwords[2];
- } else if (fields->passwords[1]->value() ==
+ } else if (fields->passwords[1]->value() ==
fields->passwords[2]->value()) {
*old_password = fields->passwords[0];
*password = fields->passwords[1];
@@ -171,9 +171,9 @@ bool PasswordFormDomManager::LocateSpecificPasswords(
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
- *
+ *
* ***** END LICENSE BLOCK ***** */
-// static
+// static
void PasswordFormDomManager::FindPasswordFormFields(
WebCore::HTMLFormElement* form,
PasswordFormFields* fields) {
@@ -213,7 +213,7 @@ void PasswordFormDomManager::FindPasswordFormFields(
WebCore::HTMLInputElement* input_element =
static_cast<WebCore::HTMLInputElement*>(form_element);
- if (!input_element->isEnabled())
+ if (!input_element->isEnabled())
continue;
if ((input_element->inputType() == WebCore::HTMLInputElement::TEXT) &&
@@ -227,7 +227,7 @@ void PasswordFormDomManager::FindPasswordFormFields(
// static
PasswordForm* PasswordFormDomManager::AssemblePasswordFormResult(
- const GURL& full_origin,
+ const GURL& full_origin,
const GURL& full_action,
WebCore::HTMLFormControlElement* submit,
WebCore::HTMLInputElement* username,
@@ -246,7 +246,7 @@ PasswordForm* PasswordFormDomManager::AssemblePasswordFormResult(
result->action = full_action.ReplaceComponents(rep);
result->origin = full_origin.ReplaceComponents(rep);
- // Naming is confusing here because we have both the HTML form origin URL
+ // Naming is confusing here because we have both the HTML form origin URL
// the page where the form was seen), and the "origin" components of the url
// (scheme, host, and port).
result->signon_realm = full_origin.GetOrigin().spec();
@@ -254,22 +254,22 @@ PasswordForm* PasswordFormDomManager::AssemblePasswordFormResult(
result->submit_element =
submit == NULL ? empty : webkit_glue::StringToStdWString(submit->name());
result->username_element =
- username == NULL ? empty
+ username == NULL ? empty
: webkit_glue::StringToStdWString(username->name());
result->username_value =
- username == NULL ? empty
+ username == NULL ? empty
: webkit_glue::StringToStdWString(username->value());
result->password_element =
- password == NULL ? empty
+ password == NULL ? empty
: webkit_glue::StringToStdWString(password->name());
result->password_value =
- password == NULL ? empty
+ password == NULL ? empty
: webkit_glue::StringToStdWString(password->value());
result->old_password_element =
- old_password == NULL ? empty
+ old_password == NULL ? empty
: webkit_glue::StringToStdWString(old_password->name());
result->old_password_value =
- old_password == NULL ? empty
+ old_password == NULL ? empty
: webkit_glue::StringToStdWString(old_password->value());
return result;
}
diff --git a/webkit/glue/password_form_dom_manager.h b/webkit/glue/password_form_dom_manager.h
index 6beb0ab..3591c19 100644
--- a/webkit/glue/password_form_dom_manager.h
+++ b/webkit/glue/password_form_dom_manager.h
@@ -20,7 +20,7 @@ class PasswordFormDomManager {
public:
typedef std::map<std::wstring, std::wstring> LoginCollection;
- // Structure used for autofilling password forms.
+ // Structure used for autofilling password forms.
// basic_data identifies the HTML form on the page and preferred username/
// password for login, while
// additional_logins is a list of other matching user/pass pairs for the form.
@@ -40,16 +40,16 @@ class PasswordFormDomManager {
// Create a PasswordForm from DOM form. Webkit doesn't allow storing
// custom metadata to DOM nodes, so we have to do this every time an event
// happens with a given form and compare against previously Create'd forms
- // to identify..which sucks.
+ // to identify..which sucks.
static PasswordForm* CreatePasswordForm(WebCore::HTMLFormElement* form);
- // Create a FillData structure in preparation for autofilling a form,
+ // Create a FillData structure in preparation for autofilling a form,
// from basic_data identifying which form to fill, and a collection of
// matching stored logins to use as username/password values.
// preferred_match should equal (address) one of matches.
// wait_for_username_before_autofill is true if we should not autofill
// anything until the user typed in a valid username and blurred the field.
- static void InitFillData(const PasswordForm& form_on_page,
+ static void InitFillData(const PasswordForm& form_on_page,
const PasswordFormMap& matches,
const PasswordForm* const preferred_match,
bool wait_for_username_before_autofill,
@@ -60,11 +60,11 @@ class PasswordFormDomManager {
WebCore::HTMLInputElement* username;
std::vector<WebCore::HTMLInputElement*> passwords;
WebCore::HTMLFormControlElement* submit;
- PasswordFormFields() : username(NULL), submit(NULL) {
+ PasswordFormFields() : username(NULL), submit(NULL) {
}
};
-
- // Helper to CreatePasswordForm to do the locating of username/password
+
+ // Helper to CreatePasswordForm to do the locating of username/password
// fields.
// This method based on Firefox2 code in
// toolkit/components/passwordmgr/base/nsPasswordManager.cpp
@@ -105,25 +105,25 @@ class PasswordFormDomManager {
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
- * ***** END LICENSE BLOCK ***** */
- static void FindPasswordFormFields(WebCore::HTMLFormElement* form,
+ * ***** END LICENSE BLOCK ***** */
+ static void FindPasswordFormFields(WebCore::HTMLFormElement* form,
PasswordFormFields* fields);
// Helper to determine which password is the main one, and which is
// an old password (e.g on a "make new password" form), if any.
static bool LocateSpecificPasswords(
- PasswordFormFields* fields,
+ PasswordFormFields* fields,
WebCore::HTMLInputElement** password,
WebCore::HTMLInputElement** old_password_index);
// Helper to gather up the final form data and create a PasswordForm.
static PasswordForm* AssemblePasswordFormResult(
- const GURL& full_origin,
+ const GURL& full_origin,
const GURL& full_action,
WebCore::HTMLFormControlElement* submit,
WebCore::HTMLInputElement* username,
WebCore::HTMLInputElement* old_password,
WebCore::HTMLInputElement* password);
-
+
// This class can't be instantiated.
DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordFormDomManager);
};
diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc
index 2cc2933..450e319 100644
--- a/webkit/glue/plugins/plugin_host.cc
+++ b/webkit/glue/plugins/plugin_host.cc
@@ -878,7 +878,7 @@ NPError NPN_SetValue(NPP id, NPPVariable variable, void *value) {
// we only support the CoreGraphics drawing model
if (reinterpret_cast<int>(value) == NPDrawingModelCoreGraphics)
return NPERR_NO_ERROR;
- return NPERR_GENERIC_ERROR;
+ return NPERR_GENERIC_ERROR;
#endif
default:
// TODO: implement me
diff --git a/webkit/glue/regular_expression_unittest.cc b/webkit/glue/regular_expression_unittest.cc
index eaab8ce..e238636 100644
--- a/webkit/glue/regular_expression_unittest.cc
+++ b/webkit/glue/regular_expression_unittest.cc
@@ -64,7 +64,7 @@ TEST(RegexTest, Unicode) {
wstr_pattern = L":[ \x2000]+:";
pattern = StdWStringToString(wstr_pattern);
regex = RegularExpression(pattern, WebCore::TextCaseInsensitive);
-
+
const Match matches[] = {
{ L": :", 0, 4 },
{ L" : : ", 2, 6 },
@@ -83,7 +83,7 @@ TEST(RegexTest, Unicode) {
wstr_pattern = L"|x";
pattern = StdWStringToString(wstr_pattern);
regex = RegularExpression(pattern, WebCore::TextCaseInsensitive);
-
+
const Match matches2[] = {
{ L"", 0, 0 },
};
diff --git a/webkit/glue/resource_fetcher.cc b/webkit/glue/resource_fetcher.cc
index 89fc48a..074563d 100644
--- a/webkit/glue/resource_fetcher.cc
+++ b/webkit/glue/resource_fetcher.cc
@@ -93,11 +93,11 @@ void ResourceFetcher::didFinishLoading(ResourceHandle* resource_handle) {
delegate_->OnURLFetchComplete(response_, data_);
}
-void ResourceFetcher::didFail(ResourceHandle* resource_handle,
+void ResourceFetcher::didFail(ResourceHandle* resource_handle,
const ResourceError& error) {
ASSERT(!completed_);
completed_ = true;
-
+
// Go ahead and tell our delegate that we're done. Send an empty
// ResourceResponse and string.
if (delegate_)
diff --git a/webkit/glue/resource_fetcher_unittest.cc b/webkit/glue/resource_fetcher_unittest.cc
index 81d9646..c742cee 100644
--- a/webkit/glue/resource_fetcher_unittest.cc
+++ b/webkit/glue/resource_fetcher_unittest.cc
@@ -83,9 +83,9 @@ class FetcherDelegate : public ResourceFetcher::Delegate {
// CFAbsoluteTime is in seconds and |interval| is in ms, so make sure we
// keep the units correct.
CFTimeInterval interval_in_seconds = static_cast<double>(interval) / 1000.0;
- CFAbsoluteTime fire_date =
+ CFAbsoluteTime fire_date =
CFAbsoluteTimeGetCurrent() + interval_in_seconds;
- timer_id_ = CFRunLoopTimerCreate(NULL, fire_date, interval_in_seconds, 0,
+ timer_id_ = CFRunLoopTimerCreate(NULL, fire_date, interval_in_seconds, 0,
0, FetcherDelegate::TimerCallback, NULL);
CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer_id_, kCFRunLoopCommonModes);
#endif
@@ -97,7 +97,7 @@ class FetcherDelegate : public ResourceFetcher::Delegate {
#elif defined(OS_LINUX)
g_source_remove(timer_id_);
#elif defined(OS_MACOSX)
- CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), timer_id_,
+ CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), timer_id_,
kCFRunLoopCommonModes);
CFRelease(timer_id_);
#endif
diff --git a/webkit/glue/searchable_form_data.cc b/webkit/glue/searchable_form_data.cc
index bdc5abd..71453cf 100644
--- a/webkit/glue/searchable_form_data.cc
+++ b/webkit/glue/searchable_form_data.cc
@@ -47,7 +47,7 @@ static void appendString(Vector<char>& buffer, const char* string)
buffer.append(string, strlen(string));
}
-// TODO (sky): This comes straight out of HTMLFormElement, will work with
+// TODO (sky): This comes straight out of HTMLFormElement, will work with
// WebKit folks to make public.
static void appendEncodedString(Vector<char>& buffer, const WebCore::CString& string)
{
@@ -76,28 +76,28 @@ static void appendEncodedString(Vector<char>& buffer, const WebCore::CString& st
// Returns true if the form element has an 'onsubmit' attribute.
bool FormHasOnSubmit(WebCore::HTMLFormElement* form) {
- const WebCore::AtomicString& attribute_value =
+ const WebCore::AtomicString& attribute_value =
form->getAttribute(WebCore::HTMLNames::onsubmitAttr);
return (!attribute_value.isNull() && !attribute_value.isEmpty());
}
// Returns true if the form element will submit the data using a GET.
bool IsFormMethodGet(WebCore::HTMLFormElement* form) {
- const WebCore::AtomicString& attribute_value =
+ const WebCore::AtomicString& attribute_value =
form->getAttribute(WebCore::HTMLNames::methodAttr);
return !equalIgnoringCase(attribute_value, "post");
}
// Gets the encoding for the form.
-void GetFormEncoding(WebCore::HTMLFormElement* form,
+void GetFormEncoding(WebCore::HTMLFormElement* form,
WebCore::TextEncoding* encoding) {
- WebCore::String str =
+ WebCore::String str =
form->getAttribute(WebCore::HTMLNames::accept_charsetAttr);
str.replace(',', ' ');
Vector<WebCore::String> charsets;
str.split(' ', charsets);
Vector<WebCore::String>::const_iterator end = charsets.end();
- for (Vector<WebCore::String>::const_iterator it = charsets.begin(); it != end;
+ for (Vector<WebCore::String>::const_iterator it = charsets.begin(); it != end;
++it) {
*encoding = WebCore::TextEncoding(*it);
if (encoding->isValid())
@@ -125,7 +125,7 @@ bool IsHTTPFormSubmit(WebCore::HTMLFormElement* form) {
// button is returned.
WebCore::HTMLFormControlElement* GetButtonToActivate(
WebCore::HTMLFormElement* form) {
- WTF::Vector<WebCore::HTMLFormControlElement*> form_elements =
+ WTF::Vector<WebCore::HTMLFormControlElement*> form_elements =
form->formElements;
WebCore::HTMLFormControlElement* first_submit_button = NULL;
@@ -134,7 +134,7 @@ WebCore::HTMLFormControlElement* GetButtonToActivate(
if (current->isActivatedSubmit()) {
// There's a button that is already activated for submit, return NULL.
return NULL;
- } else if (first_submit_button == NULL &&
+ } else if (first_submit_button == NULL &&
current->isSuccessfulSubmitButton()) {
first_submit_button = current;
}
@@ -206,7 +206,7 @@ bool IsInDefaultState(WebCore::HTMLFormControlElement* form_element) {
}
// If form has only one text input element, it is returned. If a valid input
-// element is not found, NULL is returned. Additionally, the form data for all
+// element is not found, NULL is returned. Additionally, the form data for all
// elements is added to enc_string and the encoding used is set in
// encoding_name.
WebCore::HTMLInputElement* GetTextElement(
@@ -223,7 +223,7 @@ WebCore::HTMLInputElement* GetTextElement(
}
*encoding_name = encoding.name();
WebCore::HTMLInputElement* text_element = NULL;
- WTF::Vector<WebCore::HTMLFormControlElement*> form_elements =
+ WTF::Vector<WebCore::HTMLFormControlElement*> form_elements =
form->formElements;
for (unsigned i = 0; i < form_elements.size(); ++i) {
WebCore::HTMLFormControlElement* form_element = form_elements[i];
@@ -233,7 +233,7 @@ WebCore::HTMLInputElement* GetTextElement(
return NULL;
}
if (form_element->hasTagName(WebCore::HTMLNames::inputTag)) {
- WebCore::HTMLInputElement* input_element =
+ WebCore::HTMLInputElement* input_element =
static_cast<WebCore::HTMLInputElement*>(form_element);
switch (input_element->inputType()) {
case WebCore::HTMLInputElement::TEXT:
@@ -304,7 +304,7 @@ SearchableFormData* SearchableFormData::Create(WebCore::Element* element) {
if (frame == NULL)
return NULL;
- WebCore::HTMLFormControlElement* input_element =
+ WebCore::HTMLFormControlElement* input_element =
static_cast<WebCore::HTMLFormControlElement*>(element);
WebCore::HTMLFormElement* form = input_element->form();
@@ -326,7 +326,7 @@ SearchableFormData* SearchableFormData::Create(WebCore::HTMLFormElement* form) {
return NULL;
Vector<char> enc_string;
- WebCore::HTMLFormControlElement* first_submit_button =
+ WebCore::HTMLFormControlElement* first_submit_button =
GetButtonToActivate(form);
if (first_submit_button) {
@@ -357,14 +357,14 @@ SearchableFormData* SearchableFormData::Create(WebCore::HTMLFormElement* form) {
url.setQuery(form_data->flattenToString());
std::wstring current_value = webkit_glue::StringToStdWString(
static_cast<WebCore::HTMLInputElement*>(text_element)->value());
- std::wstring text_name =
+ std::wstring text_name =
webkit_glue::StringToStdWString(text_element->name());
GURL gurl(webkit_glue::KURLToGURL(url));
return new SearchableFormData(gurl, text_name, current_value, encoding);
}
-// static
-bool SearchableFormData::Equals(const SearchableFormData* a,
+// static
+bool SearchableFormData::Equals(const SearchableFormData* a,
const SearchableFormData* b) {
return ((a == b) ||
(a != NULL && b != NULL &&
@@ -374,7 +374,7 @@ bool SearchableFormData::Equals(const SearchableFormData* a,
a->encoding() == b->encoding()));
}
-SearchableFormData::SearchableFormData(const GURL& url,
+SearchableFormData::SearchableFormData(const GURL& url,
const std::wstring& element_name,
const std::wstring& element_value,
const std::string& encoding)
diff --git a/webkit/glue/webcursor_mac.mm b/webkit/glue/webcursor_mac.mm
index dfbe5df..90ff096 100644
--- a/webkit/glue/webcursor_mac.mm
+++ b/webkit/glue/webcursor_mac.mm
@@ -146,14 +146,14 @@ void WebCursor::SetCustomData(WebCore::Image* image) {
WebCore::NativeImagePtr image_ptr = image->nativeImageForCurrentFrame();
if (!image_ptr)
return;
-
+
RetainPtr<CGColorSpace> cg_color(AdoptCF, CGColorSpaceCreateDeviceRGB());
-
+
size_t size = CGImageGetHeight(image_ptr)*CGImageGetWidth(image_ptr)*4;
custom_data_.resize(size);
custom_size_.set_width(CGImageGetWidth(image_ptr));
custom_size_.set_height(CGImageGetHeight(image_ptr));
-
+
// These settings match up with the code in CreateCustomCursor() above; keep
// them in sync.
// TODO(avi): test to ensure that the flags here are correct for RGBA
diff --git a/webkit/glue/webcursor_win.cc b/webkit/glue/webcursor_win.cc
index 2c6e275..5ed5d67 100644
--- a/webkit/glue/webcursor_win.cc
+++ b/webkit/glue/webcursor_win.cc
@@ -182,8 +182,8 @@ HCURSOR WebCursor::GetCursor(HINSTANCE module_handle){
custom_cursor_ = CreateIconIndirect(&ii);
- DeleteObject(mask);
- DeleteObject(bitmap_handle);
+ DeleteObject(mask);
+ DeleteObject(bitmap_handle);
DeleteDC(workingDC);
ReleaseDC(0, dc);
return custom_cursor_;
@@ -211,7 +211,7 @@ bool WebCursor::SerializePlatformData(Pickle* pickle) const {
}
bool WebCursor::DeserializePlatformData(const Pickle* pickle, void** iter) {
- return pickle->ReadIntPtr(iter,
+ return pickle->ReadIntPtr(iter,
reinterpret_cast<intptr_t*>(&external_cursor_));
}
diff --git a/webkit/glue/webdatasource.h b/webkit/glue/webdatasource.h
index 3f3eb0d..b90a079 100644
--- a/webkit/glue/webdatasource.h
+++ b/webkit/glue/webdatasource.h
@@ -54,7 +54,7 @@ class WebDataSource {
//
// @method unreachableURL
- // @discussion This will be non-nil only for dataSources created by calls to the
+ // @discussion This will be non-nil only for dataSources created by calls to the
// WebFrame method loadAlternateHTMLString:baseURL:forUnreachableURL:.
// @result returns the unreachableURL for which this dataSource is showing alternate content, or nil
// - (NSURL *)unreachableURL;
@@ -90,12 +90,12 @@ class WebDataSource {
/*
These functions are not implemented yet, and we are not yet sure whether or not
- we need them, so we have commented them out both here and in the
+ we need them, so we have commented them out both here and in the
webdatasource_impl.cc file.
//
// @method data
- // @discussion The data will be incomplete until the datasource has completely loaded.
+ // @discussion The data will be incomplete until the datasource has completely loaded.
// @result Returns the raw data associated with the datasource. Returns nil
// if the datasource hasn't loaded any data.
// - (NSData *)data;
@@ -120,7 +120,7 @@ class WebDataSource {
//
// @method textEncodingName
- // @result Returns either the override encoding, as set on the WebView for this
+ // @result Returns either the override encoding, as set on the WebView for this
// dataSource or the encoding from the response.
// - (NSString *)textEncodingName;
virtual void GetTextEncodingName(std::wstring* name) = 0;
@@ -155,7 +155,7 @@ class WebDataSource {
// @description The returned array only contains subresources that have fully downloaded.
// - (NSArray *)subresources;
virtual void GetSubresources(int* count, IWebResource*** resources);
-
+
//
// method subresourceForURL:
// @abstract Returns a subresource for a given URL.
diff --git a/webkit/glue/webdatasource_impl.cc b/webkit/glue/webdatasource_impl.cc
index b8043b1..70ba01c 100644
--- a/webkit/glue/webdatasource_impl.cc
+++ b/webkit/glue/webdatasource_impl.cc
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
diff --git a/webkit/glue/webdatasource_impl.h b/webkit/glue/webdatasource_impl.h
index d5daa22..0b364c4 100644
--- a/webkit/glue/webdatasource_impl.h
+++ b/webkit/glue/webdatasource_impl.h
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WEBKIT_GLUE_WEBDATASOURCE_IMPL_H_
@@ -56,7 +56,7 @@ class WebDataSourceImpl : public WebDataSource {
virtual const std::vector<GURL>& GetRedirectChain() const;
// WebDataSourceImpl
-
+
// Called after creating a new data source if there is request info
// available. Since we store copies of the WebRequests, the original
// WebRequest that the embedder created was lost, and the exra data would
diff --git a/webkit/glue/webdocumentloader_impl.cc b/webkit/glue/webdocumentloader_impl.cc
index 3d89633..81c91be 100644
--- a/webkit/glue/webdocumentloader_impl.cc
+++ b/webkit/glue/webdocumentloader_impl.cc
@@ -6,13 +6,13 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+ * documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
diff --git a/webkit/glue/webdocumentloader_impl.h b/webkit/glue/webdocumentloader_impl.h
index 8a739bf..8a5b320 100644
--- a/webkit/glue/webdocumentloader_impl.h
+++ b/webkit/glue/webdocumentloader_impl.h
@@ -6,13 +6,13 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+ * documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -66,7 +66,7 @@ class WebDocumentLoaderImpl : public WebCore::DocumentLoader {
// Returns the SearchableFormData for this DocumentLoader.
// WebDocumentLoaderImpl owns the returned SearchableFormData.
const SearchableFormData* searchable_form_data() const {
- return searchable_form_data_.get();
+ return searchable_form_data_.get();
}
// Sets the PasswordFormData for this DocumentLoader.
@@ -95,7 +95,7 @@ class WebDocumentLoaderImpl : public WebCore::DocumentLoader {
scoped_ptr<WebDataSource> detached_datasource_;
scoped_ptr<const SearchableFormData> searchable_form_data_;
scoped_ptr<const PasswordForm> password_form_data_;
-
+
bool lock_history_;
bool form_submit_;
diff --git a/webkit/glue/webdropdata.h b/webkit/glue/webdropdata.h
index 7c9fe19..f74dcaf 100644
--- a/webkit/glue/webdropdata.h
+++ b/webkit/glue/webdropdata.h
@@ -37,7 +37,7 @@ struct WebDropData {
// User is dragging plain text into the webview.
std::wstring plain_text;
- // User is dragging text/html into the webview (e.g., out of Firefox).
+ // User is dragging text/html into the webview (e.g., out of Firefox).
// |html_base_url| is the URL that the html fragment is taken from (used to
// resolve relative links). It's ok for |html_base_url| to be empty.
std::wstring text_html;
diff --git a/webkit/glue/weberror_impl.h b/webkit/glue/weberror_impl.h
index 1ce453a..35e515c 100644
--- a/webkit/glue/weberror_impl.h
+++ b/webkit/glue/weberror_impl.h
@@ -22,7 +22,7 @@ class WebErrorImpl : public WebError {
// WebError implementation:
virtual int GetErrorCode() const;
virtual const GURL& GetFailedURL() const;
-
+
private:
int error_code_;
GURL failed_url_;
diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc
index f8acc50..2207fca 100644
--- a/webkit/glue/webframeloaderclient_impl.cc
+++ b/webkit/glue/webframeloaderclient_impl.cc
@@ -227,7 +227,7 @@ bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader*,
// This returns true for backward compatibility: the ability to override the
// system credential store is new. (Actually, not yet fully implemented in
// WebKit, as of this writing.)
- return true;
+ return true;
}
void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(
diff --git a/webkit/glue/webframeloaderclient_impl.h b/webkit/glue/webframeloaderclient_impl.h
index a84b937..2dbd805 100644
--- a/webkit/glue/webframeloaderclient_impl.h
+++ b/webkit/glue/webframeloaderclient_impl.h
@@ -39,7 +39,7 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
virtual void frameLoaderDestroyed();
- // Notifies the WebView delegate that the JS window object has been cleared,
+ // Notifies the WebView delegate that the JS window object has been cleared,
// giving it a chance to bind native objects to the window before script
// parsing begins.
virtual void windowObjectCleared();
@@ -62,7 +62,7 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse);
virtual bool shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier);
virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&);
- virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&);
+ virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&);
virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&);
virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int lengthReceived);
virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier);
@@ -148,7 +148,7 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
virtual void prepareForDataSourceReplacement();
virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(
- const WebCore::ResourceRequest&,
+ const WebCore::ResourceRequest&,
const WebCore::SubstituteData&);
virtual void setTitle(const WebCore::String& title, const WebCore::KURL&);
@@ -165,28 +165,28 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
const WebCore::ResourceResponse& response);
virtual PassRefPtr<WebCore::Frame> createFrame(
const WebCore::KURL& url,
- const WebCore::String& name,
+ const WebCore::String& name,
WebCore::HTMLFrameOwnerElement* ownerElement,
- const WebCore::String& referrer,
+ const WebCore::String& referrer,
bool allowsScrolling, int marginWidth,
int marginHeight);
virtual WebCore::Widget* createPlugin(const WebCore::IntSize&,
- WebCore::HTMLPlugInElement*,
- const WebCore::KURL&,
- const WTF::Vector<WebCore::String>&,
- const WTF::Vector<WebCore::String>&,
- const WebCore::String&,
+ WebCore::HTMLPlugInElement*,
+ const WebCore::KURL&,
+ const WTF::Vector<WebCore::String>&,
+ const WTF::Vector<WebCore::String>&,
+ const WebCore::String&,
bool loadManually);
virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget);
virtual WebCore::Widget* createJavaAppletWidget(
- const WebCore::IntSize&,
+ const WebCore::IntSize&,
WebCore::HTMLAppletElement*,
- const WebCore::KURL& baseURL,
- const WTF::Vector<WebCore::String>& paramNames,
+ const WebCore::KURL& baseURL,
+ const WTF::Vector<WebCore::String>& paramNames,
const WTF::Vector<WebCore::String>& paramValues);
- virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL& url,
+ virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL& url,
const WebCore::String& mimeType);
virtual WebCore::String overrideMediaType() const;
diff --git a/webkit/glue/webhistoryitem_impl.cc b/webkit/glue/webhistoryitem_impl.cc
index 20bd956..c381eed 100644
--- a/webkit/glue/webhistoryitem_impl.cc
+++ b/webkit/glue/webhistoryitem_impl.cc
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
diff --git a/webkit/glue/webinputevent_mac.mm b/webkit/glue/webinputevent_mac.mm
index cdef792..f713683 100644
--- a/webkit/glue/webinputevent_mac.mm
+++ b/webkit/glue/webinputevent_mac.mm
@@ -98,7 +98,7 @@ WebMouseEvent::WebMouseEvent(NSEvent *event, NSView* view) {
location = [view convertPoint:windowLocal fromView:nil];
y = [view frame].size.height - location.y; // flip y
x = location.x;
-
+
// set modifiers:
if ([event modifierFlags] & NSControlKeyMask)
@@ -178,22 +178,22 @@ static inline bool isKeyUpEvent(NSEvent *event)
case 54: // Right Command
case 55: // Left Command
return ([event modifierFlags] & NSCommandKeyMask) == 0;
-
+
case 57: // Capslock
return ([event modifierFlags] & NSAlphaShiftKeyMask) == 0;
-
+
case 56: // Left Shift
case 60: // Right Shift
return ([event modifierFlags] & NSShiftKeyMask) == 0;
-
+
case 58: // Left Alt
case 61: // Right Alt
return ([event modifierFlags] & NSAlternateKeyMask) == 0;
-
+
case 59: // Left Ctrl
case 62: // Right Ctrl
return ([event modifierFlags] & NSControlKeyMask) == 0;
-
+
case 63: // Function
return ([event modifierFlags] & NSFunctionKeyMask) == 0;
}
@@ -233,7 +233,7 @@ static bool isKeypadEvent(NSEvent* event)
case 92: // 9
return true;
}
-
+
return false;
}
@@ -246,30 +246,30 @@ static int windowsKeyCodeForKeyEvent(NSEvent* event)
// VK_APPS (5D) Right windows/meta key
case 54: // Right Command
return 0x5D;
-
+
// VK_LWIN (5B) Left windows/meta key
case 55: // Left Command
return 0x5B;
-
+
// VK_CAPITAL (14) caps locks key
case 57: // Capslock
return 0x14;
-
+
// VK_SHIFT (10) either shift key
case 56: // Left Shift
case 60: // Right Shift
return 0x10;
-
+
// VK_MENU (12) either alt key
case 58: // Left Alt
case 61: // Right Alt
return 0x12;
-
+
// VK_CONTROL (11) either ctrl key
case 59: // Left Ctrl
case 62: // Right Ctrl
return 0x11;
-
+
// VK_CLEAR (0C) CLEAR key
case 71: return 0x0C;
@@ -611,8 +611,8 @@ static inline NSString* textFromEvent(NSEvent* event)
return @"";
return [event characters];
}
-
-
+
+
static inline NSString* unmodifiedTextFromEvent(NSEvent* event)
{
if ([event type] == NSFlagsChanged)
@@ -622,32 +622,32 @@ static inline NSString* unmodifiedTextFromEvent(NSEvent* event)
static NSString* keyIdentifierForKeyEvent(NSEvent* event)
{
- if ([event type] == NSFlagsChanged)
+ if ([event type] == NSFlagsChanged)
switch ([event keyCode]) {
case 54: // Right Command
case 55: // Left Command
return @"Meta";
-
+
case 57: // Capslock
return @"CapsLock";
-
+
case 56: // Left Shift
case 60: // Right Shift
return @"Shift";
-
+
case 58: // Left Alt
case 61: // Right Alt
return @"Alt";
-
+
case 59: // Left Ctrl
case 62: // Right Ctrl
return @"Control";
-
+
default:
ASSERT_NOT_REACHED();
return @"";
}
-
+
NSString *s = [event charactersIgnoringModifiers];
if ([s length] != 1) {
return @"Unidentified";
@@ -914,7 +914,7 @@ static NSString* keyIdentifierForKeyEvent(NSEvent* event)
// Standard says that DEL becomes U+007F.
case NSDeleteFunctionKey:
return @"U+007F";
-
+
// Always use 0x09 for tab instead of AppKit's backtab character.
case NSBackTabCharacter:
return @"U+0009";
@@ -958,10 +958,10 @@ WebKeyboardEvent::WebKeyboardEvent(NSEvent *event) {
modifiers |= ALT_KEY;
if ([event modifierFlags] & NSCommandKeyMask)
modifiers |= META_KEY;
-
+
if (WebCore::isKeypadEvent(event))
modifiers |= IS_KEYPAD;
-
+
if (([event type] != NSFlagsChanged) && [event isARepeat])
modifiers |= IS_AUTO_REPEAT;
diff --git a/webkit/glue/webinputevent_win.cc b/webkit/glue/webinputevent_win.cc
index 9202672..455ecfc 100644
--- a/webkit/glue/webinputevent_win.cc
+++ b/webkit/glue/webinputevent_win.cc
@@ -93,7 +93,7 @@ WebMouseEvent::WebMouseEvent(HWND hwnd, UINT message, WPARAM wparam,
global_x = global_point.x;
global_y = global_point.y;
-
+
// set modifiers:
if (wparam & MK_CONTROL)
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc
index 3ba885a..30c1ed0 100644
--- a/webkit/glue/webkit_glue.cc
+++ b/webkit/glue/webkit_glue.cc
@@ -184,7 +184,7 @@ static void DumpHistoryItem(WebCore::HistoryItem* item, int indent,
if (item->hasChildren()) {
WebCore::HistoryItemVector children = item->children();
- // Must sort to eliminate arbitrary result ordering which defeats
+ // Must sort to eliminate arbitrary result ordering which defeats
// reproducible testing.
std::sort(children.begin(), children.end(), HistoryItemCompareLess);
for (unsigned i = 0; i < children.size(); i++) {
@@ -419,7 +419,7 @@ const std::string& GetUserAgent(const GURL& url) {
if (!g_user_agent->user_agent_is_overridden) {
// For hotmail, we need to spoof as Safari (bug 4111).
if (MatchPattern(url.host(), "*.mail.live.com")) {
- if (g_user_agent->mimic_safari_user_agent.empty())
+ if (g_user_agent->mimic_safari_user_agent.empty())
BuildUserAgent(true, &g_user_agent->mimic_safari_user_agent);
return g_user_agent->mimic_safari_user_agent;
}
diff --git a/webkit/glue/webkit_glue_mac.mm b/webkit/glue/webkit_glue_mac.mm
index 856e662..484b6f1 100644
--- a/webkit/glue/webkit_glue_mac.mm
+++ b/webkit/glue/webkit_glue_mac.mm
@@ -54,7 +54,7 @@ ScreenInfo GetScreenInfoHelper(gfx::NativeView view) {
NSBitsPerPixelFromDepth([[NSScreen deepestScreen] depth]);
results.depth_per_component =
NSBitsPerSampleFromDepth([[NSScreen deepestScreen] depth]);
- results.is_monochrome =
+ results.is_monochrome =
color_space == NSCalibratedWhiteColorSpace ||
color_space == NSCalibratedBlackColorSpace ||
color_space == NSDeviceWhiteColorSpace ||
diff --git a/webkit/glue/webkit_glue_win.cc b/webkit/glue/webkit_glue_win.cc
index f41feb5..82242f7 100644
--- a/webkit/glue/webkit_glue_win.cc
+++ b/webkit/glue/webkit_glue_win.cc
@@ -25,7 +25,7 @@ ScreenInfo GetScreenInfoHelper(gfx::NativeView window) {
results.depth_per_component = dev_mode.dmBitsPerPel / 3; // Assumes RGB
results.is_monochrome = dev_mode.dmColor == DMCOLOR_MONOCHROME;
results.rect = gfx::Rect(monitor_info.rcMonitor);
- results.available_rect = gfx::Rect(monitor_info.rcWork);
+ results.available_rect = gfx::Rect(monitor_info.rcWork);
return results;
}
diff --git a/webkit/glue/webmediaplayer.h b/webkit/glue/webmediaplayer.h
index b786c7e..102eb5e 100644
--- a/webkit/glue/webmediaplayer.h
+++ b/webkit/glue/webmediaplayer.h
@@ -38,7 +38,7 @@ public:
// Get the web frame associated with the media player
virtual WebFrame* GetWebFrame() = 0;
-
+
// Notify the media player about network state change.
virtual void NotifyNetworkStateChange() = 0;
diff --git a/webkit/glue/webmediaplayer_delegate.h b/webkit/glue/webmediaplayer_delegate.h
index 1f4d695..69df7e7 100644
--- a/webkit/glue/webmediaplayer_delegate.h
+++ b/webkit/glue/webmediaplayer_delegate.h
@@ -45,7 +45,7 @@ class WebMediaPlayerDelegate {
// Methods for painting.
virtual void SetRect(const gfx::Rect& rect) = 0;
- // TODO(hclam): Using paint at the moment, maybe we just need to return a
+ // TODO(hclam): Using paint at the moment, maybe we just need to return a
// SkiaBitmap?
virtual void Paint(skia::PlatformCanvas *canvas, const gfx::Rect& rect) = 0;
diff --git a/webkit/glue/webmediaplayer_impl.h b/webkit/glue/webmediaplayer_impl.h
index 0f9e53e..fce28bc 100644
--- a/webkit/glue/webmediaplayer_impl.h
+++ b/webkit/glue/webmediaplayer_impl.h
@@ -2,7 +2,7 @@
// source code is governed by a BSD-style license that can be found in the
// LICENSE file.
//
-// Wrapper over WebCore::MediaPlayerPrivate. It also would handle resource
+// Wrapper over WebCore::MediaPlayerPrivate. It also would handle resource
// loading for the internal media player.
#ifndef WEBKIT_GLUE_WEBMEDIAPLAYER_IMPL_H_
@@ -32,7 +32,7 @@ class WebMediaPlayerImpl : public WebMediaPlayer {
// Get the web frame associated with the media player
virtual WebFrame* GetWebFrame();
-
+
// Notify the media player about network state change.
virtual void NotifyNetworkStateChange();
diff --git a/webkit/glue/webresponse.h b/webkit/glue/webresponse.h
index 34abd935..9d087c05 100644
--- a/webkit/glue/webresponse.h
+++ b/webkit/glue/webresponse.h
@@ -15,7 +15,7 @@ class WebResponse {
public:
// Get the URL.
virtual GURL GetURL() const = 0;
-
+
// Get the http status code.
virtual int GetHttpStatusCode() const = 0;
diff --git a/webkit/glue/webresponse_impl.h b/webkit/glue/webresponse_impl.h
index e9dfddf..494848b 100644
--- a/webkit/glue/webresponse_impl.h
+++ b/webkit/glue/webresponse_impl.h
@@ -15,7 +15,7 @@ class WebResponseImpl : public WebResponse {
WebResponseImpl() { }
explicit WebResponseImpl(const WebCore::ResourceResponse& response)
: response_(response) { }
-
+
virtual ~WebResponseImpl() { }
// Get the URL.
diff --git a/webkit/glue/weburlrequest_impl.h b/webkit/glue/weburlrequest_impl.h
index 0548c26..3ce55b0 100644
--- a/webkit/glue/weburlrequest_impl.h
+++ b/webkit/glue/weburlrequest_impl.h
@@ -16,7 +16,7 @@ MSVC_POP_WARNING();
class WebRequestImpl : public WebRequest {
public:
WebRequestImpl();
-
+
explicit WebRequestImpl(const GURL& url);
explicit WebRequestImpl(const WebCore::ResourceRequest& request);
explicit WebRequestImpl(const WebCore::FrameLoadRequest& request);
diff --git a/webkit/glue/webview.h b/webkit/glue/webview.h
index d8ef94d..85f11a7 100644
--- a/webkit/glue/webview.h
+++ b/webkit/glue/webview.h
@@ -168,7 +168,7 @@ class WebView : public WebWidget {
virtual void DragSourceEndedAt(
int client_x, int client_y, int screen_x, int screen_y) = 0;
- // Notifies the webview that a drag and drop operation is in progress, with
+ // Notifies the webview that a drag and drop operation is in progress, with
// dropable items over the view.
virtual void DragSourceMovedTo(
int client_x, int client_y, int screen_x, int screen_y) = 0;
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index b81f0cd..4b62711 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -161,12 +161,12 @@ class AutocompletePopupMenuClient : public WebCore::PopupMenuClient {
// WebCore::PopupMenuClient implementation.
virtual void valueChanged(unsigned listIndex, bool fireEvents = true) {
text_field_->setValue(suggestions_[listIndex]);
- }
+ }
virtual WebCore::String itemText(unsigned list_index) const {
return suggestions_[list_index];
}
-
+
virtual bool itemIsEnabled(unsigned listIndex) const {
return true;
}
@@ -246,7 +246,7 @@ class AutocompletePopupMenuClient : public WebCore::PopupMenuClient {
ScrollbarClient* client,
ScrollbarOrientation orientation,
ScrollbarControlSize size) {
- RefPtr<Scrollbar> widget = Scrollbar::createNativeScrollbar(client,
+ RefPtr<Scrollbar> widget = Scrollbar::createNativeScrollbar(client,
orientation,
size);
return widget.release();
@@ -267,7 +267,7 @@ class AutocompletePopupMenuClient : public WebCore::PopupMenuClient {
WebCore::HTMLInputElement* text_field() const {
return text_field_.get();
}
-
+
WebCore::RenderStyle* GetTextFieldStyle() const {
WebCore::RenderStyle* style = text_field_->computedStyle();
if (!style) {
@@ -553,7 +553,7 @@ bool WebViewImpl::AutocompleteHandleKeyEvent(const WebKeyboardEvent& event) {
return false;
}
-
+
bool WebViewImpl::CharEvent(const WebKeyboardEvent& event) {
DCHECK(event.type == WebInputEvent::CHAR);
@@ -600,7 +600,7 @@ bool WebViewImpl::CharEvent(const WebKeyboardEvent& event) {
* webkit\webkit\win\WebView.cpp. The only significant change in this
* function is the code to convert from a Keyboard event to the Right
* Mouse button up event.
-*
+*
* This function is an ugly copy/paste and should be cleaned up when the
* WebKitWin version is cleaned: https://bugs.webkit.org/show_bug.cgi?id=20438
*/
diff --git a/webkit/glue/webwidget_delegate.h b/webkit/glue/webwidget_delegate.h
index 81caeb31..010a7d0 100644
--- a/webkit/glue/webwidget_delegate.h
+++ b/webkit/glue/webwidget_delegate.h
@@ -50,7 +50,7 @@ class WebWidgetDelegate {
// it no longer receives keyboard events.
virtual void Blur(WebWidget* webwidget) = 0;
- virtual void SetCursor(WebWidget* webwidget,
+ virtual void SetCursor(WebWidget* webwidget,
const WebCursor& cursor) = 0;
// Returns the rectangle of the WebWidget in screen coordinates.
virtual void GetWindowRect(WebWidget* webwidget, gfx::Rect* rect) = 0;
@@ -70,7 +70,7 @@ class WebWidgetDelegate {
// is used on Mac to determine if a scrollbar is over the in-window resize
// area at the bottom right corner.
virtual void GetRootWindowResizerRect(WebWidget* webwidget, gfx::Rect* rect) = 0;
-
+
// Keeps track of the necessary window move for a plugin window that resulted
// from a scroll operation. That way, all plugin windows can be moved at the
// same time as each other and the page.
diff --git a/webkit/pending/AccessibleBase.cpp b/webkit/pending/AccessibleBase.cpp
index c211bbb..d512ab6 100644
--- a/webkit/pending/AccessibleBase.cpp
+++ b/webkit/pending/AccessibleBase.cpp
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
@@ -250,7 +250,7 @@ HRESULT STDMETHODCALLTYPE AccessibleBase::get_accRole(VARIANT vChild, VARIANT* p
{
if (!pvRole)
return E_POINTER;
-
+
if (vChild.vt != VT_I4) {
pvRole->vt = VT_EMPTY;
return E_INVALIDARG;
diff --git a/webkit/pending/AccessibleBase.h b/webkit/pending/AccessibleBase.h
index fdecd35..c0df93f 100644
--- a/webkit/pending/AccessibleBase.h
+++ b/webkit/pending/AccessibleBase.h
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef AccessibleBase_h
diff --git a/webkit/pending/AccessibleDocument.cpp b/webkit/pending/AccessibleDocument.cpp
index d9bbe13..368b851 100644
--- a/webkit/pending/AccessibleDocument.cpp
+++ b/webkit/pending/AccessibleDocument.cpp
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
diff --git a/webkit/pending/AccessibleDocument.h b/webkit/pending/AccessibleDocument.h
index f231bf1..2fce1d5 100644
--- a/webkit/pending/AccessibleDocument.h
+++ b/webkit/pending/AccessibleDocument.h
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef AccessibleDocument_h
diff --git a/webkit/port/bindings/v8/JSDOMBinding.cpp b/webkit/port/bindings/v8/JSDOMBinding.cpp
index 7796fc5..c72a92b 100644
--- a/webkit/port/bindings/v8/JSDOMBinding.cpp
+++ b/webkit/port/bindings/v8/JSDOMBinding.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/webkit/port/bindings/v8/JSDOMBinding.h b/webkit/port/bindings/v8/JSDOMBinding.h
index 6d52e3f..8ed5602 100644
--- a/webkit/port/bindings/v8/JSDOMBinding.h
+++ b/webkit/port/bindings/v8/JSDOMBinding.h
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/webkit/port/bindings/v8/JSXPathNSResolver.cpp b/webkit/port/bindings/v8/JSXPathNSResolver.cpp
index ed6ed3c..2fb2849 100644
--- a/webkit/port/bindings/v8/JSXPathNSResolver.cpp
+++ b/webkit/port/bindings/v8/JSXPathNSResolver.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/webkit/port/bindings/v8/RGBColor.cpp b/webkit/port/bindings/v8/RGBColor.cpp
index 601b5c1..4a37ea6 100644
--- a/webkit/port/bindings/v8/RGBColor.cpp
+++ b/webkit/port/bindings/v8/RGBColor.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/webkit/port/bindings/v8/RGBColor.h b/webkit/port/bindings/v8/RGBColor.h
index c1e7f4a..afc0500 100644
--- a/webkit/port/bindings/v8/RGBColor.h
+++ b/webkit/port/bindings/v8/RGBColor.h
@@ -18,7 +18,7 @@ class RGBColor : public RefCounted<RGBColor> {
PassRefPtr<CSSPrimitiveValue> red();
PassRefPtr<CSSPrimitiveValue> green();
PassRefPtr<CSSPrimitiveValue> blue();
-
+
private:
unsigned m_rgbcolor;
};
diff --git a/webkit/port/bindings/v8/ScriptController.cpp b/webkit/port/bindings/v8/ScriptController.cpp
index a0b0969..9f2a5be 100644
--- a/webkit/port/bindings/v8/ScriptController.cpp
+++ b/webkit/port/bindings/v8/ScriptController.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -224,7 +224,7 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
// HTMLTokenizer used to use base zero line numbers for scripts, now it
// uses base 1. This confuses v8, which uses line offsets from the
// first line.
- v8::Local<v8::Value> obj = m_proxy->Evaluate(sourceCode.url(),
+ v8::Local<v8::Value> obj = m_proxy->Evaluate(sourceCode.url(),
sourceCode.startLine() - 1,
sourceCode.source(),
NULL);
@@ -328,21 +328,21 @@ PassScriptInstance ScriptController::createScriptInstanceForWidget(Widget* widge
// NPObjects can be created either by the browser (e.g. the main
// window object) or by the plugin (the main plugin object
// for a HTMLEmbedElement). Further,
- // unlike most DOM Objects, the frame is especially careful to ensure
- // NPObjects terminate at frame teardown because if a plugin leaks a
+ // unlike most DOM Objects, the frame is especially careful to ensure
+ // NPObjects terminate at frame teardown because if a plugin leaks a
// reference, it could leak its objects (or the browser's objects).
- //
+ //
// The Frame maintains a list of plugin objects (m_pluginObjects)
// which it can use to quickly find the wrapped embed object.
- //
- // Inside the NPRuntime, we've added a few methods for registering
- // wrapped NPObjects. The purpose of the registration is because
+ //
+ // Inside the NPRuntime, we've added a few methods for registering
+ // wrapped NPObjects. The purpose of the registration is because
// javascript garbage collection is non-deterministic, yet we need to
// be able to tear down the plugin objects immediately. When an object
// is registered, javascript can use it. When the object is destroyed,
// or when the object's "owning" object is destroyed, the object will
// be un-registered, and the javascript engine must not use it.
- //
+ //
// Inside the javascript engine, the engine can keep a reference to the
// NPObject as part of its wrapper. However, before accessing the object
// it must consult the NPN_Registry.
@@ -363,7 +363,7 @@ void ScriptController::cleanupScriptObjectsForPlugin(void* nativeHandle)
_NPN_UnregisterObject(it->second);
NPN_ReleaseObject(it->second);
m_pluginObjects.remove(it);
-}
+}
static NPObject* createNoScriptObject()
{
diff --git a/webkit/port/bindings/v8/ScriptController.h b/webkit/port/bindings/v8/ScriptController.h
index 7af3fd8..be4c6b4 100644
--- a/webkit/port/bindings/v8/ScriptController.h
+++ b/webkit/port/bindings/v8/ScriptController.h
@@ -156,7 +156,7 @@ public:
bool haveWindowShell() const { return true; }
// Masquerade 'this' as the windowShell.
- // This is a bit of a hack, but provides reasonable compatibility
+ // This is a bit of a hack, but provides reasonable compatibility
// with what JSC does as well.
ScriptController* windowShell() { return this; }
@@ -224,7 +224,7 @@ public:
// Some WebKit layout test need window.GCController.collect() to
// trigger GC, this flag lets the binding code expose
// window.GCController.collect() to the JavaScript code.
- //
+ //
// GCController.collect() needs V8 engine expose gc() function by passing
// '--expose-gc' flag to the engine.
static bool shouldExposeGCController() {
diff --git a/webkit/port/bindings/v8/V8CanvasPixelArrayCustom.cpp b/webkit/port/bindings/v8/V8CanvasPixelArrayCustom.cpp
index f4421d5..b1a659c 100644
--- a/webkit/port/bindings/v8/V8CanvasPixelArrayCustom.cpp
+++ b/webkit/port/bindings/v8/V8CanvasPixelArrayCustom.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2009, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -67,7 +67,7 @@ INDEXED_PROPERTY_SETTER(CanvasPixelArray) {
V8Proxy::ToNativeObject<CanvasPixelArray>(
V8ClassIndex::CANVASPIXELARRAY,
info.Holder());
-
+
if ((index >= 0) && (index < pixelBuffer->length())) {
pixelBuffer->set(index, value->NumberValue());
}
diff --git a/webkit/port/bindings/v8/V8MessagePortCustom.cpp b/webkit/port/bindings/v8/V8MessagePortCustom.cpp
index 81948f8..63a1ee2 100644
--- a/webkit/port/bindings/v8/V8MessagePortCustom.cpp
+++ b/webkit/port/bindings/v8/V8MessagePortCustom.cpp
@@ -1,10 +1,10 @@
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
-*
+*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
-*
+*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
-*
+*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -185,7 +185,7 @@ CALLBACK_FUNC_DECL(MessagePortStartConversation)
RefPtr<MessagePort> port =
messagePort->startConversation(messagePort->scriptExecutionContext(),
ToWebCoreString(args[0]));
- v8::Handle<v8::Value> wrapper =
+ v8::Handle<v8::Value> wrapper =
V8Proxy::ToV8Object(V8ClassIndex::MESSAGEPORT, port.get());
return wrapper;
}
diff --git a/webkit/port/bindings/v8/V8SVGPODTypeWrapper.h b/webkit/port/bindings/v8/V8SVGPODTypeWrapper.h
index 60c34d5..9c83a4b 100644
--- a/webkit/port/bindings/v8/V8SVGPODTypeWrapper.h
+++ b/webkit/port/bindings/v8/V8SVGPODTypeWrapper.h
@@ -22,7 +22,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef V8SVGPODTypeWrapper_h
@@ -52,7 +52,7 @@ template<typename PODType>
class V8SVGPODTypeWrapperCreatorForList : public V8SVGPODTypeWrapper<PODType>
{
public:
- typedef PODType (SVGPODListItem<PODType>::*GetterMethod)() const;
+ typedef PODType (SVGPODListItem<PODType>::*GetterMethod)() const;
typedef void (SVGPODListItem<PODType>::*SetterMethod)(PODType);
V8SVGPODTypeWrapperCreatorForList(SVGPODListItem<PODType>* creator, const QualifiedName& attributeName)
@@ -114,65 +114,65 @@ private:
PODType m_podType;
};
-template<typename PODType, typename ParentTypeArg>
-class V8SVGStaticPODTypeWrapperWithPODTypeParent : public V8SVGStaticPODTypeWrapper<PODType> {
-public:
- typedef V8SVGPODTypeWrapper<ParentTypeArg> ParentType;
-
- V8SVGStaticPODTypeWrapperWithPODTypeParent(PODType type, ParentType* parent)
- : V8SVGStaticPODTypeWrapper<PODType>(type)
- , m_parentType(parent)
- {
- }
-
- virtual void commitChange(PODType type, SVGElement* context)
- {
- V8SVGStaticPODTypeWrapper<PODType>::commitChange(type, context);
- m_parentType->commitChange(ParentTypeArg(type), context);
- }
-
-private:
- RefPtr<ParentType> m_parentType;
-};
-
-template<typename PODType, typename ParentType>
-class V8SVGStaticPODTypeWrapperWithParent : public V8SVGPODTypeWrapper<PODType> {
-public:
- typedef PODType (ParentType::*GetterMethod)() const;
- typedef void (ParentType::*SetterMethod)(const PODType&);
-
- V8SVGStaticPODTypeWrapperWithParent(ParentType* parent, GetterMethod getter, SetterMethod setter)
- : m_parent(parent)
- , m_getter(getter)
- , m_setter(setter)
- {
- ASSERT(m_parent);
- ASSERT(m_getter);
- ASSERT(m_setter);
- }
-
- virtual operator PODType()
- {
- return (m_parent.get()->*m_getter)();
- }
-
- virtual void commitChange(PODType type, SVGElement* context)
- {
- (m_parent.get()->*m_setter)(type);
- }
-
-private:
- // Update callbacks
- RefPtr<ParentType> m_parent;
- GetterMethod m_getter;
- SetterMethod m_setter;
-};
+template<typename PODType, typename ParentTypeArg>
+class V8SVGStaticPODTypeWrapperWithPODTypeParent : public V8SVGStaticPODTypeWrapper<PODType> {
+public:
+ typedef V8SVGPODTypeWrapper<ParentTypeArg> ParentType;
+
+ V8SVGStaticPODTypeWrapperWithPODTypeParent(PODType type, ParentType* parent)
+ : V8SVGStaticPODTypeWrapper<PODType>(type)
+ , m_parentType(parent)
+ {
+ }
+
+ virtual void commitChange(PODType type, SVGElement* context)
+ {
+ V8SVGStaticPODTypeWrapper<PODType>::commitChange(type, context);
+ m_parentType->commitChange(ParentTypeArg(type), context);
+ }
+
+private:
+ RefPtr<ParentType> m_parentType;
+};
+
+template<typename PODType, typename ParentType>
+class V8SVGStaticPODTypeWrapperWithParent : public V8SVGPODTypeWrapper<PODType> {
+public:
+ typedef PODType (ParentType::*GetterMethod)() const;
+ typedef void (ParentType::*SetterMethod)(const PODType&);
+
+ V8SVGStaticPODTypeWrapperWithParent(ParentType* parent, GetterMethod getter, SetterMethod setter)
+ : m_parent(parent)
+ , m_getter(getter)
+ , m_setter(setter)
+ {
+ ASSERT(m_parent);
+ ASSERT(m_getter);
+ ASSERT(m_setter);
+ }
+
+ virtual operator PODType()
+ {
+ return (m_parent.get()->*m_getter)();
+ }
+
+ virtual void commitChange(PODType type, SVGElement* context)
+ {
+ (m_parent.get()->*m_setter)(type);
+ }
+
+private:
+ // Update callbacks
+ RefPtr<ParentType> m_parent;
+ GetterMethod m_getter;
+ SetterMethod m_setter;
+};
template<typename PODType, typename PODTypeCreator>
class V8SVGDynamicPODTypeWrapper : public V8SVGPODTypeWrapper<PODType>
{
public:
- typedef PODType (PODTypeCreator::*GetterMethod)() const;
+ typedef PODType (PODTypeCreator::*GetterMethod)() const;
typedef void (PODTypeCreator::*SetterMethod)(PODType);
typedef void (*CacheRemovalCallback)(V8SVGPODTypeWrapper<PODType>*);
@@ -188,7 +188,7 @@ public:
ASSERT(cacheRemovalCallback);
}
- virtual ~V8SVGDynamicPODTypeWrapper() {
+ virtual ~V8SVGDynamicPODTypeWrapper() {
ASSERT(m_cacheRemovalCallback);
(*m_cacheRemovalCallback)(this);
@@ -217,7 +217,7 @@ private:
// Caching facilities
template<typename PODType, typename PODTypeCreator>
struct PODTypeWrapperCacheInfo {
- typedef PODType (PODTypeCreator::*GetterMethod)() const;
+ typedef PODType (PODTypeCreator::*GetterMethod)() const;
typedef void (PODTypeCreator::*SetterMethod)(PODType);
// Empty value
@@ -301,15 +301,15 @@ template<typename PODType, typename PODTypeCreator>
class V8SVGDynamicPODTypeWrapperCache
{
public:
- typedef PODType (PODTypeCreator::*GetterMethod)() const;
+ typedef PODType (PODTypeCreator::*GetterMethod)() const;
typedef void (PODTypeCreator::*SetterMethod)(PODType);
typedef PODTypeWrapperCacheInfo<PODType, PODTypeCreator> CacheInfo;
typedef PODTypeWrapperCacheInfoHash<PODType, PODTypeCreator> CacheInfoHash;
typedef PODTypeWrapperCacheInfoTraits<PODType, PODTypeCreator> CacheInfoTraits;
- typedef V8SVGPODTypeWrapper<PODType> WrapperBase;
- typedef V8SVGDynamicPODTypeWrapper<PODType, PODTypeCreator> DynamicWrapper;
+ typedef V8SVGPODTypeWrapper<PODType> WrapperBase;
+ typedef V8SVGDynamicPODTypeWrapper<PODType, PODTypeCreator> DynamicWrapper;
typedef HashMap<CacheInfo, DynamicWrapper*, CacheInfoHash, CacheInfoTraits> DynamicWrapperHashMap;
typedef typename DynamicWrapperHashMap::const_iterator DynamicWrapperHashMapIterator;
diff --git a/webkit/port/bindings/v8/V8WorkerContextCustom.cpp b/webkit/port/bindings/v8/V8WorkerContextCustom.cpp
index d3c1c3a..27f6c8b 100644
--- a/webkit/port/bindings/v8/V8WorkerContextCustom.cpp
+++ b/webkit/port/bindings/v8/V8WorkerContextCustom.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2009, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/webkit/port/bindings/v8/V8WorkerCustom.cpp b/webkit/port/bindings/v8/V8WorkerCustom.cpp
index bdcb803..e1a1d23 100644
--- a/webkit/port/bindings/v8/V8WorkerCustom.cpp
+++ b/webkit/port/bindings/v8/V8WorkerCustom.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -81,7 +81,7 @@ CALLBACK_FUNC_DECL(WorkerConstructor) {
ExceptionCode ec = 0;
RefPtr<Worker> obj = Worker::create(
ToWebCoreString(script_url), document, ec);
-
+
// Setup the standard wrapper object internal fields.
v8::Handle<v8::Object> wrapper_object = args.Holder();
V8Proxy::SetDOMWrapper(
@@ -89,7 +89,7 @@ CALLBACK_FUNC_DECL(WorkerConstructor) {
obj->ref();
V8Proxy::SetJSWrapperForActiveDOMObject(
- obj.get(), v8::Persistent<v8::Object>::New(wrapper_object));
+ obj.get(), v8::Persistent<v8::Object>::New(wrapper_object));
return wrapper_object;
}
@@ -201,7 +201,7 @@ ACCESSOR_SETTER(WorkerOnerror) {
static_cast<V8ObjectEventListener*>(imp->onerror());
if (value->IsNull()) {
if (old_listener) {
- v8::Local<v8::Object> old_v8_listener =
+ v8::Local<v8::Object> old_v8_listener =
old_listener->GetListenerObject();
RemoveHiddenDependency(info.Holder(), old_v8_listener);
}
diff --git a/webkit/port/bindings/v8/V8XMLHttpRequestCustom.cpp b/webkit/port/bindings/v8/V8XMLHttpRequestCustom.cpp
index 6044cb9..c39d037 100644
--- a/webkit/port/bindings/v8/V8XMLHttpRequestCustom.cpp
+++ b/webkit/port/bindings/v8/V8XMLHttpRequestCustom.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp b/webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp
index 496dce3..02a6579 100644
--- a/webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp
+++ b/webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2009, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/webkit/port/bindings/v8/WorkerContextExecutionProxy.h b/webkit/port/bindings/v8/WorkerContextExecutionProxy.h
index b64029e..2aaa160 100644
--- a/webkit/port/bindings/v8/WorkerContextExecutionProxy.h
+++ b/webkit/port/bindings/v8/WorkerContextExecutionProxy.h
@@ -1,10 +1,10 @@
// Copyright (c) 2009, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/webkit/port/bindings/v8/WorkerScriptController.cpp b/webkit/port/bindings/v8/WorkerScriptController.cpp
index 0f1d8b9e8..9d73437 100644
--- a/webkit/port/bindings/v8/WorkerScriptController.cpp
+++ b/webkit/port/bindings/v8/WorkerScriptController.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/webkit/port/bindings/v8/WorkerScriptController.h b/webkit/port/bindings/v8/WorkerScriptController.h
index efc71d3..73cf799 100644
--- a/webkit/port/bindings/v8/WorkerScriptController.h
+++ b/webkit/port/bindings/v8/WorkerScriptController.h
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
diff --git a/webkit/port/bindings/v8/extensions/Gears.cpp b/webkit/port/bindings/v8/extensions/Gears.cpp
index 54787a8..9d36707 100755
--- a/webkit/port/bindings/v8/extensions/Gears.cpp
+++ b/webkit/port/bindings/v8/extensions/Gears.cpp
@@ -34,7 +34,7 @@ const char* kGearsExtensionScript =
class GearsExtensionWrapper : public v8::Extension {
public:
- GearsExtensionWrapper() :
+ GearsExtensionWrapper() :
v8::Extension(kGearsExtensionName, kGearsExtensionScript) {}
};
diff --git a/webkit/port/bindings/v8/extensions/Interval.cpp b/webkit/port/bindings/v8/extensions/Interval.cpp
index 4a5c13d..b09847c 100644
--- a/webkit/port/bindings/v8/extensions/Interval.cpp
+++ b/webkit/port/bindings/v8/extensions/Interval.cpp
@@ -12,7 +12,7 @@ const char* kIntervalExtensionName = "v8/Interval";
class IntervalExtensionWrapper : public v8::Extension {
public:
- IntervalExtensionWrapper() :
+ IntervalExtensionWrapper() :
v8::Extension(kIntervalExtensionName,
"var chromium;"
"if (!chromium)"
diff --git a/webkit/port/bindings/v8/npruntime.cpp b/webkit/port/bindings/v8/npruntime.cpp
index 78c5323..9b21c36 100644
--- a/webkit/port/bindings/v8/npruntime.cpp
+++ b/webkit/port/bindings/v8/npruntime.cpp
@@ -67,7 +67,7 @@ inline bool operator<(const StringKey& x, const StringKey& y) {
else if (x.length > y.length)
return false;
else
- return memcmp(x.string, y.string, y.length) < 0;
+ return memcmp(x.string, y.string, y.length) < 0;
}
} // namespace
diff --git a/webkit/port/bindings/v8/npruntime_impl.h b/webkit/port/bindings/v8/npruntime_impl.h
index 3224565..9a9b612 100644
--- a/webkit/port/bindings/v8/npruntime_impl.h
+++ b/webkit/port/bindings/v8/npruntime_impl.h
@@ -1,10 +1,10 @@
/*
* Copyright (c) 2008, 2009, Google Inc. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/webkit/port/bindings/v8/npruntime_priv.h b/webkit/port/bindings/v8/npruntime_priv.h
index 88a3ac3..0aa952c 100644
--- a/webkit/port/bindings/v8/npruntime_priv.h
+++ b/webkit/port/bindings/v8/npruntime_priv.h
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NP_RUNTIME_PRIV_H_
@@ -45,7 +45,7 @@ void _NPN_DeallocateObject(NPObject *obj);
// be "registered" while they are alive. After an object has been
// deleted, it is possible for Javascript to have a reference to that object
// which has not yet been garbage collected. Javascript access to NPObjects
-// will reference this registry to determine if the object is accessible or
+// will reference this registry to determine if the object is accessible or
// not.
// Windows introduces an additional complication for objects created by the
@@ -59,7 +59,7 @@ void _NPN_DeallocateObject(NPObject *obj);
// We generally associate NPObjects with an owner. The owner of an NPObject
// is an NPObject which, when destroyed, also destroys all objects it owns.
// For example, if an NPAPI plugin creates 10 sub-NPObjects, all 11 objects
-// (the NPAPI plugin + its 10 sub-objects) should become inaccessible
+// (the NPAPI plugin + its 10 sub-objects) should become inaccessible
// simultaneously.
// The ownership hierarchy is flat, and not a tree. Imagine the following
diff --git a/webkit/port/bindings/v8/v8_binding.h b/webkit/port/bindings/v8/v8_binding.h
index 5f83e51..34c598f 100644
--- a/webkit/port/bindings/v8/v8_binding.h
+++ b/webkit/port/bindings/v8/v8_binding.h
@@ -44,7 +44,7 @@ class WebCoreStringResource: public v8::String::ExternalStringResource {
// Keeps the string buffer alive until the V8 engine garbage collects it.
String external_string_;
};
-
+
// Convert a v8::String to a WebCore::String. If the V8 string is not already
// an external string then it is transformed into an external string at this
// point to avoid repeated conversions.
diff --git a/webkit/port/bindings/v8/v8_custom.cpp b/webkit/port/bindings/v8/v8_custom.cpp
index 7b4ccdd..32a5f14 100644
--- a/webkit/port/bindings/v8/v8_custom.cpp
+++ b/webkit/port/bindings/v8/v8_custom.cpp
@@ -615,7 +615,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DStrokeText) {
CALLBACK_FUNC_DECL(CanvasRenderingContext2DPutImageData) {
INC_STATS("DOM.CanvasRenderingContext2D.putImageData()");
-
+
// Two froms:
// * putImageData(ImageData, x, y)
// * putImageData(ImageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight)
@@ -853,7 +853,7 @@ v8::Handle<v8::Value> V8Custom::WindowSetTimeoutImpl(const v8::Arguments& args,
if (!V8Proxy::CanAccessFrame(imp->frame(), true))
return v8::Undefined();
- ScriptExecutionContext* script_context =
+ ScriptExecutionContext* script_context =
static_cast<ScriptExecutionContext*>(imp->frame()->document());
v8::Handle<v8::Value> function = args[0];
@@ -1064,7 +1064,7 @@ CALLBACK_FUNC_DECL(DOMWindowNOP)
CALLBACK_FUNC_DECL(HTMLFormElementSubmit) {
INC_STATS("DOM.HTMLFormElement.submit()");
-
+
HTMLFormElement* form =
V8Proxy::DOMWrapperToNative<HTMLFormElement>(args.Holder());
@@ -1086,9 +1086,9 @@ static String EventNameFromAttributeName(const String& name) {
break;
case 'd':
ASSERT(event_type.length() > 7);
- if (event_type[7] == 'a')
+ if (event_type[7] == 'a')
event_type = "webkitAnimationEnd";
- else
+ else
event_type = "webkitTransitionEnd";
break;
}
@@ -1115,7 +1115,7 @@ ACCESSOR_SETTER(DOMWindowEventHandler) {
String key = ToWebCoreString(name);
String event_type = EventNameFromAttributeName(key);
-
+
if (value->IsNull()) {
// Clear the event listener
doc->removeWindowInlineEventListenerForType(event_type);
diff --git a/webkit/port/bindings/v8/v8_custom.h b/webkit/port/bindings/v8/v8_custom.h
index 16e9359..c88fed4 100644
--- a/webkit/port/bindings/v8/v8_custom.h
+++ b/webkit/port/bindings/v8/v8_custom.h
@@ -95,9 +95,9 @@ class V8Custom {
static const int kXMLHttpRequestInternalFieldCount =
kDefaultWrapperInternalFieldCount + 1;
- static const int kMessageChannelPort1Index =
+ static const int kMessageChannelPort1Index =
kDefaultWrapperInternalFieldCount + 0;
- static const int kMessageChannelPort2Index =
+ static const int kMessageChannelPort2Index =
kDefaultWrapperInternalFieldCount + 1;
static const int kMessageChannelInternalFieldCount =
kDefaultWrapperInternalFieldCount + 2;
diff --git a/webkit/port/bindings/v8/v8_events.cpp b/webkit/port/bindings/v8/v8_events.cpp
index 06de1c6..265561f 100644
--- a/webkit/port/bindings/v8/v8_events.cpp
+++ b/webkit/port/bindings/v8/v8_events.cpp
@@ -548,7 +548,7 @@ v8::Local<v8::Value> V8WorkerContextEventListener::CallListenerFunction(
v8::Handle<v8::Value> parameters[1] = {jsevent};
v8::Local<v8::Value> result;
- {
+ {
//ConsoleMessageScope scope;
result = handler_func->Call(receiver, 1, parameters);
diff --git a/webkit/port/bindings/v8/v8_events.h b/webkit/port/bindings/v8/v8_events.h
index e01f972..c352f1f 100644
--- a/webkit/port/bindings/v8/v8_events.h
+++ b/webkit/port/bindings/v8/v8_events.h
@@ -92,7 +92,7 @@ class V8AbstractEventListener : public EventListener {
// that can handle the event.
class V8EventListener : public V8AbstractEventListener {
public:
- static PassRefPtr<V8EventListener> create(Frame* frame,
+ static PassRefPtr<V8EventListener> create(Frame* frame,
v8::Local<v8::Object> listener, bool isInline) {
return adoptRef(new V8EventListener(frame, listener, isInline));
}
@@ -118,7 +118,7 @@ class V8EventListener : public V8AbstractEventListener {
// in the DOM. It keeps the JS listener as a weak pointer.
class V8ObjectEventListener : public V8EventListener {
public:
- static PassRefPtr<V8ObjectEventListener> create(Frame* frame,
+ static PassRefPtr<V8ObjectEventListener> create(Frame* frame,
v8::Local<v8::Object> listener, bool isInline) {
return adoptRef(new V8ObjectEventListener(frame, listener, isInline));
}
@@ -133,7 +133,7 @@ class V8ObjectEventListener : public V8EventListener {
// A V8LazyEventListener is always a HTML event handler.
class V8LazyEventListener : public V8AbstractEventListener {
public:
- static PassRefPtr<V8LazyEventListener> create(Frame* frame,
+ static PassRefPtr<V8LazyEventListener> create(Frame* frame,
const String& code, const String& func_name) {
return adoptRef(new V8LazyEventListener(frame, code, func_name));
}
diff --git a/webkit/port/bindings/v8/v8_helpers.cpp b/webkit/port/bindings/v8/v8_helpers.cpp
index 089aedd..f09c2e0 100644
--- a/webkit/port/bindings/v8/v8_helpers.cpp
+++ b/webkit/port/bindings/v8/v8_helpers.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/webkit/port/bindings/v8/v8_index.cpp b/webkit/port/bindings/v8/v8_index.cpp
index bf6225c..c3838ef 100644
--- a/webkit/port/bindings/v8/v8_index.cpp
+++ b/webkit/port/bindings/v8/v8_index.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/webkit/port/bindings/v8/v8_index.h b/webkit/port/bindings/v8/v8_index.h
index 9e6584f..fff021a 100644
--- a/webkit/port/bindings/v8/v8_index.h
+++ b/webkit/port/bindings/v8/v8_index.h
@@ -239,8 +239,8 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)();
V(XMLHTTPREQUEST, XMLHttpRequest) \
WORKER_ACTIVE_OBJECT_WRAPPER_TYPES(V)
-// NOTE: DOM_OBJECT_TYPES is split into two halves because
-// Visual Studio's Intellinonsense crashes when macros get
+// NOTE: DOM_OBJECT_TYPES is split into two halves because
+// Visual Studio's Intellinonsense crashes when macros get
// too large. 10-29-08
// DOM_OBJECT_TYPES are non-node DOM types.
#define DOM_OBJECT_TYPES_1(V) \
@@ -418,7 +418,7 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)();
V(SVGURIREFERENCE, SVGURIReference) \
V(SVGANIMATEDPOINTS, SVGAnimatedPoints)
-// SVG_NONNODE_TYPES are SVG non-node object types, pod typs and
+// SVG_NONNODE_TYPES are SVG non-node object types, pod typs and
// numerical types.
#define SVG_NONNODE_TYPES(V) \
SVG_OBJECT_TYPES(V) \
diff --git a/webkit/port/bindings/v8/v8_nodefilter.cpp b/webkit/port/bindings/v8/v8_nodefilter.cpp
index 7a01f5b..34d17c1 100644
--- a/webkit/port/bindings/v8/v8_nodefilter.cpp
+++ b/webkit/port/bindings/v8/v8_nodefilter.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/webkit/port/bindings/v8/v8_np_utils.cpp b/webkit/port/bindings/v8/v8_np_utils.cpp
index 957aa6f..f7bb20a 100644
--- a/webkit/port/bindings/v8/v8_np_utils.cpp
+++ b/webkit/port/bindings/v8/v8_np_utils.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -54,7 +54,7 @@ void ConvertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject *owner, NP
return;
if (object->IsInt32())
- INT32_TO_NPVARIANT(object->NumberValue(), *result);
+ INT32_TO_NPVARIANT(object->NumberValue(), *result);
else if (object->IsNumber())
DOUBLE_TO_NPVARIANT(object->NumberValue(), *result);
else if (object->IsBoolean())
diff --git a/webkit/port/bindings/v8/v8_npobject.cpp b/webkit/port/bindings/v8/v8_npobject.cpp
index b39078e2..cdb9bee 100644
--- a/webkit/port/bindings/v8/v8_npobject.cpp
+++ b/webkit/port/bindings/v8/v8_npobject.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -337,10 +337,10 @@ v8::Local<v8::Object> CreateV8ObjectForNPObject(NPObject* object, NPObject* root
v8::Handle<v8::Function> func = npObjectDesc->GetFunction();
v8::Local<v8::Object> value = SafeAllocation::NewInstance(func);
-
- // If we were unable to allocate the instance we avoid wrapping
- // and registering the NP object.
- if (value.IsEmpty())
+
+ // If we were unable to allocate the instance we avoid wrapping
+ // and registering the NP object.
+ if (value.IsEmpty())
return value;
WrapNPObject(value, object);
diff --git a/webkit/port/bindings/v8/v8_proxy.cpp b/webkit/port/bindings/v8/v8_proxy.cpp
index 3ef9c9e..c303a08 100644
--- a/webkit/port/bindings/v8/v8_proxy.cpp
+++ b/webkit/port/bindings/v8/v8_proxy.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -480,7 +480,7 @@ static HashMap<void*, SVGElement*>& svg_object_to_context_map()
}
v8::Handle<v8::Value> V8Proxy::SVGObjectWithContextToV8Object(
- V8ClassIndex::V8WrapperType type, void* object)
+ V8ClassIndex::V8WrapperType type, void* object)
{
if (!object)
return v8::Null();
@@ -1186,10 +1186,10 @@ static V8EventListener* FindEventListenerInList(V8EventListenerList& list,
V8EventListener* el = *p;
v8::Local<v8::Object> wrapper = el->GetListenerObject();
ASSERT(!wrapper.IsEmpty());
- // Since the listener is an object, it is safe to compare for
+ // Since the listener is an object, it is safe to compare for
// strict equality (in the JS sense) by doing a simple equality
// check using the == operator on the handles. This is much,
- // much faster than calling StrictEquals through the API in
+ // much faster than calling StrictEquals through the API in
// the negative case.
if (el->isInline() == isInline && listener == wrapper)
return el;
@@ -1235,7 +1235,7 @@ PassRefPtr<V8EventListener> V8Proxy::FindOrCreateV8EventListener(v8::Local<v8::V
// wrapper. So we can create a hidden reference from the JS wrapper to
// to its JS function.
//
-// (map)
+// (map)
// XHR <---------- JS_wrapper
// | (hidden) : ^
// V V : (may reachable by closure)
@@ -1455,7 +1455,7 @@ v8::Local<v8::Value> V8Proxy::CallFunction(v8::Handle<v8::Function> function,
// of recursion that stems from calling functions. This is in
// contrast to the script evaluations.
v8::Local<v8::Value> result;
- {
+ {
ConsoleMessageScope scope;
// Evaluating the JavaScript could cause the frame to be deallocated,
@@ -1565,7 +1565,7 @@ v8::Persistent<v8::FunctionTemplate> V8Proxy::GetTemplate(
SetCollectionStringOrNullIndexedGetter<CSSStyleDeclaration>(desc);
break;
case V8ClassIndex::CSSRULELIST:
- SetCollectionIndexedGetter<CSSRuleList, CSSRule>(desc,
+ SetCollectionIndexedGetter<CSSRuleList, CSSRule>(desc,
V8ClassIndex::CSSRULE);
break;
case V8ClassIndex::CSSVALUELIST:
@@ -1588,12 +1588,12 @@ v8::Persistent<v8::FunctionTemplate> V8Proxy::GetTemplate(
USE_NAMED_PROPERTY_GETTER(HTMLCollection));
desc->InstanceTemplate()->SetCallAsFunctionHandler(
USE_CALLBACK(HTMLCollectionCallAsFunction));
- SetCollectionIndexedGetter<HTMLCollection, Node>(desc,
+ SetCollectionIndexedGetter<HTMLCollection, Node>(desc,
V8ClassIndex::NODE);
break;
case V8ClassIndex::HTMLOPTIONSCOLLECTION:
SetCollectionNamedGetter<HTMLOptionsCollection, Node>(
- desc,
+ desc,
V8ClassIndex::NODE);
desc->InstanceTemplate()->SetIndexedPropertyHandler(
USE_INDEXED_PROPERTY_GETTER(HTMLOptionsCollection),
@@ -1693,7 +1693,7 @@ v8::Persistent<v8::FunctionTemplate> V8Proxy::GetTemplate(
case V8ClassIndex::STYLESHEET: // fall through
case V8ClassIndex::CSSSTYLESHEET: {
// We add an extra internal field to hold a reference to
- // the owner node.
+ // the owner node.
v8::Local<v8::ObjectTemplate> instance_template =
desc->InstanceTemplate();
ASSERT(instance_template->InternalFieldCount() ==
@@ -1931,7 +1931,7 @@ Frame* V8Proxy::retrieveFrame(v8::Handle<v8::Context> context)
Frame* V8Proxy::retrieveActiveFrame()
{
v8::Handle<v8::Context> context = v8::Context::GetEntered();
- if (context.IsEmpty())
+ if (context.IsEmpty())
return 0;
return retrieveFrame(context);
}
@@ -1985,8 +1985,8 @@ bool V8Proxy::isEnabled()
return true;
// If JavaScript has been disabled, we need to look at the frame to tell
- // whether this script came from the web or the embedder. Scripts from the
- // embedder are safe to run, but scripts from the other sources are
+ // whether this script came from the web or the embedder. Scripts from the
+ // embedder are safe to run, but scripts from the other sources are
// disallowed.
Document* document = m_frame->document();
if (!document)
@@ -2301,7 +2301,7 @@ bool V8Proxy::CheckNodeSecurity(Node* node)
// the outer window, and the outer window identify is preserved for
// the frame. However, a new inner window is created for the new page.
// If there are JS code holds a closure to the old inner window,
-// it won't be able to reach the outer window via its global object.
+// it won't be able to reach the outer window via its global object.
void V8Proxy::InitContextIfNeeded()
{
// Bail out if the context has already been initialized.
@@ -3074,11 +3074,11 @@ v8::Handle<v8::Value> V8Proxy::EventToV8Object(Event* event)
else if (event->isMessageEvent())
type = V8ClassIndex::MESSAGEEVENT;
else if (event->isProgressEvent()) {
- if (event->isXMLHttpRequestProgressEvent())
+ if (event->isXMLHttpRequestProgressEvent())
type = V8ClassIndex::XMLHTTPREQUESTPROGRESSEVENT;
- else
+ else
type = V8ClassIndex::PROGRESSEVENT;
- } else if (event->isWebKitAnimationEvent())
+ } else if (event->isWebKitAnimationEvent())
type = V8ClassIndex::WEBKITANIMATIONEVENT;
else if (event->isWebKitTransitionEvent())
type = V8ClassIndex::WEBKITTRANSITIONEVENT;
@@ -3346,7 +3346,7 @@ v8::Handle<v8::Value> V8Proxy::CSSValueToV8Object(CSSValue* value)
V8ClassIndex::V8WrapperType type;
- if (value->isWebKitCSSTransformValue())
+ if (value->isWebKitCSSTransformValue())
type = V8ClassIndex::WEBKITCSSTRANSFORMVALUE;
else if (value->isValueList())
type = V8ClassIndex::CSSVALUELIST;
diff --git a/webkit/port/bindings/v8/v8_proxy.h b/webkit/port/bindings/v8/v8_proxy.h
index 56ef4c9..bb9cc52 100644
--- a/webkit/port/bindings/v8/v8_proxy.h
+++ b/webkit/port/bindings/v8/v8_proxy.h
@@ -87,7 +87,7 @@ void log_info(Frame* frame, const String& msg, const String& url);
V(EVENT_LISTENER) \
V(NODE_FILTER) \
V(SCRIPTINSTANCE) \
- V(SCRIPTVALUE)
+ V(SCRIPTVALUE)
// Host information of persistent handles.
@@ -404,7 +404,7 @@ class V8Proxy {
static v8::Handle<v8::Value> ConstructDOMObject(const v8::Arguments& args);
// Checks whether a DOM object has a JS wrapper.
- static bool DOMObjectHasJSWrapper(void* obj);
+ static bool DOMObjectHasJSWrapper(void* obj);
// Set JS wrapper of a DOM object, the caller in charge of increase ref.
static void SetJSWrapperForDOMObject(void* obj,
v8::Persistent<v8::Object> wrapper);
@@ -434,7 +434,7 @@ class V8Proxy {
static int GetSourceLineNumber();
static String GetSourceName();
-
+
// Returns a local handle of the context.
v8::Local<v8::Context> GetContext() {
return v8::Local<v8::Context>::New(m_context);
@@ -544,7 +544,7 @@ class V8Proxy {
// it can keep all objects alive.
v8::Persistent<v8::Array> m_dom_constructor_cache;
v8::Persistent<v8::Value> m_object_prototype;
-
+
v8::Persistent<v8::Object> m_global;
v8::Persistent<v8::Value> m_document;
diff --git a/webkit/tools/layout_tests/layout_package/compare_failures.py b/webkit/tools/layout_tests/layout_package/compare_failures.py
index 5850fda..70745d7 100644
--- a/webkit/tools/layout_tests/layout_package/compare_failures.py
+++ b/webkit/tools/layout_tests/layout_package/compare_failures.py
@@ -16,7 +16,7 @@ import test_expectations
def PrintFilesFromSet(filenames, header_text, output, opt_expectations=None):
"""A helper method to print a list of files to output.
-
+
Args:
filenames: a list of absolute filenames
header_text: a string to display before the list of filenames
@@ -25,7 +25,7 @@ def PrintFilesFromSet(filenames, header_text, output, opt_expectations=None):
"""
if not len(filenames):
return
-
+
filenames = list(filenames)
filenames.sort()
output.write("\n")
@@ -36,7 +36,7 @@ def PrintFilesFromSet(filenames, header_text, output, opt_expectations=None):
output_string += "\n"
for filename in filenames:
output.write(output_string % path_utils.RelativeTestFilename(filename))
-
+
class CompareFailures:
@@ -70,7 +70,7 @@ class CompareFailures:
# Print unexpected passes by category.
passes = self._regressed_passes
- PrintFilesFromSet(passes & self._expectations.GetFixableFailures(),
+ PrintFilesFromSet(passes & self._expectations.GetFixableFailures(),
"Expected to fail, but passed",
output)
PrintFilesFromSet(passes & self._expectations.GetFixableTimeouts(),
@@ -79,18 +79,18 @@ class CompareFailures:
PrintFilesFromSet(passes & self._expectations.GetFixableCrashes(),
"Expected to crash, but passed",
output)
-
- PrintFilesFromSet(passes & self._expectations.GetIgnoredFailures(),
+
+ PrintFilesFromSet(passes & self._expectations.GetIgnoredFailures(),
"Expected to fail (ignored), but passed",
output)
PrintFilesFromSet(passes & self._expectations.GetIgnoredTimeouts(),
"Expected to timeout (ignored), but passed",
output)
# Crashes should never be deferred.
- PrintFilesFromSet(passes & self._expectations.GetFixableDeferredFailures(),
+ PrintFilesFromSet(passes & self._expectations.GetFixableDeferredFailures(),
"Expected to fail (deferred), but passed",
- output)
- PrintFilesFromSet(passes & self._expectations.GetFixableDeferredTimeouts(),
+ output)
+ PrintFilesFromSet(passes & self._expectations.GetFixableDeferredTimeouts(),
"Expected to timeout (deferred), but passed",
output)
# Print real regressions.
@@ -113,7 +113,7 @@ class CompareFailures:
def _CalculateRegressions(self):
"""Calculate regressions from this run through the layout tests."""
worklist = self._test_files.copy()
-
+
passes = set()
crashes = set()
hangs = set()
@@ -146,7 +146,7 @@ class CompareFailures:
# Check that all passing tests are expected to pass.
expectations = self._expectations.GetExpectations(test)
if not test_expectations.PASS in expectations: passes.add(test)
-
+
self._regressed_passes = passes
self._regressed_crashes = crashes
self._regressed_hangs = hangs
diff --git a/webkit/tools/layout_tests/layout_package/compare_failures_unittest.py b/webkit/tools/layout_tests/layout_package/compare_failures_unittest.py
index b5d286c..21022f4 100644
--- a/webkit/tools/layout_tests/layout_package/compare_failures_unittest.py
+++ b/webkit/tools/layout_tests/layout_package/compare_failures_unittest.py
@@ -28,7 +28,7 @@ class CompareFailuresUnittest(unittest.TestCase):
# copyfile doesn't copy file permissions so we can delete the files later
shutil.copyfile(os.path.join(testdatadir, filename),
os.path.join(self._tempdir, filename))
-
+
def tearDown(self):
"""Remove temp directory."""
shutil.rmtree(self._tempdir)
@@ -62,7 +62,7 @@ class CompareFailuresUnittest(unittest.TestCase):
def testPassingToFailure(self):
"""When there's a new failure, we don't add it to the baseline."""
failures = self.GetTestFailures()
-
+
# Test case where we don't update new baseline. We have a new failure,
# but it shouldn't be added to the expected-failures.txt file.
pass_file = os.path.join(path_utils.LayoutDataDir(), 'fast', 'pass1.html')
@@ -72,12 +72,12 @@ class CompareFailuresUnittest(unittest.TestCase):
# Same thing as before: pass -> crash
failures[pass_file] = [test_failures.FailureCrash()]
self.CheckNoChanges(failures)
-
+
def testFailureToCrash(self):
"""When there's a new crash, we don't add it to the baseline or remove it
from the failure list."""
failures = self.GetTestFailures()
-
+
# Test case where we don't update new baseline. A failure moving to a
# crash shouldn't be added to the expected-crashes.txt file.
failure_file = os.path.join(path_utils.LayoutDataDir(),
@@ -106,7 +106,7 @@ class CompareFailuresUnittest(unittest.TestCase):
def testCrashToPassing(self):
"""This is better than before, so we update the crashes file."""
failures = self.GetTestFailures()
-
+
crash_file = os.path.join(path_utils.LayoutDataDir(),
'fast', 'bar', 'betz', 'crash3.html')
del failures[crash_file]
@@ -121,7 +121,7 @@ class CompareFailuresUnittest(unittest.TestCase):
def testCrashToFailure(self):
"""This is better than before, so we should update both lists."""
failures = self.GetTestFailures()
-
+
crash_file = os.path.join(path_utils.LayoutDataDir(),
'fast', 'bar', 'betz', 'crash3.html')
failures[crash_file] = [test_failures.FailureTextMismatch(None)]
@@ -163,7 +163,7 @@ class CompareFailuresUnittest(unittest.TestCase):
self.CheckOutputWithExpectedFiles('expected-passing.txt',
'expected-failures-new-test.txt',
'expected-crashes.txt')
-
+
def testNewTestCrash(self):
"""After a merge, we need to update new crashing tests properly."""
files = self.GetTestFiles()
@@ -195,7 +195,7 @@ class CompareFailuresUnittest(unittest.TestCase):
cf = compare_failures.CompareFailures(files, failures, set(), set(),
self.GetTmpDir(), False)
self.failUnless(cf.HasNewFailures())
-
+
# Failing to passing
failures = self.GetTestFailures()
failure_file = os.path.join(path_utils.LayoutDataDir(),
@@ -204,7 +204,7 @@ class CompareFailuresUnittest(unittest.TestCase):
cf = compare_failures.CompareFailures(files, failures, set(), set(),
self.GetTmpDir(), False)
self.failUnless(not cf.HasNewFailures())
-
+
# A new test that fails, this doesn't count as a new failure.
new_test_file = os.path.join(path_utils.LayoutDataDir(), "new-test.html")
files.add(new_test_file)
@@ -261,7 +261,7 @@ class CompareFailuresUnittest(unittest.TestCase):
'fast\\bar\\fail2.html',
'fast\\bar\\betz\\fail3.html',
]
-
+
return set([os.path.join(layout_dir, f) for f in files])
def GetTestFailures(self):
@@ -275,7 +275,7 @@ class CompareFailuresUnittest(unittest.TestCase):
failures[filename] = [test_failures.FailureTextMismatch(None)]
return failures
-
+
if '__main__' == __name__:
unittest.main()
diff --git a/webkit/tools/layout_tests/layout_package/path_utils.py b/webkit/tools/layout_tests/layout_package/path_utils.py
index e2f0dcb..cdb6554 100644
--- a/webkit/tools/layout_tests/layout_package/path_utils.py
+++ b/webkit/tools/layout_tests/layout_package/path_utils.py
@@ -165,7 +165,7 @@ def TestShellBinaryPath(target):
"""Gets the full path to the test_shell binary for the target build
configuration. Raises PathNotFound if the file doesn't exist"""
platform_util = platform_utils.PlatformUtility('')
- full_path = os.path.join(WebKitRoot(), target,
+ full_path = os.path.join(WebKitRoot(), target,
platform_util.TestShellBinary())
if not os.path.exists(full_path):
# try output directory from either Xcode or chrome.sln
diff --git a/webkit/tools/layout_tests/layout_package/platform_utils_mac.py b/webkit/tools/layout_tests/layout_package/platform_utils_mac.py
index dbc6963..fd0e725 100644
--- a/webkit/tools/layout_tests/layout_package/platform_utils_mac.py
+++ b/webkit/tools/layout_tests/layout_package/platform_utils_mac.py
@@ -96,13 +96,13 @@ class PlatformUtility(object):
port += 443
use_ssl = True
return PlatformUtility._FilenameToUri(self,
- relative_path,
+ relative_path,
use_http=True,
use_ssl=use_ssl,
port=port)
# Run off file://
- return PlatformUtility._FilenameToUri(self, full_path, use_http=False,
+ return PlatformUtility._FilenameToUri(self, full_path, use_http=False,
use_ssl=False, port=0)
def LigHTTPdExecutablePath(self):
@@ -119,7 +119,7 @@ class PlatformUtility(object):
def ShutDownHTTPServer(self, server_process):
"""Shut down the lighttpd web server. Blocks until it's fully shut down.
-
+
Args:
server_process: The subprocess object representing the running server
"""
@@ -139,10 +139,10 @@ class PlatformUtility(object):
def TestShellBinary(self):
"""The name of the binary for TestShell."""
return 'TestShell'
-
+
def TestShellBinaryPath(self, target):
"""Return the platform-specific binary path for our TestShell.
-
+
Args:
target: Build target mode (debug or release)
"""
diff --git a/webkit/tools/layout_tests/layout_package/platform_utils_win.py b/webkit/tools/layout_tests/layout_package/platform_utils_win.py
index c6bd525..5695a28 100644
--- a/webkit/tools/layout_tests/layout_package/platform_utils_win.py
+++ b/webkit/tools/layout_tests/layout_package/platform_utils_win.py
@@ -100,9 +100,9 @@ class PlatformUtility(google.platform_utils_win.PlatformUtility):
"""Prepares the config file and output directory to start an httpd server.
Returns a list of strings containing the server's command line+args.
- Creates the test output directory and generates an httpd.conf (or
- httpd2.conf for Apache 2 if apache2 is True) file in it that contains
- the necessary <VirtualHost> directives for running all the http tests.
+ Creates the test output directory and generates an httpd.conf (or
+ httpd2.conf for Apache 2 if apache2 is True) file in it that contains
+ the necessary <VirtualHost> directives for running all the http tests.
WebKit http tests expect the DocumentRoot to be in LayoutTests/http/tests/,
but that prevents us from running http tests in chrome/ or pending/. So we
@@ -126,7 +126,7 @@ class PlatformUtility(google.platform_utils_win.PlatformUtility):
chrome_document_root = layout_dir
apache_config_dir = google.httpd_utils.ApacheConfigDir(self._base_dir)
mime_types_path = os.path.join(apache_config_dir, "mime.types")
-
+
conf_file_name = "httpd.conf"
if apache2:
conf_file_name = "httpd2.conf"
diff --git a/webkit/tools/layout_tests/layout_package/test_expectations.py b/webkit/tools/layout_tests/layout_package/test_expectations.py
index 28dade7..0d343ca 100644
--- a/webkit/tools/layout_tests/layout_package/test_expectations.py
+++ b/webkit/tools/layout_tests/layout_package/test_expectations.py
@@ -35,13 +35,13 @@ class TestExpectations:
def GetFixable(self):
return (self._fixable.GetTests() -
- self._fixable.GetNonSkippedDeferred() -
+ self._fixable.GetNonSkippedDeferred() -
self._fixable.GetSkippedDeferred())
def GetFixableSkipped(self):
return self._fixable.GetSkipped()
- def GetFixableSkippedDeferred(self):
+ def GetFixableSkippedDeferred(self):
return self._fixable.GetSkippedDeferred()
def GetFixableFailures(self):
@@ -58,15 +58,15 @@ class TestExpectations:
def GetFixableCrashes(self):
return self._fixable.GetTestsExpectedTo(CRASH)
- def GetFixableDeferred(self):
- return self._fixable.GetNonSkippedDeferred()
+ def GetFixableDeferred(self):
+ return self._fixable.GetNonSkippedDeferred()
- def GetFixableDeferredFailures(self):
- return (self._fixable.GetNonSkippedDeferred() &
- self._fixable.GetTestsExpectedTo(FAIL))
+ def GetFixableDeferredFailures(self):
+ return (self._fixable.GetNonSkippedDeferred() &
+ self._fixable.GetTestsExpectedTo(FAIL))
- def GetFixableDeferredTimeouts(self):
- return (self._fixable.GetNonSkippedDeferred() &
+ def GetFixableDeferredTimeouts(self):
+ return (self._fixable.GetNonSkippedDeferred() &
self._fixable.GetTestsExpectedTo(TIMEOUT))
def GetIgnored(self):
@@ -112,7 +112,7 @@ class TestExpectations:
"""Read the expectation files for the given filename and return a single
expectations file with the merged results.
"""
-
+
path = os.path.join(self._directory, filename)
return TestExpectationsFile(path, self._tests, self._platform,
self._is_debug_mode)
@@ -131,11 +131,11 @@ def StripComments(line):
"""Strips comments from a line and return None if the line is empty
or else the contents of line with leading and trailing spaces removed
and all other whitespace collapsed"""
-
+
commentIndex = line.find('//')
if commentIndex is -1:
commentIndex = len(line)
-
+
line = re.sub(r'\s+', ' ', line[:commentIndex].strip())
if line == '': return None
else: return line
@@ -146,7 +146,7 @@ class TestExpectationsFile:
in which case the expectations apply to all test cases in that
directory and any subdirectory. The format of the file is along the
lines of:
-
+
LayoutTests/fast/js/fixme.js = FAIL
LayoutTests/fast/js/flaky.js = FAIL PASS
LayoutTests/fast/js/crash.js = CRASH TIMEOUT FAIL PASS
@@ -173,22 +173,22 @@ class TestExpectationsFile:
'fail': FAIL,
'timeout': TIMEOUT,
'crash': CRASH }
-
+
PLATFORMS = [ 'mac', 'linux', 'win' ]
def __init__(self, path, full_test_list, platform, is_debug_mode):
"""
path: The path to the expectation file. An error is thrown if a test is
- listed more than once.
+ listed more than once.
full_test_list: The list of all tests to be run pending processing of the
expections for those tests.
platform: Which platform from self.PLATFORMS to filter tests for.
is_debug_mode: Whether we testing a test_shell built debug mode.
"""
-
+
self._full_test_list = full_test_list
self._skipped = set()
- self._skipped_deferred = set()
+ self._skipped_deferred = set()
self._non_skipped_deferred = set()
self._expectations = {}
self._test_list_paths = {}
@@ -203,10 +203,10 @@ class TestExpectationsFile:
def GetSkipped(self):
return self._skipped
- def GetNonSkippedDeferred(self):
- return self._non_skipped_deferred
-
- def GetSkippedDeferred(self):
+ def GetNonSkippedDeferred(self):
+ return self._non_skipped_deferred
+
+ def GetSkippedDeferred(self):
return self._skipped_deferred
def GetExpectations(self, test):
@@ -233,7 +233,7 @@ class TestExpectationsFile:
platforms are listed.
"""
has_any_platforms = False
-
+
for platform in self.PLATFORMS:
if platform in options:
has_any_platforms = True
@@ -300,7 +300,7 @@ class TestExpectationsFile:
else:
tests = self._ExpandTests(test_list_path)
- if is_skipped:
+ if is_skipped:
self._AddSkippedTests(tests, is_deferred)
else:
self._AddTests(tests, expectations, test_list_path, lineno,
@@ -308,7 +308,7 @@ class TestExpectationsFile:
if len(self._errors) is not 0:
print "\nFAILURES FOR PLATFORM: %s, IS_DEBUG_MODE: %s" \
- % (self._platform.upper(), self._is_debug_mode)
+ % (self._platform.upper(), self._is_debug_mode)
raise SyntaxError('\n'.join(map(str, self._errors)))
def _GetOptionsList(self, listString):
@@ -329,8 +329,8 @@ class TestExpectationsFile:
path = os.path.join(path_utils.LayoutDataDir(), test_list_path)
path = os.path.normpath(path)
if os.path.isdir(path): path = os.path.join(path, '')
- # This is kind of slow - O(n*m) - since this is called for all
- # entries in the test lists. It has not been a performance
+ # This is kind of slow - O(n*m) - since this is called for all
+ # entries in the test lists. It has not been a performance
# issue so far. Maybe we should re-measure the time spent reading
# in the test lists?
result = []
@@ -360,19 +360,19 @@ class TestExpectationsFile:
self._expectations[test] = expectations
self._test_list_paths[test] = os.path.normpath(test_list_path)
- if is_deferred:
+ if is_deferred:
self._non_skipped_deferred.add(test)
for expectation in expectations:
if expectation == CRASH and is_deferred:
self._AddError(lineno, 'Crashes cannot be deferred.', test)
self._tests[expectation].add(test)
-
+
def _AddSkippedTests(self, tests, is_deferred):
for test in tests:
- if is_deferred:
+ if is_deferred:
self._skipped_deferred.add(test)
self._skipped.add(test)
def _AddError(self, lineno, msg, path):
- self._errors.append('\nLine:%s %s\n%s' % (lineno, msg, path)) \ No newline at end of file
+ self._errors.append('\nLine:%s %s\n%s' % (lineno, msg, path))
diff --git a/webkit/tools/layout_tests/layout_package/test_types_unittest.py b/webkit/tools/layout_tests/layout_package/test_types_unittest.py
index 24e1e75..a7b9bb6 100644
--- a/webkit/tools/layout_tests/layout_package/test_types_unittest.py
+++ b/webkit/tools/layout_tests/layout_package/test_types_unittest.py
@@ -29,7 +29,7 @@ class SimplifiedDiffUnittest(unittest.TestCase):
prefix + "-expected.txt")
output = differ._SimplifyText(open(output_filename).read())
expected = differ._SimplifyText(open(expected_filename).read())
-
+
if output != expected:
lst = difflib.unified_diff(expected.splitlines(True),
output.splitlines(True),
diff --git a/webkit/tools/layout_tests/run_webkit_tests.py b/webkit/tools/layout_tests/run_webkit_tests.py
index 1494f64..a11f1c2 100755
--- a/webkit/tools/layout_tests/run_webkit_tests.py
+++ b/webkit/tools/layout_tests/run_webkit_tests.py
@@ -237,7 +237,7 @@ class TestRunner:
else:
logging.info('Run: %d tests' % len(self._test_files))
- logging.info('Deferred: %d tests' %
+ logging.info('Deferred: %d tests' %
len(self._expectations.GetFixableDeferred()))
logging.info('Expected passes: %d tests' %
len(self._test_files -
@@ -480,10 +480,10 @@ class TestRunner:
skipped,
output)
- self._PrintResultSummary("=> Tests to be fixed for a future release",
- self._expectations.GetFixableDeferred(),
- deferred_failures,
- deferred_counts,
+ self._PrintResultSummary("=> Tests to be fixed for a future release",
+ self._expectations.GetFixableDeferred(),
+ deferred_failures,
+ deferred_counts,
self._expectations.GetFixableSkippedDeferred(),
output)
diff --git a/webkit/tools/layout_tests/test_types/simplified_text_diff.py b/webkit/tools/layout_tests/test_types/simplified_text_diff.py
index 00af6c1..3767a43 100644
--- a/webkit/tools/layout_tests/test_types/simplified_text_diff.py
+++ b/webkit/tools/layout_tests/test_types/simplified_text_diff.py
@@ -21,12 +21,12 @@ class SimplifiedTextDiff(text_diff.TestTextDiff):
"""Removes position and size information from a render tree dump. This
also combines contiguous lines of text together so lines that wrap between
different words match. Returns the simplified text."""
-
+
# SVG render paths are a little complicated: we want to strip digits after
# a decimal point only for strings that begin with "RenderPath.*data".
def simplify_svg_path(match):
return match.group(1) + re.sub(r"([0-9]*)\.[0-9]{2}", "\\1", match.group(2))
-
+
# Regular expressions to remove or substitue text.
simplifications = (
# Ignore TypeError and ReferenceError, V8 has different error text.
@@ -67,13 +67,13 @@ class SimplifiedTextDiff(text_diff.TestTextDiff):
# Handle RTL "...Browse" text. The space gets inserted when text lines
# are merged together in the step above.
(re.compile(r"... Browse"), "Browse..."),
-
+
# Some SVG tests inexplicably emit -0.00 rather than 0.00 in the expected results
(re.compile(r"-0\.00"), '0.00'),
-
+
# Remove size information from SVG text
(re.compile(r"(chunk.*width )([0-9]+\.[0-9]{2})"), '\\1'),
-
+
# Remove decimals from SVG paths
(re.compile(r"(RenderPath.*data)(.*)"), simplify_svg_path),
)
diff --git a/webkit/tools/layout_tests/test_types/test_type_base.py b/webkit/tools/layout_tests/test_types/test_type_base.py
index 4d6fdb7..9fab50e 100644
--- a/webkit/tools/layout_tests/test_types/test_type_base.py
+++ b/webkit/tools/layout_tests/test_types/test_type_base.py
@@ -58,7 +58,7 @@ class TestTypeBase(object):
"""
self._root_output_dir = root_output_dir
self._platform = platform
-
+
def _MakeOutputDirectory(self, filename):
"""Creates the output directory (if needed) for a given test filename."""
output_filename = os.path.join(self._root_output_dir,
@@ -88,11 +88,11 @@ class TestTypeBase(object):
def OutputFilename(self, filename, modifier):
"""Returns a filename inside the output dir that contains modifier.
-
+
For example, if filename is c:/.../fast/dom/foo.html and modifier is
"-expected.txt", the return value is
c:/cygwin/tmp/layout-test-results/fast/dom/foo-expected.txt
-
+
Args:
filename: absolute filename to test file
modifier: a string to replace the extension of filename with
@@ -105,12 +105,12 @@ class TestTypeBase(object):
return os.path.splitext(output_filename)[0] + modifier
def RelativeOutputFilename(self, filename, modifier):
- """Returns a relative filename inside the output dir that contains
+ """Returns a relative filename inside the output dir that contains
modifier.
-
+
For example, if filename is fast\dom\foo.html and modifier is
"-expected.txt", the return value is fast\dom\foo-expected.txt
-
+
Args:
filename: relative filename to test file
modifier: a string to replace the extension of filename with
@@ -122,16 +122,16 @@ class TestTypeBase(object):
def CompareOutput(self, filename, proc, output, test_args, target):
"""Method that compares the output from the test with the expected value.
-
+
This is an abstract method to be implemented by all sub classes.
-
+
Args:
filename: absolute filename to test file
proc: a reference to the test_shell process
output: a string containing the output of the test
test_args: a TestArguments object holding optional additional arguments
target: Debug or Release
-
+
Return:
a list of TestFailure objects, empty if the test passes
"""
diff --git a/webkit/tools/merge/diff3-wrapper.py b/webkit/tools/merge/diff3-wrapper.py
index 4e31ebd..2d0f0e2 100755
--- a/webkit/tools/merge/diff3-wrapper.py
+++ b/webkit/tools/merge/diff3-wrapper.py
@@ -29,7 +29,7 @@ def EnsureWindowsPath(path):
path = path[CYGLEN:CYGLEN + 1] + ':' + path[CYGLEN + 1:]
path = path.replace('/', '\\')
return path
-
+
def GetPathToBinary(exe):
""" Try to find a copy of the binary that exists. Search for the full path
and then the basename.
@@ -44,9 +44,9 @@ def main(args):
args: The arguments passed by svn merge to its diff3 tool.
"""
- # Grab the arguments from the end of the list since svn will add any other
+ # Grab the arguments from the end of the list since svn will add any other
# arguments provided before these.
-
+
# The titles of the files being diffed.
title_mine = EnsureWindowsPath(args[-8])
title_older = EnsureWindowsPath(args[-6])
@@ -56,15 +56,15 @@ def main(args):
mine = EnsureWindowsPath(args[-3])
older = EnsureWindowsPath(args[-2])
yours = EnsureWindowsPath(args[-1])
-
+
# The command for which diff3 tool to use.
diff_tool = args[1]
-
+
if diff_tool == "--use-beyondcompare":
exe = GetPathToBinary("c:/Progra~1/Beyond~1/BComp.exe")
if not os.path.exists(exe):
exe = GetPathToBinary("c:/Progra~2/Beyond~1/BComp.exe")
- cmd = [exe,
+ cmd = [exe,
mine,
yours,
older,
@@ -74,9 +74,9 @@ def main(args):
'/leftreadonly',
'/rightreadonly',
'/ignoreunimportant',
- '/lefttitle', title_mine,
- '/righttitle', title_yours,
- '/centertitle', title_older,
+ '/lefttitle', title_mine,
+ '/righttitle', title_yours,
+ '/centertitle', title_older,
'/outputtitle', 'merged']
elif diff_tool == "--use-kdiff3":
exe = GetPathToBinary("c:/Progra~1/KDiff3/kdiff3.exe")
@@ -106,7 +106,7 @@ def main(args):
traceback.print_exc(file=sys.stdout)
# After performing the merge, this script needs to print the contents
- # of the merged file to stdout.
+ # of the merged file to stdout.
# Return an errorcode of 0 on successful merge, 1 if unresolved conflicts
# remain in the result. Any other errorcode will be treated as fatal.
merged_file_contents = open(mine).read()
diff --git a/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp b/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp
index 2afda67..afcb60f 100644
--- a/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp
+++ b/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp
@@ -413,19 +413,19 @@ static bool destroyStream(PluginObject* obj, const NPVariant* args, uint32_t arg
static bool testEnumerate(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
if (argCount == 2 && NPVARIANT_IS_OBJECT(args[0]) && NPVARIANT_IS_OBJECT(args[1])) {
- uint32_t count;
+ uint32_t count;
NPIdentifier* identifiers;
if (browser->enumerate(obj->npp, NPVARIANT_TO_OBJECT(args[0]), &identifiers, &count)) {
NPObject* outArray = NPVARIANT_TO_OBJECT(args[1]);
NPIdentifier pushIdentifier = browser->getstringidentifier("push");
-
+
for (uint32_t i = 0; i < count; i++) {
NPUTF8* string = browser->utf8fromidentifier(identifiers[i]);
-
+
if (!string)
continue;
-
+
NPVariant args[1];
STRINGZ_TO_NPVARIANT(string, args[0]);
NPVariant browserResult;
@@ -433,12 +433,12 @@ static bool testEnumerate(PluginObject* obj, const NPVariant* args, uint32_t arg
browser->releasevariantvalue(&browserResult);
browser->memfree(string);
}
-
+
browser->memfree(identifiers);
}
-
+
VOID_TO_NPVARIANT(*result);
- return true;
+ return true;
}
return false;
}
@@ -639,7 +639,7 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
// object before returning it and the calling JS gets a garbage
// value. Firefox handles it fine.
OBJECT_TO_NPVARIANT(NPVARIANT_TO_OBJECT(browserResult), *result);
- } else {
+ } else {
browser->releasevariantvalue(&browserResult);
VOID_TO_NPVARIANT(*result);
}
@@ -682,21 +682,21 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
// NPObject.
// Arguments:
// arg1: Callback that returns a script object.
- // arg2: Name of the method to call on the script object returned
+ // arg2: Name of the method to call on the script object returned
// from the callback
NPObject *windowScriptObject;
- browser->getvalue(plugin->npp, NPNVWindowNPObject,
+ browser->getvalue(plugin->npp, NPNVWindowNPObject,
&windowScriptObject);
// Arg1 is the name of the callback
NPUTF8* callbackString = createCStringFromNPVariant(&args[0]);
- NPIdentifier callbackIdentifier =
+ NPIdentifier callbackIdentifier =
browser->getstringidentifier(callbackString);
free(callbackString);
// Invoke a callback that returns a script object
NPVariant object_result;
- browser->invoke(plugin->npp, windowScriptObject, callbackIdentifier,
+ browser->invoke(plugin->npp, windowScriptObject, callbackIdentifier,
&args[1], 1, &object_result);
// Script object returned
@@ -704,7 +704,7 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
// Arg2 is the name of the method to be called on the script object
NPUTF8* object_mehod_string = createCStringFromNPVariant(&args[1]);
- NPIdentifier object_method =
+ NPIdentifier object_method =
browser->getstringidentifier(object_mehod_string);
free(object_mehod_string);
@@ -729,7 +729,7 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
// value. Firefox handles it fine.
OBJECT_TO_NPVARIANT(NPVARIANT_TO_OBJECT(object_method_result),
*result);
- } else {
+ } else {
browser->releasevariantvalue(&object_method_result);
VOID_TO_NPVARIANT(*result);
}
diff --git a/webkit/tools/npapi_layout_test_plugin/PluginObject.h b/webkit/tools/npapi_layout_test_plugin/PluginObject.h
index f344a36..5027f22 100644
--- a/webkit/tools/npapi_layout_test_plugin/PluginObject.h
+++ b/webkit/tools/npapi_layout_test_plugin/PluginObject.h
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "webkit/glue/plugins/nphostapi.h"
diff --git a/webkit/tools/npapi_layout_test_plugin/TestObject.cpp b/webkit/tools/npapi_layout_test_plugin/TestObject.cpp
index e82ba13..659da76 100644
--- a/webkit/tools/npapi_layout_test_plugin/TestObject.cpp
+++ b/webkit/tools/npapi_layout_test_plugin/TestObject.cpp
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "TestObject.h"
@@ -35,10 +35,10 @@ static bool testGetProperty(NPObject *obj, NPIdentifier name, NPVariant *variant
static NPObject *testAllocate(NPP npp, NPClass *theClass);
static void testDeallocate(NPObject *obj);
-static NPClass testClass = {
+static NPClass testClass = {
NP_CLASS_STRUCT_VERSION,
- testAllocate,
- testDeallocate,
+ testAllocate,
+ testDeallocate,
0,
0,
0,
@@ -88,16 +88,16 @@ static NPObject *testAllocate(NPP npp, NPClass *theClass)
static_cast<TestObject*>(malloc(sizeof(TestObject)));
newInstance->testObject = NULL;
++testObjectCount;
-
+
if (!identifiersInitialized) {
identifiersInitialized = true;
initializeIdentifiers();
}
-
+
return reinterpret_cast<NPObject*>(newInstance);
}
-static void testDeallocate(NPObject *obj)
+static void testDeallocate(NPObject *obj)
{
TestObject *testObject = reinterpret_cast<TestObject*>(obj);
if (testObject->testObject)
@@ -119,11 +119,11 @@ static bool testHasProperty(NPObject *obj, NPIdentifier name)
if (testIdentifiers[i] == name)
return true;
}
-
+
return false;
}
-static bool testGetProperty(NPObject *obj, NPIdentifier name,
+static bool testGetProperty(NPObject *obj, NPIdentifier name,
NPVariant *variant)
{
if (name == testIdentifiers[ID_PROPERTY_FOO]) {
@@ -151,10 +151,10 @@ static bool testGetProperty(NPObject *obj, NPIdentifier name,
static bool testEnumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count)
{
*count = NUM_TEST_IDENTIFIERS;
-
+
*value = (NPIdentifier*)browser->memalloc(NUM_TEST_IDENTIFIERS * sizeof(NPIdentifier));
memcpy(*value, testIdentifiers, sizeof(NPIdentifier) * NUM_TEST_IDENTIFIERS);
-
+
return true;
}
diff --git a/webkit/tools/npapi_layout_test_plugin/TestObject.h b/webkit/tools/npapi_layout_test_plugin/TestObject.h
index 2babaaf..812603c 100644
--- a/webkit/tools/npapi_layout_test_plugin/TestObject.h
+++ b/webkit/tools/npapi_layout_test_plugin/TestObject.h
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "third_party/npapi/bindings/npapi.h"
diff --git a/webkit/tools/npapi_layout_test_plugin/main.cpp b/webkit/tools/npapi_layout_test_plugin/main.cpp
index dce0e3d..65426c0 100644
--- a/webkit/tools/npapi_layout_test_plugin/main.cpp
+++ b/webkit/tools/npapi_layout_test_plugin/main.cpp
@@ -1,33 +1,33 @@
/*
IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
- consideration of your agreement to the following terms, and your use, installation,
- modification or redistribution of this Apple software constitutes acceptance of these
- terms. If you do not agree with these terms, please do not use, install, modify or
+ consideration of your agreement to the following terms, and your use, installation,
+ modification or redistribution of this Apple software constitutes acceptance of these
+ terms. If you do not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
- In consideration of your agreement to abide by the following terms, and subject to these
- terms, Apple grants you a personal, non-exclusive license, under Apple’s copyrights in
- this original Apple software (the "Apple Software"), to use, reproduce, modify and
- redistribute the Apple Software, with or without modifications, in source and/or binary
- forms; provided that if you redistribute the Apple Software in its entirety and without
- modifications, you must retain this notice and the following text and disclaimers in all
- such redistributions of the Apple Software. Neither the name, trademarks, service marks
- or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
+
+ In consideration of your agreement to abide by the following terms, and subject to these
+ terms, Apple grants you a personal, non-exclusive license, under Apple’s copyrights in
+ this original Apple software (the "Apple Software"), to use, reproduce, modify and
+ redistribute the Apple Software, with or without modifications, in source and/or binary
+ forms; provided that if you redistribute the Apple Software in its entirety and without
+ modifications, you must retain this notice and the following text and disclaimers in all
+ such redistributions of the Apple Software. Neither the name, trademarks, service marks
+ or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
the Apple Software without specific prior written permission from Apple. Except as expressly
stated in this notice, no other rights or licenses, express or implied, are granted by Apple
- herein, including but not limited to any patent rights that may be infringed by your
+ herein, including but not limited to any patent rights that may be infringed by your
derivative works or by other works in which the Apple Software may be incorporated.
-
- The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
- EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
+
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
+ EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
- REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
- WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
+ REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
+ WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@@ -81,7 +81,7 @@ NPError NPAPI NP_GetEntryPoints(NPPluginFuncs *pluginFuncs)
pluginFuncs->urlnotify = NPP_URLNotify;
pluginFuncs->getvalue = NPP_GetValue;
pluginFuncs->setvalue = NPP_SetValue;
-
+
return NPERR_NO_ERROR;
}
@@ -93,7 +93,7 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
{
if (browser->version >= 14) {
PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass());
-
+
for (int i = 0; i < argc; i++) {
if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
obj->onStreamLoad = strdup(argv[i]);
@@ -104,10 +104,10 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
else if (strcasecmp(argn[i], "logfirstsetwindow") == 0)
obj->logSetWindow = TRUE;
}
-
+
instance->pdata = obj;
}
-
+
// On Windows and Unix, plugins only get events if they are windowless.
return browser->setvalue(instance, NPPVpluginWindowBool, NULL);
}
@@ -141,7 +141,7 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window)
if (window->window == NULL) {
return NPERR_NO_ERROR;
}
-
+
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
if (obj) {
@@ -150,7 +150,7 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window)
obj->logSetWindow = false;
}
}
-
+
return NPERR_NO_ERROR;
}
@@ -220,7 +220,7 @@ int16 NPP_HandleEvent(NPP instance, void *event)
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
if (!obj->eventLogging)
return 0;
-
+
#ifdef WIN32
// Below is the event handling code. Per the NPAPI spec, the events don't
// map directly between operating systems:
@@ -268,7 +268,7 @@ int16 NPP_HandleEvent(NPP instance, void *event)
printf("PLUGIN: loseFocusEvent\n");
break;
default:
- printf("PLUGIN: event %d\n", evt->event);
+ printf("PLUGIN: event %d\n", evt->event);
}
fflush(stdout);
@@ -378,7 +378,7 @@ int16 NPP_HandleEvent(NPP instance, void *event)
printf("PLUGIN: event %d\n", evt->what);
}
#endif
-
+
return 0;
}
diff --git a/webkit/tools/npapi_layout_test_plugin/resource.h b/webkit/tools/npapi_layout_test_plugin/resource.h
index c2bcf92..fe773d32 100644
--- a/webkit/tools/npapi_layout_test_plugin/resource.h
+++ b/webkit/tools/npapi_layout_test_plugin/resource.h
@@ -3,7 +3,7 @@
// Used by npapi_layout_test_plugin.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/webkit/tools/test_shell/event_sending_controller.h b/webkit/tools/test_shell/event_sending_controller.h
index aaa7a74..38715dd 100644
--- a/webkit/tools/test_shell/event_sending_controller.h
+++ b/webkit/tools/test_shell/event_sending_controller.h
@@ -8,7 +8,7 @@
Bound to a JavaScript window.eventSender object using
CppBoundClass::BindToJavascript(), this allows layout tests that are run in
the test_shell to fire DOM events.
-
+
The OSX reference file is in
WebKit/WebKitTools/DumpRenderTree/EventSendingController.m
*/
diff --git a/webkit/tools/test_shell/foreground_helper.h b/webkit/tools/test_shell/foreground_helper.h
index 4829832..aeccef8 100644
--- a/webkit/tools/test_shell/foreground_helper.h
+++ b/webkit/tools/test_shell/foreground_helper.h
@@ -12,7 +12,7 @@
// move to the foreground, unless requested by the current window in the
// foreground. For automated testing, we really want some of our windows
// to be capable of moving to the foreground.
-//
+//
// This is probably leveraging a windows bug.
class ForegroundHelper : public CWindowImpl<ForegroundHelper> {
public:
@@ -21,7 +21,7 @@ BEGIN_MSG_MAP(ForegroundHelper)
END_MSG_MAP()
// Brings a window into the foreground.
- // Can be called from any window, even if the caller is not the
+ // Can be called from any window, even if the caller is not the
// foreground window.
static HRESULT SetForeground(HWND window) {
DCHECK(::IsWindow(window));
@@ -32,7 +32,7 @@ END_MSG_MAP()
private:
HRESULT ForegroundHotKey(HWND window) {
- // This implementation registers a hot key (F22) and then
+ // This implementation registers a hot key (F22) and then
// triggers the hot key. When receiving the hot key, we'll
// be in the foreground and allowed to move the target window
// into the foreground too.
@@ -60,7 +60,7 @@ END_MSG_MAP()
return E_FAIL;
// Loop until we get the key.
- // TODO: It may be possible to get stuck here if the
+ // TODO: It may be possible to get stuck here if the
// message gets lost?
while(GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
@@ -77,7 +77,7 @@ END_MSG_MAP()
}
// Handle the registered Hotkey being pressed.
- LRESULT OnHotKey(UINT /*uMsg*/, WPARAM /*wParam*/,
+ LRESULT OnHotKey(UINT /*uMsg*/, WPARAM /*wParam*/,
LPARAM /*lParam*/, BOOL& bHandled) {
HWND window = reinterpret_cast<HWND>(GetWindowLongPtr(GWLP_USERDATA));
SetForegroundWindow(window);
diff --git a/webkit/tools/test_shell/image_decoder_unittest.cc b/webkit/tools/test_shell/image_decoder_unittest.cc
index 89ed594..7a55eea 100644
--- a/webkit/tools/test_shell/image_decoder_unittest.cc
+++ b/webkit/tools/test_shell/image_decoder_unittest.cc
@@ -37,7 +37,7 @@ void SaveMD5Sum(const std::wstring& path, WebCore::RGBA32Buffer* buffer) {
// Calculate MD5 sum.
MD5Digest digest;
- SkAutoLockPixels bmp_lock(buffer->bitmap());
+ SkAutoLockPixels bmp_lock(buffer->bitmap());
MD5Sum(buffer->bitmap().getPixels(),
buffer->rect().width() * buffer->rect().height() * sizeof(unsigned),
&digest);
@@ -60,7 +60,7 @@ void VerifyImage(WebCore::ImageDecoder* decoder,
// Calculate MD5 sum.
MD5Digest actual_digest;
- SkAutoLockPixels bmp_lock(image_buffer->bitmap());
+ SkAutoLockPixels bmp_lock(image_buffer->bitmap());
MD5Sum(image_buffer->bitmap().getPixels(), image_buffer->rect().width() *
image_buffer->rect().height() * sizeof(unsigned), &actual_digest);
diff --git a/webkit/tools/test_shell/mac/DumpRenderTreePasteboard.h b/webkit/tools/test_shell/mac/DumpRenderTreePasteboard.h
index 60e2ab5..f2c1953 100644
--- a/webkit/tools/test_shell/mac/DumpRenderTreePasteboard.h
+++ b/webkit/tools/test_shell/mac/DumpRenderTreePasteboard.h
@@ -8,13 +8,13 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+ * documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
diff --git a/webkit/tools/test_shell/mac/DumpRenderTreePasteboard.m b/webkit/tools/test_shell/mac/DumpRenderTreePasteboard.m
index e8fa4ee..0e6731a 100644
--- a/webkit/tools/test_shell/mac/DumpRenderTreePasteboard.m
+++ b/webkit/tools/test_shell/mac/DumpRenderTreePasteboard.m
@@ -8,13 +8,13 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+ * documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
diff --git a/webkit/tools/test_shell/mac/test_shell_webview.mm b/webkit/tools/test_shell/mac/test_shell_webview.mm
index 17d6b79..4767e63 100644
--- a/webkit/tools/test_shell/mac/test_shell_webview.mm
+++ b/webkit/tools/test_shell/mac/test_shell_webview.mm
@@ -35,7 +35,7 @@
- (void) dealloc {
[self removeTrackingArea:trackingArea_];
[trackingArea_ release];
-
+
[super dealloc];
}
@@ -43,7 +43,7 @@
CGContextRef context =
reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext]
graphicsPort]);
-
+
// start by filling the rect with magenta, so that we can see what's drawn
CGContextSetRGBFillColor (context, 1, 0, 1, 1);
CGContextFillRect(context, NSRectToCGRect(rect));
@@ -53,7 +53,7 @@
// flip from cocoa coordinates
client_rect.set_y([self frame].size.height -
client_rect.height() - client_rect.y());
-
+
shell_->webViewHost()->UpdatePaintRect(client_rect);
shell_->webViewHost()->Paint();
}
@@ -81,8 +81,8 @@
- (IBAction)takeURLStringValueFrom:(NSTextField *)sender {
NSString *url = [sender stringValue];
-
- // if it doesn't already have a prefix, add http. If we can't parse it,
+
+ // if it doesn't already have a prefix, add http. If we can't parse it,
// just don't bother rather than making things worse.
NSURL* tempUrl = [NSURL URLWithString:url];
if (tempUrl && ![tempUrl scheme])
@@ -182,7 +182,7 @@
shell_->webViewHost()->SetFocus(YES);
return YES;
}
-
+
return NO;
}
@@ -191,7 +191,7 @@
shell_->webViewHost()->SetFocus(NO);
return YES;
}
-
+
return NO;
}
diff --git a/webkit/tools/test_shell/mac/test_webview_delegate.mm b/webkit/tools/test_shell/mac/test_webview_delegate.mm
index 48e2c3f..e80f75a 100755
--- a/webkit/tools/test_shell/mac/test_webview_delegate.mm
+++ b/webkit/tools/test_shell/mac/test_webview_delegate.mm
@@ -74,7 +74,7 @@ void TestWebViewDelegate::CloseWidgetSoon(WebWidget* webwidget) {
}
}
-void TestWebViewDelegate::SetCursor(WebWidget* webwidget,
+void TestWebViewDelegate::SetCursor(WebWidget* webwidget,
const WebCursor& cursor) {
NSCursor* ns_cursor = cursor.GetCursor();
[ns_cursor set];
@@ -114,7 +114,7 @@ void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget,
- (NSRect)_growBoxRect;
@end
-void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget,
+void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget,
gfx::Rect* out_rect) {
NSRect resize_rect = NSMakeRect(0, 0, 0, 0);
WebWidgetHost* host = GetHostForWidget(webwidget);
@@ -131,8 +131,8 @@ void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget,
// Convert to view coordinates from window coordinates.
resize_rect = [view convertRect:resize_rect fromView:nil];
// Flip the rect in view coordinates
- resize_rect.origin.y =
- [view frame].size.height - resize_rect.origin.y -
+ resize_rect.origin.y =
+ [view frame].size.height - resize_rect.origin.y -
resize_rect.size.height;
}
*out_rect = gfx::Rect(NSRectToCGRect(resize_rect));
diff --git a/webkit/tools/test_shell/mac/webwidget_host.mm b/webkit/tools/test_shell/mac/webwidget_host.mm
index b99aca7..fd95535 100644
--- a/webkit/tools/test_shell/mac/webwidget_host.mm
+++ b/webkit/tools/test_shell/mac/webwidget_host.mm
@@ -23,7 +23,7 @@ WebWidgetHost* WebWidgetHost::Create(NSView* parent_view,
content_rect.size.height -= 64;
host->view_ = [[NSView alloc] initWithFrame:content_rect];
[parent_view addSubview:host->view_];
-
+
// win_util::SetWindowUserData(host->hwnd_, host);
host->webwidget_ = WebWidget::Create(delegate);
@@ -162,10 +162,10 @@ void WebWidgetHost::Paint() {
[NSGraphicsContext setCurrentContext:
[NSGraphicsContext graphicsContextWithGraphicsPort:bitmap_context
flipped:NO]];
-
+
// This may result in more invalidation
webwidget_->Layout();
-
+
// Scroll the canvas if necessary
scroll_rect_ = client_rect.Intersect(scroll_rect_);
if (!scroll_rect_.IsEmpty()) {
@@ -188,7 +188,7 @@ void WebWidgetHost::Paint() {
}
}
DCHECK(paint_rect_.IsEmpty());
-
+
// set the context back to our window
[NSGraphicsContext setCurrentContext: view_context];
@@ -201,7 +201,7 @@ void WebWidgetHost::Paint() {
{ bitmap_width, bitmap_height } };
canvas_->getTopPlatformDevice().DrawToContext(
context, 0, client_rect.height() - bitmap_height, &bitmap_rect);
-
+
[view_ unlockFocus];
}
}
diff --git a/webkit/tools/test_shell/plugin_tests.cc b/webkit/tools/test_shell/plugin_tests.cc
index 36737e4..5da7cf2 100644
--- a/webkit/tools/test_shell/plugin_tests.cc
+++ b/webkit/tools/test_shell/plugin_tests.cc
@@ -52,7 +52,7 @@ class PluginTest : public TestShellTest {
void WaitForFinish(const std::string &name, const std::string &id) {
test_shell_->WaitTestFinished();
- std::string cookies =
+ std::string cookies =
request_context_->cookie_store()->GetCookies(test_url_);
EXPECT_FALSE(cookies.empty());
@@ -115,7 +115,7 @@ class PluginTest : public TestShellTest {
};
TEST_F(PluginTest, DISABLED_VerifyPluginWindowRect) {
- std::wstring test_url = GetTestURL(plugin_data_dir_,
+ std::wstring test_url = GetTestURL(plugin_data_dir_,
L"verify_plugin_window_rect.html");
NavigateToURL(test_url);
WaitForFinish("checkwindowrect", "1");
diff --git a/webkit/tools/test_shell/resource.h b/webkit/tools/test_shell/resource.h
index 7deb4b9..f2deaaf 100644
--- a/webkit/tools/test_shell/resource.h
+++ b/webkit/tools/test_shell/resource.h
@@ -4,7 +4,7 @@
//
#define IDS_APP_TITLE 103
-
+
#define IDR_MAINFRAME 128
#define IDD_TESTSHELL_DIALOG 102
#define IDD_ABOUTBOX 103
@@ -26,7 +26,7 @@
#define IDC_STATIC -1
#endif
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
diff --git a/webkit/tools/test_shell/run_all_tests.cc b/webkit/tools/test_shell/run_all_tests.cc
index 5cc12a2..ba37d68 100644
--- a/webkit/tools/test_shell/run_all_tests.cc
+++ b/webkit/tools/test_shell/run_all_tests.cc
@@ -30,7 +30,7 @@
#include "webkit/tools/test_shell/test_shell_webkit_init.h"
#include "testing/gtest/include/gtest/gtest.h"
-const char* TestShellTest::kJavascriptDelayExitScript =
+const char* TestShellTest::kJavascriptDelayExitScript =
"<script>"
"window.layoutTestController.waitUntilDone();"
"window.addEventListener('load', function() {"
diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
index 79ffee0..696502b 100644
--- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc
+++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
@@ -498,7 +498,7 @@ ResourceLoaderBridge* ResourceLoaderBridge::Create(
headers, load_flags);
}
-// Issue the proxy resolve request on the io thread, and wait
+// Issue the proxy resolve request on the io thread, and wait
// for the result.
bool FindProxyForUrl(const GURL& url, std::string* proxy_list) {
DCHECK(request_context);
diff --git a/webkit/tools/test_shell/test_navigation_controller.cc b/webkit/tools/test_shell/test_navigation_controller.cc
index cf9bff5..ff4a753 100644
--- a/webkit/tools/test_shell/test_navigation_controller.cc
+++ b/webkit/tools/test_shell/test_navigation_controller.cc
@@ -226,7 +226,7 @@ int TestNavigationController::GetEntryIndexWithPageID(int32 page_id) const {
void TestNavigationController::NavigateToPendingEntry(bool reload) {
// For session history navigations only the pending_entry_index_ is set.
if (!pending_entry_) {
- DCHECK(pending_entry_index_ != -1);
+ DCHECK(pending_entry_index_ != -1);
pending_entry_ = entries_[pending_entry_index_].get();
}
diff --git a/webkit/tools/test_shell/test_navigation_controller.h b/webkit/tools/test_shell/test_navigation_controller.h
index f65c85a..aeec2bf 100644
--- a/webkit/tools/test_shell/test_navigation_controller.h
+++ b/webkit/tools/test_shell/test_navigation_controller.h
@@ -80,7 +80,7 @@ class TestNavigationEntry {
std::string state_;
mutable scoped_refptr<WebHistoryItem> cached_history_item_;
-
+
std::wstring target_frame_;
DISALLOW_COPY_AND_ASSIGN(TestNavigationEntry);
diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc
index 5cde156..fb56328 100644
--- a/webkit/tools/test_shell/test_shell_gtk.cc
+++ b/webkit/tools/test_shell/test_shell_gtk.cc
@@ -495,7 +495,7 @@ void TestShell::ResizeSubViews() {
static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), "test-shell"));
shell->ResetTestController();
- // ResetTestController may have closed the window we were holding on to.
+ // ResetTestController may have closed the window we were holding on to.
// Grab the first window again.
window = *(TestShell::windowList()->begin());
shell = static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), "test-shell"));
diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm
index dea940a..54c2859 100644
--- a/webkit/tools/test_shell/test_shell_mac.mm
+++ b/webkit/tools/test_shell/test_shell_mac.mm
@@ -109,8 +109,8 @@ FilePath GetResourcesFilePath() {
// clean ourselves up and do the work after clearing the stack of anything
// that might have the shell on it.
- [self performSelectorOnMainThread:@selector(cleanup:)
- withObject:window
+ [self performSelectorOnMainThread:@selector(cleanup:)
+ withObject:window
waitUntilDone:NO];
return YES;
@@ -161,7 +161,7 @@ void TestShell::PlatformShutdown() {
}
// assert if we have anything left over, that would be bad.
DCHECK(window_map_.Get().size() == 0);
-
+
// Dump the pasteboards we built up.
[DumpRenderTreePasteboard releaseLocalPasteboards];
}
@@ -173,9 +173,9 @@ void TestShell::InitializeTestShell(bool layout_test_mode) {
window_list_ = new WindowList;
layout_test_mode_ = layout_test_mode;
-
+
web_prefs_ = new WebPreferences;
-
+
ResetWebPreferences();
// Load the Ahem font, which is used by layout tests.
@@ -214,7 +214,7 @@ NSButton* MakeTestButton(NSRect* rect, NSString* title, NSView* parent) {
bool TestShell::Initialize(const std::wstring& startingURL) {
// Perform application initialization:
// send message to app controller? need to work this out
-
+
// TODO(awalker): this is a straight recreation of windows test_shell.cc's
// window creation code--we should really pull this from the nib and grab
// references to the already-created subviews that way.
@@ -230,30 +230,30 @@ bool TestShell::Initialize(const std::wstring& startingURL) {
backing:NSBackingStoreBuffered
defer:NO];
[m_mainWnd setTitle:@"TestShell"];
-
+
// Add to our map
window_map_.Get()[m_mainWnd] = this;
-
+
// Create a window delegate to watch for when it's asked to go away. It will
// clean itself up so we don't need to hold a reference.
[m_mainWnd setDelegate:[[WindowCloseDelegate alloc] init]];
-
- // Rely on the window delegate to clean us up rather than immediately
- // releasing when the window gets closed. We use the delegate to do
+
+ // Rely on the window delegate to clean us up rather than immediately
+ // releasing when the window gets closed. We use the delegate to do
// everything from the autorelease pool so the shell isn't on the stack
// during cleanup (ie, a window close from javascript).
[m_mainWnd setReleasedWhenClosed:NO];
-
+
// Create a webview. Note that |web_view| takes ownership of this shell so we
// will get cleaned up when it gets destroyed.
m_webViewHost.reset(
WebViewHost::Create([m_mainWnd contentView], delegate_.get(), *TestShell::web_prefs_));
webView()->SetUseEditorDelegate(true);
delegate_->RegisterDragDrop();
- TestShellWebView* web_view =
+ TestShellWebView* web_view =
static_cast<TestShellWebView*>(m_webViewHost->view_handle());
[web_view setShell:this];
-
+
// create buttons
NSRect button_rect = [[m_mainWnd contentView] bounds];
button_rect.origin.y = window_rect.size.height - URLBAR_HEIGHT +
@@ -261,27 +261,27 @@ bool TestShell::Initialize(const std::wstring& startingURL) {
button_rect.size.height = BUTTON_HEIGHT;
button_rect.origin.x += BUTTON_MARGIN;
button_rect.size.width = BUTTON_WIDTH;
-
+
NSView* content = [m_mainWnd contentView];
-
+
NSButton* button = MakeTestButton(&button_rect, @"Back", content);
[button setTarget:web_view];
[button setAction:@selector(goBack:)];
-
+
button = MakeTestButton(&button_rect, @"Forward", content);
[button setTarget:web_view];
[button setAction:@selector(goForward:)];
-
+
// reload button
button = MakeTestButton(&button_rect, @"Reload", content);
[button setTarget:web_view];
[button setAction:@selector(reload:)];
-
+
// stop button
button = MakeTestButton(&button_rect, @"Stop", content);
[button setTarget:web_view];
[button setAction:@selector(stopLoading:)];
-
+
// text field for URL
button_rect.origin.x += BUTTON_MARGIN;
button_rect.size.width = [[m_mainWnd contentView] bounds].size.width -
@@ -296,7 +296,7 @@ bool TestShell::Initialize(const std::wstring& startingURL) {
// show the window
[m_mainWnd makeKeyAndOrderFront: nil];
-
+
// Load our initial content.
if (!startingURL.empty())
LoadURL(startingURL.c_str());
@@ -315,7 +315,7 @@ bool TestShell::Initialize(const std::wstring& startingURL) {
void TestShell::TestFinished() {
if (!test_is_pending_)
return; // reached when running under test_shell_tests
-
+
test_is_pending_ = false;
NSWindow* window = *(TestShell::windowList()->begin());
WindowMap::iterator it = window_map_.Get().find(window);
@@ -347,14 +347,14 @@ void TestShell::TestFinished() {
- (void)run:(id)ignore {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
-
+
// check for debugger, just bail if so. We don't want the timeouts hitting
// when we're trying to track down an issue.
if (DebugUtil::BeingDebugged())
return;
-
+
NSThread* currentThread = [NSThread currentThread];
-
+
// Wait to be cancelled. If we are that means the test finished. If it hasn't,
// then we need to tell the layout script we timed out and start again.
NSDate* limitDate = [NSDate dateWithTimeIntervalSinceNow:timeout_];
@@ -381,26 +381,26 @@ void TestShell::TestFinished() {
void TestShell::WaitTestFinished() {
DCHECK(!test_is_pending_) << "cannot be used recursively";
-
+
test_is_pending_ = true;
-
+
// Create a watchdog thread which just sets a timer and
// kills the process if it times out. This catches really
- // bad hangs where the shell isn't coming back to the
- // message loop. If the watchdog is what catches a
+ // bad hangs where the shell isn't coming back to the
+ // message loop. If the watchdog is what catches a
// timeout, it can't do anything except terminate the test
// shell, which is unfortunate.
// Windows multiplies by 2.5, but that causes us to run for far, far too
// long. We use the passed value and let the scripts flag override
// the value as needed.
NSTimeInterval timeout_seconds = GetLayoutTestTimeoutInSeconds();
- WatchDogTarget* watchdog = [[[WatchDogTarget alloc]
+ WatchDogTarget* watchdog = [[[WatchDogTarget alloc]
initWithTimeout:timeout_seconds] autorelease];
NSThread* thread = [[NSThread alloc] initWithTarget:watchdog
- selector:@selector(run:)
+ selector:@selector(run:)
object:nil];
[thread start];
-
+
// TestFinished() will post a quit message to break this loop when the page
// finishes loading.
while (test_is_pending_)
@@ -444,7 +444,7 @@ WebWidget* TestShell::CreatePopupWidget(WebView* webview) {
DCHECK(!m_popupHost);
m_popupHost = WebWidgetHost::Create(NULL, delegate_.get());
// ShowWindow(popupWnd(), SW_SHOW);
-
+
return m_popupHost->webwidget();
}
@@ -492,7 +492,7 @@ void TestShell::ResizeSubViews() {
DCHECK(shell);
shell->ResetTestController();
- // ResetTestController may have closed the window we were holding on to.
+ // ResetTestController may have closed the window we were holding on to.
// Grab the first window again.
window = *(TestShell::windowList()->begin());
shell = window_map_.Get()[window];
@@ -536,7 +536,7 @@ void TestShell::LoadURLForFrame(const wchar_t* url,
const wchar_t* frame_name) {
if (!url)
return;
-
+
std::string url8 = WideToUTF8(url);
bool bIsSVGTest = strstr(url8.c_str(), "W3C-SVG-1.1") > 0;
@@ -567,12 +567,12 @@ bool TestShell::PromptForSaveFile(const wchar_t* prompt_title,
std::wstring* result)
{
NSSavePanel* save_panel = [NSSavePanel savePanel];
-
+
/* set up new attributes */
[save_panel setRequiredFileType:@"txt"];
[save_panel setMessage:
[NSString stringWithUTF8String:WideToUTF8(prompt_title).c_str()]];
-
+
/* display the NSSavePanel */
if ([save_panel runModalForDirectory:NSHomeDirectory() file:@""] ==
NSOKButton) {
diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc
index 01afc6d..859fd5f 100644
--- a/webkit/tools/test_shell/test_shell_main.cc
+++ b/webkit/tools/test_shell/test_shell_main.cc
@@ -52,15 +52,15 @@ static int kStatsFileCounters = 200;
int main(int argc, char* argv[]) {
base::EnableTerminationOnHeapCorruption();
-
+
// Some tests may use base::Singleton<>, thus we need to instanciate
// the AtExitManager or else we will leak objects.
- base::AtExitManager at_exit_manager;
+ base::AtExitManager at_exit_manager;
TestShellPlatformDelegate::PreflightArgs(&argc, &argv);
CommandLine::Init(argc, argv);
const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
-
+
TestShellPlatformDelegate platform(parsed_command_line);
if (parsed_command_line.HasSwitch(test_shell::kStartupDialog))
@@ -100,9 +100,9 @@ int main(int argc, char* argv[]) {
base::TraceLog::StartTracing();
net::HttpCache::Mode cache_mode = net::HttpCache::NORMAL;
- bool playback_mode =
+ bool playback_mode =
parsed_command_line.HasSwitch(test_shell::kPlaybackMode);
- bool record_mode =
+ bool record_mode =
parsed_command_line.HasSwitch(test_shell::kRecordMode);
if (playback_mode)
diff --git a/webkit/tools/test_shell/test_shell_platform_delegate.h b/webkit/tools/test_shell/test_shell_platform_delegate.h
index 5be147a..19ffbd7 100644
--- a/webkit/tools/test_shell/test_shell_platform_delegate.h
+++ b/webkit/tools/test_shell/test_shell_platform_delegate.h
@@ -48,7 +48,7 @@ class TestShellPlatformDelegate {
// settings. Normally called by the destructor, but also called before
// abort() (example: test timeouts).
void AboutToExit();
-
+
// SetWindowPositionForRecording: if the platform's implementation of
// EventRecorder requires the window to be in a particular absolute position,
// make it so. This is called by TestShell after it creates the window.
diff --git a/webkit/tools/test_shell/test_shell_platform_delegate_gtk.cc b/webkit/tools/test_shell/test_shell_platform_delegate_gtk.cc
index 52b1d49..78dd552 100644
--- a/webkit/tools/test_shell/test_shell_platform_delegate_gtk.cc
+++ b/webkit/tools/test_shell/test_shell_platform_delegate_gtk.cc
@@ -10,7 +10,7 @@
#include "webkit/tools/test_shell/test_shell_platform_delegate.h"
void TestShellPlatformDelegate::PreflightArgs(int *argc, char ***argv) {
- gtk_init(argc, argv);
+ gtk_init(argc, argv);
}
void TestShellPlatformDelegate::SelectUnifiedTheme() {
diff --git a/webkit/tools/test_shell/test_shell_platform_delegate_mac.mm b/webkit/tools/test_shell/test_shell_platform_delegate_mac.mm
index 76e0757..0583f72 100644
--- a/webkit/tools/test_shell/test_shell_platform_delegate_mac.mm
+++ b/webkit/tools/test_shell/test_shell_platform_delegate_mac.mm
@@ -28,9 +28,9 @@ static void SetDefaultsToLayoutTestValues(void) {
// preferences that control appearance to match.
// (We want to do this as early as possible in application startup so
// the settings are in before any higher layers could cache values.)
-
+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-
+
const NSInteger kMinFontSizeCGSmoothes = 4;
const NSInteger kNoFontSmoothing = 0;
const NSInteger kBlueTintedAppearance = 1;
@@ -46,7 +46,7 @@ static void SetDefaultsToLayoutTestValues(void) {
forKey:@"AppleOtherHighlightColor"];
[defaults setObject:[NSArray arrayWithObject:@"en"]
forKey:@"AppleLanguages"];
-
+
// AppKit pulls scrollbar style from NSUserDefaults. HIToolbox uses
// CFPreferences, but AnyApplication, so we set it, force it to load, and
// then reset the pref to what it was (HIToolbox will cache what it loaded).
@@ -78,9 +78,9 @@ static void SetDefaultsToLayoutTestValues(void) {
static void ClearAnyDefaultsForLayoutTests(void) {
// Not running a test, clear the keys so the TestShell looks right to the
// running user.
-
+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-
+
[defaults removeObjectForKey:@"AppleAntiAliasingThreshold"];
[defaults removeObjectForKey:@"AppleFontSmoothing"];
[defaults removeObjectForKey:@"AppleAquaColorVariant"];
@@ -96,7 +96,7 @@ static void RestoreUsersColorProfile(void) {
// This is called from the unsafe signal handers, so doing just about anything
// isn't really safe. But since we're already gonna crash, we give it a try
// anyways... (and WebKit uses this strategy...)
-
+
if (gUsersColorProfile) {
CGDirectDisplayID displayID = CGMainDisplayID();
CMError error = CMSetProfileByAVID((UInt32)displayID, gUsersColorProfile);
@@ -127,7 +127,7 @@ static void InstallLayoutTestColorProfile(void) {
// we force the generic rgb color profile. This cases a change the user can
// see. We use the same basic method as WebKit for trying to make sure we
// get the profile back if we go down in flames.
-
+
// Save off the current
CGDirectDisplayID displayID = CGMainDisplayID();
CMProfileRef previousProfile;
@@ -137,7 +137,7 @@ static void InstallLayoutTestColorProfile(void) {
"pixmaps won't match. Error: " << (int)error;
return;
}
-
+
// Install the generic one
NSColorSpace *genericSpace = [NSColorSpace genericRGBColorSpace];
CMProfileRef genericProfile = (CMProfileRef)[genericSpace colorSyncProfile];
@@ -146,7 +146,7 @@ static void InstallLayoutTestColorProfile(void) {
"pixmaps won't match. Error: " << (int)error;
return;
}
-
+
// Save the starting profile, and hook in as best we can to make sure when
// we exit, it's restored (use atexit() so direct calls to exit() call us).
gUsersColorProfile = previousProfile;
@@ -173,13 +173,13 @@ static void InstallLayoutTestColorProfile(void) {
static void SwizzleAllMethods(Class imposter, Class original) {
unsigned int imposterMethodCount = 0;
Method* imposterMethods = class_copyMethodList(imposter, &imposterMethodCount);
-
+
unsigned int originalMethodCount = 0;
Method* originalMethods = class_copyMethodList(original, &originalMethodCount);
-
+
for (unsigned int i = 0; i < imposterMethodCount; i++) {
SEL imposterMethodName = method_getName(imposterMethods[i]);
-
+
// Attempt to add the method to the original class. If it fails, the method
// already exists and we should instead exchange the implementations.
if (class_addMethod(original,
@@ -188,7 +188,7 @@ static void SwizzleAllMethods(Class imposter, Class original) {
method_getTypeEncoding(originalMethods[i]))) {
continue;
}
-
+
unsigned int j = 0;
for (; j < originalMethodCount; j++) {
SEL originalMethodName = method_getName(originalMethods[j]);
@@ -196,13 +196,13 @@ static void SwizzleAllMethods(Class imposter, Class original) {
break;
}
}
-
+
// If class_addMethod failed above then the method must exist on the
// original class.
DCHECK(j < originalMethodCount) << "method wasn't found?";
method_exchangeImplementations(imposterMethods[i], originalMethods[j]);
}
-
+
if (imposterMethods) {
free(imposterMethods);
}
@@ -215,7 +215,7 @@ static void SwizzleAllMethods(Class imposter, Class original) {
static void SwizzleNSPasteboard(void) {
// We replace NSPaseboard w/ the shim (from WebKit) that avoids having
// sideeffects w/ whatever the user does at the same time.
-
+
Class imposterClass = objc_getClass("DumpRenderTreePasteboard");
Class originalClass = objc_getClass("NSPasteboard");
#if OBJC_API_VERSION == 0
@@ -270,7 +270,7 @@ void TestShellPlatformDelegate::SetWindowPositionForRecording(TestShell *) {
void TestShellPlatformDelegate::SelectUnifiedTheme() {
SetDefaultsToLayoutTestValues();
SwizzleNSPasteboard();
-
+
if (command_line_.HasSwitch(test_shell::kDumpPixels)) {
InstallLayoutTestColorProfile();
}
@@ -280,6 +280,6 @@ void TestShellPlatformDelegate::SuppressErrorReporting() {
// If we die during tests, we don't want to be spamming the user's crash
// reporter. Set our exception port to null.
task_set_exception_ports(mach_task_self(), EXC_MASK_ALL, MACH_PORT_NULL,
- EXCEPTION_DEFAULT, THREAD_STATE_NONE);
+ EXCEPTION_DEFAULT, THREAD_STATE_NONE);
}
diff --git a/webkit/tools/test_shell/test_shell_test.cc b/webkit/tools/test_shell/test_shell_test.cc
index 4b5a37e..1ce279a 100644
--- a/webkit/tools/test_shell/test_shell_test.cc
+++ b/webkit/tools/test_shell/test_shell_test.cc
@@ -10,7 +10,7 @@
#include "base/path_service.h"
#include "base/string_util.h"
-std::wstring TestShellTest::GetTestURL(std::wstring test_case_path,
+std::wstring TestShellTest::GetTestURL(std::wstring test_case_path,
const std::wstring& test_case) {
file_util::AppendToPath(&test_case_path, test_case);
return test_case_path;
@@ -33,7 +33,7 @@ void TestShellTest::TearDown() {
test_shell_->LoadURL(L"about:blank");
test_shell_->DestroyWindow(test_shell_->mainWnd());
LayoutTestController::ClearShell();
-
+
// Flush the MessageLoop of any residual tasks.
MessageLoop::current()->RunAllPending();
}
diff --git a/webkit/tools/test_shell/test_shell_test.h b/webkit/tools/test_shell/test_shell_test.h
index 6cff03b..137fc71 100644
--- a/webkit/tools/test_shell/test_shell_test.h
+++ b/webkit/tools/test_shell/test_shell_test.h
@@ -17,7 +17,7 @@
class TestShellTest : public testing::Test {
protected:
// Returns the path "test_case_path/test_case".
- std::wstring GetTestURL(std::wstring test_case_path,
+ std::wstring GetTestURL(std::wstring test_case_path,
const std::wstring& test_case);
virtual void SetUp();
@@ -27,7 +27,7 @@ class TestShellTest : public testing::Test {
virtual void CreateEmptyWindow();
static const char* kJavascriptDelayExitScript;
-
+
protected:
// Location of SOURCE_ROOT/webkit/data/
std::wstring data_dir_;
diff --git a/webkit/tools/test_shell/test_shell_webkit_init.h b/webkit/tools/test_shell/test_shell_webkit_init.h
index 75f7c4c..dd98b33 100644
--- a/webkit/tools/test_shell/test_shell_webkit_init.h
+++ b/webkit/tools/test_shell/test_shell_webkit_init.h
@@ -19,7 +19,7 @@ class TestShellWebKitInit : public webkit_glue::WebKitClientImpl {
public:
TestShellWebKitInit(bool layout_test_mode) {
WebKit::initialize(this);
- WebKit::setLayoutTestMode(layout_test_mode);
+ WebKit::setLayoutTestMode(layout_test_mode);
WebKit::registerURLSchemeAsLocal(
ASCIIToUTF16(webkit_glue::GetUIResourceProtocol()));
}
diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc
index 045c8b8..c1d3ff1 100644
--- a/webkit/tools/test_shell/test_shell_win.cc
+++ b/webkit/tools/test_shell/test_shell_win.cc
@@ -244,7 +244,7 @@ bool TestShell::RunFileTest(const TestParams& params) {
// after we invoke StopLoading.
shell->ResetTestController();
- // ResetTestController may have closed the window we were holding on to.
+ // ResetTestController may have closed the window we were holding on to.
// Grab the first window again.
hwnd = *(TestShell::windowList()->begin());
shell = static_cast<TestShell*>(win_util::GetWindowUserData(hwnd));
diff --git a/webkit/tools/test_shell/test_webview_delegate_gtk.cc b/webkit/tools/test_shell/test_webview_delegate_gtk.cc
index c74b64f..8c9399c 100755
--- a/webkit/tools/test_shell/test_webview_delegate_gtk.cc
+++ b/webkit/tools/test_shell/test_webview_delegate_gtk.cc
@@ -122,7 +122,7 @@ void TestWebViewDelegate::CloseWidgetSoon(WebWidget* webwidget) {
}
}
-void TestWebViewDelegate::SetCursor(WebWidget* webwidget,
+void TestWebViewDelegate::SetCursor(WebWidget* webwidget,
const WebCursor& cursor) {
current_cursor_ = cursor;
GdkCursorType cursor_type = current_cursor_.GetCursorType();
@@ -194,7 +194,7 @@ void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget,
}
}
-void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget,
+void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget,
gfx::Rect* out_rect) {
// Not necessary on Linux.
*out_rect = gfx::Rect();
diff --git a/webkit/tools/test_shell/test_webview_delegate_win.cc b/webkit/tools/test_shell/test_webview_delegate_win.cc
index e9fff70..b6935e8 100755
--- a/webkit/tools/test_shell/test_webview_delegate_win.cc
+++ b/webkit/tools/test_shell/test_webview_delegate_win.cc
@@ -124,7 +124,7 @@ void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget,
}
}
-void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget,
+void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget,
gfx::Rect* out_rect) {
// Not necessary on Windows.
*out_rect = gfx::Rect();
diff --git a/webkit/tools/test_shell/webwidget_host_win.cc b/webkit/tools/test_shell/webwidget_host_win.cc
index b8430af..fc4be75 100644
--- a/webkit/tools/test_shell/webwidget_host_win.cc
+++ b/webkit/tools/test_shell/webwidget_host_win.cc
@@ -213,7 +213,7 @@ void WebWidgetHost::Paint() {
RECT r;
GetClientRect(view_, &r);
gfx::Rect client_rect(r);
-
+
// Allocate a canvas if necessary
if (!canvas_.get()) {
ResetScrollRect();
diff --git a/webkit/tools/webcore_unit_tests/BMPImageDecoder_unittest.cpp b/webkit/tools/webcore_unit_tests/BMPImageDecoder_unittest.cpp
index 763cf00..4d8b55a 100644
--- a/webkit/tools/webcore_unit_tests/BMPImageDecoder_unittest.cpp
+++ b/webkit/tools/webcore_unit_tests/BMPImageDecoder_unittest.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/webkit/tools/webcore_unit_tests/GKURL_unittest.cpp b/webkit/tools/webcore_unit_tests/GKURL_unittest.cpp
index 683b6a2..3f84e8d 100644
--- a/webkit/tools/webcore_unit_tests/GKURL_unittest.cpp
+++ b/webkit/tools/webcore_unit_tests/GKURL_unittest.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -358,7 +358,7 @@ TEST(GKURL, ReplaceInvalid) {
EXPECT_FALSE(gurl.isValid());
EXPECT_TRUE(gurl.isEmpty());
EXPECT_STREQ("", gurl.string().utf8().data());
-
+
gurl.setProtocol("http");
// GKURL will say that a URL with just a scheme is invalid, KURL will not.
#if USE(GOOGLEURL)
@@ -451,7 +451,7 @@ TEST(GKURL, Ref) {
cur = gurl;
cur.setRef("asdf");
EXPECT_STREQ("http://foo/bar#asdf", cur.string().utf8().data());
-
+
// Setting a ref to the empty string will set it to "#".
cur = WebCore::KURL("http://foo/bar");
cur.setRef("");
diff --git a/webkit/tools/webcore_unit_tests/ICOImageDecoder_unittest.cpp b/webkit/tools/webcore_unit_tests/ICOImageDecoder_unittest.cpp
index d49706a..3d6b0f9 100644
--- a/webkit/tools/webcore_unit_tests/ICOImageDecoder_unittest.cpp
+++ b/webkit/tools/webcore_unit_tests/ICOImageDecoder_unittest.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/webkit/tools/webcore_unit_tests/TransparencyWin_unittest.cpp b/webkit/tools/webcore_unit_tests/TransparencyWin_unittest.cpp
index 46b955f..07366c8 100644
--- a/webkit/tools/webcore_unit_tests/TransparencyWin_unittest.cpp
+++ b/webkit/tools/webcore_unit_tests/TransparencyWin_unittest.cpp
@@ -1,10 +1,10 @@
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -117,7 +117,7 @@ TEST(TransparencyWin, NoLayer)
EXPECT_TRUE(IntSize(14, 12) == helper.m_layerSize);
EXPECT_TRUE(IntRect(1, 1, 14, 12) == helper.drawRect());
}
-
+
// Untransform is not allowed for NoLayer.
// ScaleTransform
@@ -168,7 +168,7 @@ TEST(TransparencyWin, WhiteLayer)
EXPECT_TRUE(IntSize(14, 12) == helper.m_layerSize);
EXPECT_TRUE(IntRect(0, 0, 14, 12) == helper.drawRect());
}
-
+
// ScaleTransform
src->context()->save();
src->context()->scale(FloatSize(2.0, 0.5));
@@ -251,7 +251,7 @@ TEST(TransparencyWin, OpaqueCompositeLayer)
EXPECT_TRUE(IntSize(14, 12) == helper.m_layerSize);
EXPECT_TRUE(IntRect(0, 0, 14, 12) == helper.drawRect());
}
-
+
// ScaleTransform
src->context()->save();
src->context()->scale(FloatSize(2.0, 0.5));
@@ -676,4 +676,4 @@ TEST(TransparencyWin, Text)
EXPECT_EQ(Color::transparent, getPixelAt(src->context(), 7, 0));
}
-} // namespace WebCore \ No newline at end of file
+} // namespace WebCore
diff --git a/webkit/tools/webcore_unit_tests/UniscribeHelper_unittest.cpp b/webkit/tools/webcore_unit_tests/UniscribeHelper_unittest.cpp
index 6410828..d61f90f 100644
--- a/webkit/tools/webcore_unit_tests/UniscribeHelper_unittest.cpp
+++ b/webkit/tools/webcore_unit_tests/UniscribeHelper_unittest.cpp
@@ -136,4 +136,4 @@ TEST_F(UniscribeTest, TooBig)
EXPECT_EQ(0, uniscribe.xToCharacter(0));
EXPECT_EQ(0, uniscribe.xToCharacter(1000));
}
-} \ No newline at end of file
+}
diff --git a/webkit/tools/webcore_unit_tests/XBMImageDecoder_unittest.cpp b/webkit/tools/webcore_unit_tests/XBMImageDecoder_unittest.cpp
index 1140813..0f34238 100644
--- a/webkit/tools/webcore_unit_tests/XBMImageDecoder_unittest.cpp
+++ b/webkit/tools/webcore_unit_tests/XBMImageDecoder_unittest.cpp
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR