<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<merge
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <!--
    Barrier to handle the conditional presence of omnibox_back_button.
    On tablets, the back button is not inflated, so referencing it directly in
    constraints fails. This barrier will ignore the missing ID and default to
    the start of the parent, ensuring correct layout on both form factors.
    -->
    <androidx.constraintlayout.widget.Barrier
        android:id="@+id/back_button_barrier"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:barrierDirection="end"
        app:constraint_referenced_ids="omnibox_back_button"/>

    <!--
    StatusView acts as a single focusable group. This improves accessibility
    screen reading behavior.
    -->
    <org.chromium.chrome.browser.omnibox.status.StatusView
        android:id="@+id/location_bar_status"
        android:layout_width="wrap_content"
        android:layout_height="@dimen/location_bar_height"
        android:gravity="center"
        android:focusable="true"
        android:screenReaderFocusable="true"
        app:layout_constraintStart_toEndOf="@id/back_button_barrier"
        app:layout_constraintEnd_toStartOf="@id/url_bar"
        app:layout_constraintTop_toBottomOf="@id/location_bar_attachments"
        app:layout_constraintHorizontal_chainStyle="spread_inside"
        app:layout_constraintHorizontal_weight="0">
        <!-- End padding is adjusted programmatically. -->
        <ViewStub
            android:id="@+id/location_bar_incognito_badge_stub"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout="@layout/location_status_incognito_badge"
            android:inflatedId="@+id/location_bar_incognito_badge"
            android:focusable="false"/>

        <include layout="@layout/location_status_icon"/>
        <TextView
            android:id="@+id/location_bar_verbose_status"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginStart="@dimen/omnibox_verbose_text_negative_start_margin"
            android:visibility="gone"
            android:paddingStart="@dimen/location_bar_verbose_start_padding_verbose_text"
            android:paddingEnd="8dp"
            android:gravity="center_vertical"
            android:textAlignment="viewStart"
            android:textAppearance="@style/TextAppearance.TextLarge.Primary"
            android:ellipsize="end"
            android:maxLines="1"
            android:focusable="false"/>

        <!--
        Separator is going to be shown or hidden together with the status
        defined above.
        -->
        <View
            android:id="@+id/location_bar_verbose_status_separator"
            android:layout_width="@dimen/location_bar_status_separator_width"
            android:layout_height="24dp"
            android:layout_gravity="center_vertical"
            android:visibility="gone"
            android:background="@color/black_alpha_12"
            android:focusable="false"/>

        <!--
        This space follows the verbose status and compliments the space that
        follows the status.
        -->
        <Space
            android:id="@+id/location_bar_verbose_status_extra_space"
            android:layout_width="@dimen/location_bar_status_extra_padding"
            android:layout_height="match_parent"
            android:visibility="gone"
            android:focusable="false"/>

    </org.chromium.chrome.browser.omnibox.status.StatusView>

</merge>
