diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/SConscript | 2 | ||||
-rw-r--r-- | chrome/browser/SConscript | 513 | ||||
-rw-r--r-- | chrome/browser/net/dns_host_info.cc | 6 | ||||
-rw-r--r-- | chrome/browser/net/dns_host_info.h | 2 | ||||
-rw-r--r-- | chrome/browser/printing/page_number.cc | 6 | ||||
-rw-r--r-- | chrome/browser/printing/page_setup.h | 2 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/bloom_filter.cc | 5 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/chunk_range.cc | 3 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/protocol_parser.cc | 12 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_util.cc | 9 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_util.h | 2 |
11 files changed, 298 insertions, 264 deletions
diff --git a/chrome/SConscript b/chrome/SConscript index 7340ae4..185b186 100644 --- a/chrome/SConscript +++ b/chrome/SConscript @@ -425,6 +425,7 @@ if env['PLATFORM'] == 'win32': sconscript_files = [ + 'browser/SConscript', 'common/SConscript', '$THIRD_PARTY_DIR/sqlite/SConscript', ] @@ -434,7 +435,6 @@ if env['PLATFORM'] == 'win32': sconscript_files.extend([ 'app/resources/SConscript', 'app/theme/SConscript', - 'browser/SConscript', 'browser/views/SConscript', 'installer/mini_installer/SConscript', 'installer/setup/SConscript', diff --git a/chrome/browser/SConscript b/chrome/browser/SConscript index 73d25c1..14965ed 100644 --- a/chrome/browser/SConscript +++ b/chrome/browser/SConscript @@ -23,11 +23,15 @@ env.Prepend( 'CHROME_PNG_WRITE_SUPPORT', 'GOOGLE_CHROME_BUILD', ], - CCFLAGS = [ - '/TP', - ], ) +if env['PLATFORM'] == 'win32': + env.Prepend( + CCFLAGS = [ + '/TP', + ], + ) + env.Append( CPPPATH = [ '$GTEST_DIR/include', @@ -51,252 +55,265 @@ env.Append( ], ) -input_files = [ - 'about_internets_status_view.cc', - 'alternate_nav_url_fetcher.cc', - 'app_modal_dialog_queue.cc', - 'autocomplete/autocomplete.cc', - 'autocomplete/autocomplete_edit.cc', - 'autocomplete/autocomplete_popup.cc', - 'autocomplete/edit_drop_target.cc', - 'autocomplete/history_contents_provider.cc', - 'autocomplete/history_url_provider.cc', - 'autocomplete/keyword_provider.cc', - 'autocomplete/search_provider.cc', - 'automation/automation_provider.cc', - 'automation/automation_provider_list.cc', - 'automation/automation_resource_tracker.cc', - 'automation/ui_controls.cc', - 'automation/url_request_failed_dns_job.cc', - 'automation/url_request_mock_http_job.cc', - 'automation/url_request_mock_net_error_job.cc', - 'automation/url_request_slow_download_job.cc', - 'back_forward_menu_model.cc', - 'base_history_model.cc', - 'bookmark_bar_context_menu_controller.cc', - 'bookmarks/bookmark_bar_model.cc', - 'bookmarks/bookmark_codec.cc', - 'bookmarks/bookmark_storage.cc', - 'bookmarks/bookmark_drag_data.cc', - 'browser.cc', - 'browser_about_handler.cc', - 'browser_commands.cc', - 'browser_init.cc', - 'browser_list.cc', - 'browser_main.cc', - 'browser_prefs.cc', - 'browser_process.cc', - 'browser_process_impl.cc', - 'browser_shutdown.cc', - 'browser_url_handler.cc', - 'browser_window.cc', - 'browsing_data_remover.cc', - 'browsing_instance.cc', - 'cache_manager_host.cc', - 'cancelable_request.cc', - 'cert_store.cc', - 'character_encoding.cc', - 'chrome_plugin_browsing_context.cc', - 'chrome_plugin_host.cc', - 'chrome_thread.cc', - 'controller.cc', - 'cross_site_request_manager.cc', - 'dom_ui/chrome_url_data_manager.cc', - 'dom_ui/dom_ui_host.cc', - 'dom_ui/html_dialog_contents.cc', - 'dom_ui/new_tab_ui.cc', - 'download_exe.cc', - 'download_file.cc', - 'download_item_model.cc', - 'download_manager.cc', - 'download_tab_view.cc', - 'download_util.cc', - 'drag_utils.cc', - 'encoding_menu_controller_delegate.cc', - 'encryptor.cc', - 'external_protocol_dialog.cc', - 'external_protocol_handler.cc', - 'external_tab_container.cc', - 'fav_icon_helper.cc', - 'find_in_page_controller.cc', - 'find_in_page_view.cc', - 'firefox2_importer.cc', - 'firefox3_importer.cc', - 'firefox_importer_utils.cc', - 'firefox_profile_lock.cc', - 'first_run.cc', - 'frame_util.cc', - 'frame_view.cc', - 'gears_integration.cc', - 'google_url_tracker.cc', - 'google_util.cc', - 'hang_monitor/hung_plugin_action.cc', - 'hang_monitor/hung_window_detector.cc', - 'history/archived_database.cc', - 'history/download_database.cc', - 'history/expire_history_backend.cc', - 'history/history.cc', - 'history/history_backend.cc', - 'history/history_database.cc', - 'history/history_types.cc', - 'history/in_memory_database.cc', - 'history/in_memory_history_backend.cc', - 'history/page_usage_data.cc', - 'history/query_parser.cc', - 'history/snippet.cc', - 'history/starred_url_database.cc', - 'history/text_database.cc', - 'history/text_database_manager.cc', - 'history/thumbnail_database.cc', - 'history/url_database.cc', - 'history/visit_database.cc', - 'history/visit_tracker.cc', - 'history/visitsegment_database.cc', - 'history_model.cc', - 'history_tab_ui.cc', - 'history_view.cc', - 'icon_loader.cc', - 'icon_manager.cc', - 'ie7_password.cc', - 'ie_importer.cc', - 'ime_input.cc', - 'importer.cc', - 'ipc_status_view.cc', - 'jankometer.cc', - 'js_before_unload_handler.cc', - 'jsmessage_box_handler.cc', - 'login_prompt.cc', - 'memory_details.cc', - 'meta_table_helper.cc', - 'metrics_log.cc', - 'metrics_response.cc', - 'metrics_service.cc', - 'modal_html_dialog_delegate.cc', - 'mork_reader.cc', - 'native_ui_contents.cc', - 'navigation_controller.cc', - 'navigation_entry.cc', - 'net/dns_global.cc', - 'net/dns_host_info.cc', - 'net/dns_master.cc', - 'net/dns_slave.cc', - 'network_status_view.cc', - 'google_update.cc', - 'page_info_window.cc', - 'page_state.cc', - 'password_form_manager.cc', - 'password_manager.cc', - 'plugin_installer.cc', - 'plugin_process_host.cc', - 'plugin_service.cc', - 'point_buffer.cc', - 'printing/page_number.cc', - 'printing/page_overlays.cc', - 'printing/page_range.cc', - 'printing/page_setup.cc', - 'printing/print_job.cc', - 'printing/print_job_manager.cc', - 'printing/print_job_worker.cc', - 'printing/print_settings.cc', - 'printing/print_view_manager.cc', - 'printing/printed_document.cc', - 'printing/printed_page.cc', - 'printing/printer_query.cc', - 'printing/units.cc', - 'printing/win_printing_context.cc', - 'profile.cc', - 'profile_manager.cc', - 'provisional_load_details.cc', - 'render_process_host.cc', - 'render_view_context_menu.cc', - 'render_view_context_menu_controller.cc', - 'render_view_host.cc', - 'render_view_host_manager.cc', - 'render_widget_helper.cc', - 'render_widget_host.cc', - 'render_widget_host_hwnd.cc', - 'renderer_security_policy.cc', - 'repost_Form_warning_dialog.cc', - 'resource_dispatcher_host.cc', - 'resource_message_filter.cc', - 'rlz/rlz.cc', - 'safe_browsing/bloom_filter.cc', - 'safe_browsing/chunk_range.cc', - 'safe_browsing/protocol_manager.cc', - 'safe_browsing/protocol_parser.cc', - 'safe_browsing/safe_browsing_blocking_page.cc', - 'safe_browsing/safe_browsing_database.cc', - 'safe_browsing/safe_browsing_service.cc', - 'safe_browsing/safe_browsing_util.cc', - 'sandbox_policy.cc', - 'save_file.cc', - 'save_file_manager.cc', - 'save_item.cc', - 'save_package.cc', - 'save_page_model.cc', - 'session_backend.cc', - 'session_crashed_view.cc', - 'session_restore.cc', - 'session_service.cc', - 'session_startup_pref.cc', - 'shell_integration.cc', - 'simple_vista_frame.cc', - 'simple_xp_frame.cc', - 'site_instance.cc', - 'spellcheck_worditerator.cc', - 'spellchecker.cc', - 'ssl_blocking_page.cc', - 'ssl_error_info.cc', - 'ssl_manager.cc', - 'ssl_policy.cc', - 'status_view.cc', - 'suspend_controller.cc', - 'tab_contents.cc', - 'tab_contents_container_view.cc', - 'tab_contents_factory.cc', - 'tab_restore_service.cc', - 'tab_util.cc', - 'tabs/dragged_tab_controller.cc', - 'tabs/dragged_tab_view.cc', - 'tabs/hwnd_photobooth.cc', - 'tabs/tab.cc', - 'tabs/tab_renderer.cc', - 'tabs/tab_strip.cc', - 'tabs/tab_strip_model.cc', - 'tabs/tab_strip_model_order_controller.cc', - 'task_manager.cc', - 'task_manager_resource_providers.cc', - 'template_url.cc', - 'template_url_fetcher.cc', - 'template_url_model.cc', - 'template_url_parser.cc', - 'template_url_prepopulate_data.cc', - 'title_chomper.cc', - 'toolbar_model.cc', - 'url_fetcher.cc', - 'url_fetcher_protect.cc', - 'url_fixer_upper.cc', - 'user_data_dir_dialog.cc', - 'user_metrics.cc', - 'view_source_contents.cc', - 'visitedlink_master.cc', - 'vista_frame.cc', - 'web_app.cc', - 'web_app_icon_manager.cc', - 'web_app_launcher.cc', - 'web_contents.cc', - 'web_drag_source.cc', - 'web_drop_target.cc', - 'webdata/web_data_service.cc', - 'webdata/web_database.cc', - 'window_clipping_info.cc', - 'window_sizer.cc', - 'wizard/wizard.cc', - 'xp_frame.cc', -] +input_files = [] + +if env['PLATFORM'] in ('posix', 'win32'): + # TODO: Port to Mac. + input_files.extend([ + 'printing/page_setup.cc', + 'printing/units.cc', + 'net/dns_host_info.cc', + 'safe_browsing/bloom_filter.cc', + 'safe_browsing/chunk_range.cc', + 'safe_browsing/protocol_parser.cc', + 'safe_browsing/safe_browsing_util.cc', + ]) + +if env['PLATFORM'] == 'win32': + # TODO: Port these. + input_files.extend([ + 'about_internets_status_view.cc', + 'alternate_nav_url_fetcher.cc', + 'app_modal_dialog_queue.cc', + 'autocomplete/autocomplete.cc', + 'autocomplete/autocomplete_edit.cc', + 'autocomplete/autocomplete_popup.cc', + 'autocomplete/edit_drop_target.cc', + 'autocomplete/history_contents_provider.cc', + 'autocomplete/history_url_provider.cc', + 'autocomplete/keyword_provider.cc', + 'autocomplete/search_provider.cc', + 'automation/automation_provider.cc', + 'automation/automation_provider_list.cc', + 'automation/automation_resource_tracker.cc', + 'automation/ui_controls.cc', + 'automation/url_request_failed_dns_job.cc', + 'automation/url_request_mock_http_job.cc', + 'automation/url_request_mock_net_error_job.cc', + 'automation/url_request_slow_download_job.cc', + 'back_forward_menu_model.cc', + 'base_history_model.cc', + 'bookmark_bar_context_menu_controller.cc', + 'bookmarks/bookmark_bar_model.cc', + 'bookmarks/bookmark_codec.cc', + 'bookmarks/bookmark_storage.cc', + 'bookmarks/bookmark_drag_data.cc', + 'browser.cc', + 'browser_about_handler.cc', + 'browser_commands.cc', + 'browser_init.cc', + 'browser_list.cc', + 'browser_main.cc', + 'browser_prefs.cc', + 'browser_process.cc', + 'browser_process_impl.cc', + 'browser_shutdown.cc', + 'browser_url_handler.cc', + 'browser_window.cc', + 'browsing_data_remover.cc', + 'browsing_instance.cc', + 'cache_manager_host.cc', + 'cancelable_request.cc', + 'cert_store.cc', + 'character_encoding.cc', + 'chrome_plugin_browsing_context.cc', + 'chrome_plugin_host.cc', + 'chrome_thread.cc', + 'controller.cc', + 'cross_site_request_manager.cc', + 'dom_ui/chrome_url_data_manager.cc', + 'dom_ui/dom_ui_host.cc', + 'dom_ui/html_dialog_contents.cc', + 'dom_ui/new_tab_ui.cc', + 'download_exe.cc', + 'download_file.cc', + 'download_item_model.cc', + 'download_manager.cc', + 'download_tab_view.cc', + 'download_util.cc', + 'drag_utils.cc', + 'encoding_menu_controller_delegate.cc', + 'encryptor.cc', + 'external_protocol_dialog.cc', + 'external_protocol_handler.cc', + 'external_tab_container.cc', + 'fav_icon_helper.cc', + 'find_in_page_controller.cc', + 'find_in_page_view.cc', + 'firefox2_importer.cc', + 'firefox3_importer.cc', + 'firefox_importer_utils.cc', + 'firefox_profile_lock.cc', + 'first_run.cc', + 'frame_util.cc', + 'frame_view.cc', + 'gears_integration.cc', + 'google_url_tracker.cc', + 'google_util.cc', + 'hang_monitor/hung_plugin_action.cc', + 'hang_monitor/hung_window_detector.cc', + 'history/archived_database.cc', + 'history/download_database.cc', + 'history/expire_history_backend.cc', + 'history/history.cc', + 'history/history_backend.cc', + 'history/history_database.cc', + 'history/history_types.cc', + 'history/in_memory_database.cc', + 'history/in_memory_history_backend.cc', + 'history/page_usage_data.cc', + 'history/query_parser.cc', + 'history/snippet.cc', + 'history/starred_url_database.cc', + 'history/text_database.cc', + 'history/text_database_manager.cc', + 'history/thumbnail_database.cc', + 'history/url_database.cc', + 'history/visit_database.cc', + 'history/visit_tracker.cc', + 'history/visitsegment_database.cc', + 'history_model.cc', + 'history_tab_ui.cc', + 'history_view.cc', + 'icon_loader.cc', + 'icon_manager.cc', + 'ie7_password.cc', + 'ie_importer.cc', + 'ime_input.cc', + 'importer.cc', + 'ipc_status_view.cc', + 'jankometer.cc', + 'js_before_unload_handler.cc', + 'jsmessage_box_handler.cc', + 'login_prompt.cc', + 'memory_details.cc', + 'meta_table_helper.cc', + 'metrics_log.cc', + 'metrics_response.cc', + 'metrics_service.cc', + 'modal_html_dialog_delegate.cc', + 'mork_reader.cc', + 'native_ui_contents.cc', + 'navigation_controller.cc', + 'navigation_entry.cc', + 'net/dns_global.cc', + 'net/dns_master.cc', + 'net/dns_slave.cc', + 'network_status_view.cc', + 'google_update.cc', + 'page_info_window.cc', + 'page_state.cc', + 'password_form_manager.cc', + 'password_manager.cc', + 'plugin_installer.cc', + 'plugin_process_host.cc', + 'plugin_service.cc', + 'point_buffer.cc', + 'printing/page_number.cc', + 'printing/page_overlays.cc', + 'printing/page_range.cc', + 'printing/print_job.cc', + 'printing/print_job_manager.cc', + 'printing/print_job_worker.cc', + 'printing/print_settings.cc', + 'printing/print_view_manager.cc', + 'printing/printed_document.cc', + 'printing/printed_page.cc', + 'printing/printer_query.cc', + 'printing/win_printing_context.cc', + 'profile.cc', + 'profile_manager.cc', + 'provisional_load_details.cc', + 'render_process_host.cc', + 'render_view_context_menu.cc', + 'render_view_context_menu_controller.cc', + 'render_view_host.cc', + 'render_view_host_manager.cc', + 'render_widget_helper.cc', + 'render_widget_host.cc', + 'render_widget_host_hwnd.cc', + 'renderer_security_policy.cc', + 'repost_Form_warning_dialog.cc', + 'resource_dispatcher_host.cc', + 'resource_message_filter.cc', + 'rlz/rlz.cc', + 'safe_browsing/protocol_manager.cc', + 'safe_browsing/safe_browsing_blocking_page.cc', + 'safe_browsing/safe_browsing_database.cc', + 'safe_browsing/safe_browsing_service.cc', + 'sandbox_policy.cc', + 'save_file.cc', + 'save_file_manager.cc', + 'save_item.cc', + 'save_package.cc', + 'save_page_model.cc', + 'session_backend.cc', + 'session_crashed_view.cc', + 'session_restore.cc', + 'session_service.cc', + 'session_startup_pref.cc', + 'shell_integration.cc', + 'simple_vista_frame.cc', + 'simple_xp_frame.cc', + 'site_instance.cc', + 'spellcheck_worditerator.cc', + 'spellchecker.cc', + 'ssl_blocking_page.cc', + 'ssl_error_info.cc', + 'ssl_manager.cc', + 'ssl_policy.cc', + 'status_view.cc', + 'suspend_controller.cc', + 'tab_contents.cc', + 'tab_contents_container_view.cc', + 'tab_contents_factory.cc', + 'tab_restore_service.cc', + 'tab_util.cc', + 'tabs/dragged_tab_controller.cc', + 'tabs/dragged_tab_view.cc', + 'tabs/hwnd_photobooth.cc', + 'tabs/tab.cc', + 'tabs/tab_renderer.cc', + 'tabs/tab_strip.cc', + 'tabs/tab_strip_model.cc', + 'tabs/tab_strip_model_order_controller.cc', + 'task_manager.cc', + 'task_manager_resource_providers.cc', + 'template_url.cc', + 'template_url_fetcher.cc', + 'template_url_model.cc', + 'template_url_parser.cc', + 'template_url_prepopulate_data.cc', + 'title_chomper.cc', + 'toolbar_model.cc', + 'url_fetcher.cc', + 'url_fetcher_protect.cc', + 'url_fixer_upper.cc', + 'user_data_dir_dialog.cc', + 'user_metrics.cc', + 'view_source_contents.cc', + 'visitedlink_master.cc', + 'vista_frame.cc', + 'web_app.cc', + 'web_app_icon_manager.cc', + 'web_app_launcher.cc', + 'web_contents.cc', + 'web_drag_source.cc', + 'web_drop_target.cc', + 'webdata/web_data_service.cc', + 'webdata/web_database.cc', + 'window_clipping_info.cc', + 'window_sizer.cc', + 'wizard/wizard.cc', + 'xp_frame.cc', + ]) -env.ChromeStaticLibrary('browser', input_files) +if env['PLATFORM'] in ('posix', 'win32'): + # TODO: This should work for all platforms. + env.ChromeStaticLibrary('browser', input_files) -SConscript('debugger/SConscript', exports=['env']) +if env['PLATFORM'] == 'win32': + # TODO: Port this. + SConscript('debugger/SConscript', exports=['env']) diff --git a/chrome/browser/net/dns_host_info.cc b/chrome/browser/net/dns_host_info.cc index 232af4c..296afc9 100644 --- a/chrome/browser/net/dns_host_info.cc +++ b/chrome/browser/net/dns_host_info.cc @@ -202,7 +202,7 @@ void DnsHostInfo::DLogResultsStats(const char* message) const { static std::string RemoveJs(const std::string& text) { std::string output(text); size_t length = output.length(); - for (size_t i = 0; i < 1; i++) { + for (size_t i = 0; i < length; i++) { char next = output[i]; if (isalnum(next) || isspace(next) || '.' == next) continue; @@ -279,8 +279,8 @@ void DnsHostInfo::GetHtmlTable(const DnsInfoTable host_infos, return; } - char* row_format = "<tr align=right><td>%s</td>" - "<td>%d</td><td>%d</td><td>%s</td></tr>"; + const char* row_format = "<tr align=right><td>%s</td>" + "<td>%d</td><td>%d</td><td>%s</td></tr>"; output->append("<br><table border=1>"); StringAppendF(output, "<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>", diff --git a/chrome/browser/net/dns_host_info.h b/chrome/browser/net/dns_host_info.h index 39b2e29..d54da84 100644 --- a/chrome/browser/net/dns_host_info.h +++ b/chrome/browser/net/dns_host_info.h @@ -49,7 +49,7 @@ class DnsHostInfo { // might likely take place. static const int kMaxGuaranteedCacheSize = 50; - typedef std::vector<const DnsHostInfo> DnsInfoTable; + typedef std::vector<DnsHostInfo> DnsInfoTable; static const TimeDelta kNullDuration; diff --git a/chrome/browser/printing/page_number.cc b/chrome/browser/printing/page_number.cc index d5310d3..941fa730 100644 --- a/chrome/browser/printing/page_number.cc +++ b/chrome/browser/printing/page_number.cc @@ -4,6 +4,8 @@ #include "chrome/browser/printing/page_number.h" +#include <limits> + #include "base/logging.h" #include "chrome/browser/printing/print_settings.h" @@ -56,7 +58,9 @@ int PageNumber::operator++() { ++page_number_; // Page ranges are inclusive. if (page_number_ > (*ranges_)[page_range_index_].to) { - if (++page_range_index_ == ranges_->size()) { + DCHECK(ranges_->size() <= static_cast<size_t>( + std::numeric_limits<int>::max())); + if (++page_range_index_ == static_cast<int>(ranges_->size())) { // Finished. *this = npos(); } else { diff --git a/chrome/browser/printing/page_setup.h b/chrome/browser/printing/page_setup.h index 572f604..558eb44 100644 --- a/chrome/browser/printing/page_setup.h +++ b/chrome/browser/printing/page_setup.h @@ -25,8 +25,8 @@ class PageMargins { int footer; // Margin on each side of the sheet. int left; - int top; int right; + int top; int bottom; }; diff --git a/chrome/browser/safe_browsing/bloom_filter.cc b/chrome/browser/safe_browsing/bloom_filter.cc index 5b9f8dbe..c87da9e 100644 --- a/chrome/browser/safe_browsing/bloom_filter.cc +++ b/chrome/browser/safe_browsing/bloom_filter.cc @@ -4,14 +4,13 @@ #include "chrome/browser/safe_browsing/bloom_filter.h" -#include <windows.h> - +#include <string.h> BloomFilter::BloomFilter(int bit_size) { byte_size_ = bit_size / 8 + 1; bit_size_ = byte_size_ * 8; data_.reset(new char[byte_size_]); - ZeroMemory(data_.get(), byte_size_); + memset(data_.get(), 0, byte_size_); } BloomFilter::BloomFilter(char* data, int size) { diff --git a/chrome/browser/safe_browsing/chunk_range.cc b/chrome/browser/safe_browsing/chunk_range.cc index ff99924..e40ee72 100644 --- a/chrome/browser/safe_browsing/chunk_range.cc +++ b/chrome/browser/safe_browsing/chunk_range.cc @@ -61,8 +61,7 @@ void RangesToString(const std::vector<ChunkRange>& ranges, if (!result->empty()) result->append(","); if (it->start() == it->stop()) { - char num_buf[11]; // One 32 bit positive integer + NULL. - _itoa_s(it->start(), num_buf, sizeof(num_buf), 10); + std::string num_buf = IntToString(it->start()); result->append(num_buf); } else { result->append(StringPrintf("%d-%d", it->start(), it->stop())); diff --git a/chrome/browser/safe_browsing/protocol_parser.cc b/chrome/browser/safe_browsing/protocol_parser.cc index 3c6e17c..b3a460b 100644 --- a/chrome/browser/safe_browsing/protocol_parser.cc +++ b/chrome/browser/safe_browsing/protocol_parser.cc @@ -4,7 +4,13 @@ // // Parse the data returned from the SafeBrowsing v2.1 protocol response. -#include <Winsock2.h> // for htonl +#include "build/build_config.h" + +#if defined(OS_WIN) +#include <Winsock2.h> +#elif defined(OS_POSIX) +#include <arpa/inet.h> +#endif #include "chrome/browser/safe_browsing/protocol_parser.h" @@ -85,7 +91,7 @@ bool SafeBrowsingProtocolParser::ParseGetHash( int full_hash_len = atoi(cmd_parts[2].c_str()); while (full_hash_len > 0) { - DCHECK(full_hash_len >= sizeof(SBFullHash)); + DCHECK(static_cast<size_t>(full_hash_len) >= sizeof(SBFullHash)); memcpy(&full_hash.hash, data, sizeof(SBFullHash)); full_hashes->push_back(full_hash); data += sizeof(SBFullHash); @@ -449,7 +455,7 @@ bool SafeBrowsingProtocolParser::ParseNewKey(const char* chunk_data, if (cmd_parts.size() != 3) return false; - if (cmd_parts[2].size() != atoi(cmd_parts[1].c_str())) + if (static_cast<int>(cmd_parts[2].size()) != atoi(cmd_parts[1].c_str())) return false; if (cmd_parts[0] == "clientkey") { diff --git a/chrome/browser/safe_browsing/safe_browsing_util.cc b/chrome/browser/safe_browsing/safe_browsing_util.cc index 8037154..0096263 100644 --- a/chrome/browser/safe_browsing/safe_browsing_util.cc +++ b/chrome/browser/safe_browsing/safe_browsing_util.cc @@ -137,6 +137,11 @@ static void DecodeWebSafe(std::string* decoded) { bool VerifyMAC(const std::string& key, const std::string& mac, const char* data, int data_length) { +#if !defined(OS_WIN) + // TODO(port): Remove #defines when linking issue with modp_b64 is resolved. + NOTIMPLEMENTED(); + return false; +#endif std::string key_copy = key; DecodeWebSafe(&key_copy); std::string decoded_key; @@ -168,6 +173,8 @@ void FreeChunks(std::deque<SBChunk>* chunks) { } } +#if defined(OS_WIN) +// TODO(port): remove conditional #ifs when google_util is ported GURL GeneratePhishingReportUrl(const std::string& report_page, const std::string& url_to_report) { Locale locale = Locale::getDefault(); @@ -183,6 +190,7 @@ GURL GeneratePhishingReportUrl(const std::string& report_page, current_esc.c_str())); return google_util::AppendGoogleLocaleParam(report_url); } +#endif } // namespace safe_browsing_util @@ -476,7 +484,6 @@ void SBHostInfo::RemoveSubEntry(int list_id, int chunk_id) { data.reset(new char[entry->Size()]); new_sub_entry = reinterpret_cast<SBEntry*>(data.get()); memcpy(new_sub_entry, entry, entry->Size()); - int new_prefix_count = 0; // Remove any matching prefixes. for (int i = 0; i < new_sub_entry->prefix_count(); ++i) { if (new_sub_entry->ChunkIdAtPrefix(i) == chunk_id) diff --git a/chrome/browser/safe_browsing/safe_browsing_util.h b/chrome/browser/safe_browsing/safe_browsing_util.h index 1fe7102..f43d85b 100644 --- a/chrome/browser/safe_browsing/safe_browsing_util.h +++ b/chrome/browser/safe_browsing/safe_browsing_util.h @@ -7,6 +7,8 @@ #ifndef CHROME_BROWSER_SAFE_BROWSING_UTIL_H__ #define CHROME_BROWSER_SAFE_BROWSING_UTIL_H__ +#include <string.h> + #include <deque> #include <string> #include <vector> |