Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1355)

Unified Diff: components/exo/shell_surface.cc

Issue 2889523003: Add kApplicationIdKey for ShellSurface::GetApplicationId and SetApplicationId (Closed)
Patch Set: Fix nits. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/exo/shell_surface.cc
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc
index e4fff6f17a71d2ddb9ce98a97105c2dec3b6f52f..a6f8f389fa094b073f4914302b38cc8ba583d84b 100644
--- a/components/exo/shell_surface.cc
+++ b/components/exo/shell_surface.cc
@@ -51,6 +51,11 @@
namespace exo {
namespace {
+DEFINE_LOCAL_UI_CLASS_PROPERTY_KEY(Surface*, kMainSurfaceKey, nullptr)
+
+// Application Id set by the client.
+DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(std::string, kApplicationIdKey, nullptr);
+
// This is a struct for accelerator keys used to close ShellSurfaces.
const struct Accelerator {
ui::KeyboardCode keycode;
@@ -311,8 +316,6 @@ ShellSurface::ScopedAnimationsDisabled::~ScopedAnimationsDisabled() {
////////////////////////////////////////////////////////////////////////////////
// ShellSurface, public:
-DEFINE_LOCAL_UI_CLASS_PROPERTY_KEY(Surface*, kMainSurfaceKey, nullptr)
-
ShellSurface::ShellSurface(Surface* surface,
ShellSurface* parent,
BoundsMode bounds_mode,
@@ -555,14 +558,12 @@ void ShellSurface::UpdateSystemModal() {
void ShellSurface::SetApplicationId(aura::Window* window,
const std::string& id) {
TRACE_EVENT1("exo", "ShellSurface::SetApplicationId", "application_id", id);
- const ash::ShelfID shelf_id(id);
- window->SetProperty(ash::kShelfIDKey, new std::string(shelf_id.Serialize()));
+ window->SetProperty(kApplicationIdKey, new std::string(id));
}
// static
-const std::string ShellSurface::GetApplicationId(aura::Window* window) {
- return ash::ShelfID::Deserialize(window->GetProperty(ash::kShelfIDKey))
- .app_id;
+const std::string* ShellSurface::GetApplicationId(aura::Window* window) {
+ return window->GetProperty(kApplicationIdKey);
}
void ShellSurface::SetApplicationId(const std::string& application_id) {
@@ -713,10 +714,13 @@ std::unique_ptr<base::trace_event::TracedValue> ShellSurface::AsTracedValue()
std::unique_ptr<base::trace_event::TracedValue> value(
new base::trace_event::TracedValue());
value->SetString("title", base::UTF16ToUTF8(title_));
- std::string application_id;
- if (GetWidget() && GetWidget()->GetNativeWindow())
- application_id = GetApplicationId(GetWidget()->GetNativeWindow());
- value->SetString("application_id", application_id);
+ if (GetWidget() && GetWidget()->GetNativeWindow()) {
+ const std::string* application_id =
+ GetApplicationId(GetWidget()->GetNativeWindow());
+
+ if (application_id)
+ value->SetString("application_id", *application_id);
+ }
return value;
}
« chrome/browser/memory/tab_manager_delegate_chromeos.cc ('K') | « components/exo/shell_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698