#include "chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h"
#include <dbus/dbus-shared.h>
#include <memory>
#include <string>
#include "base/check_op.h"
#include "base/environment.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/memory/ref_counted_memory.h"
#include "base/nix/xdg_util.h"
#include "base/notreached.h"
#include "base/numerics/checked_math.h"
#include "base/process/process.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/thread_pool.h"
#include "components/dbus/menu/menu.h"
#include "components/dbus/properties/dbus_properties.h"
#include "components/dbus/properties/success_barrier_callback.h"
#include "components/dbus/properties/types.h"
#include "components/dbus/thread_linux/dbus_thread_linux.h"
#include "content/public/browser/browser_thread.h"
#include "dbus/bus.h"
#include "dbus/exported_object.h"
#include "dbus/message.h"
#include "dbus/object_path.h"
#include "dbus/object_proxy.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/models/menu_model.h"
#include "ui/base/models/menu_separator_types.h"
#include "ui/base/models/simple_menu_model.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/linux/status_icon_linux.h"
namespace {
const char kServiceStatusNotifierWatcher[] = …;
const char kInterfaceStatusNotifierItem[] = …;
const char kInterfaceStatusNotifierWatcher[] = …;
const char kPathStatusNotifierItem[] = …;
const char kPathStatusNotifierWatcher[] = …;
const char kPathDbusMenu[] = …;
const char kMethodNameHasOwner[] = …;
const char kMethodRegisterStatusNotifierItem[] = …;
const char kMethodActivate[] = …;
const char kMethodContextMenu[] = …;
const char kMethodScroll[] = …;
const char kMethodSecondaryActivate[] = …;
const char kMethodGet[] = …;
const char kPropertyIsStatusNotifierHostRegistered[] = …;
const char kPropertyItemIsMenu[] = …;
const char kPropertyWindowId[] = …;
const char kPropertyMenu[] = …;
const char kPropertyAttentionIconName[] = …;
const char kPropertyAttentionMovieName[] = …;
const char kPropertyCategory[] = …;
const char kPropertyIconName[] = …;
const char kPropertyIconThemePath[] = …;
const char kPropertyId[] = …;
const char kPropertyOverlayIconName[] = …;
const char kPropertyStatus[] = …;
const char kPropertyTitle[] = …;
const char kPropertyAttentionIconPixmap[] = …;
const char kPropertyIconPixmap[] = …;
const char kPropertyOverlayIconPixmap[] = …;
const char kPropertyToolTip[] = …;
const char kSignalNewIcon[] = …;
const char kSignalNewIconThemePath[] = …;
const char kSignalNewToolTip[] = …;
const char kPropertyValueCategory[] = …;
const char kPropertyValueStatus[] = …;
int NextServiceId() { … }
std::string PropertyIdFromId(int service_id) { … }
auto MakeDbusImage(const gfx::ImageSkia& image) { … }
auto MakeDbusToolTip(const std::string& text) { … }
bool ShouldWriteIconToFile() { … }
base::FilePath WriteIconFile(size_t icon_file_id,
scoped_refptr<base::RefCountedMemory> data) { … }
}
StatusIconLinuxDbus::StatusIconLinuxDbus()
: … { … }
void StatusIconLinuxDbus::SetIcon(const gfx::ImageSkia& image) { … }
void StatusIconLinuxDbus::SetToolTip(const std::u16string& tool_tip) { … }
void StatusIconLinuxDbus::UpdatePlatformContextMenu(ui::MenuModel* model) { … }
void StatusIconLinuxDbus::RefreshPlatformContextMenu() { … }
void StatusIconLinuxDbus::ExecuteCommand(int command_id, int event_flags) { … }
StatusIconLinuxDbus::~StatusIconLinuxDbus() { … }
void StatusIconLinuxDbus::CheckStatusNotifierWatcherHasOwner() { … }
void StatusIconLinuxDbus::OnNameHasOwnerResponse(dbus::Response* response) { … }
void StatusIconLinuxDbus::OnHostRegisteredResponse(dbus::Response* response) { … }
void StatusIconLinuxDbus::OnExported(const std::string& interface_name,
const std::string& method_name,
bool success) { … }
void StatusIconLinuxDbus::OnInitialized(bool success) { … }
void StatusIconLinuxDbus::RegisterStatusNotifierItem() { … }
void StatusIconLinuxDbus::OnRegistered(dbus::Response* response) { … }
void StatusIconLinuxDbus::OnNameOwnerChangedReceived(
const std::string& old_owner,
const std::string& new_owner) { … }
void StatusIconLinuxDbus::OnActivate(
dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender sender) { … }
void StatusIconLinuxDbus::OnContextMenu(
dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender sender) { … }
void StatusIconLinuxDbus::OnScroll(
dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender sender) { … }
void StatusIconLinuxDbus::OnSecondaryActivate(
dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender sender) { … }
void StatusIconLinuxDbus::UpdateMenuImpl(ui::MenuModel* model,
bool send_signal) { … }
void StatusIconLinuxDbus::SetIconImpl(const gfx::ImageSkia& image,
bool send_signals) { … }
void StatusIconLinuxDbus::OnIconFileWritten(const base::FilePath& icon_file) { … }
void StatusIconLinuxDbus::CleanupIconFile() { … }