OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 "ui/base/resource/resource_bundle.h" | 5 #include "ui/base/resource/resource_bundle.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| 11 #include "ui/gfx/font.h" |
| 12 #include "ui/gfx/platform_font_win.h" |
11 | 13 |
12 // NOTE(gregoryd): This is a hack to avoid creating more nacl_win64-specific | 14 // NOTE(gregoryd): This is a hack to avoid creating more nacl_win64-specific |
13 // files. The font members of ResourceBundle are never initialized in our code | 15 // files. The font members of ResourceBundle are never initialized in our code |
14 // so we can get away with an empty class definition. | 16 // so this destructor is never called. |
15 namespace gfx { | 17 namespace gfx { |
16 class Font {}; | 18 Font::~Font() { |
| 19 NOTREACHED(); |
| 20 } |
| 21 PlatformFontWin::HFontRef::~HFontRef() { |
| 22 NOTREACHED(); |
| 23 } |
17 } | 24 } |
18 | 25 |
19 namespace ui { | 26 namespace ui { |
20 | 27 |
21 ResourceBundle* ResourceBundle::g_shared_instance_ = NULL; | 28 ResourceBundle* ResourceBundle::g_shared_instance_ = NULL; |
22 | 29 |
23 // static | 30 /* static */ |
24 std::string ResourceBundle::InitSharedInstance( | 31 std::string ResourceBundle::InitSharedInstance( |
25 const std::string& pref_locale) { | 32 const std::string& pref_locale) { |
26 DCHECK(g_shared_instance_ == NULL) << "ResourceBundle initialized twice"; | 33 DCHECK(g_shared_instance_ == NULL) << "ResourceBundle initialized twice"; |
27 g_shared_instance_ = new ResourceBundle(); | 34 g_shared_instance_ = new ResourceBundle(); |
28 return std::string(); | 35 return std::string(); |
29 } | 36 } |
30 | 37 |
31 // static | 38 /* static */ |
32 void ResourceBundle::CleanupSharedInstance() { | 39 void ResourceBundle::CleanupSharedInstance() { |
33 if (g_shared_instance_) { | 40 if (g_shared_instance_) { |
34 delete g_shared_instance_; | 41 delete g_shared_instance_; |
35 g_shared_instance_ = NULL; | 42 g_shared_instance_ = NULL; |
36 } | 43 } |
37 } | 44 } |
38 | 45 |
39 // static | 46 /* static */ |
40 ResourceBundle& ResourceBundle::GetSharedInstance() { | 47 ResourceBundle& ResourceBundle::GetSharedInstance() { |
41 // Must call InitSharedInstance before this function. | 48 // Must call InitSharedInstance before this function. |
42 CHECK(g_shared_instance_ != NULL); | 49 CHECK(g_shared_instance_ != NULL); |
43 return *g_shared_instance_; | 50 return *g_shared_instance_; |
44 } | 51 } |
45 | 52 |
46 ResourceBundle::ResourceBundle() | 53 ResourceBundle::ResourceBundle() |
47 : lock_(new base::Lock), | 54 : lock_(new base::Lock), |
48 resources_data_(NULL), | 55 resources_data_(NULL), |
49 locale_resources_data_(NULL) { | 56 locale_resources_data_(NULL) { |
50 } | 57 } |
51 | 58 |
52 ResourceBundle::~ResourceBundle() { | 59 ResourceBundle::~ResourceBundle() { |
53 } | 60 } |
54 | 61 |
55 | 62 |
56 string16 ResourceBundle::GetLocalizedString(int message_id) { | 63 string16 ResourceBundle::GetLocalizedString(int message_id) { |
57 return string16(); | 64 return string16(); |
58 } | 65 } |
59 | 66 |
60 } // namespace ui | 67 } // namespace ui |
OLD | NEW |