#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
#include <memory>
#include <string>
#include <utility>
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/i18n/rtl.h"
#include "base/memory/ref_counted_memory.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/ntp/cookie_controls_handler.h"
#include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h"
#include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
#include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h"
#include "chrome/browser/ui/webui/theme_handler.h"
#include "chrome/browser/ui/webui/theme_source.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/url_constants.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/native_theme/native_theme.h"
#include "url/gurl.h"
namespace {
const char kRTLHtmlTextDirection[] = …;
const char kLTRHtmlTextDirection[] = …;
const char* GetHtmlTextDirection(const std::u16string& text) { … }
}
NewTabUI::NewTabUI(content::WebUI* web_ui) : … { … }
NewTabUI::~NewTabUI() { … }
bool NewTabUI::IsNewTab(const GURL& url) { … }
void NewTabUI::SetUrlTitleAndDirection(base::Value::Dict* dictionary,
const std::u16string& title,
const GURL& gurl) { … }
void NewTabUI::SetFullNameAndDirection(const std::u16string& full_name,
base::Value::Dict* dictionary) { … }
Profile* NewTabUI::GetProfile() const { … }
NewTabUI::NewTabHTMLSource::NewTabHTMLSource(Profile* profile)
: … { … }
std::string NewTabUI::NewTabHTMLSource::GetSource() { … }
void NewTabUI::NewTabHTMLSource::StartDataRequest(
const GURL& url,
const content::WebContents::Getter& wc_getter,
content::URLDataSource::GotDataCallback callback) { … }
std::string NewTabUI::NewTabHTMLSource::GetMimeType(const GURL&) { … }
bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() { … }
std::string NewTabUI::NewTabHTMLSource::GetContentSecurityPolicy(
network::mojom::CSPDirectiveName directive) { … }
NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() { … }