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

Unified Diff: components/exo/shell_surface.cc

Issue 2480713003: Window prerequisites for ShelfWindowWatcher panel support. (Closed)
Patch Set: Support and test pre-widget exo ShellSurface::SetApplicationId. Created 4 years, 1 month 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
« no previous file with comments | « components/exo/shell_surface.h ('k') | components/exo/shell_surface_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/shell_surface.cc
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc
index 92fb6e0772851f374ec0a5ad6072b55a8248ba85..2811720b5f539457fa0e57e307e7fc6b023eb61d 100644
--- a/components/exo/shell_surface.cc
+++ b/components/exo/shell_surface.cc
@@ -43,8 +43,6 @@
#include "chromeos/audio/chromeos_sounds.h"
#endif
-DECLARE_WINDOW_PROPERTY_TYPE(std::string*)
-
namespace exo {
namespace {
@@ -329,7 +327,6 @@ 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,
@@ -532,21 +529,22 @@ void ShellSurface::SetSystemModal(bool system_modal) {
// static
void ShellSurface::SetApplicationId(aura::Window* window,
- std::string* application_id) {
- window->SetProperty(kApplicationIdKey, application_id);
+ const std::string& id) {
+ TRACE_EVENT1("exo", "ShellSurface::SetApplicationId", "application_id", id);
+ window->SetProperty(aura::client::kAppIdKey, new std::string(id));
}
// static
const std::string ShellSurface::GetApplicationId(aura::Window* window) {
- std::string* string_ptr = window->GetProperty(kApplicationIdKey);
+ std::string* string_ptr = window->GetProperty(aura::client::kAppIdKey);
return string_ptr ? *string_ptr : std::string();
}
void ShellSurface::SetApplicationId(const std::string& application_id) {
- TRACE_EVENT1("exo", "ShellSurface::SetApplicationId", "application_id",
- application_id);
-
+ // Store the value in |application_id_| in case the window does not exist yet.
application_id_ = application_id;
+ if (widget_ && widget_->GetNativeWindow())
+ SetApplicationId(widget_->GetNativeWindow(), application_id);
}
void ShellSurface::Move() {
@@ -626,7 +624,10 @@ 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_));
- value->SetString("application_id", application_id_);
+ std::string application_id;
+ if (GetWidget() && GetWidget()->GetNativeWindow())
+ application_id = GetApplicationId(GetWidget()->GetNativeWindow());
+ value->SetString("application_id", application_id);
return value;
}
@@ -1023,7 +1024,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_);
+ SetApplicationId(window, application_id_);
SetMainSurface(window, surface_);
// Start tracking changes to window bounds and window state.
« no previous file with comments | « components/exo/shell_surface.h ('k') | components/exo/shell_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698