| OLD | NEW | 
|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "app/resource_bundle.h" | 5 #include "app/resource_bundle.h" | 
| 6 | 6 | 
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> | 
| 8 | 8 | 
| 9 #include "app/app_paths.h" | 9 #include "app/app_paths.h" | 
| 10 #include "app/gfx/font.h" | 10 #include "app/gfx/font.h" | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 62   for (GdkPixbufMap::iterator i = gdk_pixbufs_.begin(); | 62   for (GdkPixbufMap::iterator i = gdk_pixbufs_.begin(); | 
| 63        i != gdk_pixbufs_.end(); i++) { | 63        i != gdk_pixbufs_.end(); i++) { | 
| 64     g_object_unref(i->second); | 64     g_object_unref(i->second); | 
| 65   } | 65   } | 
| 66   gdk_pixbufs_.clear(); | 66   gdk_pixbufs_.clear(); | 
| 67 | 67 | 
| 68   delete locale_resources_data_; | 68   delete locale_resources_data_; | 
| 69   locale_resources_data_ = NULL; | 69   locale_resources_data_ = NULL; | 
| 70   delete resources_data_; | 70   delete resources_data_; | 
| 71   resources_data_ = NULL; | 71   resources_data_ = NULL; | 
| 72   theme_data_ = NULL; |  | 
| 73 } | 72 } | 
| 74 | 73 | 
| 75 void ResourceBundle::LoadResources(const std::wstring& pref_locale) { | 74 void ResourceBundle::LoadResources(const std::wstring& pref_locale) { | 
| 76   FilePath resources_data_path; | 75   FilePath resources_data_path; | 
| 77   PathService::Get(base::DIR_EXE, &resources_data_path); | 76   PathService::Get(base::DIR_EXE, &resources_data_path); | 
| 78   resources_data_path = resources_data_path.Append( | 77   resources_data_path = resources_data_path.Append( | 
| 79       FILE_PATH_LITERAL("chrome.pak")); | 78       FILE_PATH_LITERAL("chrome.pak")); | 
| 80   DCHECK(resources_data_ == NULL) << "resource data already loaded!"; | 79   DCHECK(resources_data_ == NULL) << "resource data already loaded!"; | 
| 81   resources_data_ = new base::DataPack; | 80   resources_data_ = new base::DataPack; | 
| 82   bool success = resources_data_->Load(resources_data_path); | 81   bool success = resources_data_->Load(resources_data_path); | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 100   FilePath locale_path; | 99   FilePath locale_path; | 
| 101   PathService::Get(app::DIR_LOCALES, &locale_path); | 100   PathService::Get(app::DIR_LOCALES, &locale_path); | 
| 102 | 101 | 
| 103   const std::string app_locale = l10n_util::GetApplicationLocale(pref_locale); | 102   const std::string app_locale = l10n_util::GetApplicationLocale(pref_locale); | 
| 104   if (app_locale.empty()) | 103   if (app_locale.empty()) | 
| 105     return FilePath(); | 104     return FilePath(); | 
| 106 | 105 | 
| 107   return locale_path.AppendASCII(app_locale + ".pak"); | 106   return locale_path.AppendASCII(app_locale + ".pak"); | 
| 108 } | 107 } | 
| 109 | 108 | 
| 110 void ResourceBundle::LoadThemeResources() { |  | 
| 111   // The data has been merged with chrome.pak so just set the pointer to be |  | 
| 112   // the same file. |  | 
| 113   DCHECK(resources_data_); |  | 
| 114   theme_data_ = resources_data_; |  | 
| 115 } |  | 
| 116 |  | 
| 117 // static | 109 // static | 
| 118 RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( | 110 RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( | 
| 119     DataHandle module, int resource_id) { | 111     DataHandle module, int resource_id) { | 
| 120   DCHECK(module); | 112   DCHECK(module); | 
| 121   return module->GetStaticMemory(resource_id); | 113   return module->GetStaticMemory(resource_id); | 
| 122 } | 114 } | 
| 123 | 115 | 
| 124 base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) { | 116 base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) { | 
| 125   DCHECK(resources_data_); | 117   DCHECK(resources_data_); | 
| 126   base::StringPiece data; | 118   base::StringPiece data; | 
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 208   } | 200   } | 
| 209 } | 201 } | 
| 210 | 202 | 
| 211 GdkPixbuf* ResourceBundle::GetPixbufNamed(int resource_id) { | 203 GdkPixbuf* ResourceBundle::GetPixbufNamed(int resource_id) { | 
| 212   return GetPixbufImpl(resource_id, false); | 204   return GetPixbufImpl(resource_id, false); | 
| 213 } | 205 } | 
| 214 | 206 | 
| 215 GdkPixbuf* ResourceBundle::GetRTLEnabledPixbufNamed(int resource_id) { | 207 GdkPixbuf* ResourceBundle::GetRTLEnabledPixbufNamed(int resource_id) { | 
| 216   return GetPixbufImpl(resource_id, true); | 208   return GetPixbufImpl(resource_id, true); | 
| 217 } | 209 } | 
| OLD | NEW | 
|---|