diff options
author | Ben Murdoch <benm@google.com> | 2013-08-06 11:01:04 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2013-08-06 11:01:04 +0100 |
commit | 2385ea399aae016c0806a4f9ef3c9cfe3d2a39df (patch) | |
tree | e910e76d19265ff3230c473da95410d3f3a007af /components | |
parent | 8ee924b76946696c0f52e56d28cc5ab741919041 (diff) | |
download | chromium_org-2385ea399aae016c0806a4f9ef3c9cfe3d2a39df.tar.gz |
Merge from Chromium at DEPS revision r215849
This commit was generated by merge_to_master.py.
Change-Id: I225a31651af894e33bdd71e7121702bcbe5310f4
Diffstat (limited to 'components')
17 files changed, 283 insertions, 78 deletions
diff --git a/components/autofill/content/browser/autocheckout_manager.cc b/components/autofill/content/browser/autocheckout_manager.cc index c029ba824a..01f656bd34 100644 --- a/components/autofill/content/browser/autocheckout_manager.cc +++ b/components/autofill/content/browser/autocheckout_manager.cc @@ -142,9 +142,9 @@ void GetGoogleCookies( } bool IsBillingGroup(FieldTypeGroup group) { - return group == AutofillType::ADDRESS_BILLING || - group == AutofillType::PHONE_BILLING || - group == AutofillType::NAME_BILLING; + return group == ADDRESS_BILLING || + group == PHONE_BILLING || + group == NAME_BILLING; } const char kTransactionIdNotSet[] = "transaction id not set"; @@ -361,7 +361,7 @@ void AutocheckoutManager::ReturnAutocheckoutData( continue; } FieldTypeGroup group = AutofillType(type).group(); - if (group == AutofillType::CREDIT_CARD) { + if (group == CREDIT_CARD) { credit_card_->SetRawInfo(type, value); // TODO(dgwallinga): Find a way of cleanly deprecating CREDIT_CARD_NAME. // code.google.com/p/chromium/issues/detail?id=263498 @@ -493,7 +493,7 @@ void AutocheckoutManager::SetValue(const AutofillField& field, return; } - if (AutofillType(type).group() == AutofillType::CREDIT_CARD) { + if (AutofillType(type).group() == CREDIT_CARD) { credit_card_->FillFormField( field, 0, autofill_manager_->app_locale(), field_to_fill); } else if (IsBillingGroup(AutofillType(type).group())) { diff --git a/components/autofill/content/browser/wallet/wallet_items.cc b/components/autofill/content/browser/wallet/wallet_items.cc index 1643461877..1608c3ecbd 100644 --- a/components/autofill/content/browser/wallet/wallet_items.cc +++ b/components/autofill/content/browser/wallet/wallet_items.cc @@ -311,7 +311,7 @@ const gfx::Image& WalletItems::MaskedInstrument::CardIcon() const { base::string16 WalletItems::MaskedInstrument::GetInfo( AutofillFieldType type, const std::string& app_locale) const { - if (AutofillType(type).group() != AutofillType::CREDIT_CARD) + if (AutofillType(type).group() != CREDIT_CARD) return address().GetInfo(type, app_locale); switch (type) { diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc index 36a22b7dc5..76437dfad0 100644 --- a/components/autofill/core/browser/autofill_manager.cc +++ b/components/autofill/core/browser/autofill_manager.cc @@ -426,7 +426,7 @@ void AutofillManager::OnQueryFormFieldAutofill(int query_id, form_structure->IsAutofillable(false)) { AutofillFieldType type = autofill_field->type(); bool is_filling_credit_card = - (AutofillType(type).group() == AutofillType::CREDIT_CARD); + (AutofillType(type).group() == CREDIT_CARD); if (is_filling_credit_card) { GetCreditCardSuggestions( field, type, &values, &labels, &icons, &unique_ids); @@ -546,7 +546,7 @@ void AutofillManager::OnFillAutofillFormData(int query_id, const AutofillField* cached_field = form_structure->field(i); FieldTypeGroup field_group_type = AutofillType(cached_field->type()).group(); - if (field_group_type != AutofillType::NO_GROUP) { + if (field_group_type != NO_GROUP) { // If the field being filled is either // (a) the field that the user initiated the fill from, or // (b) part of the same logical unit, e.g. name or phone number, diff --git a/components/autofill/core/browser/autofill_metrics.cc b/components/autofill/core/browser/autofill_metrics.cc index a1e4d594c2..54582cc6c1 100644 --- a/components/autofill/core/browser/autofill_metrics.cc +++ b/components/autofill/core/browser/autofill_metrics.cc @@ -86,19 +86,19 @@ int GetFieldTypeGroupMetric(const AutofillFieldType field_type, FieldTypeGroupForMetrics group; switch (AutofillType(field_type).group()) { - case AutofillType::NO_GROUP: + case ::autofill::NO_GROUP: group = AMBIGUOUS; break; - case AutofillType::NAME: + case ::autofill::NAME: group = NAME; break; - case AutofillType::COMPANY: + case ::autofill::COMPANY: group = COMPANY; break; - case AutofillType::ADDRESS_HOME: + case ::autofill::ADDRESS_HOME: switch (field_type) { case ADDRESS_HOME_LINE1: group = ADDRESS_LINE_1; @@ -124,15 +124,15 @@ int GetFieldTypeGroupMetric(const AutofillFieldType field_type, } break; - case AutofillType::EMAIL: + case ::autofill::EMAIL: group = EMAIL; break; - case AutofillType::PHONE_HOME: + case ::autofill::PHONE_HOME: group = PHONE; break; - case AutofillType::CREDIT_CARD: + case ::autofill::CREDIT_CARD: switch (field_type) { case ::autofill::CREDIT_CARD_NAME: group = CREDIT_CARD_NAME; diff --git a/components/autofill/core/browser/autofill_profile.cc b/components/autofill/core/browser/autofill_profile.cc index 85c0408f57..653060ac7c 100644 --- a/components/autofill/core/browser/autofill_profile.cc +++ b/components/autofill/core/browser/autofill_profile.cc @@ -316,15 +316,15 @@ void AutofillProfile::SetRawMultiInfo( AutofillFieldType type, const std::vector<base::string16>& values) { switch (AutofillType(type).group()) { - case AutofillType::NAME: - case AutofillType::NAME_BILLING: + case NAME: + case NAME_BILLING: CopyValuesToItems(type, values, &name_, NameInfo()); break; - case AutofillType::EMAIL: + case EMAIL: CopyValuesToItems(type, values, &email_, EmailInfo()); break; - case AutofillType::PHONE_HOME: - case AutofillType::PHONE_BILLING: + case PHONE_HOME: + case PHONE_BILLING: CopyValuesToItems(type, values, &phone_number_, @@ -360,7 +360,7 @@ void AutofillProfile::FillFormField(const AutofillField& field, const std::string& app_locale, FormFieldData* field_data) const { AutofillFieldType type = field.type(); - DCHECK_NE(AutofillType::CREDIT_CARD, AutofillType(type).group()); + DCHECK_NE(CREDIT_CARD, AutofillType(type).group()); DCHECK(field_data); if (type == PHONE_HOME_NUMBER || type == PHONE_BILLING_NUMBER) { @@ -514,7 +514,7 @@ bool AutofillProfile::IsSubsetOf(const AutofillProfile& profile, // name saved, but |profile| lacks one, |profile| could still be a subset // of |this|. continue; - } else if (AutofillType(*iter).group() == AutofillType::PHONE_HOME) { + } else if (AutofillType(*iter).group() == PHONE_HOME) { // Phone numbers should be canonicalized prior to being compared. if (*iter != PHONE_HOME_WHOLE_NUMBER) { continue; @@ -565,7 +565,7 @@ void AutofillProfile::OverwriteWithOrAddTo(const AutofillProfile& profile, new_values.begin(); value_iter != new_values.end(); ++value_iter) { // Don't add duplicates. - if (group == AutofillType::PHONE_HOME) { + if (group == PHONE_HOME) { AddPhoneIfUnique(*value_iter, app_locale, &existing_values); } else { std::vector<base::string16>::const_iterator existing_iter = @@ -589,12 +589,12 @@ void AutofillProfile::OverwriteWithOrAddTo(const AutofillProfile& profile, // static bool AutofillProfile::SupportsMultiValue(AutofillFieldType type) { - AutofillType::FieldTypeGroup group = AutofillType(type).group(); - return group == AutofillType::NAME || - group == AutofillType::NAME_BILLING || - group == AutofillType::EMAIL || - group == AutofillType::PHONE_HOME || - group == AutofillType::PHONE_BILLING; + FieldTypeGroup group = AutofillType(type).group(); + return group == NAME || + group == NAME_BILLING || + group == EMAIL || + group == PHONE_HOME || + group == PHONE_BILLING; } // static @@ -693,15 +693,15 @@ void AutofillProfile::GetMultiInfoImpl( const std::string& app_locale, std::vector<base::string16>* values) const { switch (AutofillType(type).group()) { - case AutofillType::NAME: - case AutofillType::NAME_BILLING: + case NAME: + case NAME_BILLING: CopyItemsToValues(type, name_, app_locale, values); break; - case AutofillType::EMAIL: + case EMAIL: CopyItemsToValues(type, email_, app_locale, values); break; - case AutofillType::PHONE_HOME: - case AutofillType::PHONE_BILLING: + case PHONE_HOME: + case PHONE_BILLING: CopyItemsToValues(type, phone_number_, app_locale, values); break; default: @@ -845,22 +845,22 @@ const FormGroup* AutofillProfile::FormGroupForType( FormGroup* AutofillProfile::MutableFormGroupForType(AutofillFieldType type) { FormGroup* form_group = NULL; switch (AutofillType(type).group()) { - case AutofillType::NAME: - case AutofillType::NAME_BILLING: + case NAME: + case NAME_BILLING: form_group = &name_[0]; break; - case AutofillType::EMAIL: + case EMAIL: form_group = &email_[0]; break; - case AutofillType::COMPANY: + case COMPANY: form_group = &company_; break; - case AutofillType::PHONE_HOME: - case AutofillType::PHONE_BILLING: + case PHONE_HOME: + case PHONE_BILLING: form_group = &phone_number_[0]; break; - case AutofillType::ADDRESS_HOME: - case AutofillType::ADDRESS_BILLING: + case ADDRESS_HOME: + case ADDRESS_BILLING: form_group = &address_; break; default: diff --git a/components/autofill/core/browser/autofill_type.h b/components/autofill/core/browser/autofill_type.h index c626dc094b..c85bea1589 100644 --- a/components/autofill/core/browser/autofill_type.h +++ b/components/autofill/core/browser/autofill_type.h @@ -5,11 +5,8 @@ #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_TYPE_H_ #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_TYPE_H_ -#include <map> -#include <set> #include <string> -#include "base/strings/string16.h" #include "components/autofill/core/browser/field_types.h" namespace autofill { @@ -18,19 +15,6 @@ namespace autofill { // and for associating form fields with form values in the Web Database. class AutofillType { public: - enum FieldTypeGroup { - NO_GROUP, - NAME, - NAME_BILLING, - EMAIL, - COMPANY, - ADDRESS_HOME, - ADDRESS_BILLING, - PHONE_HOME, - PHONE_BILLING, - CREDIT_CARD, - }; - explicit AutofillType(AutofillFieldType field_type); AutofillType(const AutofillType& autofill_type); AutofillType& operator=(const AutofillType& autofill_type); @@ -56,10 +40,6 @@ class AutofillType { AutofillFieldType field_type_; }; -typedef AutofillType::FieldTypeGroup FieldTypeGroup; -typedef std::set<AutofillFieldType> FieldTypeSet; -typedef std::map<base::string16, AutofillFieldType> FieldTypeMap; - } // namespace autofill #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_TYPE_H_ diff --git a/components/autofill/core/browser/autofill_type_unittest.cc b/components/autofill/core/browser/autofill_type_unittest.cc index eb68e0151a..8bff67162b 100644 --- a/components/autofill/core/browser/autofill_type_unittest.cc +++ b/components/autofill/core/browser/autofill_type_unittest.cc @@ -12,42 +12,42 @@ TEST(AutofillTypeTest, AutofillTypes) { // No server data. AutofillType none(NO_SERVER_DATA); EXPECT_EQ(NO_SERVER_DATA, none.field_type()); - EXPECT_EQ(AutofillType::NO_GROUP, none.group()); + EXPECT_EQ(NO_GROUP, none.group()); // Unknown type. AutofillType unknown(UNKNOWN_TYPE); EXPECT_EQ(UNKNOWN_TYPE, unknown.field_type()); - EXPECT_EQ(AutofillType::NO_GROUP, unknown.group()); + EXPECT_EQ(NO_GROUP, unknown.group()); // Type with group but no subgroup. AutofillType first(NAME_FIRST); EXPECT_EQ(NAME_FIRST, first.field_type()); - EXPECT_EQ(AutofillType::NAME, first.group()); + EXPECT_EQ(NAME, first.group()); // Type with group and subgroup. AutofillType phone(PHONE_HOME_NUMBER); EXPECT_EQ(PHONE_HOME_NUMBER, phone.field_type()); - EXPECT_EQ(AutofillType::PHONE_HOME, phone.group()); + EXPECT_EQ(PHONE_HOME, phone.group()); // Last value, to check any offset errors. AutofillType last(COMPANY_NAME); EXPECT_EQ(COMPANY_NAME, last.field_type()); - EXPECT_EQ(AutofillType::COMPANY, last.group()); + EXPECT_EQ(COMPANY, last.group()); // Boundary (error) condition. AutofillType boundary(MAX_VALID_FIELD_TYPE); EXPECT_EQ(UNKNOWN_TYPE, boundary.field_type()); - EXPECT_EQ(AutofillType::NO_GROUP, boundary.group()); + EXPECT_EQ(NO_GROUP, boundary.group()); // Beyond the boundary (error) condition. AutofillType beyond(static_cast<AutofillFieldType>(MAX_VALID_FIELD_TYPE+10)); EXPECT_EQ(UNKNOWN_TYPE, beyond.field_type()); - EXPECT_EQ(AutofillType::NO_GROUP, beyond.group()); + EXPECT_EQ(NO_GROUP, beyond.group()); // In-between value. Missing from enum but within range. Error condition. AutofillType between(static_cast<AutofillFieldType>(16)); EXPECT_EQ(UNKNOWN_TYPE, between.field_type()); - EXPECT_EQ(AutofillType::NO_GROUP, between.group()); + EXPECT_EQ(NO_GROUP, between.group()); } } // namespace diff --git a/components/autofill/core/browser/contact_info.cc b/components/autofill/core/browser/contact_info.cc index aeed7a319a..11d6b2bde8 100644 --- a/components/autofill/core/browser/contact_info.cc +++ b/components/autofill/core/browser/contact_info.cc @@ -74,7 +74,7 @@ base::string16 NameInfo::GetRawInfo(AutofillFieldType type) const { void NameInfo::SetRawInfo(AutofillFieldType type, const base::string16& value) { type = AutofillType::GetEquivalentFieldType(type); - DCHECK_EQ(AutofillType::NAME, AutofillType(type).group()); + DCHECK_EQ(NAME, AutofillType(type).group()); if (type == NAME_FIRST) first_ = value; else if (type == NAME_MIDDLE || type == NAME_MIDDLE_INITIAL) diff --git a/components/autofill/core/browser/credit_card.cc b/components/autofill/core/browser/credit_card.cc index 31933a0e1a..8fc67ee3b5 100644 --- a/components/autofill/core/browser/credit_card.cc +++ b/components/autofill/core/browser/credit_card.cc @@ -533,7 +533,7 @@ void CreditCard::FillFormField(const AutofillField& field, size_t /*variant*/, const std::string& app_locale, FormFieldData* field_data) const { - DCHECK_EQ(AutofillType::CREDIT_CARD, AutofillType(field.type()).group()); + DCHECK_EQ(CREDIT_CARD, AutofillType(field.type()).group()); DCHECK(field_data); if (field_data->form_control_type == "select-one") { diff --git a/components/autofill/core/browser/field_types.h b/components/autofill/core/browser/field_types.h index 3fab90e40e..1e784d566f 100644 --- a/components/autofill/core/browser/field_types.h +++ b/components/autofill/core/browser/field_types.h @@ -5,8 +5,10 @@ #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_TYPES_H_ #define COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_TYPES_H_ +#include <map> #include <set> -#include <string> + +#include "base/strings/string16.h" namespace autofill { @@ -102,7 +104,21 @@ enum AutofillFieldType { MAX_VALID_FIELD_TYPE = 73, }; +enum FieldTypeGroup { + NO_GROUP, + NAME, + NAME_BILLING, + EMAIL, + COMPANY, + ADDRESS_HOME, + ADDRESS_BILLING, + PHONE_HOME, + PHONE_BILLING, + CREDIT_CARD, +}; + typedef std::set<AutofillFieldType> FieldTypeSet; +typedef std::map<base::string16, AutofillFieldType> FieldTypeMap; } // namespace autofill diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc index 46d0dbc0d1..3c49b4509a 100644 --- a/components/autofill/core/browser/form_structure.cc +++ b/components/autofill/core/browser/form_structure.cc @@ -1218,7 +1218,7 @@ void FormStructure::IdentifySections(bool has_author_specified_sections) { // Forms often ask for multiple phone numbers -- e.g. both a daytime and // evening phone number. Our phone number detection is also generally a // little off. Hence, ignore this field type as a signal here. - if (AutofillType(current_type).group() == AutofillType::PHONE_HOME) + if (AutofillType(current_type).group() == PHONE_HOME) already_saw_current_type = false; // Some forms have adjacent fields of the same type. Two common examples: @@ -1250,9 +1250,8 @@ void FormStructure::IdentifySections(bool has_author_specified_sections) { // This simplifies the section-aware logic in autofill_manager.cc. for (std::vector<AutofillField*>::iterator field = fields_.begin(); field != fields_.end(); ++field) { - AutofillType::FieldTypeGroup field_type_group = - AutofillType((*field)->type()).group(); - if (field_type_group == AutofillType::CREDIT_CARD) + FieldTypeGroup field_type_group = AutofillType((*field)->type()).group(); + if (field_type_group == CREDIT_CARD) (*field)->set_section((*field)->section() + "-cc"); else (*field)->set_section((*field)->section() + "-default"); diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc index b3ea877020..d7fb2919b5 100644 --- a/components/autofill/core/browser/personal_data_manager.cc +++ b/components/autofill/core/browser/personal_data_manager.cc @@ -279,7 +279,7 @@ bool PersonalDataManager::ImportFormData( types_seen.insert(field_type); - if (group == AutofillType::CREDIT_CARD) { + if (group == CREDIT_CARD) { if (LowerCaseEqualsASCII(field->form_control_type, "month")) { DCHECK_EQ(CREDIT_CARD_EXP_MONTH, field_type); local_imported_credit_card->SetInfoForMonthInputType(value); diff --git a/components/nacl.gyp b/components/nacl.gyp new file mode 100644 index 0000000000..f3ded8354a --- /dev/null +++ b/components/nacl.gyp @@ -0,0 +1,167 @@ +# Copyright 2013 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. + +{ + 'variables': { + 'chromium_code': 1, + }, + 'includes': [ + '../native_client/build/untrusted.gypi', + 'nacl/nacl_defines.gypi', + ], + 'target_defaults': { + 'variables': { + 'nacl_target': 0, + }, + 'target_conditions': [ + # This part is shared between the targets defined below. Only files and + # settings relevant for building the Win64 target should be added here. + ['nacl_target==1', { + 'include_dirs': [ + '<(INTERMEDIATE_DIR)', + ], + 'defines': [ + '<@(nacl_defines)', + ], + 'sources': [ + # .cc, .h, and .mm files under nacl that are used on all + # platforms, including both 32-bit and 64-bit Windows. + # Test files are also not included. + 'nacl/loader/nacl_ipc_adapter.cc', + 'nacl/loader/nacl_ipc_adapter.h', + 'nacl/loader/nacl_main.cc', + 'nacl/loader/nacl_main_platform_delegate.h', + 'nacl/loader/nacl_main_platform_delegate_linux.cc', + 'nacl/loader/nacl_main_platform_delegate_mac.mm', + 'nacl/loader/nacl_main_platform_delegate_win.cc', + 'nacl/loader/nacl_listener.cc', + 'nacl/loader/nacl_listener.h', + 'nacl/loader/nacl_validation_db.h', + 'nacl/loader/nacl_validation_query.cc', + 'nacl/loader/nacl_validation_query.h', + ], + # TODO(gregoryd): consider switching NaCl to use Chrome OS defines + 'conditions': [ + ['OS=="win"', { + 'defines': [ + '__STDC_LIMIT_MACROS=1', + ], + 'include_dirs': [ + '<(DEPTH)/third_party/wtl/include', + ], + },], + ['OS=="linux"', { + 'defines': [ + '__STDC_LIMIT_MACROS=1', + ], + 'sources': [ + '../components/nacl/common/nacl_paths.cc', + '../components/nacl/common/nacl_paths.h', + '../components/nacl/zygote/nacl_fork_delegate_linux.cc', + '../components/nacl/zygote/nacl_fork_delegate_linux.h', + ], + },], + ], + }], + ], + }, + 'conditions': [ + ['disable_nacl!=1', { + 'targets': [ + { + 'target_name': 'nacl', + 'type': 'static_library', + 'variables': { + 'nacl_target': 1, + }, + 'dependencies': [ + '../base/base.gyp:base', + '../ipc/ipc.gyp:ipc', + '../ppapi/native_client/src/trusted/plugin/plugin.gyp:ppGoogleNaClPluginChrome', + '../ppapi/ppapi_internal.gyp:ppapi_shared', + '../ppapi/ppapi_internal.gyp:ppapi_ipc', + '../native_client/src/trusted/service_runtime/service_runtime.gyp:sel_main_chrome', + ], + 'conditions': [ + ['disable_nacl_untrusted==0', { + 'dependencies': [ + '../ppapi/native_client/native_client.gyp:nacl_irt', + '../ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim', + '../ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp:pnacl_support_extension', + ], + }], + ], + 'direct_dependent_settings': { + 'defines': [ + '<@(nacl_defines)', + ], + }, + }, + ], + 'conditions': [ + ['OS=="win" and target_arch=="ia32"', { + 'targets': [ + { + 'target_name': 'nacl_win64', + 'type': 'static_library', + 'variables': { + 'nacl_target': 1, + }, + 'dependencies': [ + '../native_client/src/trusted/service_runtime/service_runtime.gyp:sel_main_chrome64', + '../ppapi/ppapi_internal.gyp:ppapi_shared_win64', + '../ppapi/ppapi_internal.gyp:ppapi_ipc_win64', + '../components/nacl_common.gyp:nacl_common_win64', + ], + 'export_dependent_settings': [ + '../ppapi/ppapi_internal.gyp:ppapi_ipc_win64', + ], + 'sources': [ + '../components/nacl/broker/nacl_broker_listener.cc', + '../components/nacl/broker/nacl_broker_listener.h', + '../components/nacl/common/nacl_debug_exception_handler_win.cc', + ], + 'include_dirs': [ + '..', + ], + 'defines': [ + '<@(nacl_win64_defines)', + 'COMPILE_CONTENT_STATICALLY', + ], + 'configurations': { + 'Common_Base': { + 'msvs_target_platform': 'x64', + }, + }, + 'direct_dependent_settings': { + 'defines': [ + '<@(nacl_defines)', + ], + }, + }, + ], + }], + ], + }, { # else (disable_nacl==1) + 'targets': [ + { + 'target_name': 'nacl', + 'type': 'none', + 'sources': [], + }, + ], + 'conditions': [ + ['OS=="win"', { + 'targets': [ + { + 'target_name': 'nacl_win64', + 'type': 'none', + 'sources': [], + }, + ], + }], + ], + }], + ], +} diff --git a/components/nacl/common/nacl_browser_delegate.h b/components/nacl/common/nacl_browser_delegate.h index 5655a8f8ba..6cff071716 100644 --- a/components/nacl/common/nacl_browser_delegate.h +++ b/components/nacl/common/nacl_browser_delegate.h @@ -58,6 +58,7 @@ class NaClBrowserDelegate { // Install PNaCl if this operation is supported. On success, the |installed| // callback should be called with true, and on failure (or not supported), // the |installed| callback should be called with false. + // TODO(jvoung): Add the progress callback as well. virtual void TryInstallPnacl( const base::Callback<void(bool)>& installed) = 0; }; diff --git a/components/nacl/common/nacl_host_messages.h b/components/nacl/common/nacl_host_messages.h index 0f3df7e9a6..7a395040ac 100644 --- a/components/nacl/common/nacl_host_messages.h +++ b/components/nacl/common/nacl_host_messages.h @@ -53,6 +53,17 @@ IPC_SYNC_MESSAGE_CONTROL1_2(NaClHostMsg_LaunchNaCl, std::string /* error_message */) // A renderer sends this to the browser process when it wants to +// ensure that PNaCl is installed. +IPC_MESSAGE_CONTROL1(NaClHostMsg_EnsurePnaclInstalled, + int /* pp_instance */) + +// The browser replies to the renderer's request to ensure that +// PNaCl is installed. +IPC_MESSAGE_CONTROL2(NaClViewMsg_EnsurePnaclInstalledReply, + int /* pp_instance */, + bool /* success */) + +// A renderer sends this to the browser process when it wants to // open a file for from the Pnacl component directory. IPC_SYNC_MESSAGE_CONTROL1_1(NaClHostMsg_GetReadonlyPnaclFD, std::string /* name of requested PNaCl file */, diff --git a/components/nacl/common/pnacl_types.cc b/components/nacl/common/pnacl_types.cc index f6302bc9c9..6c43319c6b 100644 --- a/components/nacl/common/pnacl_types.cc +++ b/components/nacl/common/pnacl_types.cc @@ -9,4 +9,20 @@ namespace nacl { PnaclCacheInfo::PnaclCacheInfo() {} PnaclCacheInfo::~PnaclCacheInfo() {} +// static +bool PnaclInstallProgress::progress_known(const PnaclInstallProgress& p) { + return p.total_size >= 0; +} + +// static +PnaclInstallProgress PnaclInstallProgress::Unknown() { + PnaclInstallProgress p; + p.current = 0; + // Use -1 to indicate that total is not determined. + // This matches the -1 of the OnURLFetchDownloadProgress interface in + // net/url_request/url_fetcher_delegate.h + p.total_size = -1; + return p; +} + } // namespace nacl diff --git a/components/nacl/common/pnacl_types.h b/components/nacl/common/pnacl_types.h index 802319bd71..3fc405a980 100644 --- a/components/nacl/common/pnacl_types.h +++ b/components/nacl/common/pnacl_types.h @@ -9,6 +9,7 @@ // nacl_types is built into nacl_helper in addition to chrome, and we don't // want to pull src/url/ into there, since it would be unnecessary bloat. +#include "base/basictypes.h" #include "base/time/time.h" #include "url/gurl.h" @@ -28,6 +29,20 @@ struct PnaclCacheInfo { std::string etag; }; +// Progress information for PNaCl on-demand installs. +struct PnaclInstallProgress { + int64 current; + int64 total_size; + + // Returns an instance of PnaclInstallProgress where the + // total is marked as unknown. + static PnaclInstallProgress Unknown(); + + // Returns true if the given instance of PnaclInstallProgress has + // an unknown total. + static bool progress_known(const PnaclInstallProgress& p); +}; + } // namespace nacl #endif // COMPONENTS_NACL_COMMON_PNACL_TYPES_H_ |