Index: components/exo/shell_surface.cc |
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc |
index 8247e8681a643410806db68ea103fb252a5194ec..92fb6e0772851f374ec0a5ad6072b55a8248ba85 100644 |
--- a/components/exo/shell_surface.cc |
+++ b/components/exo/shell_surface.cc |
@@ -43,6 +43,8 @@ |
#include "chromeos/audio/chromeos_sounds.h" |
#endif |
+DECLARE_WINDOW_PROPERTY_TYPE(std::string*) |
+ |
namespace exo { |
namespace { |
@@ -327,6 +329,7 @@ ShellSurface::ScopedAnimationsDisabled::~ScopedAnimationsDisabled() { |
//////////////////////////////////////////////////////////////////////////////// |
// ShellSurface, public: |
+DEFINE_LOCAL_WINDOW_PROPERTY_KEY(std::string*, kApplicationIdKey, nullptr) |
DEFINE_LOCAL_WINDOW_PROPERTY_KEY(Surface*, kMainSurfaceKey, nullptr) |
ShellSurface::ShellSurface(Surface* surface, |
@@ -529,19 +532,21 @@ void ShellSurface::SetSystemModal(bool system_modal) { |
// static |
void ShellSurface::SetApplicationId(aura::Window* window, |
- const std::string& id) { |
- TRACE_EVENT1("exo", "ShellSurface::SetApplicationId", "application_id", id); |
- window->SetProperty(aura::client::kAppIdKey, new std::string(id)); |
+ std::string* application_id) { |
+ window->SetProperty(kApplicationIdKey, application_id); |
} |
// static |
const std::string ShellSurface::GetApplicationId(aura::Window* window) { |
- std::string* string_ptr = window->GetProperty(aura::client::kAppIdKey); |
+ std::string* string_ptr = window->GetProperty(kApplicationIdKey); |
return string_ptr ? *string_ptr : std::string(); |
} |
void ShellSurface::SetApplicationId(const std::string& application_id) { |
- SetApplicationId(widget_->GetNativeWindow(), application_id); |
+ TRACE_EVENT1("exo", "ShellSurface::SetApplicationId", "application_id", |
+ application_id); |
+ |
+ application_id_ = application_id; |
} |
void ShellSurface::Move() { |
@@ -621,10 +626,7 @@ 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); |
+ value->SetString("application_id", application_id_); |
return value; |
} |
@@ -1021,6 +1023,7 @@ void ShellSurface::CreateShellSurfaceWidget(ui::WindowShowState show_state) { |
window->SetName("ExoShellSurface"); |
window->AddChild(surface_->window()); |
window->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter(widget_))); |
+ SetApplicationId(window, &application_id_); |
SetMainSurface(window, surface_); |
// Start tracking changes to window bounds and window state. |