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