diff options
-rw-r--r-- | chrome/chrome_browser_chromeos.gypi | 42 | ||||
-rw-r--r-- | chromeos/chromeos.gyp | 18 | ||||
-rw-r--r-- | google_apis/BUILD.gn | 8 | ||||
-rw-r--r-- | google_apis/google_apis.gyp | 10 | ||||
-rwxr-xr-x | tools/sort-headers.py | 23 | ||||
-rwxr-xr-x | tools/sort_sources.py | 93 | ||||
-rw-r--r-- | tools/yes_no.py | 28 |
7 files changed, 161 insertions, 61 deletions
diff --git a/chrome/chrome_browser_chromeos.gypi b/chrome/chrome_browser_chromeos.gypi index 3c1ea0e..1d776f7 100644 --- a/chrome/chrome_browser_chromeos.gypi +++ b/chrome/chrome_browser_chromeos.gypi @@ -15,10 +15,10 @@ 'browser/chromeos/accessibility/accessibility_util.h', 'browser/chromeos/accessibility/magnification_manager.cc', 'browser/chromeos/accessibility/magnification_manager.h', - 'browser/chromeos/app_mode/app_session_lifetime.cc', - 'browser/chromeos/app_mode/app_session_lifetime.h', 'browser/chromeos/app_mode/app_launch_utils.cc', 'browser/chromeos/app_mode/app_launch_utils.h', + 'browser/chromeos/app_mode/app_session_lifetime.cc', + 'browser/chromeos/app_mode/app_session_lifetime.h', 'browser/chromeos/app_mode/certificate_manager_dialog.cc', 'browser/chromeos/app_mode/certificate_manager_dialog.h', 'browser/chromeos/app_mode/kiosk_app_data.cc', @@ -55,10 +55,10 @@ 'browser/chromeos/attestation/platform_verification_flow.h', 'browser/chromeos/background/ash_user_wallpaper_delegate.cc', 'browser/chromeos/background/ash_user_wallpaper_delegate.h', - 'browser/chromeos/bluetooth/bluetooth_pairing_dialog.cc', - 'browser/chromeos/bluetooth/bluetooth_pairing_dialog.h', 'browser/chromeos/base/locale_util.cc', 'browser/chromeos/base/locale_util.h', + 'browser/chromeos/bluetooth/bluetooth_pairing_dialog.cc', + 'browser/chromeos/bluetooth/bluetooth_pairing_dialog.h', 'browser/chromeos/boot_times_recorder.cc', 'browser/chromeos/boot_times_recorder.h', 'browser/chromeos/camera_detector.cc', @@ -67,22 +67,18 @@ 'browser/chromeos/camera_presence_notifier.h', 'browser/chromeos/chrome_browser_main_chromeos.cc', 'browser/chromeos/chrome_browser_main_chromeos.h', + 'browser/chromeos/chromeos_utils.cc', + 'browser/chromeos/chromeos_utils.h', 'browser/chromeos/customization/customization_document.cc', 'browser/chromeos/customization/customization_document.h', 'browser/chromeos/customization/customization_wallpaper_downloader.cc', 'browser/chromeos/customization/customization_wallpaper_downloader.h', - 'browser/chromeos/display/display_configuration_observer.cc', - 'browser/chromeos/display/display_configuration_observer.h', - 'browser/chromeos/display/display_preferences.cc', - 'browser/chromeos/display/display_preferences.h', - 'browser/chromeos/display/overscan_calibrator.cc', - 'browser/chromeos/display/overscan_calibrator.h', 'browser/chromeos/dbus/chrome_console_service_provider_delegate.cc', 'browser/chromeos/dbus/chrome_console_service_provider_delegate.h', 'browser/chromeos/dbus/chrome_display_power_service_provider_delegate.cc', 'browser/chromeos/dbus/chrome_display_power_service_provider_delegate.h', - 'browser/chromeos/dbus/chrome_proxy_resolver_delegate.h', 'browser/chromeos/dbus/chrome_proxy_resolver_delegate.cc', + 'browser/chromeos/dbus/chrome_proxy_resolver_delegate.h', 'browser/chromeos/dbus/printer_service_provider.cc', 'browser/chromeos/dbus/printer_service_provider.h', 'browser/chromeos/dbus/screen_lock_service_provider.cc', @@ -92,6 +88,12 @@ 'browser/chromeos/device_hierarchy_observer.h', 'browser/chromeos/device_uma.cc', 'browser/chromeos/device_uma.h', + 'browser/chromeos/display/display_configuration_observer.cc', + 'browser/chromeos/display/display_configuration_observer.h', + 'browser/chromeos/display/display_preferences.cc', + 'browser/chromeos/display/display_preferences.h', + 'browser/chromeos/display/overscan_calibrator.cc', + 'browser/chromeos/display/overscan_calibrator.h', 'browser/chromeos/drive/change_list_loader.cc', 'browser/chromeos/drive/change_list_loader.h', 'browser/chromeos/drive/change_list_loader_observer.h', @@ -427,10 +429,10 @@ 'browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operation.h', 'browser/chromeos/login/easy_unlock/easy_unlock_key_manager.cc', 'browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h', - 'browser/chromeos/login/easy_unlock/easy_unlock_refresh_keys_operation.cc', - 'browser/chromeos/login/easy_unlock/easy_unlock_refresh_keys_operation.h', 'browser/chromeos/login/easy_unlock/easy_unlock_reauth.cc', 'browser/chromeos/login/easy_unlock/easy_unlock_reauth.h', + 'browser/chromeos/login/easy_unlock/easy_unlock_refresh_keys_operation.cc', + 'browser/chromeos/login/easy_unlock/easy_unlock_refresh_keys_operation.h', 'browser/chromeos/login/easy_unlock/easy_unlock_remove_keys_operation.cc', 'browser/chromeos/login/easy_unlock/easy_unlock_remove_keys_operation.h', 'browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc', @@ -439,10 +441,10 @@ 'browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager_factory.h', 'browser/chromeos/login/easy_unlock/easy_unlock_types.cc', 'browser/chromeos/login/easy_unlock/easy_unlock_types.h', - 'browser/chromeos/login/easy_unlock/short_lived_user_context.cc', - 'browser/chromeos/login/easy_unlock/short_lived_user_context.h', 'browser/chromeos/login/easy_unlock/easy_unlock_user_login_flow.cc', 'browser/chromeos/login/easy_unlock/easy_unlock_user_login_flow.h', + 'browser/chromeos/login/easy_unlock/short_lived_user_context.cc', + 'browser/chromeos/login/easy_unlock/short_lived_user_context.h', 'browser/chromeos/login/enrollment/auto_enrollment_check_screen.cc', 'browser/chromeos/login/enrollment/auto_enrollment_check_screen.h', 'browser/chromeos/login/enrollment/auto_enrollment_check_screen_actor.h', @@ -451,12 +453,12 @@ 'browser/chromeos/login/enrollment/enrollment_screen.cc', 'browser/chromeos/login/enrollment/enrollment_screen.h', 'browser/chromeos/login/enrollment/enrollment_screen_actor.h', + 'browser/chromeos/login/enrollment/enrollment_uma.cc', + 'browser/chromeos/login/enrollment/enrollment_uma.h', 'browser/chromeos/login/enrollment/enterprise_enrollment_helper.cc', 'browser/chromeos/login/enrollment/enterprise_enrollment_helper.h', 'browser/chromeos/login/enrollment/enterprise_enrollment_helper_impl.cc', 'browser/chromeos/login/enrollment/enterprise_enrollment_helper_impl.h', - 'browser/chromeos/login/enrollment/enrollment_uma.cc', - 'browser/chromeos/login/enrollment/enrollment_uma.h', 'browser/chromeos/login/error_screens_histogram_helper.cc', 'browser/chromeos/login/error_screens_histogram_helper.h', 'browser/chromeos/login/existing_user_controller.cc', @@ -951,8 +953,6 @@ 'browser/chromeos/system_logs/touch_log_source.h', 'browser/chromeos/system_logs/touch_log_source_ozone.cc', 'browser/chromeos/system_logs/touch_log_source_x11.cc', - 'browser/chromeos/chromeos_utils.cc', - 'browser/chromeos/chromeos_utils.h', 'browser/chromeos/ui/accessibility_focus_ring.cc', 'browser/chromeos/ui/accessibility_focus_ring.h', 'browser/chromeos/ui/accessibility_focus_ring_controller.cc', @@ -1035,10 +1035,10 @@ 'browser/chromeos/extensions/input_method_api.h', 'browser/chromeos/extensions/media_player_api.cc', 'browser/chromeos/extensions/media_player_api.h', - 'browser/chromeos/extensions/wallpaper_api.h', 'browser/chromeos/extensions/wallpaper_api.cc', - 'browser/chromeos/extensions/wallpaper_function_base.h', + 'browser/chromeos/extensions/wallpaper_api.h', 'browser/chromeos/extensions/wallpaper_function_base.cc', + 'browser/chromeos/extensions/wallpaper_function_base.h', 'browser/chromeos/extensions/wallpaper_manager_util.cc', 'browser/chromeos/extensions/wallpaper_manager_util.h', 'browser/chromeos/extensions/wallpaper_private_api.cc', diff --git a/chromeos/chromeos.gyp b/chromeos/chromeos.gyp index 91efc3a..d870e1e 100644 --- a/chromeos/chromeos.gyp +++ b/chromeos/chromeos.gyp @@ -13,6 +13,10 @@ 'accelerometer/accelerometer_types.h', 'app_mode/kiosk_oem_manifest_parser.cc', 'app_mode/kiosk_oem_manifest_parser.h', + 'attestation/attestation_constants.cc', + 'attestation/attestation_constants.h', + 'attestation/attestation_flow.cc', + 'attestation/attestation_flow.h', 'audio/audio_device.cc', 'audio/audio_device.h', 'audio/audio_devices_pref_handler.h', @@ -24,10 +28,6 @@ 'audio/chromeos_sounds.h', 'audio/cras_audio_handler.cc', 'audio/cras_audio_handler.h', - 'attestation/attestation_constants.cc', - 'attestation/attestation_constants.h', - 'attestation/attestation_flow.cc', - 'attestation/attestation_flow.h', 'cert_loader.cc', 'cert_loader.h', 'chromeos_constants.cc', @@ -79,10 +79,10 @@ 'dbus/bluetooth_input_client.h', 'dbus/bluetooth_media_client.cc', 'dbus/bluetooth_media_client.h', - 'dbus/bluetooth_media_transport_client.cc', - 'dbus/bluetooth_media_transport_client.h', 'dbus/bluetooth_media_endpoint_service_provider.cc', 'dbus/bluetooth_media_endpoint_service_provider.h', + 'dbus/bluetooth_media_transport_client.cc', + 'dbus/bluetooth_media_transport_client.h', 'dbus/bluetooth_profile_manager_client.cc', 'dbus/bluetooth_profile_manager_client.h', 'dbus/bluetooth_profile_service_provider.cc', @@ -93,8 +93,8 @@ 'dbus/cros_disks_client.h', 'dbus/cryptohome_client.cc', 'dbus/cryptohome_client.h', - 'dbus/dbus_client_bundle.h', 'dbus/dbus_client_bundle.cc', + 'dbus/dbus_client_bundle.h', 'dbus/dbus_client_implementation_type.h', 'dbus/dbus_method_call_status.cc', 'dbus/dbus_method_call_status.h', @@ -130,10 +130,10 @@ 'dbus/fake_bluetooth_input_client.h', 'dbus/fake_bluetooth_media_client.cc', 'dbus/fake_bluetooth_media_client.h', - 'dbus/fake_bluetooth_media_transport_client.cc', - 'dbus/fake_bluetooth_media_transport_client.h', 'dbus/fake_bluetooth_media_endpoint_service_provider.cc', 'dbus/fake_bluetooth_media_endpoint_service_provider.h', + 'dbus/fake_bluetooth_media_transport_client.cc', + 'dbus/fake_bluetooth_media_transport_client.h', 'dbus/fake_bluetooth_profile_manager_client.cc', 'dbus/fake_bluetooth_profile_manager_client.h', 'dbus/fake_bluetooth_profile_service_provider.cc', diff --git a/google_apis/BUILD.gn b/google_apis/BUILD.gn index 2d9253a..9d10b9e 100644 --- a/google_apis/BUILD.gn +++ b/google_apis/BUILD.gn @@ -101,8 +101,6 @@ source_set("google_apis") { "gaia/identity_provider.h", "gaia/merge_session_helper.cc", "gaia/merge_session_helper.h", - "gaia/oauth_request_signer.cc", - "gaia/oauth_request_signer.h", "gaia/oauth2_access_token_consumer.h", "gaia/oauth2_access_token_fetcher.cc", "gaia/oauth2_access_token_fetcher.h", @@ -116,6 +114,8 @@ source_set("google_apis") { "gaia/oauth2_token_service.h", "gaia/oauth2_token_service_request.cc", "gaia/oauth2_token_service_request.h", + "gaia/oauth_request_signer.cc", + "gaia/oauth_request_signer.h", "gaia/ubertoken_fetcher.cc", "gaia/ubertoken_fetcher.h", "google_api_keys.cc", @@ -199,18 +199,18 @@ source_set("test_support") { if (!is_win || link_chrome_on_windows) { test("google_apis_unittest") { sources = [ - "google_api_keys_unittest.cc", "gaia/gaia_auth_fetcher_unittest.cc", "gaia/gaia_auth_util_unittest.cc", "gaia/gaia_oauth_client_unittest.cc", "gaia/google_service_auth_error_unittest.cc", "gaia/merge_session_helper_unittest.cc", - "gaia/oauth_request_signer_unittest.cc", "gaia/oauth2_access_token_fetcher_impl_unittest.cc", "gaia/oauth2_api_call_flow_unittest.cc", "gaia/oauth2_mint_token_flow_unittest.cc", "gaia/oauth2_token_service_unittest.cc", + "gaia/oauth_request_signer_unittest.cc", "gaia/ubertoken_fetcher_unittest.cc", + "google_api_keys_unittest.cc", ] configs += [ ":key_defines" ] diff --git a/google_apis/google_apis.gyp b/google_apis/google_apis.gyp index 7383181..7859a73 100644 --- a/google_apis/google_apis.gyp +++ b/google_apis/google_apis.gyp @@ -92,11 +92,9 @@ 'gaia/identity_provider.h', 'gaia/merge_session_helper.cc', 'gaia/merge_session_helper.h', - 'gaia/oauth_request_signer.cc', - 'gaia/oauth_request_signer.h', 'gaia/oauth2_access_token_consumer.h', - 'gaia/oauth2_access_token_fetcher.h', 'gaia/oauth2_access_token_fetcher.cc', + 'gaia/oauth2_access_token_fetcher.h', 'gaia/oauth2_access_token_fetcher_impl.cc', 'gaia/oauth2_access_token_fetcher_impl.h', 'gaia/oauth2_api_call_flow.cc', @@ -107,6 +105,8 @@ 'gaia/oauth2_token_service.h', 'gaia/oauth2_token_service_request.cc', 'gaia/oauth2_token_service_request.h', + 'gaia/oauth_request_signer.cc', + 'gaia/oauth_request_signer.h', 'gaia/ubertoken_fetcher.cc', 'gaia/ubertoken_fetcher.h', 'google_api_keys.cc', @@ -132,20 +132,20 @@ '..', ], 'sources': [ - 'google_api_keys_unittest.cc', 'gaia/account_tracker_unittest.cc', 'gaia/gaia_auth_fetcher_unittest.cc', 'gaia/gaia_auth_util_unittest.cc', 'gaia/gaia_oauth_client_unittest.cc', 'gaia/google_service_auth_error_unittest.cc', 'gaia/merge_session_helper_unittest.cc', - 'gaia/oauth_request_signer_unittest.cc', 'gaia/oauth2_access_token_fetcher_impl_unittest.cc', 'gaia/oauth2_api_call_flow_unittest.cc', 'gaia/oauth2_mint_token_flow_unittest.cc', 'gaia/oauth2_token_service_request_unittest.cc', 'gaia/oauth2_token_service_unittest.cc', + 'gaia/oauth_request_signer_unittest.cc', 'gaia/ubertoken_fetcher_unittest.cc', + 'google_api_keys_unittest.cc', ], 'conditions': [ ['enable_extensions==1', { diff --git a/tools/sort-headers.py b/tools/sort-headers.py index 3f3435d..5e8fc26 100755 --- a/tools/sort-headers.py +++ b/tools/sort-headers.py @@ -13,28 +13,7 @@ import optparse import os import sys - -def YesNo(prompt): - """Prompts with a yes/no question, returns True if yes.""" - print prompt, - sys.stdout.flush() - # http://code.activestate.com/recipes/134892/ - if sys.platform == 'win32': - import msvcrt - ch = msvcrt.getch() - else: - import termios - import tty - fd = sys.stdin.fileno() - old_settings = termios.tcgetattr(fd) - ch = 'n' - try: - tty.setraw(sys.stdin.fileno()) - ch = sys.stdin.read(1) - finally: - termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) - print ch - return ch in ('Y', 'y') +from yes_no import YesNo def IncludeCompareKey(line): diff --git a/tools/sort_sources.py b/tools/sort_sources.py new file mode 100755 index 0000000..b2bacef --- /dev/null +++ b/tools/sort_sources.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python +# Copyright 2015 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. + +"""Given a GYP/GN filename as an argument, sort C++ source files in that file. + +Shows a diff and prompts for confirmation before doing the deed. +Works great with tools/git/for-all-touched-files.py. +""" + +import difflib +import optparse +import re +import sys + +from yes_no import YesNo + + +def SortSources(original_lines): + """Sort source file names in |original_lines|. + + Args: + original_lines: Lines of the original content as a list of strings. + + Returns: + Lines of the sorted content as a list of strings. + + The algorithm is fairly naive. The code tries to find a list of C++ source + file names by a simple regex, then sort them. The code does not try to + understand the syntax of the build files, hence there are many cases that + the code cannot handle correctly (ex. comments within a list of source file + names). + """ + + output_lines = [] + sources = [] + for line in original_lines: + if re.search(r'^\s+[\'"].*\.(c|cc|cpp|h)[\'"],$', line): + sources.append(line) + else: + if sources: + output_lines.extend(sorted(sources)) + sources = [] + output_lines.append(line) + return output_lines + + +def ProcessFile(filename, should_confirm): + """Process the input file and rewrite if needed. + + Args: + filename: Path to the input file. + should_confirm: If true, diff and confirmation prompt are shown. + """ + + original_lines = [] + with open(filename, 'r') as input_file: + for line in input_file: + original_lines.append(line) + + new_lines = SortSources(original_lines) + if original_lines == new_lines: + print '%s: no change' % filename + return + + if should_confirm: + diff = difflib.unified_diff(original_lines, new_lines) + sys.stdout.writelines(diff) + if not YesNo('Use new file (y/N)'): + return + + with open(filename, 'w') as output_file: + output_file.writelines(new_lines) + + +def main(): + parser = optparse.OptionParser(usage='%prog filename1 filename2 ...') + parser.add_option('-f', '--force', action='store_false', default=True, + dest='should_confirm', + help='Turn off confirmation prompt.') + opts, filenames = parser.parse_args() + + if len(filenames) < 1: + parser.print_help() + return 1 + + for filename in filenames: + ProcessFile(filename, opts.should_confirm) + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/tools/yes_no.py b/tools/yes_no.py new file mode 100644 index 0000000..8682ec8 --- /dev/null +++ b/tools/yes_no.py @@ -0,0 +1,28 @@ +# Copyright 2015 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. + +import sys + + +def YesNo(prompt): + """Prompts with a yes/no question, returns True if yes.""" + print prompt, + sys.stdout.flush() + # http://code.activestate.com/recipes/134892/ + if sys.platform == 'win32': + import msvcrt + ch = msvcrt.getch() + else: + import termios + import tty + fd = sys.stdin.fileno() + old_settings = termios.tcgetattr(fd) + ch = 'n' + try: + tty.setraw(sys.stdin.fileno()) + ch = sys.stdin.read(1) + finally: + termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) + print ch + return ch in ('Y', 'y') |