#include "chrome/browser/ui/views/performance_controls/memory_saver_bubble_view.h"
#include "base/functional/bind.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/performance_controls/memory_saver_bubble_delegate.h"
#include "chrome/browser/ui/performance_controls/memory_saver_bubble_observer.h"
#include "chrome/browser/ui/performance_controls/memory_saver_chip_tab_helper.h"
#include "chrome/browser/ui/performance_controls/memory_saver_utils.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/toolbar_button_provider.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_view.h"
#include "chrome/browser/ui/views/performance_controls/memory_saver_resource_view.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/performance_manager/public/user_tuning/prefs.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/signin/public/base/signin_buildflags.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/dialog_model.h"
#include "ui/base/models/dialog_model_field.h"
#include "ui/base/text/bytes_formatting.h"
#include "ui/base/ui_base_types.h"
#include "ui/views/bubble/bubble_dialog_model_host.h"
#include "ui/views/interaction/element_tracker_views.h"
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(MemorySaverBubbleView,
kMemorySaverDialogBodyElementId);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(MemorySaverBubbleView,
kMemorySaverDialogResourceViewElementId);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(MemorySaverBubbleView,
kMemorySaverDialogOkButton);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(MemorySaverBubbleView,
kMemorySaverDialogCancelButton);
namespace {
constexpr int64_t kMemoryUsageThresholdInBytes = …;
void AddBubbleBodyText(
ui::DialogModel::Builder* dialog_model_builder,
int text_id,
std::vector<ui::DialogModelLabel::TextReplacement> replacements = { … }
void AddCancelButton(ui::DialogModel::Builder* dialog_model_builder,
MemorySaverBubbleDelegate* bubble_delegate,
const bool is_site_excluded) { … }
}
views::BubbleDialogModelHost* MemorySaverBubbleView::ShowBubble(
Browser* browser,
views::View* anchor_view,
MemorySaverBubbleObserver* observer) { … }