chromium/chrome/browser/ui/views/translate/translate_bubble_view.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/views/translate/translate_bubble_view.h"

#include <stddef.h>

#include <algorithm>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "base/i18n/string_compare.h"
#include "base/memory/singleton.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/translate/chrome_translate_client.h"
#include "chrome/browser/translate/translate_service.h"
#include "chrome/browser/ui/actions/chrome_action_id.h"
#include "chrome/browser/ui/browser_actions.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/translate/translate_bubble_model_impl.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/translate/translate_icon_view.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/theme_resources.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h"
#include "components/translate/core/browser/translate_download_manager.h"
#include "components/translate/core/browser/translate_manager.h"
#include "components/translate/core/browser/translate_metrics_logger.h"
#include "components/translate/core/browser/translate_prefs.h"
#include "components/translate/core/browser/translate_ui_delegate.h"
#include "components/translate/core/common/translate_constants.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/web_contents.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/combobox_model.h"
#include "ui/base/models/simple_combobox_model.h"
#include "ui/base/mojom/dialog_button.mojom.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/strings/grit/ui_strings.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/border.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/image_button_factory.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/controls/button/md_text_button_with_down_arrow.h"
#include "ui/views/controls/button/menu_button.h"
#include "ui/views/controls/combobox/combobox.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/link.h"
#include "ui/views/controls/styled_label.h"
#include "ui/views/controls/tabbed_pane/tabbed_pane.h"
#include "ui/views/controls/throbber.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/box_layout_view.h"
#include "ui/views/layout/flex_layout_types.h"
#include "ui/views/style/platform_style.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/widget/widget.h"

namespace {

bool UseGoogleTranslateBranding() {}

std::unique_ptr<views::View> CreateWordmarkView() {}

}  // namespace

TranslateBubbleView::~TranslateBubbleView() {}

DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(TranslateBubbleView, kIdentifier);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(TranslateBubbleView, kSourceLanguageTab);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(TranslateBubbleView, kTargetLanguageTab);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(TranslateBubbleView, kCloseButton);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(TranslateBubbleView, kOptionsMenuButton);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(TranslateBubbleView,
                                      kChangeTargetLanguage);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(TranslateBubbleView,
                                      kTargetLanguageCombobox);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(TranslateBubbleView,
                                      kTargetLanguageDoneButton);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(TranslateBubbleView,
                                      kChangeSourceLanguage);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(TranslateBubbleView,
                                      kSourceLanguageCombobox);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(TranslateBubbleView,
                                      kSourceLanguageDoneButton);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(TranslateBubbleView, kErrorMessage);

void TranslateBubbleView::CloseBubble() {}

void TranslateBubbleView::TabSelectedAt(int index) {}

void TranslateBubbleView::Init() {}

views::View* TranslateBubbleView::GetInitiallyFocusedView() {}

bool TranslateBubbleView::ShouldShowCloseButton() const {}

bool TranslateBubbleView::ShouldShowWindowTitle() const {}

bool TranslateBubbleView::DidLanguageSelectionChange(
    TranslateBubbleModel::ViewState view_state) {}

void TranslateBubbleView::ResetLanguage() {}

void TranslateBubbleView::WindowClosing() {}

bool TranslateBubbleView::AcceleratorPressed(
    const ui::Accelerator& accelerator) {}

gfx::Size TranslateBubbleView::CalculatePreferredSize(
    const views::SizeBounds& available_size) const {}

// Create the menu items for the dropdown options menu under TAB UI.
void TranslateBubbleView::ShowOptionsMenu(views::Button* source) {}

bool TranslateBubbleView::IsCommandIdChecked(int command_id) const {}

bool TranslateBubbleView::IsCommandIdEnabled(int command_id) const {}

void TranslateBubbleView::ExecuteCommand(int command_id, int event_flags) {}

void TranslateBubbleView::OnWidgetClosing(views::Widget* widget) {}

TranslateBubbleModel::ViewState TranslateBubbleView::GetViewState() const {}

void TranslateBubbleView::SetViewState(translate::TranslateStep step,
                                       translate::TranslateErrors error_type) {}

TranslateBubbleView::TranslateBubbleView(
    views::View* anchor_view,
    std::unique_ptr<TranslateBubbleModel> model,
    translate::TranslateErrors error_type,
    content::WebContents* web_contents,
    base::OnceClosure on_closing)
    :{}

views::View* TranslateBubbleView::GetCurrentView() const {}

void TranslateBubbleView::Translate() {}

void TranslateBubbleView::ShowOriginal() {}

void TranslateBubbleView::ConfirmAdvancedOptions() {}

void TranslateBubbleView::SourceLanguageChanged() {}

void TranslateBubbleView::TargetLanguageChanged() {}

void TranslateBubbleView::AlwaysTranslatePressed() {}

void TranslateBubbleView::UpdateChildVisibilities() {}

std::unique_ptr<views::View> TranslateBubbleView::CreateEmptyPane() {}

std::unique_ptr<views::View> TranslateBubbleView::CreateView() {}

// TODO(crbug.com/40336858): Revise this later to show a specific message for
// each error.
std::unique_ptr<views::View> TranslateBubbleView::CreateViewError() {}

std::unique_ptr<views::View> TranslateBubbleView::CreateViewErrorNoTitle(
    std::unique_ptr<views::Button> advanced_button) {}

std::unique_ptr<views::View> TranslateBubbleView::CreateViewAdvancedSource() {}

std::unique_ptr<views::View> TranslateBubbleView::CreateViewAdvancedTarget() {}

std::unique_ptr<views::View> TranslateBubbleView::CreateViewAdvanced(
    std::unique_ptr<views::Combobox> combobox,
    std::unique_ptr<views::Label> language_title_label,
    std::unique_ptr<views::Button> advanced_reset_button,
    std::unique_ptr<views::Button> advanced_done_button,
    std::unique_ptr<views::Checkbox> advanced_always_translate_checkbox) {}

std::unique_ptr<views::ImageView> TranslateBubbleView::CreateTranslateIcon() {}

std::unique_ptr<views::Button> TranslateBubbleView::CreateOptionsMenuButton() {}

std::unique_ptr<views::Button> TranslateBubbleView::CreateCloseButton() {}

views::Checkbox* TranslateBubbleView::GetAlwaysTranslateCheckbox() {}

void TranslateBubbleView::SetWindowTitle(
    TranslateBubbleModel::ViewState view_state) {}

void TranslateBubbleView::UpdateViewState(
    TranslateBubbleModel::ViewState view_state) {}

void TranslateBubbleView::SwitchView(
    TranslateBubbleModel::ViewState view_state) {}

void TranslateBubbleView::AnnounceTextToScreenReader(
    const std::u16string& announcement_text) {}

void TranslateBubbleView::SwitchTabForViewState(
    TranslateBubbleModel::ViewState view_state) {}

void TranslateBubbleView::SwitchToErrorView(
    translate::TranslateErrors error_type) {}

void TranslateBubbleView::UpdateAdvancedView() {}

void TranslateBubbleView::UpdateLanguageNames(
    std::u16string* source_language_name,
    std::u16string* target_language_name) {}

void TranslateBubbleView::UpdateInsets(TranslateBubbleModel::ViewState state) {}

void TranslateBubbleView::RevertOrDeclineTranslation() {}

BEGIN_METADATA()