chromium/components/translate/content/browser/content_translate_driver.cc

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

#include "components/translate/content/browser/content_translate_driver.h"

#include <memory>
#include <string>
#include <utility>

#include "base/check.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/notreached.h"
#include "base/observer_list.h"
#include "base/strings/utf_string_conversions.h"
#include "base/supports_user_data.h"
#include "base/task/single_thread_task_runner.h"
#include "components/google/core/common/google_util.h"
#include "components/language/core/browser/url_language_histogram.h"
#include "components/translate/content/browser/content_record_page_language.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/common/translate_metrics.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/page_navigator.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/referrer.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "url/gurl.h"

namespace translate {

namespace {

// The maximum number of attempts we'll do to see if the page has finshed
// loading before giving up the translation
const int kMaxTranslateLoadCheckAttempts =;

// Overrides the hrefTranslate logic to auto-translate when the navigation is
// from any origin rather than only Google origins. Used for manual testing
// where the test page may reside on a test domain.
BASE_FEATURE();

}  // namespace

ContentTranslateDriver::ContentTranslateDriver(
    content::WebContents& web_contents,
    language::UrlLanguageHistogram* url_language_histogram)
    :{}

ContentTranslateDriver::~ContentTranslateDriver() = default;

void ContentTranslateDriver::AddTranslationObserver(
    TranslationObserver* observer) {}

void ContentTranslateDriver::RemoveTranslationObserver(
    TranslationObserver* observer) {}

void ContentTranslateDriver::InitiateTranslation(const std::string& page_lang,
                                                 int attempt) {}

// TranslateDriver methods

bool ContentTranslateDriver::IsLinkNavigation() {}

void ContentTranslateDriver::OnTranslateEnabledChanged() {}

void ContentTranslateDriver::OnIsPageTranslatedChanged() {}

void ContentTranslateDriver::TranslatePage(int page_seq_no,
                                           const std::string& translate_script,
                                           const std::string& source_lang,
                                           const std::string& target_lang) {}

void ContentTranslateDriver::RevertTranslation(int page_seq_no) {}

bool ContentTranslateDriver::IsIncognito() const {}

const std::string& ContentTranslateDriver::GetContentsMimeType() {}

const GURL& ContentTranslateDriver::GetLastCommittedURL() const {}

const GURL& ContentTranslateDriver::GetVisibleURL() {}

ukm::SourceId ContentTranslateDriver::GetUkmSourceId() {}

bool ContentTranslateDriver::HasCurrentPage() const {}

void ContentTranslateDriver::InitiateTranslationIfReload(
    content::NavigationHandle* navigation_handle) {}

// content::WebContentsObserver methods
void ContentTranslateDriver::DidFinishNavigation(
    content::NavigationHandle* navigation_handle) {}

bool ContentTranslateDriver::IsAutoHrefTranslateAllOriginsEnabled() const {}

void ContentTranslateDriver::OnPageAway(int page_seq_no) {}

void ContentTranslateDriver::AddReceiver(
    mojo::PendingReceiver<translate::mojom::ContentTranslateDriver> receiver) {}

void ContentTranslateDriver::RegisterPage(
    mojo::PendingRemote<translate::mojom::TranslateAgent> translate_agent,
    const translate::LanguageDetectionDetails& details,
    const bool page_level_translation_criteria_met) {}

void ContentTranslateDriver::OnPageTranslated(
    bool cancelled,
    const std::string& source_lang,
    const std::string& translated_lang,
    TranslateErrors error_type) {}

}  // namespace translate