Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / base / view_prop.h
blob3ce14ba5d9572151efdf173f53789529e2534542
1 // Copyright (c) 2011 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.
5 #ifndef UI_BASE_VIEW_PROP_H_
6 #define UI_BASE_VIEW_PROP_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "ui/base/ui_base_export.h"
11 #include "ui/gfx/native_widget_types.h"
13 #if !defined(OS_WIN) && !defined(USE_AURA)
14 #error view_prop.h is only for windows and aura builds.
15 #endif
17 namespace ui {
19 // ViewProp maintains a key/value pair for a particular view. ViewProp is
20 // designed as a replacement for the Win32's SetProp, but does not make use of
21 // window manager memory. ViewProp shares similar semantics as SetProp, the
22 // value for a particular view/key pair comes from the last ViewProp created.
23 class UI_BASE_EXPORT ViewProp {
24 public:
25 // Associates data with a view/key pair. If a ViewProp has already been
26 // created for the specified pair |data| replaces the current value.
28 // ViewProp does *not* make a copy of the char*, the pointer is used for
29 // sorting.
30 ViewProp(gfx::AcceleratedWidget view, const char* key, void* data);
31 ~ViewProp();
33 // Returns the value associated with the view/key pair, or NULL if there is
34 // none.
35 static void* GetValue(gfx::AcceleratedWidget view, const char* key);
37 // Returns the key.
38 const char* Key() const;
40 private:
41 class Data;
43 // Stores the actual data.
44 scoped_refptr<Data> data_;
46 DISALLOW_COPY_AND_ASSIGN(ViewProp);
49 } // namespace ui
51 #endif // UI_BASE_VIEW_PROP_H_