chrome/browser/share/core/resources/gen_share_targets_proto.py
def ParseInputPb(input_pb):
    """ Return a protobuf based on input pb """

    new_pb = share_target_pb2.MapLocaleTargets()

    temp_pb = share_target_pb2.TargetLocalesForParsing()
    temp_pb.CopyFrom(input_pb)

    new_pb.version_id = temp_pb.version_id

    all_targets_pb = share_target_pb2.TmpShareTargetMap()

    for s in temp_pb.targets:
        all_targets_pb.all_targets[s.nickname].nickname = s.nickname
        all_targets_pb.all_targets[s.nickname].url = s.url
        all_targets_pb.all_targets[s.nickname].icon = s.icon
        all_targets_pb.all_targets[s.nickname].icon_2x = s.icon_2x
        all_targets_pb.all_targets[s.nickname].icon_3x = s.icon_3x

    for s in temp_pb.locale_mapping:
        tmp_share_targets = share_target_pb2.ShareTargets()
        for target in s.targets:
            added = tmp_share_targets.targets.add()
            added.nickname = all_targets_pb.all_targets[target].nickname
            added.url = all_targets_pb.all_targets[target].url
            added.icon = all_targets_pb.all_targets[target].icon
            added.icon_2x = all_targets_pb.all_targets[target].icon_2x
            added.icon_3x = all_targets_pb.all_targets[target].icon_3x

        for locale in s.locale_keys:
            for target in tmp_share_targets.targets:
                added = new_pb.map_target_locale_map[locale].targets.add()
                added.nickname = target.nickname
                added.url = target.url
                added.icon = target.icon
                added.icon_2x = target.icon_2x
                added.icon_3x = target.icon_3x

    return new_pb
 Return a protobuf based on input pb 
Return a protobuf based on input pb
Return a protobuf based on input pb
def ParseInputPb(input_pb):
    new_pb = share_target_pb2.MapLocaleTargets()
    temp_pb = share_target_pb2.TargetLocalesForParsing()
    temp_pb.CopyFrom(input_pb)
    new_pb.version_id = temp_pb.version_id
    all_targets_pb = share_target_pb2.TmpShareTargetMap()
    for s in temp_pb.targets:
        all_targets_pb.all_targets[s.nickname].nickname = s.nickname
        all_targets_pb.all_targets[s.nickname].url = s.url
        all_targets_pb.all_targets[s.nickname].icon = s.icon
        all_targets_pb.all_targets[s.nickname].icon_2x = s.icon_2x
        all_targets_pb.all_targets[s.nickname].icon_3x = s.icon_3x
    for s in temp_pb.locale_mapping:
        tmp_share_targets = share_target_pb2.ShareTargets()
        for target in s.targets:
            added = tmp_share_targets.targets.add()
            added.nickname = all_targets_pb.all_targets[target].nickname
            added.url = all_targets_pb.all_targets[target].url
            added.icon = all_targets_pb.all_targets[target].icon
            added.icon_2x = all_targets_pb.all_targets[target].icon_2x
            added.icon_3x = all_targets_pb.all_targets[target].icon_3x
        for locale in s.locale_keys:
            for target in tmp_share_targets.targets:
                added = new_pb.map_target_locale_map[locale].targets.add()
                added.nickname = target.nickname
                added.url = target.url
                added.icon = target.icon
                added.icon_2x = target.icon_2x
                added.icon_3x = target.icon_3x
    return new_pb
def ParseInputPb ( input_pb ) : new_pb = share_target_pb2 . MapLocaleTargets ( ) temp_pb = share_target_pb2 . TargetLocalesForParsing ( ) temp_pb . CopyFrom ( input_pb ) new_pb . version_id = temp_pb . version_id all_targets_pb = share_target_pb2 . TmpShareTargetMap ( ) for s in temp_pb . targets : all_targets_pb . all_targets [ s . nickname ] . nickname = s . nickname all_targets_pb . all_targets [ s . nickname ] . url = s . url all_targets_pb . all_targets [ s . nickname ] . icon = s . icon all_targets_pb . all_targets [ s . nickname ] . icon_2x = s . icon_2x all_targets_pb . all_targets [ s . nickname ] . icon_3x = s . icon_3x for s in temp_pb . locale_mapping : tmp_share_targets = share_target_pb2 . ShareTargets ( ) for target in s . targets : added = tmp_share_targets . targets . add ( ) added . nickname = all_targets_pb . all_targets [ target ] . nickname added . url = all_targets_pb . all_targets [ target ] . url added . icon = all_targets_pb . all_targets [ target ] . icon added . icon_2x = all_targets_pb . all_targets [ target ] . icon_2x added . icon_3x = all_targets_pb . all_targets [ target ] . icon_3x for locale in s . locale_keys : for target in tmp_share_targets . targets : added = new_pb . map_target_locale_map [ locale ] . targets . add ( ) added . nickname = target . nickname added . url = target . url added . icon = target . icon added . icon_2x = target . icon_2x added . icon_3x = target . icon_3x return new_pb
Return a protobuf based on input pb
Return a protobuf based on input pb
""" Return a protobuf based on input pb """
input_pb