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

Unified Diff: components/exo/shell_surface.cc

Issue 2889523003: Add kApplicationIdKey for ShellSurface::GetApplicationId and SetApplicationId (Closed)
Patch Set: Address comments. 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') | no next file » | 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 e4fff6f17a71d2ddb9ce98a97105c2dec3b6f52f..4b6d5b78371e43c3724e8ab9c44348844b9e656f 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, kExoAppIdKey, nullptr);
reveman 2017/05/18 03:53:12 nit: s/kExoAppIdKey/kApplicationIdKey/ as exo pref
yawano 2017/05/18 04:07:36 Done.
+
// 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(kExoAppIdKey, 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(kExoAppIdKey);
}
void ShellSurface::SetApplicationId(const std::string& application_id) {
@@ -713,10 +714,11 @@ 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;
+ const std::string* application_id = nullptr;
if (GetWidget() && GetWidget()->GetNativeWindow())
application_id = GetApplicationId(GetWidget()->GetNativeWindow());
- value->SetString("application_id", application_id);
+ value->SetString("application_id",
reveman 2017/05/18 03:53:12 nit: empty application_id value is not worth much
yawano 2017/05/18 04:07:36 Done.
+ application_id ? *application_id : std::string());
return value;
}
« no previous file with comments | « components/exo/shell_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698