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

Unified Diff: components/exo/shell_surface.cc

Issue 2889523003: Add kApplicationIdKey for ShellSurface::GetApplicationId and SetApplicationId (Closed)
Patch Set: Fix shell_surface_unittest. 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
« 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 cf0e78ad527e3a46e27129318f999091a8fc57c4..13b5e395c77fda5609c54b0c0175dcf138f68a7f 100644
--- a/components/exo/shell_surface.cc
+++ b/components/exo/shell_surface.cc
@@ -46,6 +46,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;
@@ -271,8 +276,6 @@ ShellSurface::ScopedAnimationsDisabled::~ScopedAnimationsDisabled() {
////////////////////////////////////////////////////////////////////////////////
// ShellSurface, public:
-DEFINE_LOCAL_UI_CLASS_PROPERTY_KEY(Surface*, kMainSurfaceKey, nullptr)
-
ShellSurface::ShellSurface(Surface* surface,
ShellSurface* parent,
BoundsMode bounds_mode,
@@ -514,14 +517,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) {
@@ -672,10 +673,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;
}
« 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