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

Side by Side Diff: ash/shelf/shelf_util.cc

Issue 2332393003: mash: Remove shelf util functions; use WmWindow properties. (Closed)
Patch Set: Cleanup,. Created 4 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/shelf/shelf_util.h"
6
7 #include "ash/common/shelf/shelf_constants.h"
8 #include "ui/aura/window_property.h"
9
10 DECLARE_WINDOW_PROPERTY_TYPE(ash::ShelfItemDetails*);
11
12 namespace ash {
13
14 DEFINE_WINDOW_PROPERTY_KEY(ShelfID, kShelfID, kInvalidShelfID);
15
16 // ShelfItemDetails for kShelfItemDetaildKey is owned by the window
17 // and will be freed automatically.
18 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ShelfItemDetails, kShelfItemDetailsKey, NULL);
19
20 void SetShelfIDForWindow(ShelfID id, aura::Window* window) {
21 if (!window)
22 return;
23
24 window->SetProperty(kShelfID, id);
25 }
26
27 ShelfID GetShelfIDForWindow(const aura::Window* window) {
28 DCHECK(window);
29 return window->GetProperty(kShelfID);
30 }
31
32 void SetShelfItemDetailsForWindow(aura::Window* window,
33 const ShelfItemDetails& details) {
34 // |item_details| is owned by |window|.
35 ShelfItemDetails* item_details = new ShelfItemDetails(details);
36 window->SetProperty(kShelfItemDetailsKey, item_details);
37 }
38
39 void SetShelfItemDetailsForDialogWindow(aura::Window* window,
40 int image_resource_id,
41 const base::string16& title) {
42 // |item_details| is owned by |window|.
43 ShelfItemDetails* item_details = new ShelfItemDetails;
44 item_details->type = TYPE_DIALOG;
45 item_details->image_resource_id = image_resource_id;
46 item_details->title = title;
47 window->SetProperty(kShelfItemDetailsKey, item_details);
48 }
49
50 void ClearShelfItemDetailsForWindow(aura::Window* window) {
51 window->ClearProperty(kShelfItemDetailsKey);
52 }
53
54 const ShelfItemDetails* GetShelfItemDetailsForWindow(aura::Window* window) {
55 return window->GetProperty(kShelfItemDetailsKey);
56 }
57
58 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698