OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/chrome_view_type.h" | 5 #include "chrome/common/chrome_view_type.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | |
8 #include "base/property_bag.h" | |
9 #include "content/public/browser/web_contents.h" | |
Avi (use Gerrit)
2012/05/23 03:22:52
Besides the fact that this breaks check_deps, it f
jam
2012/05/23 04:18:38
yeah that's totally not allowed :) I wasn't paying
| |
10 | |
11 using content::WebContents; | |
12 | |
7 namespace chrome { | 13 namespace chrome { |
14 | |
15 static base::LazyInstance<base::PropertyAccessor<ViewType> > | |
16 g_view_type_property_accessor = LAZY_INSTANCE_INITIALIZER; | |
17 | |
18 base::PropertyAccessor<ViewType>* GetPropertyAccessor() { | |
19 return g_view_type_property_accessor.Pointer(); | |
20 } | |
21 | |
22 ViewType GetViewType(WebContents* tab) { | |
23 if (!tab) | |
24 return VIEW_TYPE_INVALID; | |
25 ViewType* type = GetPropertyAccessor()->GetProperty(tab->GetPropertyBag()); | |
26 if (type) | |
27 return *type; | |
28 return VIEW_TYPE_INVALID; | |
29 } | |
30 | |
31 void SetViewType(WebContents* tab, ViewType type) { | |
32 GetPropertyAccessor()->SetProperty(tab->GetPropertyBag(), type); | |
33 } | |
34 | |
8 const char kViewTypeTabContents[] = "TAB"; | 35 const char kViewTypeTabContents[] = "TAB"; |
9 const char kViewTypeBackgroundPage[] = "BACKGROUND"; | 36 const char kViewTypeBackgroundPage[] = "BACKGROUND"; |
10 const char kViewTypePopup[] = "POPUP"; | 37 const char kViewTypePopup[] = "POPUP"; |
11 const char kViewTypePanel[] = "PANEL"; | 38 const char kViewTypePanel[] = "PANEL"; |
12 const char kViewTypeInfobar[] = "INFOBAR"; | 39 const char kViewTypeInfobar[] = "INFOBAR"; |
13 const char kViewTypeNotification[] = "NOTIFICATION"; | 40 const char kViewTypeNotification[] = "NOTIFICATION"; |
14 const char kViewTypeExtensionDialog[] = "EXTENSION_DIALOG"; | 41 const char kViewTypeExtensionDialog[] = "EXTENSION_DIALOG"; |
15 const char kViewTypeAppShell[] = "SHELL"; | 42 const char kViewTypeAppShell[] = "SHELL"; |
16 const char kViewTypeAll[] = "ALL"; | 43 const char kViewTypeAll[] = "ALL"; |
44 | |
17 } // namespace chrome | 45 } // namespace chrome |
OLD | NEW |